From 830533fc9f70bb849edf38fb3c25d37f2310720d Mon Sep 17 00:00:00 2001 From: bryan-aguilar <46550959+bryan-aguilar@users.noreply.github.com> Date: Wed, 6 Sep 2023 13:51:38 -0700 Subject: [PATCH] [release/v0.33.x] Prepare release v0.33.0 (#2316) * update upstream otel v0.84.0 * Update StatSD Patch file * bump version to v0.33.0 * Add statsd_instscopedisabled testcase * Update go version in workflows to 1.20.8 * [aoc-collector non-root user]: Statement breaking change non root user (#2299) * Statement about non-root user breaking change for awscontainerinightreceiver component * Resolving Comments * Adding the Issue Link * Update README.md --------- Co-authored-by: Raphael Philipe Mendes da Silva Co-authored-by: bryan-aguilar <46550959+bryan-aguilar@users.noreply.github.com> --------- Co-authored-by: Paurush Garg <62579325+PaurushGarg@users.noreply.github.com> Co-authored-by: Raphael Philipe Mendes da Silva --- .github/config/testcases.json | 8 +- .github/workflows/CI.yml | 2 +- .github/workflows/PR-build.yml | 2 +- .github/workflows/aws-resources-clean.yml | 2 +- .github/workflows/canary.yml | 2 +- .github/workflows/perf.yml | 2 +- .github/workflows/prod-image-mirror.yml | 2 +- README.md | 3 + VERSION | 2 +- cmd/awscollector/main.go | 4 + docs/releases/v0.33.0.md | 15 + go.mod | 266 +- go.sum | 555 +- .../statsDfeatGateInstrumentationScope.patch | 2 +- testbed/go.mod | 290 +- testbed/go.sum | 609 +- .../packaging/windows/aws-otel-collector.wxs | 2 +- .../v2/.apigentools-info | 12 +- .../v2/.pre-commit-config.yaml | 4 +- .../datadog-api-client-go/v2/CHANGELOG.md | 68 + .../v2/LICENSE-3rdparty.csv | 2 + .../datadog-api-client-go/v2/README.md | 2 +- .../v2/api/datadog/client.go | 2 +- .../v2/api/datadog/configuration.go | 7 + .../v2/api/datadog/utils.go | 3 +- .../api/datadogV1/api_aws_logs_integration.go | 10 +- .../v2/api/datadogV1/api_usage_metering.go | 16 +- .../v2/api/datadogV1/doc.go | 452 +- .../v2/api/datadogV1/model_access_role.go | 3 +- .../model_add_signal_to_incident_request.go | 12 +- .../model_alert_graph_widget_definition.go | 66 +- ...odel_alert_graph_widget_definition_type.go | 47 +- .../model_alert_value_widget_definition.go | 60 +- ...odel_alert_value_widget_definition_type.go | 47 +- .../api/datadogV1/model_api_error_response.go | 12 +- .../v2/api/datadogV1/model_api_key.go | 11 +- .../datadogV1/model_api_key_list_response.go | 11 +- .../api/datadogV1/model_api_key_response.go | 23 +- .../model_apm_stats_query_column_type.go | 46 +- .../model_apm_stats_query_definition.go | 32 +- .../model_apm_stats_query_row_type.go | 47 +- .../v2/api/datadogV1/model_application_key.go | 11 +- .../model_application_key_list_response.go | 11 +- .../model_application_key_response.go | 23 +- ...odel_authentication_validation_response.go | 11 +- .../v2/api/datadogV1/model_aws_account.go | 11 +- .../model_aws_account_and_lambda_request.go | 12 +- .../model_aws_account_create_response.go | 11 +- .../model_aws_account_delete_request.go | 11 +- .../model_aws_account_list_response.go | 11 +- .../datadogV1/model_aws_logs_async_error.go | 11 +- .../model_aws_logs_async_response.go | 11 +- .../v2/api/datadogV1/model_aws_logs_lambda.go | 11 +- .../datadogV1/model_aws_logs_list_response.go | 11 +- .../model_aws_logs_list_services_response.go | 11 +- .../model_aws_logs_services_request.go | 12 +- .../v2/api/datadogV1/model_aws_namespace.go | 47 +- .../v2/api/datadogV1/model_aws_tag_filter.go | 29 +- .../model_aws_tag_filter_create_request.go | 31 +- .../model_aws_tag_filter_delete_request.go | 31 +- .../model_aws_tag_filter_list_response.go | 11 +- .../v2/api/datadogV1/model_azure_account.go | 135 +- ...model_cancel_downtimes_by_scope_request.go | 12 +- .../datadogV1/model_canceled_downtimes_ids.go | 11 +- .../model_change_widget_definition.go | 52 +- .../model_change_widget_definition_type.go | 47 +- .../datadogV1/model_change_widget_request.go | 137 +- ...model_check_can_delete_monitor_response.go | 24 +- ..._check_can_delete_monitor_response_data.go | 11 +- .../model_check_can_delete_slo_response.go | 23 +- ...odel_check_can_delete_slo_response_data.go | 11 +- .../model_check_status_widget_definition.go | 66 +- ...del_check_status_widget_definition_type.go | 47 +- .../api/datadogV1/model_content_encoding.go | 47 +- .../v2/api/datadogV1/model_creator.go | 11 +- .../v2/api/datadogV1/model_dashboard.go | 46 +- .../model_dashboard_bulk_action_data.go | 32 +- .../model_dashboard_bulk_delete_request.go | 12 +- .../model_dashboard_delete_response.go | 11 +- .../datadogV1/model_dashboard_global_time.go | 29 +- .../model_dashboard_global_time_live_span.go | 47 +- .../datadogV1/model_dashboard_invite_type.go | 47 +- .../datadogV1/model_dashboard_layout_type.go | 47 +- .../v2/api/datadogV1/model_dashboard_list.go | 24 +- .../model_dashboard_list_delete_response.go | 11 +- .../model_dashboard_list_list_response.go | 11 +- .../datadogV1/model_dashboard_reflow_type.go | 47 +- .../model_dashboard_resource_type.go | 47 +- .../model_dashboard_restore_request.go | 12 +- .../datadogV1/model_dashboard_share_type.go | 3 +- .../api/datadogV1/model_dashboard_summary.go | 11 +- .../model_dashboard_summary_definition.go | 32 +- .../model_dashboard_template_variable.go | 12 +- ...odel_dashboard_template_variable_preset.go | 11 +- ...ashboard_template_variable_preset_value.go | 11 +- .../v2/api/datadogV1/model_dashboard_type.go | 47 +- .../model_delete_shared_dashboard_response.go | 11 +- .../v2/api/datadogV1/model_deleted_monitor.go | 11 +- .../model_distribution_point_item.go | 52 +- ...el_distribution_points_content_encoding.go | 47 +- .../model_distribution_points_payload.go | 12 +- .../model_distribution_points_series.go | 32 +- .../model_distribution_points_type.go | 47 +- .../model_distribution_widget_definition.go | 123 +- ...del_distribution_widget_definition_type.go | 47 +- ...ribution_widget_histogram_request_query.go | 52 +- ...tribution_widget_histogram_request_type.go | 47 +- .../model_distribution_widget_request.go | 91 +- .../model_distribution_widget_x_axis.go | 11 +- .../model_distribution_widget_y_axis.go | 11 +- .../v2/api/datadogV1/model_downtime.go | 11 +- .../v2/api/datadogV1/model_downtime_child.go | 11 +- .../datadogV1/model_downtime_recurrence.go | 11 +- .../v2/api/datadogV1/model_event.go | 45 +- .../api/datadogV1/model_event_alert_type.go | 47 +- .../datadogV1/model_event_create_request.go | 46 +- .../datadogV1/model_event_create_response.go | 23 +- .../datadogV1/model_event_list_response.go | 11 +- .../v2/api/datadogV1/model_event_priority.go | 3 +- .../datadogV1/model_event_query_definition.go | 12 +- .../v2/api/datadogV1/model_event_response.go | 23 +- .../model_event_stream_widget_definition.go | 66 +- ...del_event_stream_widget_definition_type.go | 47 +- .../model_event_timeline_widget_definition.go | 52 +- ...l_event_timeline_widget_definition_type.go | 47 +- ...a_and_function_apm_dependency_stat_name.go | 47 +- ...nction_apm_dependency_stats_data_source.go | 47 +- ...n_apm_dependency_stats_query_definition.go | 46 +- ...ula_and_function_apm_resource_stat_name.go | 47 +- ...function_apm_resource_stats_data_source.go | 47 +- ...ion_apm_resource_stats_query_definition.go | 46 +- ...ula_and_function_cloud_cost_data_source.go | 64 + ...nd_function_cloud_cost_query_definition.go | 216 + ..._formula_and_function_event_aggregation.go | 47 +- ...ula_and_function_event_query_definition.go | 44 +- ...function_event_query_definition_compute.go | 30 +- ..._function_event_query_definition_search.go | 12 +- ...rmula_and_function_event_query_group_by.go | 24 +- ..._and_function_event_query_group_by_sort.go | 46 +- ...formula_and_function_events_data_source.go | 47 +- ...formula_and_function_metric_aggregation.go | 47 +- ...formula_and_function_metric_data_source.go | 47 +- ...la_and_function_metric_query_definition.go | 46 +- ..._and_function_process_query_data_source.go | 47 +- ...a_and_function_process_query_definition.go | 60 +- ...l_formula_and_function_query_definition.go | 84 +- ...el_formula_and_function_response_format.go | 51 +- ...el_formula_and_function_slo_data_source.go | 47 +- ...del_formula_and_function_slo_group_mode.go | 47 +- .../model_formula_and_function_slo_measure.go | 47 +- ...rmula_and_function_slo_query_definition.go | 117 +- ...del_formula_and_function_slo_query_type.go | 47 +- .../model_free_text_widget_definition.go | 46 +- .../model_free_text_widget_definition_type.go | 47 +- .../v2/api/datadogV1/model_funnel_query.go | 30 +- .../datadogV1/model_funnel_request_type.go | 47 +- .../v2/api/datadogV1/model_funnel_source.go | 47 +- .../v2/api/datadogV1/model_funnel_step.go | 12 +- .../model_funnel_widget_definition.go | 53 +- .../model_funnel_widget_definition_type.go | 47 +- .../datadogV1/model_funnel_widget_request.go | 38 +- .../v2/api/datadogV1/model_gcp_account.go | 11 +- .../model_geomap_widget_definition.go | 64 +- .../model_geomap_widget_definition_style.go | 12 +- .../model_geomap_widget_definition_type.go | 47 +- .../model_geomap_widget_definition_view.go | 12 +- .../datadogV1/model_geomap_widget_request.go | 126 +- .../v2/api/datadogV1/model_graph_snapshot.go | 11 +- .../model_group_widget_definition.go | 60 +- .../model_group_widget_definition_type.go | 47 +- .../model_heat_map_widget_definition.go | 58 +- .../model_heat_map_widget_definition_type.go | 47 +- .../model_heat_map_widget_request.go | 71 +- .../v2/api/datadogV1/model_host.go | 29 +- .../api/datadogV1/model_host_list_response.go | 11 +- .../api/datadogV1/model_host_map_request.go | 65 +- .../model_host_map_widget_definition.go | 72 +- ...del_host_map_widget_definition_requests.go | 29 +- .../model_host_map_widget_definition_style.go | 11 +- .../model_host_map_widget_definition_type.go | 47 +- .../v2/api/datadogV1/model_host_meta.go | 23 +- .../model_host_meta_install_method.go | 11 +- .../v2/api/datadogV1/model_host_metrics.go | 11 +- .../api/datadogV1/model_host_mute_response.go | 11 +- .../api/datadogV1/model_host_mute_settings.go | 11 +- .../v2/api/datadogV1/model_host_tags.go | 11 +- .../v2/api/datadogV1/model_host_totals.go | 11 +- .../model_hourly_usage_attribution_body.go | 32 +- ...model_hourly_usage_attribution_metadata.go | 23 +- ...del_hourly_usage_attribution_pagination.go | 11 +- ...model_hourly_usage_attribution_response.go | 23 +- ...del_hourly_usage_attribution_usage_type.go | 53 +- .../v2/api/datadogV1/model_http_log_error.go | 12 +- .../v2/api/datadogV1/model_http_log_item.go | 12 +- .../model_i_frame_widget_definition.go | 30 +- .../model_i_frame_widget_definition_type.go | 47 +- .../v2/api/datadogV1/model_idp_form_data.go | 12 +- .../v2/api/datadogV1/model_idp_response.go | 12 +- .../model_image_widget_definition.go | 88 +- .../model_image_widget_definition_type.go | 47 +- .../model_intake_payload_accepted.go | 11 +- .../api/datadogV1/model_ip_prefixes_agents.go | 11 +- .../v2/api/datadogV1/model_ip_prefixes_api.go | 11 +- .../v2/api/datadogV1/model_ip_prefixes_apm.go | 11 +- .../api/datadogV1/model_ip_prefixes_logs.go | 11 +- .../model_ip_prefixes_orchestrator.go | 11 +- .../datadogV1/model_ip_prefixes_process.go | 11 +- .../model_ip_prefixes_remote_configuration.go | 139 + .../datadogV1/model_ip_prefixes_synthetics.go | 11 +- ...p_prefixes_synthetics_private_locations.go | 11 +- .../datadogV1/model_ip_prefixes_webhooks.go | 11 +- .../v2/api/datadogV1/model_ip_ranges.go | 111 +- .../api/datadogV1/model_list_stream_column.go | 32 +- .../model_list_stream_column_width.go | 47 +- .../model_list_stream_compute_aggregation.go | 47 +- .../model_list_stream_compute_items.go | 30 +- .../model_list_stream_group_by_items.go | 12 +- .../api/datadogV1/model_list_stream_query.go | 52 +- .../model_list_stream_response_format.go | 47 +- .../api/datadogV1/model_list_stream_source.go | 47 +- .../model_list_stream_widget_definition.go | 53 +- ...odel_list_stream_widget_definition_type.go | 47 +- .../model_list_stream_widget_request.go | 38 +- .../v2/api/datadogV1/model_log.go | 23 +- .../v2/api/datadogV1/model_log_content.go | 12 +- .../datadogV1/model_log_query_definition.go | 29 +- .../model_log_query_definition_group_by.go | 24 +- ...odel_log_query_definition_group_by_sort.go | 32 +- .../model_log_query_definition_search.go | 12 +- .../model_log_stream_widget_definition.go | 72 +- ...model_log_stream_widget_definition_type.go | 47 +- .../v2/api/datadogV1/model_logs_api_error.go | 11 +- .../model_logs_api_error_response.go | 23 +- .../model_logs_arithmetic_processor.go | 44 +- .../model_logs_arithmetic_processor_type.go | 47 +- .../model_logs_attribute_remapper.go | 46 +- .../model_logs_attribute_remapper_type.go | 47 +- .../api/datadogV1/model_logs_by_retention.go | 29 +- .../model_logs_by_retention_monthly_usage.go | 12 +- .../model_logs_by_retention_org_usage.go | 11 +- .../datadogV1/model_logs_by_retention_orgs.go | 11 +- .../model_logs_category_processor.go | 46 +- .../model_logs_category_processor_category.go | 23 +- .../model_logs_category_processor_type.go | 47 +- .../api/datadogV1/model_logs_date_remapper.go | 53 +- .../model_logs_date_remapper_type.go | 47 +- .../v2/api/datadogV1/model_logs_exclusion.go | 24 +- .../datadogV1/model_logs_exclusion_filter.go | 12 +- .../v2/api/datadogV1/model_logs_filter.go | 11 +- .../api/datadogV1/model_logs_geo_ip_parser.go | 32 +- .../model_logs_geo_ip_parser_type.go | 47 +- .../api/datadogV1/model_logs_grok_parser.go | 38 +- .../datadogV1/model_logs_grok_parser_rules.go | 12 +- .../datadogV1/model_logs_grok_parser_type.go | 47 +- .../v2/api/datadogV1/model_logs_index.go | 24 +- .../model_logs_index_list_response.go | 11 +- .../model_logs_index_update_request.go | 24 +- .../api/datadogV1/model_logs_indexes_order.go | 12 +- .../api/datadogV1/model_logs_list_request.go | 38 +- .../datadogV1/model_logs_list_request_time.go | 12 +- .../api/datadogV1/model_logs_list_response.go | 11 +- .../datadogV1/model_logs_lookup_processor.go | 32 +- .../model_logs_lookup_processor_type.go | 47 +- .../datadogV1/model_logs_message_remapper.go | 32 +- .../model_logs_message_remapper_type.go | 47 +- .../v2/api/datadogV1/model_logs_pipeline.go | 24 +- .../model_logs_pipeline_processor.go | 38 +- .../model_logs_pipeline_processor_type.go | 47 +- .../datadogV1/model_logs_pipelines_order.go | 12 +- .../v2/api/datadogV1/model_logs_processor.go | 52 +- .../api/datadogV1/model_logs_query_compute.go | 12 +- .../model_logs_retention_agg_sum_usage.go | 11 +- .../model_logs_retention_sum_usage.go | 11 +- .../datadogV1/model_logs_service_remapper.go | 32 +- .../model_logs_service_remapper_type.go | 47 +- .../v2/api/datadogV1/model_logs_sort.go | 47 +- .../datadogV1/model_logs_status_remapper.go | 46 +- .../model_logs_status_remapper_type.go | 47 +- .../model_logs_string_builder_processor.go | 42 +- ...odel_logs_string_builder_processor_type.go | 47 +- .../datadogV1/model_logs_trace_remapper.go | 38 +- .../model_logs_trace_remapper_type.go | 47 +- .../v2/api/datadogV1/model_logs_url_parser.go | 32 +- .../datadogV1/model_logs_url_parser_type.go | 47 +- .../datadogV1/model_logs_user_agent_parser.go | 32 +- .../model_logs_user_agent_parser_type.go | 47 +- .../api/datadogV1/model_matching_downtime.go | 12 +- .../model_metric_content_encoding.go | 47 +- .../v2/api/datadogV1/model_metric_metadata.go | 11 +- .../datadogV1/model_metric_search_response.go | 23 +- .../model_metric_search_response_results.go | 11 +- .../datadogV1/model_metrics_list_response.go | 11 +- .../v2/api/datadogV1/model_metrics_payload.go | 12 +- .../datadogV1/model_metrics_query_metadata.go | 11 +- .../datadogV1/model_metrics_query_response.go | 11 +- .../api/datadogV1/model_metrics_query_unit.go | 11 +- .../v2/api/datadogV1/model_monitor.go | 64 +- .../api/datadogV1/model_monitor_device_id.go | 47 +- ..._formula_and_function_event_aggregation.go | 47 +- ...ula_and_function_event_query_definition.go | 44 +- ...function_event_query_definition_compute.go | 30 +- ..._function_event_query_definition_search.go | 12 +- ...rmula_and_function_event_query_group_by.go | 24 +- ..._and_function_event_query_group_by_sort.go | 46 +- ...formula_and_function_events_data_source.go | 47 +- ...r_formula_and_function_query_definition.go | 52 +- .../model_monitor_group_search_response.go | 29 +- ...el_monitor_group_search_response_counts.go | 11 +- .../model_monitor_group_search_result.go | 31 +- .../v2/api/datadogV1/model_monitor_options.go | 69 +- .../model_monitor_options_aggregation.go | 11 +- ...el_monitor_options_notification_presets.go | 47 +- ...odel_monitor_options_scheduling_options.go | 23 +- ...ns_scheduling_options_evaluation_window.go | 11 +- .../datadogV1/model_monitor_overall_states.go | 47 +- .../model_monitor_renotify_status_type.go | 47 +- .../model_monitor_search_count_item.go | 11 +- .../model_monitor_search_response.go | 29 +- .../model_monitor_search_response_counts.go | 11 +- .../model_monitor_search_response_metadata.go | 11 +- .../datadogV1/model_monitor_search_result.go | 51 +- ...odel_monitor_search_result_notification.go | 11 +- .../v2/api/datadogV1/model_monitor_state.go | 11 +- .../datadogV1/model_monitor_state_group.go | 31 +- ...model_monitor_summary_widget_definition.go | 102 +- ..._monitor_summary_widget_definition_type.go | 47 +- .../model_monitor_threshold_window_options.go | 11 +- .../api/datadogV1/model_monitor_thresholds.go | 11 +- .../v2/api/datadogV1/model_monitor_type.go | 47 +- .../datadogV1/model_monitor_update_request.go | 64 +- .../model_monthly_usage_attribution_body.go | 24 +- ...odel_monthly_usage_attribution_metadata.go | 23 +- ...el_monthly_usage_attribution_pagination.go | 11 +- ...odel_monthly_usage_attribution_response.go | 23 +- ...hly_usage_attribution_supported_metrics.go | 59 +- .../model_monthly_usage_attribution_values.go | 223 +- .../datadogV1/model_note_widget_definition.go | 74 +- .../model_note_widget_definition_type.go | 47 +- .../datadogV1/model_notebook_absolute_time.go | 12 +- .../v2/api/datadogV1/model_notebook_author.go | 12 +- .../model_notebook_cell_create_request.go | 31 +- ...notebook_cell_create_request_attributes.go | 52 +- .../model_notebook_cell_resource_type.go | 47 +- .../datadogV1/model_notebook_cell_response.go | 32 +- ...model_notebook_cell_response_attributes.go | 52 +- .../api/datadogV1/model_notebook_cell_time.go | 2 +- .../model_notebook_cell_update_request.go | 32 +- ...notebook_cell_update_request_attributes.go | 52 +- .../datadogV1/model_notebook_create_data.go | 38 +- .../model_notebook_create_data_attributes.go | 38 +- .../model_notebook_create_request.go | 24 +- ...l_notebook_distribution_cell_attributes.go | 44 +- .../datadogV1/model_notebook_global_time.go | 52 +- .../datadogV1/model_notebook_graph_size.go | 47 +- ...model_notebook_heat_map_cell_attributes.go | 44 +- ...del_notebook_log_stream_cell_attributes.go | 38 +- ...model_notebook_markdown_cell_attributes.go | 24 +- ...model_notebook_markdown_cell_definition.go | 32 +- ..._notebook_markdown_cell_definition_type.go | 47 +- .../api/datadogV1/model_notebook_metadata.go | 31 +- .../datadogV1/model_notebook_metadata_type.go | 3 +- .../datadogV1/model_notebook_relative_time.go | 30 +- .../datadogV1/model_notebook_resource_type.go | 47 +- .../api/datadogV1/model_notebook_response.go | 23 +- .../datadogV1/model_notebook_response_data.go | 38 +- ...model_notebook_response_data_attributes.go | 44 +- .../api/datadogV1/model_notebook_split_by.go | 12 +- .../v2/api/datadogV1/model_notebook_status.go | 47 +- ...del_notebook_timeseries_cell_attributes.go | 44 +- .../model_notebook_toplist_cell_attributes.go | 44 +- .../datadogV1/model_notebook_update_cell.go | 52 +- .../datadogV1/model_notebook_update_data.go | 38 +- .../model_notebook_update_data_attributes.go | 38 +- .../model_notebook_update_request.go | 24 +- .../api/datadogV1/model_notebooks_response.go | 23 +- .../model_notebooks_response_data.go | 38 +- ...odel_notebooks_response_data_attributes.go | 44 +- .../model_notebooks_response_meta.go | 23 +- .../model_notebooks_response_page.go | 11 +- .../api/datadogV1/model_notify_end_state.go | 47 +- .../v2/api/datadogV1/model_notify_end_type.go | 47 +- .../datadogV1/model_on_missing_data_option.go | 47 +- .../model_org_downgraded_response.go | 11 +- .../v2/api/datadogV1/model_organization.go | 35 +- .../datadogV1/model_organization_billing.go | 11 +- .../model_organization_create_body.go | 30 +- .../model_organization_create_response.go | 41 +- .../model_organization_list_response.go | 11 +- .../datadogV1/model_organization_response.go | 23 +- .../datadogV1/model_organization_settings.go | 94 +- .../model_organization_settings_saml.go | 11 +- ..._settings_saml_autocreate_users_domains.go | 11 +- ...ation_settings_saml_idp_initiated_login.go | 11 +- ..._organization_settings_saml_strict_mode.go | 11 +- .../model_organization_subscription.go | 11 +- .../api/datadogV1/model_pager_duty_service.go | 12 +- .../datadogV1/model_pager_duty_service_key.go | 12 +- .../model_pager_duty_service_name.go | 12 +- .../v2/api/datadogV1/model_pagination.go | 11 +- .../model_process_query_definition.go | 12 +- .../api/datadogV1/model_query_sort_order.go | 47 +- .../model_query_value_widget_definition.go | 72 +- ...odel_query_value_widget_definition_type.go | 47 +- .../model_query_value_widget_request.go | 101 +- ...l_reference_table_logs_lookup_processor.go | 32 +- .../model_response_meta_attributes.go | 23 +- .../model_run_workflow_widget_definition.go | 52 +- ...del_run_workflow_widget_definition_type.go | 47 +- .../model_run_workflow_widget_input.go | 12 +- .../datadogV1/model_scatter_plot_request.go | 77 +- .../model_scatter_plot_widget_definition.go | 70 +- ...scatter_plot_widget_definition_requests.go | 35 +- ...del_scatter_plot_widget_definition_type.go | 47 +- .../datadogV1/model_scatterplot_dimension.go | 47 +- .../model_scatterplot_table_request.go | 33 +- .../model_scatterplot_widget_aggregator.go | 47 +- .../model_scatterplot_widget_formula.go | 32 +- .../model_search_service_level_objective.go | 23 +- ...arch_service_level_objective_attributes.go | 37 +- ...del_search_service_level_objective_data.go | 23 +- .../api/datadogV1/model_search_slo_query.go | 11 +- .../datadogV1/model_search_slo_response.go | 35 +- .../model_search_slo_response_data.go | 23 +- ...del_search_slo_response_data_attributes.go | 23 +- ...rch_slo_response_data_attributes_facets.go | 11 +- ...ponse_data_attributes_facets_object_int.go | 11 +- ...se_data_attributes_facets_object_string.go | 11 +- .../model_search_slo_response_links.go | 11 +- .../model_search_slo_response_meta.go | 23 +- .../model_search_slo_response_meta_page.go | 11 +- .../datadogV1/model_search_slo_threshold.go | 32 +- .../datadogV1/model_search_slo_timeframe.go | 47 +- ...odel_selectable_template_variable_items.go | 11 +- .../v2/api/datadogV1/model_series.go | 12 +- .../v2/api/datadogV1/model_service_check.go | 32 +- .../datadogV1/model_service_check_status.go | 47 +- .../model_service_level_objective.go | 58 +- .../model_service_level_objective_query.go | 12 +- .../model_service_level_objective_request.go | 52 +- .../model_service_map_widget_definition.go | 46 +- ...odel_service_map_widget_definition_type.go | 47 +- ...model_service_summary_widget_definition.go | 80 +- ..._service_summary_widget_definition_type.go | 47 +- .../api/datadogV1/model_shared_dashboard.go | 58 +- .../model_shared_dashboard_author.go | 11 +- .../model_shared_dashboard_invites.go | 24 +- .../model_shared_dashboard_invites_data.go | 52 +- ...el_shared_dashboard_invites_data_object.go | 38 +- ...ashboard_invites_data_object_attributes.go | 12 +- .../model_shared_dashboard_invites_meta.go | 23 +- ...odel_shared_dashboard_invites_meta_page.go | 11 +- .../model_shared_dashboard_update_request.go | 32 +- ...ed_dashboard_update_request_global_time.go | 29 +- .../datadogV1/model_signal_archive_reason.go | 47 +- .../model_signal_assignee_update_request.go | 12 +- .../model_signal_state_update_request.go | 46 +- .../datadogV1/model_signal_triage_state.go | 47 +- .../model_slack_integration_channel.go | 23 +- ...model_slack_integration_channel_display.go | 11 +- .../datadogV1/model_slo_bulk_delete_error.go | 32 +- .../model_slo_bulk_delete_response.go | 23 +- .../model_slo_bulk_delete_response_data.go | 11 +- .../v2/api/datadogV1/model_slo_correction.go | 37 +- .../model_slo_correction_category.go | 47 +- .../model_slo_correction_create_data.go | 38 +- .../model_slo_correction_create_request.go | 23 +- ...lo_correction_create_request_attributes.go | 30 +- .../model_slo_correction_list_response.go | 23 +- .../model_slo_correction_response.go | 23 +- ...odel_slo_correction_response_attributes.go | 35 +- ...correction_response_attributes_modifier.go | 11 +- .../datadogV1/model_slo_correction_type.go | 47 +- .../model_slo_correction_update_data.go | 37 +- .../model_slo_correction_update_request.go | 23 +- ...lo_correction_update_request_attributes.go | 29 +- .../v2/api/datadogV1/model_slo_creator.go | 11 +- .../datadogV1/model_slo_delete_response.go | 11 +- .../datadogV1/model_slo_error_timeframe.go | 47 +- .../datadogV1/model_slo_history_metrics.go | 30 +- .../model_slo_history_metrics_series.go | 24 +- ...del_slo_history_metrics_series_metadata.go | 11 +- ...lo_history_metrics_series_metadata_unit.go | 11 +- .../datadogV1/model_slo_history_monitor.go | 11 +- .../datadogV1/model_slo_history_response.go | 23 +- .../model_slo_history_response_data.go | 57 +- .../model_slo_history_response_error.go | 11 +- ...el_slo_history_response_error_with_type.go | 12 +- .../datadogV1/model_slo_history_sli_data.go | 11 +- .../api/datadogV1/model_slo_list_response.go | 23 +- .../model_slo_list_response_metadata.go | 23 +- .../model_slo_list_response_metadata_page.go | 11 +- .../model_slo_list_widget_definition.go | 46 +- .../model_slo_list_widget_definition_type.go | 47 +- .../datadogV1/model_slo_list_widget_query.go | 12 +- .../model_slo_list_widget_request.go | 38 +- .../model_slo_list_widget_request_type.go | 47 +- .../datadogV1/model_slo_overall_statuses.go | 45 +- .../model_slo_raw_error_budget_remaining.go | 11 +- .../v2/api/datadogV1/model_slo_response.go | 23 +- .../api/datadogV1/model_slo_response_data.go | 57 +- .../v2/api/datadogV1/model_slo_state.go | 47 +- .../v2/api/datadogV1/model_slo_status.go | 31 +- .../v2/api/datadogV1/model_slo_threshold.go | 32 +- .../v2/api/datadogV1/model_slo_timeframe.go | 47 +- .../v2/api/datadogV1/model_slo_type.go | 47 +- .../api/datadogV1/model_slo_type_numeric.go | 47 +- .../datadogV1/model_slo_widget_definition.go | 60 +- .../model_slo_widget_definition_type.go | 47 +- ...model_successful_signal_update_response.go | 11 +- .../model_sunburst_widget_definition.go | 52 +- .../model_sunburst_widget_definition_type.go | 47 +- .../datadogV1/model_sunburst_widget_legend.go | 52 +- ...sunburst_widget_legend_inline_automatic.go | 32 +- ...rst_widget_legend_inline_automatic_type.go | 47 +- .../model_sunburst_widget_legend_table.go | 30 +- ...model_sunburst_widget_legend_table_type.go | 47 +- .../model_sunburst_widget_request.go | 87 +- .../datadogV1/model_synthetics_api_step.go | 44 +- .../model_synthetics_api_step_subtype.go | 47 +- .../datadogV1/model_synthetics_api_test_.go | 72 +- .../model_synthetics_api_test_config.go | 23 +- .../model_synthetics_api_test_failure_code.go | 47 +- .../model_synthetics_api_test_result_data.go | 49 +- ...odel_synthetics_api_test_result_failure.go | 29 +- .../model_synthetics_api_test_result_full.go | 43 +- ...l_synthetics_api_test_result_full_check.go | 24 +- .../model_synthetics_api_test_result_short.go | 37 +- ...synthetics_api_test_result_short_result.go | 23 +- .../model_synthetics_api_test_type.go | 47 +- .../datadogV1/model_synthetics_assertion.go | 52 +- ...synthetics_assertion_json_path_operator.go | 47 +- ...l_synthetics_assertion_json_path_target.go | 52 +- ...etics_assertion_json_path_target_target.go | 11 +- .../model_synthetics_assertion_operator.go | 47 +- .../model_synthetics_assertion_target.go | 46 +- .../model_synthetics_assertion_type.go | 47 +- ...el_synthetics_assertion_x_path_operator.go | 47 +- ...odel_synthetics_assertion_x_path_target.go | 52 +- ...nthetics_assertion_x_path_target_target.go | 11 +- .../datadogV1/model_synthetics_basic_auth.go | 52 +- .../model_synthetics_basic_auth_digest.go | 32 +- ...model_synthetics_basic_auth_digest_type.go | 47 +- .../model_synthetics_basic_auth_ntlm.go | 32 +- .../model_synthetics_basic_auth_ntlm_type.go | 47 +- ...odel_synthetics_basic_auth_oauth_client.go | 46 +- ...synthetics_basic_auth_oauth_client_type.go | 47 +- .../model_synthetics_basic_auth_oauth_rop.go | 46 +- ...el_synthetics_basic_auth_oauth_rop_type.go | 47 +- ...sic_auth_oauth_token_api_authentication.go | 47 +- .../model_synthetics_basic_auth_sigv4.go | 32 +- .../model_synthetics_basic_auth_sigv4_type.go | 47 +- .../model_synthetics_basic_auth_web.go | 32 +- .../model_synthetics_basic_auth_web_type.go | 47 +- .../model_synthetics_batch_details.go | 23 +- .../model_synthetics_batch_details_data.go | 37 +- .../model_synthetics_batch_result.go | 73 +- .../model_synthetics_browser_error.go | 32 +- .../model_synthetics_browser_error_type.go | 47 +- .../model_synthetics_browser_test_.go | 58 +- .../model_synthetics_browser_test_config.go | 24 +- ...el_synthetics_browser_test_failure_code.go | 47 +- ...del_synthetics_browser_test_result_data.go | 29 +- ..._synthetics_browser_test_result_failure.go | 29 +- ...del_synthetics_browser_test_result_full.go | 43 +- ...nthetics_browser_test_result_full_check.go | 24 +- ...el_synthetics_browser_test_result_short.go | 37 +- ...hetics_browser_test_result_short_result.go | 23 +- ...el_synthetics_browser_test_rum_settings.go | 12 +- .../model_synthetics_browser_test_type.go | 47 +- .../model_synthetics_browser_variable.go | 32 +- .../model_synthetics_browser_variable_type.go | 47 +- .../datadogV1/model_synthetics_check_type.go | 47 +- .../model_synthetics_ci_batch_metadata.go | 29 +- .../model_synthetics_ci_batch_metadata_ci.go | 29 +- .../model_synthetics_ci_batch_metadata_git.go | 11 +- ...l_synthetics_ci_batch_metadata_pipeline.go | 11 +- ...l_synthetics_ci_batch_metadata_provider.go | 11 +- .../datadogV1/model_synthetics_ci_test_.go | 30 +- .../model_synthetics_ci_test_body.go | 11 +- .../model_synthetics_config_variable.go | 32 +- .../model_synthetics_config_variable_type.go | 47 +- .../model_synthetics_core_web_vitals.go | 11 +- .../model_synthetics_delete_tests_payload.go | 11 +- .../model_synthetics_delete_tests_response.go | 11 +- .../model_synthetics_deleted_test_.go | 12 +- .../api/datadogV1/model_synthetics_device.go | 32 +- .../datadogV1/model_synthetics_device_id.go | 47 +- ...cs_get_api_test_latest_results_response.go | 11 +- ...et_browser_test_latest_results_response.go | 11 +- .../model_synthetics_global_variable.go | 36 +- ...l_synthetics_global_variable_attributes.go | 11 +- ...odel_synthetics_global_variable_options.go | 23 +- ...tics_global_variable_parse_test_options.go | 38 +- ...global_variable_parse_test_options_type.go | 47 +- ..._synthetics_global_variable_parser_type.go | 47 +- ...thetics_global_variable_totp_parameters.go | 11 +- .../model_synthetics_global_variable_value.go | 23 +- ...nthetics_list_global_variables_response.go | 11 +- .../model_synthetics_list_tests_response.go | 11 +- .../datadogV1/model_synthetics_location.go | 11 +- .../datadogV1/model_synthetics_locations.go | 11 +- .../model_synthetics_parsing_options.go | 37 +- .../datadogV1/model_synthetics_playing_tab.go | 47 +- .../model_synthetics_private_location.go | 30 +- ...tics_private_location_creation_response.go | 29 +- ...ion_creation_response_result_encryption.go | 11 +- ...el_synthetics_private_location_metadata.go | 11 +- ...del_synthetics_private_location_secrets.go | 29 +- ...private_location_secrets_authentication.go | 11 +- ...vate_location_secrets_config_decryption.go | 11 +- .../model_synthetics_ssl_certificate.go | 30 +- ...model_synthetics_ssl_certificate_issuer.go | 11 +- ...odel_synthetics_ssl_certificate_subject.go | 11 +- .../api/datadogV1/model_synthetics_status.go | 47 +- .../v2/api/datadogV1/model_synthetics_step.go | 31 +- .../datadogV1/model_synthetics_step_detail.go | 59 +- .../model_synthetics_step_detail_warning.go | 32 +- .../datadogV1/model_synthetics_step_type.go | 47 +- .../model_synthetics_test_call_type.go | 47 +- .../model_synthetics_test_ci_options.go | 29 +- .../datadogV1/model_synthetics_test_config.go | 23 +- .../model_synthetics_test_details.go | 77 +- .../model_synthetics_test_details_sub_type.go | 47 +- .../model_synthetics_test_details_type.go | 47 +- .../model_synthetics_test_execution_rule.go | 47 +- .../model_synthetics_test_monitor_status.go | 47 +- .../model_synthetics_test_options.go | 61 +- ...el_synthetics_test_options_http_version.go | 47 +- ...synthetics_test_options_monitor_options.go | 11 +- .../model_synthetics_test_options_retry.go | 11 +- ...odel_synthetics_test_options_scheduling.go | 11 +- ...etics_test_options_scheduling_timeframe.go | 11 +- .../model_synthetics_test_pause_status.go | 47 +- .../model_synthetics_test_process_status.go | 47 +- .../model_synthetics_test_request.go | 94 +- ...model_synthetics_test_request_body_type.go | 47 +- ...del_synthetics_test_request_certificate.go | 29 +- ...ynthetics_test_request_certificate_item.go | 11 +- .../model_synthetics_test_request_proxy.go | 12 +- .../api/datadogV1/model_synthetics_timing.go | 11 +- .../model_synthetics_trigger_body.go | 12 +- ...del_synthetics_trigger_ci_test_location.go | 11 +- ...l_synthetics_trigger_ci_test_run_result.go | 29 +- ...el_synthetics_trigger_ci_tests_response.go | 11 +- .../model_synthetics_trigger_test_.go | 24 +- ...hetics_update_test_pause_status_payload.go | 29 +- .../model_synthetics_variable_parser.go | 30 +- .../model_synthetics_warning_type.go | 47 +- .../model_table_widget_cell_display_mode.go | 47 +- .../model_table_widget_definition.go | 66 +- .../model_table_widget_definition_type.go | 47 +- .../model_table_widget_has_search_bar.go | 47 +- .../datadogV1/model_table_widget_request.go | 115 +- .../v2/api/datadogV1/model_tag_to_hosts.go | 11 +- .../api/datadogV1/model_target_format_type.go | 47 +- .../datadogV1/model_timeseries_background.go | 36 +- .../model_timeseries_background_type.go | 47 +- .../model_timeseries_widget_definition.go | 78 +- ...model_timeseries_widget_definition_type.go | 47 +- ...odel_timeseries_widget_expression_alias.go | 12 +- .../model_timeseries_widget_legend_column.go | 47 +- .../model_timeseries_widget_legend_layout.go | 47 +- .../model_timeseries_widget_request.go | 107 +- .../model_toplist_widget_definition.go | 52 +- .../model_toplist_widget_definition_type.go | 47 +- .../datadogV1/model_toplist_widget_request.go | 93 +- .../model_topology_map_widget_definition.go | 46 +- ...del_topology_map_widget_definition_type.go | 47 +- .../v2/api/datadogV1/model_topology_query.go | 29 +- .../model_topology_query_data_source.go | 47 +- .../api/datadogV1/model_topology_request.go | 37 +- .../datadogV1/model_topology_request_type.go | 47 +- .../api/datadogV1/model_tree_map_color_by.go | 47 +- .../api/datadogV1/model_tree_map_group_by.go | 47 +- .../api/datadogV1/model_tree_map_size_by.go | 47 +- .../model_tree_map_widget_definition.go | 80 +- .../model_tree_map_widget_definition_type.go | 47 +- .../model_tree_map_widget_request.go | 33 +- .../model_usage_analyzed_logs_hour.go | 12 +- .../model_usage_analyzed_logs_response.go | 11 +- ...model_usage_attribution_aggregates_body.go | 11 +- .../datadogV1/model_usage_attribution_body.go | 24 +- .../model_usage_attribution_metadata.go | 23 +- .../model_usage_attribution_pagination.go | 11 +- .../model_usage_attribution_response.go | 23 +- .../datadogV1/model_usage_attribution_sort.go | 47 +- ...del_usage_attribution_supported_metrics.go | 47 +- .../model_usage_attribution_values.go | 11 +- .../datadogV1/model_usage_audit_logs_hour.go | 12 +- .../model_usage_audit_logs_response.go | 11 +- .../model_usage_billable_summary_body.go | 12 +- .../model_usage_billable_summary_hour.go | 24 +- .../model_usage_billable_summary_keys.go | 545 +- .../model_usage_billable_summary_response.go | 11 +- .../model_usage_ci_visibility_hour.go | 59 +- .../model_usage_ci_visibility_response.go | 11 +- ..._cloud_security_posture_management_hour.go | 12 +- ...ud_security_posture_management_response.go | 11 +- .../model_usage_custom_reports_attributes.go | 11 +- .../model_usage_custom_reports_data.go | 37 +- .../model_usage_custom_reports_meta.go | 23 +- .../model_usage_custom_reports_page.go | 11 +- .../model_usage_custom_reports_response.go | 23 +- .../v2/api/datadogV1/model_usage_cws_hour.go | 12 +- .../api/datadogV1/model_usage_cws_response.go | 11 +- .../v2/api/datadogV1/model_usage_dbm_hour.go | 12 +- .../api/datadogV1/model_usage_dbm_response.go | 11 +- .../api/datadogV1/model_usage_fargate_hour.go | 12 +- .../datadogV1/model_usage_fargate_response.go | 11 +- .../v2/api/datadogV1/model_usage_host_hour.go | 12 +- .../datadogV1/model_usage_hosts_response.go | 11 +- .../model_usage_incident_management_hour.go | 12 +- ...odel_usage_incident_management_response.go | 11 +- .../model_usage_indexed_spans_hour.go | 12 +- .../model_usage_indexed_spans_response.go | 11 +- .../model_usage_ingested_spans_hour.go | 12 +- .../model_usage_ingested_spans_response.go | 11 +- .../v2/api/datadogV1/model_usage_io_t_hour.go | 12 +- .../datadogV1/model_usage_io_t_response.go | 11 +- .../api/datadogV1/model_usage_lambda_hour.go | 12 +- .../datadogV1/model_usage_lambda_response.go | 11 +- .../model_usage_logs_by_index_hour.go | 12 +- .../model_usage_logs_by_index_response.go | 11 +- .../model_usage_logs_by_retention_hour.go | 11 +- .../model_usage_logs_by_retention_response.go | 11 +- .../v2/api/datadogV1/model_usage_logs_hour.go | 12 +- .../datadogV1/model_usage_logs_response.go | 11 +- .../datadogV1/model_usage_metric_category.go | 47 +- .../model_usage_network_flows_hour.go | 12 +- .../model_usage_network_flows_response.go | 11 +- .../model_usage_network_hosts_hour.go | 12 +- .../model_usage_network_hosts_response.go | 11 +- .../model_usage_online_archive_hour.go | 12 +- .../model_usage_online_archive_response.go | 11 +- .../datadogV1/model_usage_profiling_hour.go | 12 +- .../model_usage_profiling_response.go | 11 +- .../api/datadogV1/model_usage_reports_type.go | 47 +- .../model_usage_rum_sessions_hour.go | 12 +- .../model_usage_rum_sessions_response.go | 11 +- .../datadogV1/model_usage_rum_units_hour.go | 11 +- .../model_usage_rum_units_response.go | 11 +- .../v2/api/datadogV1/model_usage_sds_hour.go | 12 +- .../api/datadogV1/model_usage_sds_response.go | 11 +- .../v2/api/datadogV1/model_usage_snmp_hour.go | 12 +- .../datadogV1/model_usage_snmp_response.go | 11 +- .../v2/api/datadogV1/model_usage_sort.go | 47 +- .../datadogV1/model_usage_sort_direction.go | 47 +- ...age_specified_custom_reports_attributes.go | 11 +- ...del_usage_specified_custom_reports_data.go | 37 +- ...del_usage_specified_custom_reports_meta.go | 23 +- ...del_usage_specified_custom_reports_page.go | 11 +- ...usage_specified_custom_reports_response.go | 29 +- .../api/datadogV1/model_usage_summary_date.go | 84 +- .../datadogV1/model_usage_summary_date_org.go | 83 +- .../datadogV1/model_usage_summary_response.go | 96 +- .../model_usage_synthetics_api_hour.go | 12 +- .../model_usage_synthetics_api_response.go | 11 +- .../model_usage_synthetics_browser_hour.go | 12 +- ...model_usage_synthetics_browser_response.go | 11 +- .../datadogV1/model_usage_synthetics_hour.go | 12 +- .../model_usage_synthetics_response.go | 11 +- .../datadogV1/model_usage_timeseries_hour.go | 12 +- .../model_usage_timeseries_response.go | 11 +- .../model_usage_top_avg_metrics_hour.go | 31 +- .../model_usage_top_avg_metrics_metadata.go | 24 +- .../model_usage_top_avg_metrics_pagination.go | 11 +- .../model_usage_top_avg_metrics_response.go | 23 +- .../v2/api/datadogV1/model_user.go | 80 +- .../datadogV1/model_user_disable_response.go | 11 +- .../api/datadogV1/model_user_list_response.go | 11 +- .../v2/api/datadogV1/model_user_response.go | 23 +- .../datadogV1/model_webhooks_integration.go | 32 +- ...el_webhooks_integration_custom_variable.go | 12 +- ...ks_integration_custom_variable_response.go | 12 +- ...egration_custom_variable_update_request.go | 11 +- .../model_webhooks_integration_encoding.go | 47 +- ...del_webhooks_integration_update_request.go | 31 +- .../v2/api/datadogV1/model_widget.go | 31 +- .../api/datadogV1/model_widget_aggregator.go | 47 +- .../v2/api/datadogV1/model_widget_axis.go | 11 +- .../api/datadogV1/model_widget_change_type.go | 47 +- .../model_widget_color_preference.go | 47 +- .../api/datadogV1/model_widget_comparator.go | 49 +- .../api/datadogV1/model_widget_compare_to.go | 47 +- .../model_widget_conditional_format.go | 46 +- .../api/datadogV1/model_widget_custom_link.go | 11 +- .../api/datadogV1/model_widget_definition.go | 52 +- .../datadogV1/model_widget_display_type.go | 55 +- .../v2/api/datadogV1/model_widget_event.go | 12 +- .../api/datadogV1/model_widget_event_size.go | 47 +- .../api/datadogV1/model_widget_field_sort.go | 32 +- .../v2/api/datadogV1/model_widget_formula.go | 44 +- .../datadogV1/model_widget_formula_limit.go | 31 +- .../datadogV1/model_widget_formula_style.go | 11 +- .../v2/api/datadogV1/model_widget_grouping.go | 47 +- .../model_widget_horizontal_align.go | 47 +- .../datadogV1/model_widget_image_sizing.go | 47 +- .../v2/api/datadogV1/model_widget_layout.go | 12 +- .../api/datadogV1/model_widget_layout_type.go | 47 +- .../api/datadogV1/model_widget_line_type.go | 47 +- .../api/datadogV1/model_widget_line_width.go | 47 +- .../api/datadogV1/model_widget_live_span.go | 47 +- .../v2/api/datadogV1/model_widget_margin.go | 47 +- .../v2/api/datadogV1/model_widget_marker.go | 12 +- .../datadogV1/model_widget_message_display.go | 47 +- ...l_widget_monitor_summary_display_format.go | 47 +- .../model_widget_monitor_summary_sort.go | 47 +- .../api/datadogV1/model_widget_node_type.go | 47 +- .../v2/api/datadogV1/model_widget_order_by.go | 47 +- .../v2/api/datadogV1/model_widget_palette.go | 47 +- .../datadogV1/model_widget_request_style.go | 45 +- ...l_widget_service_summary_display_format.go | 47 +- .../api/datadogV1/model_widget_size_format.go | 47 +- .../v2/api/datadogV1/model_widget_sort.go | 47 +- .../v2/api/datadogV1/model_widget_style.go | 11 +- .../datadogV1/model_widget_summary_type.go | 47 +- .../api/datadogV1/model_widget_text_align.go | 47 +- .../api/datadogV1/model_widget_tick_edge.go | 47 +- .../v2/api/datadogV1/model_widget_time.go | 29 +- .../datadogV1/model_widget_time_windows_.go | 47 +- .../datadogV1/model_widget_vertical_align.go | 47 +- .../api/datadogV1/model_widget_view_mode.go | 47 +- .../v2/api/datadogV1/model_widget_viz_type.go | 47 +- .../datadogV2/api_ci_visibility_pipelines.go | 19 +- .../v2/api/datadogV2/api_downtimes.go | 554 ++ .../v2/api/datadogV2/api_logs.go | 12 +- .../v2/api/datadogV2/api_metrics.go | 2 +- .../api/datadogV2/api_security_monitoring.go | 5 +- .../v2/api/datadogV2/api_spans.go | 454 ++ .../v2/api/datadogV2/api_teams.go | 71 + .../v2/api/datadogV2/doc.go | 504 +- .../api/datadogV2/model_api_error_response.go | 12 +- .../model_api_key_create_attributes.go | 12 +- .../datadogV2/model_api_key_create_data.go | 38 +- .../datadogV2/model_api_key_create_request.go | 24 +- .../datadogV2/model_api_key_relationships.go | 29 +- .../api/datadogV2/model_api_key_response.go | 23 +- .../model_api_key_response_included_item.go | 52 +- .../model_api_key_update_attributes.go | 12 +- .../datadogV2/model_api_key_update_data.go | 38 +- .../datadogV2/model_api_key_update_request.go | 24 +- .../api/datadogV2/model_api_keys_response.go | 11 +- .../v2/api/datadogV2/model_api_keys_sort.go | 47 +- .../v2/api/datadogV2/model_api_keys_type.go | 47 +- ...model_application_key_create_attributes.go | 14 +- .../model_application_key_create_data.go | 38 +- .../model_application_key_create_request.go | 24 +- .../model_application_key_relationships.go | 23 +- .../model_application_key_response.go | 23 +- ..._application_key_response_included_item.go | 52 +- ...model_application_key_update_attributes.go | 13 +- .../model_application_key_update_data.go | 38 +- .../model_application_key_update_request.go | 24 +- .../datadogV2/model_application_keys_sort.go | 47 +- .../datadogV2/model_application_keys_type.go | 47 +- .../api/datadogV2/model_audit_logs_event.go | 37 +- .../model_audit_logs_event_attributes.go | 49 +- .../datadogV2/model_audit_logs_event_type.go | 47 +- .../model_audit_logs_events_response.go | 29 +- .../model_audit_logs_query_filter.go | 11 +- .../model_audit_logs_query_options.go | 11 +- .../model_audit_logs_query_page_options.go | 11 +- .../model_audit_logs_response_links.go | 11 +- .../model_audit_logs_response_metadata.go | 37 +- .../model_audit_logs_response_page.go | 11 +- .../model_audit_logs_response_status.go | 47 +- .../model_audit_logs_search_events_request.go | 49 +- .../v2/api/datadogV2/model_audit_logs_sort.go | 47 +- .../api/datadogV2/model_audit_logs_warning.go | 11 +- .../v2/api/datadogV2/model_auth_n_mapping.go | 44 +- .../model_auth_n_mapping_attributes.go | 12 +- .../model_auth_n_mapping_create_attributes.go | 11 +- .../model_auth_n_mapping_create_data.go | 44 +- ...del_auth_n_mapping_create_relationships.go | 23 +- .../model_auth_n_mapping_create_request.go | 24 +- .../model_auth_n_mapping_included.go | 52 +- .../model_auth_n_mapping_relationships.go | 29 +- .../model_auth_n_mapping_response.go | 23 +- .../model_auth_n_mapping_update_attributes.go | 11 +- .../model_auth_n_mapping_update_data.go | 44 +- ...del_auth_n_mapping_update_relationships.go | 23 +- .../model_auth_n_mapping_update_request.go | 24 +- .../model_auth_n_mappings_response.go | 23 +- .../datadogV2/model_auth_n_mappings_sort.go | 47 +- .../datadogV2/model_auth_n_mappings_type.go | 47 +- .../datadogV2/model_chargeback_breakdown.go | 11 +- .../model_ci_app_aggregate_bucket_value.go | 52 +- ...i_app_aggregate_bucket_value_timeseries.go | 16 +- ...aggregate_bucket_value_timeseries_point.go | 12 +- .../datadogV2/model_ci_app_aggregate_sort.go | 59 +- .../model_ci_app_aggregate_sort_type.go | 47 +- .../model_ci_app_aggregation_function.go | 47 +- .../v2/api/datadogV2/model_ci_app_ci_error.go | 29 +- .../datadogV2/model_ci_app_ci_error_domain.go | 47 +- .../v2/api/datadogV2/model_ci_app_compute.go | 46 +- .../datadogV2/model_ci_app_compute_type.go | 47 +- ...el_ci_app_create_pipeline_event_request.go | 23 +- ...reate_pipeline_event_request_attributes.go | 12 +- ...eline_event_request_attributes_resource.go | 52 +- ..._app_create_pipeline_event_request_data.go | 37 +- ...create_pipeline_event_request_data_type.go | 47 +- .../model_ci_app_event_attributes.go | 109 +- .../v2/api/datadogV2/model_ci_app_git_info.go | 12 +- .../model_ci_app_group_by_histogram.go | 12 +- .../model_ci_app_group_by_missing.go | 52 +- .../datadogV2/model_ci_app_group_by_total.go | 52 +- .../api/datadogV2/model_ci_app_host_info.go | 11 +- .../datadogV2/model_ci_app_pipeline_event.go | 55 +- .../model_ci_app_pipeline_event_attributes.go | 184 + .../model_ci_app_pipeline_event_job.go | 46 +- .../model_ci_app_pipeline_event_job_level.go | 47 +- .../model_ci_app_pipeline_event_job_status.go | 47 +- ...l_ci_app_pipeline_event_parent_pipeline.go | 12 +- .../model_ci_app_pipeline_event_pipeline.go | 48 +- ...el_ci_app_pipeline_event_pipeline_level.go | 47 +- ...l_ci_app_pipeline_event_pipeline_status.go | 47 +- ...ci_app_pipeline_event_previous_pipeline.go | 12 +- .../model_ci_app_pipeline_event_stage.go | 46 +- ...model_ci_app_pipeline_event_stage_level.go | 47 +- ...odel_ci_app_pipeline_event_stage_status.go | 47 +- .../model_ci_app_pipeline_event_step.go | 46 +- .../model_ci_app_pipeline_event_step_level.go | 47 +- ...model_ci_app_pipeline_event_step_status.go | 47 +- .../model_ci_app_pipeline_event_type_name.go | 47 +- .../model_ci_app_pipeline_events_request.go | 49 +- .../model_ci_app_pipeline_events_response.go | 29 +- .../datadogV2/model_ci_app_pipeline_level.go | 72 + ...odel_ci_app_pipelines_aggregate_request.go | 29 +- ..._pipelines_aggregation_buckets_response.go | 11 +- ..._pipelines_analytics_aggregate_response.go | 35 +- .../model_ci_app_pipelines_bucket_response.go | 11 +- .../model_ci_app_pipelines_group_by.go | 30 +- .../model_ci_app_pipelines_query_filter.go | 13 +- .../datadogV2/model_ci_app_query_options.go | 11 +- .../model_ci_app_query_page_options.go | 11 +- .../datadogV2/model_ci_app_response_links.go | 11 +- .../model_ci_app_response_metadata.go | 31 +- ...i_app_response_metadata_with_pagination.go | 37 +- .../datadogV2/model_ci_app_response_page.go | 11 +- .../datadogV2/model_ci_app_response_status.go | 47 +- .../v2/api/datadogV2/model_ci_app_sort.go | 47 +- .../api/datadogV2/model_ci_app_sort_order.go | 47 +- .../api/datadogV2/model_ci_app_test_event.go | 37 +- .../model_ci_app_test_event_type_name.go | 47 +- .../model_ci_app_test_events_request.go | 49 +- .../model_ci_app_test_events_response.go | 29 +- .../api/datadogV2/model_ci_app_test_level.go | 70 + .../model_ci_app_tests_aggregate_request.go | 29 +- ..._app_tests_aggregation_buckets_response.go | 11 +- ..._app_tests_analytics_aggregate_response.go | 49 +- .../model_ci_app_tests_bucket_response.go | 11 +- .../datadogV2/model_ci_app_tests_group_by.go | 30 +- .../model_ci_app_tests_query_filter.go | 13 +- .../v2/api/datadogV2/model_ci_app_warning.go | 11 +- ...d_configuration_compliance_rule_options.go | 24 +- .../model_cloud_configuration_rego_rule.go | 12 +- ...el_cloud_configuration_rule_case_create.go | 32 +- ...guration_rule_compliance_signal_options.go | 109 +- ...cloud_configuration_rule_create_payload.go | 81 +- .../model_cloud_configuration_rule_options.go | 24 +- .../model_cloud_configuration_rule_type.go | 47 +- ...workload_security_agent_rule_attributes.go | 193 +- ...d_security_agent_rule_create_attributes.go | 12 +- ...orkload_security_agent_rule_create_data.go | 38 +- ...load_security_agent_rule_create_request.go | 24 +- ..._security_agent_rule_creator_attributes.go | 11 +- ...cloud_workload_security_agent_rule_data.go | 37 +- ...d_workload_security_agent_rule_response.go | 23 +- ...cloud_workload_security_agent_rule_type.go | 47 +- ...d_security_agent_rule_update_attributes.go | 11 +- ...orkload_security_agent_rule_update_data.go | 38 +- ...load_security_agent_rule_update_request.go | 24 +- ..._security_agent_rule_updater_attributes.go | 11 +- ...load_security_agent_rules_list_response.go | 11 +- ...model_cloudflare_account_create_request.go | 24 +- ...flare_account_create_request_attributes.go | 12 +- ..._cloudflare_account_create_request_data.go | 38 +- .../model_cloudflare_account_response.go | 23 +- ..._cloudflare_account_response_attributes.go | 12 +- .../model_cloudflare_account_response_data.go | 38 +- .../model_cloudflare_account_type.go | 47 +- ...model_cloudflare_account_update_request.go | 24 +- ...flare_account_update_request_attributes.go | 12 +- ..._cloudflare_account_update_request_data.go | 37 +- .../model_cloudflare_accounts_response.go | 11 +- .../model_confluent_account_create_request.go | 24 +- ...luent_account_create_request_attributes.go | 12 +- ...l_confluent_account_create_request_data.go | 38 +- ...l_confluent_account_resource_attributes.go | 59 +- .../model_confluent_account_response.go | 23 +- ...l_confluent_account_response_attributes.go | 12 +- .../model_confluent_account_response_data.go | 38 +- .../datadogV2/model_confluent_account_type.go | 47 +- .../model_confluent_account_update_request.go | 24 +- ...luent_account_update_request_attributes.go | 12 +- ...l_confluent_account_update_request_data.go | 38 +- .../model_confluent_accounts_response.go | 11 +- .../model_confluent_resource_request.go | 24 +- ...l_confluent_resource_request_attributes.go | 57 +- .../model_confluent_resource_request_data.go | 38 +- .../model_confluent_resource_response.go | 23 +- ..._confluent_resource_response_attributes.go | 92 +- .../model_confluent_resource_response_data.go | 38 +- .../model_confluent_resource_type.go | 47 +- .../model_confluent_resources_response.go | 11 +- .../api/datadogV2/model_content_encoding.go | 47 +- .../v2/api/datadogV2/model_cost_by_org.go | 37 +- .../datadogV2/model_cost_by_org_attributes.go | 12 +- .../datadogV2/model_cost_by_org_response.go | 11 +- .../api/datadogV2/model_cost_by_org_type.go | 47 +- .../v2/api/datadogV2/model_creator.go | 11 +- .../model_dashboard_list_add_items_request.go | 11 +- ...model_dashboard_list_add_items_response.go | 11 +- ...del_dashboard_list_delete_items_request.go | 11 +- ...el_dashboard_list_delete_items_response.go | 11 +- .../datadogV2/model_dashboard_list_item.go | 156 +- .../model_dashboard_list_item_request.go | 32 +- .../model_dashboard_list_item_response.go | 32 +- .../datadogV2/model_dashboard_list_items.go | 12 +- ...del_dashboard_list_update_items_request.go | 11 +- ...el_dashboard_list_update_items_response.go | 11 +- .../v2/api/datadogV2/model_dashboard_type.go | 47 +- .../api/datadogV2/model_data_scalar_column.go | 23 +- .../api/datadogV2/model_detailed_finding.go | 37 +- .../model_detailed_finding_attributes.go | 57 +- .../datadogV2/model_detailed_finding_type.go | 47 +- .../model_downtime_create_request.go | 112 + ...odel_downtime_create_request_attributes.go | 373 ++ .../model_downtime_create_request_data.go | 150 + .../model_downtime_included_monitor_type.go | 64 + .../v2/api/datadogV2/model_downtime_meta.go | 113 + .../api/datadogV2/model_downtime_meta_page.go | 104 + .../model_downtime_monitor_identifier.go | 105 + .../model_downtime_monitor_identifier_id.go | 103 + .../model_downtime_monitor_identifier_tags.go | 106 + ...el_downtime_monitor_included_attributes.go | 104 + .../model_downtime_monitor_included_item.go | 191 + ...model_downtime_notify_end_state_actions.go | 66 + .../model_downtime_notify_end_state_types.go | 68 + .../datadogV2/model_downtime_relationships.go | 151 + ...model_downtime_relationships_created_by.go | 115 + ..._downtime_relationships_created_by_data.go | 203 + .../model_downtime_relationships_monitor.go | 115 + ...del_downtime_relationships_monitor_data.go | 203 + .../datadogV2/model_downtime_resource_type.go | 64 + .../api/datadogV2/model_downtime_response.go | 151 + .../model_downtime_response_attributes.go | 550 ++ .../datadogV2/model_downtime_response_data.go | 229 + .../model_downtime_response_included_item.go | 105 + .../model_downtime_schedule_create_request.go | 105 + ...time_schedule_current_downtime_response.go | 158 + ...schedule_one_time_create_update_request.go | 165 + ...del_downtime_schedule_one_time_response.go | 154 + ...hedule_recurrence_create_update_request.go | 187 + ...l_downtime_schedule_recurrence_response.go | 180 + ...ime_schedule_recurrences_create_request.go | 142 + ..._downtime_schedule_recurrences_response.go | 189 + ...ime_schedule_recurrences_update_request.go | 143 + .../model_downtime_schedule_response.go | 107 + .../model_downtime_schedule_update_request.go | 105 + .../v2/api/datadogV2/model_downtime_status.go | 70 + .../model_downtime_update_request.go | 112 + ...odel_downtime_update_request_attributes.go | 377 ++ ... => model_downtime_update_request_data.go} | 98 +- .../v2/api/datadogV2/model_event.go | 11 +- .../api/datadogV2/model_event_attributes.go | 51 +- .../v2/api/datadogV2/model_event_priority.go | 3 +- .../v2/api/datadogV2/model_event_response.go | 37 +- .../model_event_response_attributes.go | 61 +- .../api/datadogV2/model_event_status_type.go | 47 +- .../v2/api/datadogV2/model_event_type.go | 47 +- .../api/datadogV2/model_events_aggregation.go | 47 +- .../v2/api/datadogV2/model_events_compute.go | 30 +- .../api/datadogV2/model_events_data_source.go | 47 +- .../v2/api/datadogV2/model_events_group_by.go | 24 +- .../datadogV2/model_events_group_by_sort.go | 62 +- .../datadogV2/model_events_list_request.go | 49 +- .../datadogV2/model_events_list_response.go | 29 +- .../model_events_list_response_links.go | 11 +- .../datadogV2/model_events_query_filter.go | 11 +- .../datadogV2/model_events_query_options.go | 11 +- .../datadogV2/model_events_request_page.go | 11 +- .../model_events_response_metadata.go | 60 +- .../model_events_response_metadata_page.go | 11 +- .../datadogV2/model_events_scalar_query.go | 44 +- .../v2/api/datadogV2/model_events_search.go | 11 +- .../v2/api/datadogV2/model_events_sort.go | 47 +- .../api/datadogV2/model_events_sort_type.go | 47 +- .../model_events_timeseries_query.go | 44 +- .../v2/api/datadogV2/model_events_warning.go | 11 +- ...model_fastly_accoun_response_attributes.go | 12 +- .../model_fastly_account_create_request.go | 24 +- ...astly_account_create_request_attributes.go | 12 +- ...odel_fastly_account_create_request_data.go | 38 +- .../model_fastly_account_response.go | 23 +- .../model_fastly_account_response_data.go | 38 +- .../datadogV2/model_fastly_account_type.go | 47 +- .../model_fastly_account_update_request.go | 24 +- ...astly_account_update_request_attributes.go | 11 +- ...odel_fastly_account_update_request_data.go | 37 +- .../model_fastly_accounts_response.go | 11 +- .../v2/api/datadogV2/model_fastly_service.go | 12 +- .../model_fastly_service_attributes.go | 11 +- .../datadogV2/model_fastly_service_data.go | 38 +- .../datadogV2/model_fastly_service_request.go | 24 +- .../model_fastly_service_response.go | 23 +- .../datadogV2/model_fastly_service_type.go | 47 +- .../model_fastly_services_response.go | 11 +- .../v2/api/datadogV2/model_finding.go | 37 +- .../api/datadogV2/model_finding_attributes.go | 57 +- .../api/datadogV2/model_finding_evaluation.go | 47 +- .../v2/api/datadogV2/model_finding_mute.go | 30 +- .../datadogV2/model_finding_mute_reason.go | 47 +- .../v2/api/datadogV2/model_finding_rule.go | 10 +- .../v2/api/datadogV2/model_finding_status.go | 47 +- .../v2/api/datadogV2/model_finding_type.go | 47 +- .../v2/api/datadogV2/model_formula_limit.go | 32 +- .../v2/api/datadogV2/model_full_api_key.go | 43 +- .../model_full_api_key_attributes.go | 11 +- .../datadogV2/model_full_application_key.go | 43 +- .../model_full_application_key_attributes.go | 13 +- .../model_gcp_service_account_meta.go | 11 +- .../model_gcp_service_account_type.go | 47 +- .../model_gcpsts_delegate_account.go | 37 +- ...odel_gcpsts_delegate_account_attributes.go | 11 +- .../model_gcpsts_delegate_account_response.go | 23 +- .../model_gcpsts_delegate_account_type.go | 47 +- .../datadogV2/model_gcpsts_service_account.go | 43 +- ...model_gcpsts_service_account_attributes.go | 11 +- ...l_gcpsts_service_account_create_request.go | 23 +- .../model_gcpsts_service_account_data.go | 37 +- .../model_gcpsts_service_account_response.go | 23 +- ...l_gcpsts_service_account_update_request.go | 23 +- ...sts_service_account_update_request_data.go | 37 +- .../model_gcpsts_service_accounts_response.go | 11 +- .../datadogV2/model_get_finding_response.go | 24 +- .../model_get_team_memberships_sort.go | 47 +- .../datadogV2/model_group_scalar_column.go | 11 +- .../v2/api/datadogV2/model_hourly_usage.go | 37 +- .../model_hourly_usage_attributes.go | 12 +- .../model_hourly_usage_measurement.go | 11 +- .../datadogV2/model_hourly_usage_metadata.go | 23 +- .../model_hourly_usage_pagination.go | 11 +- .../datadogV2/model_hourly_usage_response.go | 23 +- .../api/datadogV2/model_hourly_usage_type.go | 47 +- .../v2/api/datadogV2/model_http_log_error.go | 11 +- .../v2/api/datadogV2/model_http_log_errors.go | 11 +- .../v2/api/datadogV2/model_http_log_item.go | 12 +- .../api/datadogV2/model_httpci_app_error.go | 11 +- .../api/datadogV2/model_httpci_app_errors.go | 11 +- .../model_id_p_metadata_form_data.go | 12 +- ...del_incident_attachment_attachment_type.go | 47 +- .../model_incident_attachment_attributes.go | 52 +- .../model_incident_attachment_data.go | 38 +- ...ncident_attachment_link_attachment_type.go | 47 +- ...del_incident_attachment_link_attributes.go | 38 +- ...hment_link_attributes_attachment_object.go | 12 +- ...t_attachment_postmortem_attachment_type.go | 47 +- ...cident_attachment_postmortem_attributes.go | 38 +- ...odel_incident_attachment_related_object.go | 47 +- ...model_incident_attachment_relationships.go | 23 +- .../model_incident_attachment_type.go | 47 +- ...l_incident_attachment_update_attributes.go | 52 +- .../model_incident_attachment_update_data.go | 32 +- ...odel_incident_attachment_update_request.go | 12 +- ...del_incident_attachment_update_response.go | 12 +- ...postmortem_attributes_attachment_object.go | 12 +- .../model_incident_attachments_response.go | 12 +- ...dent_attachments_response_included_item.go | 52 +- .../model_incident_create_attributes.go | 12 +- .../datadogV2/model_incident_create_data.go | 44 +- .../model_incident_create_relationships.go | 24 +- .../model_incident_create_request.go | 24 +- .../model_incident_field_attributes.go | 52 +- ...ncident_field_attributes_multiple_value.go | 29 +- ..._incident_field_attributes_single_value.go | 29 +- ...dent_field_attributes_single_value_type.go | 47 +- ...el_incident_field_attributes_value_type.go | 47 +- ...ncident_integration_metadata_attributes.go | 12 +- ...cident_integration_metadata_create_data.go | 38 +- ...ent_integration_metadata_create_request.go | 24 +- ...dent_integration_metadata_list_response.go | 24 +- ..._incident_integration_metadata_metadata.go | 52 +- ...ncident_integration_metadata_patch_data.go | 38 +- ...dent_integration_metadata_patch_request.go | 24 +- ..._incident_integration_metadata_response.go | 24 +- ...dent_integration_metadata_response_data.go | 38 +- ...gration_metadata_response_included_item.go | 52 +- ...odel_incident_integration_metadata_type.go | 47 +- .../model_incident_notification_handle.go | 11 +- .../model_incident_postmortem_type.go | 47 +- .../model_incident_related_object.go | 47 +- .../api/datadogV2/model_incident_response.go | 24 +- .../model_incident_response_attributes.go | 12 +- .../datadogV2/model_incident_response_data.go | 44 +- .../model_incident_response_included_item.go | 52 +- .../datadogV2/model_incident_response_meta.go | 23 +- ...model_incident_response_meta_pagination.go | 11 +- .../model_incident_response_relationships.go | 47 +- .../model_incident_search_response.go | 30 +- ...del_incident_search_response_attributes.go | 24 +- .../model_incident_search_response_data.go | 37 +- ...el_incident_search_response_facets_data.go | 11 +- ...cident_search_response_field_facet_data.go | 11 +- ...incident_search_response_incidents_data.go | 24 +- .../model_incident_search_response_meta.go | 23 +- ...dent_search_response_numeric_facet_data.go | 24 +- ..._response_numeric_facet_data_aggregates.go | 11 +- ...arch_response_property_field_facet_data.go | 24 +- ...ncident_search_response_user_facet_data.go | 11 +- .../model_incident_search_results_type.go | 47 +- .../model_incident_search_sort_order.go | 47 +- ...odel_incident_service_create_attributes.go | 12 +- .../model_incident_service_create_data.go | 44 +- .../model_incident_service_create_request.go | 24 +- .../model_incident_service_included_items.go | 52 +- .../model_incident_service_relationships.go | 29 +- .../model_incident_service_response.go | 24 +- ...el_incident_service_response_attributes.go | 12 +- .../model_incident_service_response_data.go | 44 +- .../datadogV2/model_incident_service_type.go | 47 +- ...odel_incident_service_update_attributes.go | 12 +- .../model_incident_service_update_data.go | 44 +- .../model_incident_service_update_request.go | 24 +- .../model_incident_services_response.go | 24 +- .../model_incident_team_create_attributes.go | 12 +- .../model_incident_team_create_data.go | 44 +- .../model_incident_team_create_request.go | 24 +- .../model_incident_team_included_items.go | 52 +- .../model_incident_team_relationships.go | 29 +- .../datadogV2/model_incident_team_response.go | 24 +- ...model_incident_team_response_attributes.go | 12 +- .../model_incident_team_response_data.go | 43 +- .../api/datadogV2/model_incident_team_type.go | 47 +- .../model_incident_team_update_attributes.go | 12 +- .../model_incident_team_update_data.go | 44 +- .../model_incident_team_update_request.go | 24 +- .../model_incident_teams_response.go | 24 +- ...ncident_timeline_cell_create_attributes.go | 52 +- ...ent_timeline_cell_markdown_content_type.go | 47 +- ...imeline_cell_markdown_create_attributes.go | 36 +- ...cell_markdown_create_attributes_content.go | 11 +- .../model_incident_todo_anonymous_assignee.go | 32 +- ...incident_todo_anonymous_assignee_source.go | 47 +- .../datadogV2/model_incident_todo_assignee.go | 52 +- .../model_incident_todo_attributes.go | 12 +- .../model_incident_todo_create_data.go | 38 +- .../model_incident_todo_create_request.go | 24 +- .../model_incident_todo_list_response.go | 24 +- .../model_incident_todo_patch_data.go | 38 +- .../model_incident_todo_patch_request.go | 24 +- .../datadogV2/model_incident_todo_response.go | 24 +- .../model_incident_todo_response_data.go | 38 +- ...el_incident_todo_response_included_item.go | 52 +- .../api/datadogV2/model_incident_todo_type.go | 47 +- .../v2/api/datadogV2/model_incident_type.go | 47 +- .../model_incident_update_attributes.go | 12 +- .../datadogV2/model_incident_update_data.go | 44 +- .../model_incident_update_relationships.go | 35 +- .../model_incident_update_request.go | 24 +- .../api/datadogV2/model_incidents_response.go | 24 +- .../model_intake_payload_accepted.go | 11 +- .../model_ip_allowlist_attributes.go | 11 +- .../api/datadogV2/model_ip_allowlist_data.go | 38 +- .../api/datadogV2/model_ip_allowlist_entry.go | 24 +- .../model_ip_allowlist_entry_attributes.go | 12 +- .../model_ip_allowlist_entry_data.go | 38 +- .../model_ip_allowlist_entry_type.go | 47 +- .../datadogV2/model_ip_allowlist_response.go | 23 +- .../api/datadogV2/model_ip_allowlist_type.go | 47 +- .../model_ip_allowlist_update_request.go | 24 +- .../model_jira_integration_metadata.go | 12 +- ...l_jira_integration_metadata_issues_item.go | 12 +- .../api/datadogV2/model_jsonapi_error_item.go | 11 +- .../datadogV2/model_jsonapi_error_response.go | 12 +- .../model_list_application_keys_response.go | 11 +- .../model_list_downtimes_response.go | 183 + .../api/datadogV2/model_list_findings_meta.go | 22 +- .../api/datadogV2/model_list_findings_page.go | 10 +- .../datadogV2/model_list_findings_response.go | 24 +- .../api/datadogV2/model_list_teams_include.go | 47 +- .../v2/api/datadogV2/model_list_teams_sort.go | 47 +- .../v2/api/datadogV2/model_log.go | 37 +- .../v2/api/datadogV2/model_log_attributes.go | 12 +- .../v2/api/datadogV2/model_log_type.go | 47 +- .../datadogV2/model_logs_aggregate_bucket.go | 11 +- .../model_logs_aggregate_bucket_value.go | 52 +- ..._logs_aggregate_bucket_value_timeseries.go | 16 +- ...aggregate_bucket_value_timeseries_point.go | 11 +- .../datadogV2/model_logs_aggregate_request.go | 37 +- .../model_logs_aggregate_request_page.go | 13 +- .../model_logs_aggregate_response.go | 29 +- .../model_logs_aggregate_response_data.go | 11 +- .../model_logs_aggregate_response_status.go | 47 +- .../datadogV2/model_logs_aggregate_sort.go | 59 +- .../model_logs_aggregate_sort_type.go | 47 +- .../model_logs_aggregation_function.go | 47 +- .../v2/api/datadogV2/model_logs_archive.go | 23 +- .../model_logs_archive_attributes.go | 32 +- .../model_logs_archive_create_request.go | 23 +- ..._logs_archive_create_request_attributes.go | 12 +- ..._logs_archive_create_request_definition.go | 24 +- ...logs_archive_create_request_destination.go | 52 +- .../model_logs_archive_definition.go | 24 +- .../model_logs_archive_destination.go | 2 +- .../model_logs_archive_destination_azure.go | 38 +- ...del_logs_archive_destination_azure_type.go | 47 +- .../model_logs_archive_destination_gcs.go | 38 +- ...model_logs_archive_destination_gcs_type.go | 47 +- .../model_logs_archive_destination_s3.go | 38 +- .../model_logs_archive_destination_s3_type.go | 47 +- .../model_logs_archive_integration_azure.go | 12 +- .../model_logs_archive_integration_gcs.go | 12 +- .../model_logs_archive_integration_s3.go | 12 +- .../api/datadogV2/model_logs_archive_order.go | 23 +- .../model_logs_archive_order_attributes.go | 12 +- .../model_logs_archive_order_definition.go | 38 +- ...odel_logs_archive_order_definition_type.go | 47 +- .../api/datadogV2/model_logs_archive_state.go | 47 +- .../v2/api/datadogV2/model_logs_archives.go | 11 +- .../v2/api/datadogV2/model_logs_compute.go | 46 +- .../api/datadogV2/model_logs_compute_type.go | 47 +- .../v2/api/datadogV2/model_logs_group_by.go | 35 +- .../model_logs_group_by_histogram.go | 14 +- .../datadogV2/model_logs_group_by_missing.go | 52 +- .../datadogV2/model_logs_group_by_total.go | 52 +- .../api/datadogV2/model_logs_list_request.go | 51 +- .../datadogV2/model_logs_list_request_page.go | 11 +- .../api/datadogV2/model_logs_list_response.go | 29 +- .../model_logs_list_response_links.go | 11 +- .../datadogV2/model_logs_metric_compute.go | 30 +- ...el_logs_metric_compute_aggregation_type.go | 47 +- .../model_logs_metric_create_attributes.go | 30 +- .../model_logs_metric_create_data.go | 38 +- .../model_logs_metric_create_request.go | 24 +- .../api/datadogV2/model_logs_metric_filter.go | 11 +- .../datadogV2/model_logs_metric_group_by.go | 12 +- .../datadogV2/model_logs_metric_response.go | 23 +- .../model_logs_metric_response_attributes.go | 29 +- .../model_logs_metric_response_compute.go | 29 +- ...etric_response_compute_aggregation_type.go | 47 +- .../model_logs_metric_response_data.go | 37 +- .../model_logs_metric_response_filter.go | 11 +- .../model_logs_metric_response_group_by.go | 11 +- .../api/datadogV2/model_logs_metric_type.go | 47 +- .../model_logs_metric_update_attributes.go | 29 +- .../model_logs_metric_update_compute.go | 11 +- .../model_logs_metric_update_data.go | 38 +- .../model_logs_metric_update_request.go | 24 +- .../datadogV2/model_logs_metrics_response.go | 11 +- .../api/datadogV2/model_logs_query_filter.go | 31 +- .../api/datadogV2/model_logs_query_options.go | 13 +- .../datadogV2/model_logs_response_metadata.go | 37 +- .../model_logs_response_metadata_page.go | 13 +- .../v2/api/datadogV2/model_logs_sort.go | 47 +- .../v2/api/datadogV2/model_logs_sort_order.go | 47 +- .../api/datadogV2/model_logs_storage_tier.go | 47 +- .../v2/api/datadogV2/model_logs_warning.go | 11 +- .../v2/api/datadogV2/model_metric.go | 31 +- .../model_metric_active_configuration_type.go | 47 +- .../v2/api/datadogV2/model_metric_all_tags.go | 37 +- .../model_metric_all_tags_attributes.go | 11 +- .../model_metric_all_tags_response.go | 23 +- .../model_metric_bulk_configure_tags_type.go | 47 +- .../model_metric_bulk_tag_config_create.go | 38 +- ...etric_bulk_tag_config_create_attributes.go | 11 +- ...l_metric_bulk_tag_config_create_request.go | 24 +- .../model_metric_bulk_tag_config_delete.go | 38 +- ...etric_bulk_tag_config_delete_attributes.go | 11 +- ...l_metric_bulk_tag_config_delete_request.go | 24 +- .../model_metric_bulk_tag_config_response.go | 23 +- .../model_metric_bulk_tag_config_status.go | 38 +- ...etric_bulk_tag_config_status_attributes.go | 11 +- .../model_metric_content_encoding.go | 47 +- .../model_metric_custom_aggregation.go | 42 +- .../model_metric_custom_space_aggregation.go | 47 +- .../model_metric_custom_time_aggregation.go | 47 +- .../datadogV2/model_metric_distinct_volume.go | 37 +- ...model_metric_distinct_volume_attributes.go | 11 +- .../model_metric_distinct_volume_type.go | 47 +- .../v2/api/datadogV2/model_metric_estimate.go | 37 +- .../model_metric_estimate_attributes.go | 30 +- .../model_metric_estimate_resource_type.go | 47 +- .../model_metric_estimate_response.go | 23 +- .../datadogV2/model_metric_estimate_type.go | 47 +- .../model_metric_ingested_indexed_volume.go | 37 +- ...tric_ingested_indexed_volume_attributes.go | 11 +- ...del_metric_ingested_indexed_volume_type.go | 47 +- .../api/datadogV2/model_metric_intake_type.go | 47 +- .../v2/api/datadogV2/model_metric_metadata.go | 23 +- .../v2/api/datadogV2/model_metric_origin.go | 11 +- .../v2/api/datadogV2/model_metric_payload.go | 12 +- .../v2/api/datadogV2/model_metric_point.go | 11 +- .../v2/api/datadogV2/model_metric_resource.go | 11 +- .../v2/api/datadogV2/model_metric_series.go | 38 +- ..._metric_suggested_tags_and_aggregations.go | 37 +- ...uggested_tags_and_aggregations_response.go | 23 +- .../model_metric_suggested_tags_attributes.go | 11 +- .../model_metric_tag_configuration.go | 37 +- ...del_metric_tag_configuration_attributes.go | 32 +- ...ric_tag_configuration_create_attributes.go | 32 +- ...el_metric_tag_configuration_create_data.go | 38 +- ...metric_tag_configuration_create_request.go | 24 +- ...l_metric_tag_configuration_metric_types.go | 47 +- ...model_metric_tag_configuration_response.go | 23 +- .../model_metric_tag_configuration_type.go | 47 +- ...ric_tag_configuration_update_attributes.go | 11 +- ...el_metric_tag_configuration_update_data.go | 38 +- ...metric_tag_configuration_update_request.go | 24 +- .../v2/api/datadogV2/model_metric_type.go | 47 +- .../v2/api/datadogV2/model_metric_volumes.go | 52 +- .../model_metric_volumes_response.go | 11 +- .../api/datadogV2/model_metrics_aggregator.go | 49 +- ...l_metrics_and_metric_tag_configurations.go | 52 +- ..._and_metric_tag_configurations_response.go | 11 +- .../datadogV2/model_metrics_data_source.go | 47 +- .../datadogV2/model_metrics_scalar_query.go | 48 +- .../model_metrics_timeseries_query.go | 30 +- ..._config_policy_attribute_create_request.go | 32 +- ...or_config_policy_attribute_edit_request.go | 32 +- ...onitor_config_policy_attribute_response.go | 31 +- ...model_monitor_config_policy_create_data.go | 38 +- ...el_monitor_config_policy_create_request.go | 24 +- .../model_monitor_config_policy_edit_data.go | 38 +- ...odel_monitor_config_policy_edit_request.go | 24 +- ...del_monitor_config_policy_list_response.go | 11 +- .../model_monitor_config_policy_policy.go | 52 +- ...tor_config_policy_policy_create_request.go | 52 +- ...del_monitor_config_policy_resource_type.go | 47 +- .../model_monitor_config_policy_response.go | 23 +- ...del_monitor_config_policy_response_data.go | 37 +- .../model_monitor_config_policy_tag_policy.go | 11 +- ...config_policy_tag_policy_create_request.go | 12 +- .../model_monitor_config_policy_type.go | 47 +- ...el_monitor_downtime_match_resource_type.go | 64 + .../model_monitor_downtime_match_response.go | 148 + ...itor_downtime_match_response_attributes.go | 226 + ...el_monitor_downtime_match_response_data.go | 202 + .../v2/api/datadogV2/model_monitor_type.go | 11 +- .../datadogV2/model_mute_finding_request.go | 24 +- .../model_mute_finding_request_attributes.go | 23 +- .../model_mute_finding_request_data.go | 38 +- .../model_mute_finding_request_properties.go | 31 +- .../datadogV2/model_mute_finding_response.go | 24 +- .../model_mute_finding_response_attributes.go | 57 +- .../model_mute_finding_response_data.go | 37 +- .../model_mute_finding_response_properties.go | 30 +- .../model_nullable_relationship_to_user.go | 12 +- ...odel_nullable_relationship_to_user_data.go | 32 +- .../model_on_demand_concurrency_cap.go | 64 +- ...el_on_demand_concurrency_cap_attributes.go | 11 +- ...odel_on_demand_concurrency_cap_response.go | 23 +- .../model_on_demand_concurrency_cap_type.go | 64 + ...odel_opsgenie_service_create_attributes.go | 32 +- .../model_opsgenie_service_create_data.go | 38 +- .../model_opsgenie_service_create_request.go | 24 +- .../model_opsgenie_service_region_type.go | 47 +- .../model_opsgenie_service_response.go | 24 +- ...el_opsgenie_service_response_attributes.go | 31 +- .../model_opsgenie_service_response_data.go | 38 +- .../datadogV2/model_opsgenie_service_type.go | 47 +- ...odel_opsgenie_service_update_attributes.go | 31 +- .../model_opsgenie_service_update_data.go | 38 +- .../model_opsgenie_service_update_request.go | 24 +- .../model_opsgenie_services_response.go | 12 +- .../v2/api/datadogV2/model_organization.go | 38 +- .../model_organization_attributes.go | 12 +- .../api/datadogV2/model_organizations_type.go | 47 +- .../v2/api/datadogV2/model_pagination.go | 11 +- .../v2/api/datadogV2/model_partial_api_key.go | 43 +- .../model_partial_api_key_attributes.go | 11 +- .../model_partial_application_key.go | 43 +- ...odel_partial_application_key_attributes.go | 13 +- .../model_partial_application_key_response.go | 23 +- .../v2/api/datadogV2/model_permission.go | 38 +- .../datadogV2/model_permission_attributes.go | 12 +- .../datadogV2/model_permissions_response.go | 11 +- .../api/datadogV2/model_permissions_type.go | 47 +- .../datadogV2/model_process_summaries_meta.go | 23 +- .../model_process_summaries_meta_page.go | 11 +- .../model_process_summaries_response.go | 23 +- .../v2/api/datadogV2/model_process_summary.go | 37 +- .../model_process_summary_attributes.go | 11 +- .../datadogV2/model_process_summary_type.go | 47 +- .../v2/api/datadogV2/model_query_formula.go | 25 +- .../api/datadogV2/model_query_sort_order.go | 47 +- ...del_relationship_to_incident_attachment.go | 12 +- ...elationship_to_incident_attachment_data.go | 32 +- ...p_to_incident_integration_metadata_data.go | 32 +- ...nship_to_incident_integration_metadatas.go | 12 +- ...del_relationship_to_incident_postmortem.go | 24 +- ...elationship_to_incident_postmortem_data.go | 32 +- .../model_relationship_to_organization.go | 24 +- ...model_relationship_to_organization_data.go | 32 +- .../model_relationship_to_organizations.go | 12 +- .../model_relationship_to_permission.go | 23 +- .../model_relationship_to_permission_data.go | 31 +- .../model_relationship_to_permissions.go | 11 +- .../datadogV2/model_relationship_to_role.go | 23 +- .../model_relationship_to_role_data.go | 31 +- .../datadogV2/model_relationship_to_roles.go | 11 +- ...elationship_to_saml_assertion_attribute.go | 24 +- ...onship_to_saml_assertion_attribute_data.go | 32 +- .../model_relationship_to_team_link_data.go | 32 +- .../model_relationship_to_team_links.go | 59 +- .../datadogV2/model_relationship_to_user.go | 24 +- .../model_relationship_to_user_data.go | 32 +- ...el_relationship_to_user_team_permission.go | 65 +- ...lationship_to_user_team_permission_data.go | 32 +- .../model_relationship_to_user_team_user.go | 24 +- ...del_relationship_to_user_team_user_data.go | 32 +- .../datadogV2/model_relationship_to_users.go | 12 +- .../model_response_meta_attributes.go | 23 +- .../api/datadogV2/model_restriction_policy.go | 38 +- .../model_restriction_policy_attributes.go | 12 +- .../model_restriction_policy_binding.go | 15 +- .../model_restriction_policy_response.go | 24 +- .../model_restriction_policy_type.go | 47 +- ...model_restriction_policy_update_request.go | 24 +- .../v2/api/datadogV2/model_role.go | 44 +- .../v2/api/datadogV2/model_role_attributes.go | 12 +- .../v2/api/datadogV2/model_role_clone.go | 38 +- .../datadogV2/model_role_clone_attributes.go | 12 +- .../api/datadogV2/model_role_clone_request.go | 24 +- .../datadogV2/model_role_create_attributes.go | 12 +- .../api/datadogV2/model_role_create_data.go | 44 +- .../datadogV2/model_role_create_request.go | 24 +- .../datadogV2/model_role_create_response.go | 23 +- .../model_role_create_response_data.go | 44 +- .../api/datadogV2/model_role_relationships.go | 29 +- .../v2/api/datadogV2/model_role_response.go | 23 +- .../model_role_response_relationships.go | 23 +- .../datadogV2/model_role_update_attributes.go | 12 +- .../api/datadogV2/model_role_update_data.go | 44 +- .../datadogV2/model_role_update_request.go | 24 +- .../datadogV2/model_role_update_response.go | 23 +- .../model_role_update_response_data.go | 44 +- .../v2/api/datadogV2/model_roles_response.go | 23 +- .../v2/api/datadogV2/model_roles_sort.go | 47 +- .../v2/api/datadogV2/model_roles_type.go | 47 +- .../model_rum_aggregate_bucket_value.go | 52 +- ...l_rum_aggregate_bucket_value_timeseries.go | 16 +- ...aggregate_bucket_value_timeseries_point.go | 12 +- .../datadogV2/model_rum_aggregate_request.go | 35 +- .../api/datadogV2/model_rum_aggregate_sort.go | 59 +- .../model_rum_aggregate_sort_type.go | 47 +- .../model_rum_aggregation_buckets_response.go | 11 +- .../model_rum_aggregation_function.go | 47 +- .../model_rum_analytics_aggregate_response.go | 35 +- .../v2/api/datadogV2/model_rum_application.go | 38 +- .../model_rum_application_attributes.go | 12 +- .../datadogV2/model_rum_application_create.go | 38 +- ...model_rum_application_create_attributes.go | 12 +- .../model_rum_application_create_request.go | 24 +- .../model_rum_application_create_type.go | 47 +- .../datadogV2/model_rum_application_list.go | 75 +- .../model_rum_application_list_attributes.go | 12 +- .../model_rum_application_list_type.go | 47 +- .../model_rum_application_response.go | 23 +- .../datadogV2/model_rum_application_type.go | 47 +- .../datadogV2/model_rum_application_update.go | 38 +- ...model_rum_application_update_attributes.go | 11 +- .../model_rum_application_update_request.go | 24 +- .../model_rum_application_update_type.go | 47 +- .../model_rum_applications_response.go | 11 +- .../datadogV2/model_rum_bucket_response.go | 11 +- .../v2/api/datadogV2/model_rum_compute.go | 46 +- .../api/datadogV2/model_rum_compute_type.go | 47 +- .../v2/api/datadogV2/model_rum_event.go | 37 +- .../datadogV2/model_rum_event_attributes.go | 12 +- .../v2/api/datadogV2/model_rum_event_type.go | 47 +- .../datadogV2/model_rum_events_response.go | 29 +- .../v2/api/datadogV2/model_rum_group_by.go | 30 +- .../datadogV2/model_rum_group_by_histogram.go | 12 +- .../datadogV2/model_rum_group_by_missing.go | 52 +- .../api/datadogV2/model_rum_group_by_total.go | 52 +- .../api/datadogV2/model_rum_query_filter.go | 11 +- .../api/datadogV2/model_rum_query_options.go | 11 +- .../datadogV2/model_rum_query_page_options.go | 11 +- .../api/datadogV2/model_rum_response_links.go | 11 +- .../datadogV2/model_rum_response_metadata.go | 37 +- .../api/datadogV2/model_rum_response_page.go | 11 +- .../datadogV2/model_rum_response_status.go | 47 +- .../model_rum_search_events_request.go | 49 +- .../v2/api/datadogV2/model_rum_sort.go | 47 +- .../v2/api/datadogV2/model_rum_sort_order.go | 47 +- .../v2/api/datadogV2/model_rum_warning.go | 11 +- .../model_saml_assertion_attribute.go | 38 +- ...del_saml_assertion_attribute_attributes.go | 11 +- .../model_saml_assertion_attributes_type.go | 47 +- .../v2/api/datadogV2/model_scalar_column.go | 52 +- .../model_scalar_formula_query_request.go | 24 +- .../model_scalar_formula_query_response.go | 23 +- .../datadogV2/model_scalar_formula_request.go | 38 +- ...model_scalar_formula_request_attributes.go | 12 +- .../model_scalar_formula_request_type.go | 47 +- ...odel_scalar_formula_response_atrributes.go | 11 +- .../model_scalar_formula_response_type.go | 47 +- .../v2/api/datadogV2/model_scalar_meta.go | 11 +- .../v2/api/datadogV2/model_scalar_query.go | 52 +- .../v2/api/datadogV2/model_scalar_response.go | 37 +- .../v2/api/datadogV2/model_security_filter.go | 37 +- .../model_security_filter_attributes.go | 31 +- ...model_security_filter_create_attributes.go | 32 +- .../model_security_filter_create_data.go | 38 +- .../model_security_filter_create_request.go | 24 +- .../model_security_filter_exclusion_filter.go | 12 +- ...curity_filter_exclusion_filter_response.go | 11 +- ...odel_security_filter_filtered_data_type.go | 47 +- .../datadogV2/model_security_filter_meta.go | 11 +- .../model_security_filter_response.go | 29 +- .../datadogV2/model_security_filter_type.go | 47 +- ...model_security_filter_update_attributes.go | 31 +- .../model_security_filter_update_data.go | 38 +- .../model_security_filter_update_request.go | 24 +- .../model_security_filters_response.go | 23 +- .../model_security_monitoring_filter.go | 29 +- ...model_security_monitoring_filter_action.go | 47 +- ...security_monitoring_list_rules_response.go | 23 +- .../model_security_monitoring_rule_case.go | 31 +- ...el_security_monitoring_rule_case_create.go | 32 +- ...security_monitoring_rule_create_payload.go | 52 +- ...curity_monitoring_rule_detection_method.go | 47 +- ...urity_monitoring_rule_evaluation_window.go | 47 +- ...onitoring_rule_hardcoded_evaluator_type.go | 47 +- ...nitoring_rule_impossible_travel_options.go | 11 +- ...del_security_monitoring_rule_keep_alive.go | 47 +- ...ity_monitoring_rule_max_signal_duration.go | 47 +- ...urity_monitoring_rule_new_value_options.go | 65 +- ...ing_rule_new_value_options_forget_after.go | 47 +- ...ule_new_value_options_learning_duration.go | 47 +- ..._rule_new_value_options_learning_method.go | 47 +- ...le_new_value_options_learning_threshold.go | 47 +- .../model_security_monitoring_rule_options.go | 105 +- .../model_security_monitoring_rule_query.go | 52 +- ...urity_monitoring_rule_query_aggregation.go | 47 +- ...model_security_monitoring_rule_response.go | 52 +- ...model_security_monitoring_rule_severity.go | 47 +- ...el_security_monitoring_rule_type_create.go | 47 +- ...odel_security_monitoring_rule_type_read.go | 47 +- ...security_monitoring_rule_update_payload.go | 29 +- .../model_security_monitoring_signal.go | 37 +- ...curity_monitoring_signal_archive_reason.go | 47 +- ...oring_signal_assignee_update_attributes.go | 24 +- ..._monitoring_signal_assignee_update_data.go | 24 +- ...nitoring_signal_assignee_update_request.go | 24 +- ...l_security_monitoring_signal_attributes.go | 12 +- ...ring_signal_incidents_update_attributes.go | 12 +- ...monitoring_signal_incidents_update_data.go | 24 +- ...itoring_signal_incidents_update_request.go | 24 +- ...security_monitoring_signal_list_request.go | 43 +- ...y_monitoring_signal_list_request_filter.go | 12 +- ...ity_monitoring_signal_list_request_page.go | 11 +- ...ecurity_monitoring_signal_metadata_type.go | 64 + ...del_security_monitoring_signal_response.go | 113 + ...y_monitoring_signal_rule_create_payload.go | 38 +- ...l_security_monitoring_signal_rule_query.go | 30 +- ...ecurity_monitoring_signal_rule_response.go | 37 +- ...y_monitoring_signal_rule_response_query.go | 103 +- ...el_security_monitoring_signal_rule_type.go | 47 +- .../model_security_monitoring_signal_state.go | 47 +- ...nitoring_signal_state_update_attributes.go | 46 +- ...ity_monitoring_signal_state_update_data.go | 104 +- ..._monitoring_signal_state_update_request.go | 24 +- ...ity_monitoring_signal_triage_attributes.go | 64 +- ...ty_monitoring_signal_triage_update_data.go | 103 +- ...onitoring_signal_triage_update_response.go | 24 +- .../model_security_monitoring_signal_type.go | 47 +- ...curity_monitoring_signals_list_response.go | 29 +- ..._monitoring_signals_list_response_links.go | 11 +- ...y_monitoring_signals_list_response_meta.go | 23 +- ...itoring_signals_list_response_meta_page.go | 11 +- .../model_security_monitoring_signals_sort.go | 47 +- ...monitoring_standard_rule_create_payload.go | 38 +- ...security_monitoring_standard_rule_query.go | 67 +- ...urity_monitoring_standard_rule_response.go | 43 +- .../model_security_monitoring_triage_user.go | 49 +- ...l_sensitive_data_scanner_config_request.go | 30 +- ...el_sensitive_data_scanner_configuration.go | 31 +- ...nsitive_data_scanner_configuration_data.go | 23 +- ...ata_scanner_configuration_relationships.go | 23 +- ...nsitive_data_scanner_configuration_type.go | 47 +- ...tive_data_scanner_create_group_response.go | 29 +- ...itive_data_scanner_create_rule_response.go | 29 +- .../model_sensitive_data_scanner_filter.go | 11 +- ...e_data_scanner_get_config_included_item.go | 52 +- ...sitive_data_scanner_get_config_response.go | 29 +- ...e_data_scanner_get_config_response_data.go | 74 +- .../model_sensitive_data_scanner_group.go | 31 +- ...sensitive_data_scanner_group_attributes.go | 23 +- ...del_sensitive_data_scanner_group_create.go | 44 +- ...itive_data_scanner_group_create_request.go | 29 +- ...model_sensitive_data_scanner_group_data.go | 23 +- ...itive_data_scanner_group_delete_request.go | 24 +- ...tive_data_scanner_group_delete_response.go | 23 +- ...sitive_data_scanner_group_included_item.go | 43 +- ...model_sensitive_data_scanner_group_item.go | 31 +- ...model_sensitive_data_scanner_group_list.go | 11 +- ...sitive_data_scanner_group_relationships.go | 29 +- ...l_sensitive_data_scanner_group_response.go | 43 +- ...model_sensitive_data_scanner_group_type.go | 47 +- ...del_sensitive_data_scanner_group_update.go | 43 +- ...itive_data_scanner_group_update_request.go | 30 +- ...tive_data_scanner_group_update_response.go | 23 +- .../model_sensitive_data_scanner_meta.go | 48 +- ...ensitive_data_scanner_meta_version_only.go | 11 +- .../model_sensitive_data_scanner_product.go | 47 +- ...l_sensitive_data_scanner_reorder_config.go | 37 +- ...ve_data_scanner_reorder_groups_response.go | 23 +- .../model_sensitive_data_scanner_rule.go | 31 +- ..._sensitive_data_scanner_rule_attributes.go | 23 +- ...odel_sensitive_data_scanner_rule_create.go | 44 +- ...sitive_data_scanner_rule_create_request.go | 30 +- .../model_sensitive_data_scanner_rule_data.go | 11 +- ...sitive_data_scanner_rule_delete_request.go | 24 +- ...itive_data_scanner_rule_delete_response.go | 23 +- ...nsitive_data_scanner_rule_included_item.go | 43 +- ...nsitive_data_scanner_rule_relationships.go | 29 +- ...el_sensitive_data_scanner_rule_response.go | 43 +- .../model_sensitive_data_scanner_rule_type.go | 47 +- ...odel_sensitive_data_scanner_rule_update.go | 43 +- ...sitive_data_scanner_rule_update_request.go | 30 +- ...itive_data_scanner_rule_update_response.go | 23 +- ...sensitive_data_scanner_standard_pattern.go | 31 +- ...ata_scanner_standard_pattern_attributes.go | 54 +- ...tive_data_scanner_standard_pattern_data.go | 23 +- ...tive_data_scanner_standard_pattern_type.go | 47 +- ...scanner_standard_patterns_response_data.go | 11 +- ...scanner_standard_patterns_response_item.go | 37 +- ...sensitive_data_scanner_text_replacement.go | 31 +- ...tive_data_scanner_text_replacement_type.go | 47 +- ...model_service_account_create_attributes.go | 12 +- .../model_service_account_create_data.go | 44 +- .../model_service_account_create_request.go | 24 +- ...odel_service_definition_create_response.go | 11 +- .../model_service_definition_data.go | 60 +- ...odel_service_definition_data_attributes.go | 23 +- .../model_service_definition_get_response.go | 23 +- .../model_service_definition_meta.go | 126 +- .../model_service_definition_meta_warnings.go | 174 + .../model_service_definition_schema.go | 52 +- ...odel_service_definition_schema_versions.go | 47 +- .../datadogV2/model_service_definition_v1.go | 56 +- .../model_service_definition_v1_contact.go | 11 +- .../model_service_definition_v1_info.go | 12 +- ...odel_service_definition_v1_integrations.go | 11 +- .../model_service_definition_v1_org.go | 11 +- .../model_service_definition_v1_resource.go | 32 +- ...del_service_definition_v1_resource_type.go | 47 +- .../model_service_definition_v1_version.go | 47 +- .../datadogV2/model_service_definition_v2.go | 38 +- .../model_service_definition_v2_contact.go | 52 +- .../model_service_definition_v2_doc.go | 12 +- .../model_service_definition_v2_dot1.go | 38 +- ...odel_service_definition_v2_dot1_contact.go | 52 +- .../model_service_definition_v2_dot1_email.go | 32 +- ...l_service_definition_v2_dot1_email_type.go | 47 +- ...service_definition_v2_dot1_integrations.go | 29 +- .../model_service_definition_v2_dot1_link.go | 32 +- ...el_service_definition_v2_dot1_link_type.go | 47 +- ...del_service_definition_v2_dot1_ms_teams.go | 32 +- ...ervice_definition_v2_dot1_ms_teams_type.go | 47 +- ...del_service_definition_v2_dot1_opsgenie.go | 30 +- ...vice_definition_v2_dot1_opsgenie_region.go | 47 +- ...el_service_definition_v2_dot1_pagerduty.go | 11 +- .../model_service_definition_v2_dot1_slack.go | 32 +- ...l_service_definition_v2_dot1_slack_type.go | 47 +- ...odel_service_definition_v2_dot1_version.go | 47 +- .../model_service_definition_v2_email.go | 32 +- .../model_service_definition_v2_email_type.go | 47 +- ...odel_service_definition_v2_integrations.go | 23 +- .../model_service_definition_v2_link.go | 32 +- .../model_service_definition_v2_link_type.go | 47 +- .../model_service_definition_v2_ms_teams.go | 32 +- ...del_service_definition_v2_ms_teams_type.go | 47 +- .../model_service_definition_v2_opsgenie.go | 30 +- ...l_service_definition_v2_opsgenie_region.go | 47 +- .../model_service_definition_v2_repo.go | 12 +- .../model_service_definition_v2_slack.go | 32 +- .../model_service_definition_v2_slack_type.go | 47 +- .../model_service_definition_v2_version.go | 47 +- ...odel_service_definitions_create_request.go | 52 +- ...model_service_definitions_list_response.go | 11 +- .../model_slack_integration_metadata.go | 12 +- ...slack_integration_metadata_channel_item.go | 12 +- .../v2/api/datadogV2/model_span.go | 191 + .../datadogV2/model_spans_aggregate_bucket.go | 187 + ...model_spans_aggregate_bucket_attributes.go | 174 + .../model_spans_aggregate_bucket_type.go | 64 + .../model_spans_aggregate_bucket_value.go | 137 + ...spans_aggregate_bucket_value_timeseries.go | 63 + ...aggregate_bucket_value_timeseries_point.go | 139 + .../datadogV2/model_spans_aggregate_data.go | 156 + .../model_spans_aggregate_request.go | 113 + ...odel_spans_aggregate_request_attributes.go | 222 + .../model_spans_aggregate_request_type.go | 64 + .../model_spans_aggregate_response.go | 148 + ...model_spans_aggregate_response_metadata.go | 220 + .../model_spans_aggregate_response_status.go | 66 + .../datadogV2/model_spans_aggregate_sort.go | 231 + .../model_spans_aggregate_sort_type.go | 66 + .../model_spans_aggregation_function.go | 86 + .../api/datadogV2/model_spans_attributes.go | 676 ++ .../v2/api/datadogV2/model_spans_compute.go | 227 + .../api/datadogV2/model_spans_compute_type.go | 66 + .../v2/api/datadogV2/model_spans_group_by.go | 295 + .../model_spans_group_by_histogram.go | 170 + .../datadogV2/model_spans_group_by_missing.go | 105 + .../datadogV2/model_spans_group_by_total.go | 137 + .../api/datadogV2/model_spans_list_request.go | 113 + .../model_spans_list_request_attributes.go | 229 + .../model_spans_list_request_data.go | 156 + .../model_spans_list_request_page.go | 143 + .../model_spans_list_request_type.go | 64 + .../datadogV2/model_spans_list_response.go | 186 + .../model_spans_list_response_links.go | 105 + .../model_spans_list_response_metadata.go | 258 + .../datadogV2/model_spans_metric_compute.go | 30 +- ...l_spans_metric_compute_aggregation_type.go | 47 +- .../model_spans_metric_create_attributes.go | 30 +- .../model_spans_metric_create_data.go | 38 +- .../model_spans_metric_create_request.go | 24 +- .../datadogV2/model_spans_metric_filter.go | 11 +- .../datadogV2/model_spans_metric_group_by.go | 12 +- .../datadogV2/model_spans_metric_response.go | 23 +- .../model_spans_metric_response_attributes.go | 29 +- .../model_spans_metric_response_compute.go | 29 +- .../model_spans_metric_response_data.go | 37 +- .../model_spans_metric_response_filter.go | 11 +- .../model_spans_metric_response_group_by.go | 11 +- .../api/datadogV2/model_spans_metric_type.go | 47 +- .../model_spans_metric_update_attributes.go | 29 +- .../model_spans_metric_update_compute.go | 11 +- .../model_spans_metric_update_data.go | 38 +- .../model_spans_metric_update_request.go | 24 +- .../datadogV2/model_spans_metrics_response.go | 11 +- .../api/datadogV2/model_spans_query_filter.go | 186 + .../datadogV2/model_spans_query_options.go | 144 + .../model_spans_response_metadata_page.go | 105 + .../v2/api/datadogV2/model_spans_sort.go | 66 + .../api/datadogV2/model_spans_sort_order.go | 66 + .../v2/api/datadogV2/model_spans_type.go | 64 + .../v2/api/datadogV2/model_spans_warning.go | 174 + .../v2/api/datadogV2/model_team.go | 44 +- .../v2/api/datadogV2/model_team_attributes.go | 192 +- .../v2/api/datadogV2/model_team_create.go | 44 +- .../datadogV2/model_team_create_attributes.go | 182 +- .../model_team_create_relationships.go | 23 +- .../datadogV2/model_team_create_request.go | 24 +- .../v2/api/datadogV2/model_team_included.go | 52 +- .../v2/api/datadogV2/model_team_link.go | 38 +- .../datadogV2/model_team_link_attributes.go | 12 +- .../api/datadogV2/model_team_link_create.go | 38 +- .../model_team_link_create_request.go | 24 +- .../api/datadogV2/model_team_link_response.go | 23 +- .../v2/api/datadogV2/model_team_link_type.go | 47 +- .../datadogV2/model_team_links_response.go | 11 +- .../model_team_permission_setting.go | 38 +- ...odel_team_permission_setting_attributes.go | 43 +- .../model_team_permission_setting_response.go | 23 +- ...am_permission_setting_serializer_action.go | 47 +- .../model_team_permission_setting_type.go | 47 +- .../model_team_permission_setting_update.go | 38 +- ...am_permission_setting_update_attributes.go | 29 +- ..._team_permission_setting_update_request.go | 24 +- .../model_team_permission_setting_value.go | 47 +- ...model_team_permission_settings_response.go | 11 +- .../api/datadogV2/model_team_relationships.go | 29 +- .../model_team_relationships_links.go | 104 + .../v2/api/datadogV2/model_team_response.go | 37 +- .../v2/api/datadogV2/model_team_type.go | 47 +- .../v2/api/datadogV2/model_team_update.go | 44 +- .../datadogV2/model_team_update_attributes.go | 184 +- .../model_team_update_relationships.go | 23 +- .../datadogV2/model_team_update_request.go | 24 +- .../v2/api/datadogV2/model_teams_response.go | 99 +- .../datadogV2/model_teams_response_links.go | 266 + .../datadogV2/model_teams_response_meta.go | 113 + .../model_teams_response_meta_pagination.go | 349 + .../model_timeseries_formula_query_request.go | 24 +- ...model_timeseries_formula_query_response.go | 23 +- .../model_timeseries_formula_request.go | 38 +- ...l_timeseries_formula_request_attributes.go | 12 +- .../model_timeseries_formula_request_type.go | 47 +- .../model_timeseries_formula_response_type.go | 47 +- .../api/datadogV2/model_timeseries_query.go | 52 +- .../datadogV2/model_timeseries_response.go | 37 +- .../model_timeseries_response_attributes.go | 11 +- .../model_timeseries_response_series.go | 11 +- .../v2/api/datadogV2/model_unit.go | 11 +- ...pplication_security_monitoring_response.go | 11 +- .../model_usage_attributes_object.go | 68 +- .../api/datadogV2/model_usage_data_object.go | 37 +- ...sage_lambda_traced_invocations_response.go | 11 +- ..._usage_observability_pipelines_response.go | 11 +- .../model_usage_time_series_object.go | 12 +- .../datadogV2/model_usage_time_series_type.go | 47 +- .../v2/api/datadogV2/model_user.go | 43 +- .../v2/api/datadogV2/model_user_attributes.go | 12 +- .../datadogV2/model_user_create_attributes.go | 12 +- .../api/datadogV2/model_user_create_data.go | 44 +- .../datadogV2/model_user_create_request.go | 24 +- .../datadogV2/model_user_invitation_data.go | 38 +- .../model_user_invitation_data_attributes.go | 12 +- .../model_user_invitation_relationships.go | 24 +- .../model_user_invitation_response.go | 23 +- .../model_user_invitation_response_data.go | 83 +- .../model_user_invitations_request.go | 12 +- .../model_user_invitations_response.go | 11 +- .../datadogV2/model_user_invitations_type.go | 47 +- .../api/datadogV2/model_user_relationships.go | 23 +- .../v2/api/datadogV2/model_user_response.go | 23 +- .../model_user_response_included_item.go | 52 +- .../model_user_response_relationships.go | 41 +- .../v2/api/datadogV2/model_user_team.go | 44 +- .../datadogV2/model_user_team_attributes.go | 29 +- .../api/datadogV2/model_user_team_create.go | 44 +- .../datadogV2/model_user_team_permission.go | 38 +- .../model_user_team_permission_attributes.go | 11 +- .../model_user_team_permission_type.go | 47 +- .../model_user_team_relationships.go | 23 +- .../api/datadogV2/model_user_team_request.go | 24 +- .../api/datadogV2/model_user_team_response.go | 23 +- .../v2/api/datadogV2/model_user_team_role.go | 3 +- .../v2/api/datadogV2/model_user_team_type.go | 47 +- .../api/datadogV2/model_user_team_update.go | 38 +- .../model_user_team_update_request.go | 24 +- .../datadogV2/model_user_team_user_type.go | 47 +- .../datadogV2/model_user_teams_response.go | 97 +- .../datadogV2/model_user_update_attributes.go | 11 +- .../api/datadogV2/model_user_update_data.go | 38 +- .../datadogV2/model_user_update_request.go | 24 +- .../v2/api/datadogV2/model_users_response.go | 23 +- .../v2/api/datadogV2/model_users_type.go | 47 +- .../DataDog/datadog-api-client-go/v2/doc.go | 2 +- .../datadog-api-client-go/v2/run-tests.sh | 2 +- .../datadog-api-client-go/v2/version.go | 2 +- .../IBM/sarama/.pre-commit-config.yaml | 33 + vendor/github.com/IBM/sarama/CHANGELOG.md | 33 + vendor/github.com/IBM/sarama/CONTRIBUTING.md | 37 +- vendor/github.com/IBM/sarama/Dockerfile.kafka | 24 +- vendor/github.com/IBM/sarama/README.md | 2 +- .../IBM/sarama/acl_create_request.go | 4 + .../IBM/sarama/acl_create_response.go | 18 +- .../IBM/sarama/acl_delete_request.go | 4 + .../IBM/sarama/acl_delete_response.go | 15 +- .../IBM/sarama/acl_describe_request.go | 4 + .../IBM/sarama/acl_describe_response.go | 8 + .../IBM/sarama/add_offsets_to_txn_request.go | 18 +- .../IBM/sarama/add_offsets_to_txn_response.go | 22 +- .../sarama/add_partitions_to_txn_request.go | 16 +- .../sarama/add_partitions_to_txn_response.go | 21 +- vendor/github.com/IBM/sarama/admin.go | 92 +- .../IBM/sarama/alter_client_quotas_request.go | 7 +- .../sarama/alter_client_quotas_response.go | 11 +- .../IBM/sarama/alter_configs_request.go | 16 +- .../IBM/sarama/alter_configs_response.go | 22 +- .../alter_partition_reassignments_request.go | 4 + .../alter_partition_reassignments_response.go | 10 + .../alter_user_scram_credentials_request.go | 4 + .../alter_user_scram_credentials_response.go | 8 + .../IBM/sarama/api_versions_request.go | 14 +- .../IBM/sarama/api_versions_response.go | 20 +- vendor/github.com/IBM/sarama/broker.go | 109 +- vendor/github.com/IBM/sarama/client.go | 100 +- vendor/github.com/IBM/sarama/compress.go | 2 +- vendor/github.com/IBM/sarama/config.go | 16 +- vendor/github.com/IBM/sarama/consumer.go | 28 +- .../github.com/IBM/sarama/consumer_group.go | 174 +- .../IBM/sarama/consumer_metadata_request.go | 17 +- .../IBM/sarama/consumer_metadata_response.go | 18 +- .../IBM/sarama/create_partitions_request.go | 16 +- .../IBM/sarama/create_partitions_response.go | 20 +- .../IBM/sarama/create_topics_request.go | 14 +- .../IBM/sarama/create_topics_response.go | 18 +- vendor/github.com/IBM/sarama/decompress.go | 2 +- .../IBM/sarama/delete_groups_request.go | 18 +- .../IBM/sarama/delete_groups_response.go | 20 +- .../IBM/sarama/delete_offsets_request.go | 7 +- .../IBM/sarama/delete_offsets_response.go | 11 +- .../IBM/sarama/delete_records_request.go | 14 +- .../IBM/sarama/delete_records_response.go | 17 +- .../IBM/sarama/delete_topics_request.go | 12 +- .../IBM/sarama/delete_topics_response.go | 16 +- .../sarama/describe_client_quotas_request.go | 7 +- .../sarama/describe_client_quotas_response.go | 11 +- .../IBM/sarama/describe_configs_request.go | 12 +- .../IBM/sarama/describe_configs_response.go | 16 +- .../IBM/sarama/describe_groups_request.go | 19 +- .../IBM/sarama/describe_groups_response.go | 25 +- .../IBM/sarama/describe_log_dirs_request.go | 7 + .../IBM/sarama/describe_log_dirs_response.go | 11 + ...describe_user_scram_credentials_request.go | 4 + ...escribe_user_scram_credentials_response.go | 8 + .../github.com/IBM/sarama/docker-compose.yml | 148 +- .../github.com/IBM/sarama/end_txn_request.go | 16 +- .../github.com/IBM/sarama/end_txn_response.go | 20 +- vendor/github.com/IBM/sarama/entrypoint.sh | 6 +- vendor/github.com/IBM/sarama/fetch_request.go | 42 +- .../github.com/IBM/sarama/fetch_response.go | 46 +- .../IBM/sarama/find_coordinator_request.go | 6 + .../IBM/sarama/find_coordinator_response.go | 10 + .../IBM/sarama/heartbeat_request.go | 17 +- .../IBM/sarama/heartbeat_response.go | 21 +- .../incremental_alter_configs_request.go | 7 +- .../incremental_alter_configs_response.go | 11 +- .../IBM/sarama/init_producer_id_request.go | 20 +- .../IBM/sarama/init_producer_id_response.go | 18 +- .../IBM/sarama/join_group_request.go | 16 +- .../IBM/sarama/join_group_response.go | 20 +- .../IBM/sarama/leave_group_request.go | 17 +- .../IBM/sarama/leave_group_response.go | 23 +- .../IBM/sarama/list_groups_request.go | 61 +- .../IBM/sarama/list_groups_response.go | 144 +- .../list_partition_reassignments_request.go | 4 + .../list_partition_reassignments_response.go | 10 + .../github.com/IBM/sarama/metadata_request.go | 194 +- .../IBM/sarama/metadata_response.go | 287 +- vendor/github.com/IBM/sarama/mockbroker.go | 36 +- vendor/github.com/IBM/sarama/mockresponses.go | 107 +- .../IBM/sarama/offset_commit_request.go | 26 +- .../IBM/sarama/offset_commit_response.go | 30 +- .../IBM/sarama/offset_fetch_request.go | 32 +- .../IBM/sarama/offset_fetch_response.go | 38 +- .../github.com/IBM/sarama/offset_manager.go | 69 +- .../github.com/IBM/sarama/offset_request.go | 36 +- .../github.com/IBM/sarama/offset_response.go | 72 +- vendor/github.com/IBM/sarama/partitioner.go | 31 + .../github.com/IBM/sarama/produce_request.go | 30 +- .../github.com/IBM/sarama/produce_response.go | 27 +- vendor/github.com/IBM/sarama/produce_set.go | 9 +- vendor/github.com/IBM/sarama/request.go | 96 +- .../IBM/sarama/sasl_authenticate_request.go | 4 + .../IBM/sarama/sasl_authenticate_response.go | 4 + .../IBM/sarama/sasl_handshake_request.go | 11 +- .../IBM/sarama/sasl_handshake_response.go | 14 +- .../IBM/sarama/sync_group_request.go | 17 +- .../IBM/sarama/sync_group_response.go | 23 +- .../IBM/sarama/transaction_manager.go | 68 +- .../IBM/sarama/txn_offset_commit_request.go | 44 +- .../IBM/sarama/txn_offset_commit_response.go | 23 +- vendor/github.com/IBM/sarama/utils.go | 14 +- vendor/github.com/antonmedv/expr/README.md | 87 +- vendor/github.com/antonmedv/expr/ast/dump.go | 59 + vendor/github.com/antonmedv/expr/ast/node.go | 1 + vendor/github.com/antonmedv/expr/ast/print.go | 194 +- .../antonmedv/expr/builtin/builtin.go | 505 +- .../github.com/antonmedv/expr/builtin/func.go | 237 + .../antonmedv/expr/builtin/utils.go | 35 + .../antonmedv/expr/checker/checker.go | 366 +- .../antonmedv/expr/checker/types.go | 12 +- .../antonmedv/expr/compiler/compiler.go | 75 +- .../github.com/antonmedv/expr/conf/config.go | 26 +- .../antonmedv/expr/conf/types_table.go | 11 +- vendor/github.com/antonmedv/expr/expr.go | 43 +- .../antonmedv/expr/parser/lexer/state.go | 19 +- .../antonmedv/expr/parser/lexer/utils.go | 21 +- .../expr/parser/operator/operator.go | 52 + .../antonmedv/expr/parser/parser.go | 220 +- .../antonmedv/expr/parser/utils/utils.go | 34 + .../github.com/antonmedv/expr/vm/opcodes.go | 2 +- .../github.com/antonmedv/expr/vm/program.go | 33 +- .../antonmedv/expr/vm/runtime/generated.go | 2 + .../antonmedv/expr/vm/runtime/runtime.go | 101 +- vendor/github.com/antonmedv/expr/vm/vm.go | 28 +- .../github.com/aws/aws-sdk-go-v2/CHANGELOG.md | 136 + vendor/github.com/aws/aws-sdk-go-v2/Makefile | 5 +- .../aws-sdk-go-v2/aws/go_module_metadata.go | 2 +- .../aws/protocol/query/object.go | 13 + .../aws-sdk-go-v2/aws/protocol/query/value.go | 9 + .../aws/signer/internal/v4/headers.go | 1 + .../aws/aws-sdk-go-v2/ci-find-smithy-go.sh | 10 +- .../aws/aws-sdk-go-v2/config/CHANGELOG.md | 16 + .../aws/aws-sdk-go-v2/config/env_config.go | 4 +- .../config/go_module_metadata.go | 2 +- .../aws/aws-sdk-go-v2/config/load_options.go | 24 + .../aws-sdk-go-v2/credentials/CHANGELOG.md | 12 + .../credentials/go_module_metadata.go | 2 +- .../feature/ec2/imds/CHANGELOG.md | 12 + .../feature/ec2/imds/go_module_metadata.go | 2 +- .../internal/configsources/CHANGELOG.md | 12 + .../configsources/go_module_metadata.go | 2 +- .../internal/endpoints/v2/CHANGELOG.md | 12 + .../endpoints/v2/go_module_metadata.go | 2 +- .../aws-sdk-go-v2/internal/ini/CHANGELOG.md | 12 + .../internal/ini/go_module_metadata.go | 2 +- .../github.com/aws/aws-sdk-go-v2/modman.toml | 2 +- .../internal/presigned-url/CHANGELOG.md | 12 + .../presigned-url/go_module_metadata.go | 2 +- .../aws-sdk-go-v2/service/sso/CHANGELOG.md | 12 + .../service/sso/go_module_metadata.go | 2 +- .../service/ssooidc/CHANGELOG.md | 12 + .../service/ssooidc/go_module_metadata.go | 2 +- .../aws-sdk-go-v2/service/sts/CHANGELOG.md | 12 + .../service/sts/go_module_metadata.go | 2 +- .../credentials/ssocreds/token_provider.go | 9 + .../aws/aws-sdk-go/aws/endpoints/defaults.go | 193 +- .../aws/aws-sdk-go/aws/signer/v4/v4.go | 1 + .../github.com/aws/aws-sdk-go/aws/version.go | 2 +- .../aws/aws-sdk-go/service/ec2/api.go | 334 +- vendor/github.com/aws/smithy-go/CHANGELOG.md | 4 + .../aws/smithy-go/go_module_metadata.go | 2 +- .../eapache/go-resiliency/breaker/README.md | 2 +- .../eapache/go-xerial-snappy/snappy.go | 14 +- vendor/github.com/goccy/go-json/.codecov.yml | 32 + vendor/github.com/goccy/go-json/.gitignore | 2 + vendor/github.com/goccy/go-json/.golangci.yml | 83 + vendor/github.com/goccy/go-json/CHANGELOG.md | 425 ++ vendor/github.com/goccy/go-json/LICENSE | 21 + vendor/github.com/goccy/go-json/Makefile | 39 + vendor/github.com/goccy/go-json/README.md | 529 ++ vendor/github.com/goccy/go-json/color.go | 68 + vendor/github.com/goccy/go-json/decode.go | 263 + .../goccy/go-json/docker-compose.yml | 13 + vendor/github.com/goccy/go-json/encode.go | 326 + vendor/github.com/goccy/go-json/error.go | 41 + .../internal/decoder/anonymous_field.go | 41 + .../goccy/go-json/internal/decoder/array.go | 176 + .../goccy/go-json/internal/decoder/assign.go | 438 ++ .../goccy/go-json/internal/decoder/bool.go | 83 + .../goccy/go-json/internal/decoder/bytes.go | 118 + .../goccy/go-json/internal/decoder/compile.go | 487 ++ .../internal/decoder/compile_norace.go | 29 + .../go-json/internal/decoder/compile_race.go | 37 + .../goccy/go-json/internal/decoder/context.go | 254 + .../goccy/go-json/internal/decoder/float.go | 170 + .../goccy/go-json/internal/decoder/func.go | 146 + .../goccy/go-json/internal/decoder/int.go | 246 + .../go-json/internal/decoder/interface.go | 528 ++ .../goccy/go-json/internal/decoder/invalid.go | 55 + .../goccy/go-json/internal/decoder/map.go | 280 + .../goccy/go-json/internal/decoder/number.go | 123 + .../goccy/go-json/internal/decoder/option.go | 17 + .../goccy/go-json/internal/decoder/path.go | 670 ++ .../goccy/go-json/internal/decoder/ptr.go | 96 + .../goccy/go-json/internal/decoder/slice.go | 380 ++ .../goccy/go-json/internal/decoder/stream.go | 556 ++ .../goccy/go-json/internal/decoder/string.go | 452 ++ .../goccy/go-json/internal/decoder/struct.go | 845 +++ .../goccy/go-json/internal/decoder/type.go | 30 + .../goccy/go-json/internal/decoder/uint.go | 194 + .../internal/decoder/unmarshal_json.go | 104 + .../internal/decoder/unmarshal_text.go | 285 + .../internal/decoder/wrapped_string.go | 73 + .../goccy/go-json/internal/encoder/code.go | 1023 +++ .../goccy/go-json/internal/encoder/compact.go | 286 + .../go-json/internal/encoder/compiler.go | 935 +++ .../internal/encoder/compiler_norace.go | 32 + .../go-json/internal/encoder/compiler_race.go | 45 + .../goccy/go-json/internal/encoder/context.go | 105 + .../go-json/internal/encoder/decode_rune.go | 126 + .../goccy/go-json/internal/encoder/encoder.go | 596 ++ .../goccy/go-json/internal/encoder/indent.go | 211 + .../goccy/go-json/internal/encoder/int.go | 152 + .../goccy/go-json/internal/encoder/map112.go | 9 + .../goccy/go-json/internal/encoder/map113.go | 9 + .../goccy/go-json/internal/encoder/opcode.go | 752 +++ .../goccy/go-json/internal/encoder/option.go | 48 + .../goccy/go-json/internal/encoder/optype.go | 932 +++ .../goccy/go-json/internal/encoder/query.go | 135 + .../goccy/go-json/internal/encoder/string.go | 459 ++ .../go-json/internal/encoder/string_table.go | 415 ++ .../go-json/internal/encoder/vm/debug_vm.go | 41 + .../goccy/go-json/internal/encoder/vm/hack.go | 9 + .../goccy/go-json/internal/encoder/vm/util.go | 207 + .../goccy/go-json/internal/encoder/vm/vm.go | 4859 ++++++++++++++ .../internal/encoder/vm_color/debug_vm.go | 35 + .../go-json/internal/encoder/vm_color/hack.go | 9 + .../go-json/internal/encoder/vm_color/util.go | 274 + .../go-json/internal/encoder/vm_color/vm.go | 4859 ++++++++++++++ .../encoder/vm_color_indent/debug_vm.go | 35 + .../internal/encoder/vm_color_indent/util.go | 297 + .../internal/encoder/vm_color_indent/vm.go | 4859 ++++++++++++++ .../internal/encoder/vm_indent/debug_vm.go | 35 + .../internal/encoder/vm_indent/hack.go | 9 + .../internal/encoder/vm_indent/util.go | 230 + .../go-json/internal/encoder/vm_indent/vm.go | 4859 ++++++++++++++ .../goccy/go-json/internal/errors/error.go | 183 + .../goccy/go-json/internal/runtime/rtype.go | 263 + .../go-json/internal/runtime/struct_field.go | 91 + .../goccy/go-json/internal/runtime/type.go | 100 + vendor/github.com/goccy/go-json/json.go | 371 ++ vendor/github.com/goccy/go-json/option.go | 79 + vendor/github.com/goccy/go-json/path.go | 84 + vendor/github.com/goccy/go-json/query.go | 47 + .../{gnostic => gnostic-models}/LICENSE | 0 .../compiler/README.md | 0 .../compiler/context.go | 0 .../compiler/error.go | 0 .../compiler/extensions.go | 2 +- .../compiler/helpers.go | 2 +- .../compiler/main.go | 0 .../compiler/reader.go | 0 .../extensions/README.md | 0 .../extensions/extension.pb.go | 4 +- .../extensions/extension.proto | 0 .../extensions/extensions.go | 0 .../jsonschema/README.md | 0 .../jsonschema/base.go | 15 +- .../jsonschema/display.go | 17 +- .../jsonschema/models.go | 8 +- .../jsonschema/operations.go | 0 .../jsonschema/reader.go | 1 + .../jsonschema/schema.json | 0 .../jsonschema/writer.go | 30 +- .../openapiv2/OpenAPIv2.go | 9 +- .../openapiv2/OpenAPIv2.pb.go | 4 +- .../openapiv2/OpenAPIv2.proto | 0 .../openapiv2/README.md | 0 .../openapiv2/document.go | 2 +- .../openapiv2/openapi-2.0.json | 0 .../openapiv3/OpenAPIv3.go | 9 +- .../openapiv3/OpenAPIv3.pb.go | 13 +- .../openapiv3/OpenAPIv3.proto | 2 +- .../openapiv3/README.md | 4 - .../openapiv3/document.go | 2 +- .../gnostic/openapiv3/annotations.pb.go | 183 - .../gnostic/openapiv3/annotations.proto | 60 - .../google/gnostic/openapiv3/openapi-3.0.json | 1251 ---- .../google/gnostic/openapiv3/openapi-3.1.json | 1250 ---- .../google/s2a-go/internal/v2/s2av2.go | 81 +- .../github.com/google/s2a-go/retry/retry.go | 144 + vendor/github.com/google/s2a-go/s2a.go | 20 +- vendor/github.com/google/uuid/.travis.yml | 9 - vendor/github.com/google/uuid/CHANGELOG.md | 10 + vendor/github.com/google/uuid/CONTRIBUTING.md | 16 + vendor/github.com/google/uuid/README.md | 10 +- vendor/github.com/google/uuid/node_js.go | 2 +- vendor/github.com/google/uuid/uuid.go | 10 +- .../klauspost/compress/flate/deflate.go | 988 +++ .../klauspost/compress/flate/dict_decoder.go | 184 + .../klauspost/compress/flate/fast_encoder.go | 216 + .../compress/flate/huffman_bit_writer.go | 1182 ++++ .../klauspost/compress/flate/huffman_code.go | 417 ++ .../compress/flate/huffman_sortByFreq.go | 159 + .../compress/flate/huffman_sortByLiteral.go | 201 + .../klauspost/compress/flate/inflate.go | 793 +++ .../klauspost/compress/flate/inflate_gen.go | 1283 ++++ .../klauspost/compress/flate/level1.go | 241 + .../klauspost/compress/flate/level2.go | 214 + .../klauspost/compress/flate/level3.go | 241 + .../klauspost/compress/flate/level4.go | 221 + .../klauspost/compress/flate/level5.go | 310 + .../klauspost/compress/flate/level6.go | 325 + .../klauspost/compress/flate/regmask_amd64.go | 37 + .../klauspost/compress/flate/regmask_other.go | 40 + .../klauspost/compress/flate/stateless.go | 318 + .../klauspost/compress/flate/token.go | 379 ++ .../klauspost/compress/gzip/gunzip.go | 374 ++ .../klauspost/compress/gzip/gzip.go | 269 + .../exporter/awsxrayexporter/awsxray.go | 3 +- .../exporter/awsxrayexporter/config.go | 3 + .../exporter/awsxrayexporter/factory.go | 10 +- .../internal/translator/segment.go | 29 +- .../internal/translator/span_links.go | 4 +- .../exporter/loadbalancingexporter/README.md | 3 +- .../loadbalancingexporter/metadata.yaml | 1 + .../resolver_k8s_handler.go | 15 +- .../prometheusremotewriteexporter/exporter.go | 89 +- .../prometheusremotewriteexporter/factory.go | 1 - .../prometheusremotewriteexporter/helper.go | 8 +- .../exporter/signalfxexporter/README.md | 2 +- .../exporter/signalfxexporter/config.go | 4 + .../exporter/signalfxexporter/exporter.go | 1 + .../internal/translation/converter.go | 30 +- .../healthcheckextension.go | 3 +- .../internal}/healthcheck/handler.go | 11 +- .../observer/ecsobserver/docker_label.go | 6 +- .../extension/observer/ecsobserver/fetcher.go | 20 +- .../extension/observer/ecsobserver/filter.go | 12 +- .../ecsobserver/internal/errctx/value.go | 2 +- .../extension/observer/ecsobserver/service.go | 12 +- .../extension/observer/ecsobserver/target.go | 6 +- .../observer/ecsobserver/task_definition.go | 6 +- .../internal/aws/k8s/k8sclient/clientset.go | 6 +- .../internal/aws/metrics/metric_calculator.go | 4 +- .../coreinternal/attraction/attraction.go | 2 +- .../internal/filter/filterexpr/matcher.go | 1 + .../internal/filter/filterottl/functions.go | 1 + .../pkg/ottl/expression.go | 31 + .../pkg/ottl/ottlfuncs/README.md | 17 + .../pkg/ottl/ottlfuncs/func_duration_hours.go | 38 + .../pkg/ottl/ottlfuncs/func_duration_micro.go | 38 + .../pkg/ottl/ottlfuncs/func_duration_milli.go | 38 + .../ottl/ottlfuncs/func_duration_minutes.go | 38 + .../pkg/ottl/ottlfuncs/func_duration_nano.go | 38 + .../ottl/ottlfuncs/func_duration_seconds.go | 38 + .../ottl/ottlfuncs/func_extract_patterns.go | 75 + .../pkg/ottl/ottlfuncs/func_len.go | 42 +- .../pkg/ottl/ottlfuncs/func_substring.go | 31 +- .../pkg/ottl/ottlfuncs/functions.go | 7 + .../resource_to_telemetry.go | 1 + .../pkg/translator/prometheus/README.md | 7 - .../translator/prometheus/normalize_name.go | 5 - .../pkg/translator/prometheus/unit_to_ucum.go | 90 + .../prometheusremotewrite/helper.go | 2 + .../prometheusremotewrite/metrics_to_prw.go | 1 + .../pkg/translator/signalfx/from_metrics.go | 15 +- .../k8sattributesprocessor/README.md | 5 +- .../k8sattributesprocessor/config.go | 63 + .../k8sattributesprocessor/factory.go | 18 - .../k8sattributesprocessor/metadata.yaml | 4 +- .../k8sattributesprocessor/options.go | 30 +- .../internal/k8sapiserver/k8sapiserver.go | 2 +- .../receiver/jaegerreceiver/config.go | 12 +- .../receiver/jaegerreceiver/factory.go | 11 + .../receiver/prometheusreceiver/README.md | 10 + .../internal/metricfamily.go | 2 +- .../internal/transaction.go | 152 +- .../lz4/v4/internal/lz4block/decode_arm64.s | 15 +- .../collector/config/configgrpc/configgrpc.go | 20 +- .../exporter/exporterhelper/common.go | 42 +- .../exporter/exporterhelper/constants.go | 6 + .../exporterhelper/internal/mock_storage.go | 89 + .../internal/persistent_queue.go | 14 +- .../internal/persistent_storage.go | 14 +- .../internal/persistent_storage_batch.go | 6 +- .../exporterhelper/internal/request.go | 6 +- .../collector/exporter/exporterhelper/logs.go | 79 +- .../exporter/exporterhelper/metrics.go | 80 +- .../exporter/exporterhelper/queued_retry.go | 67 +- .../exporter/exporterhelper/request.go | 54 + .../exporter/exporterhelper/traces.go | 76 +- .../internal/otlptext/databuffer.go | 36 +- .../exporter/otlphttpexporter/otlp.go | 29 +- .../collector/receiver/otlpreceiver/config.go | 4 +- .../receiver/otlpreceiver/factory.go | 2 +- .../service/internal/proctelemetry/config.go | 153 +- .../proctelemetry/process_telemetry.go | 40 +- .../collector/service/telemetry/config.go | 39 +- .../otel/exporters/otlp/otlptrace/LICENSE | 201 + .../otel/exporters/otlp/otlptrace/README.md | 51 + .../otel/exporters/otlp/otlptrace/clients.go | 54 + .../otel/exporters/otlp/otlptrace/exporter.go | 118 + .../otlp/otlptrace/internal/header.go | 25 + .../internal/otlpconfig/envconfig.go | 150 + .../otlptrace/internal/otlpconfig/options.go | 309 + .../internal/otlpconfig/optiontypes.go | 48 + .../otlp/otlptrace/internal/otlpconfig/tls.go | 34 + .../internal/tracetransform/attribute.go | 158 + .../tracetransform/instrumentation.go | 30 + .../internal/tracetransform/resource.go | 28 + .../otlptrace/internal/tracetransform/span.go | 205 + .../otlp/otlptrace/otlptracegrpc/LICENSE | 201 + .../otlp/otlptrace/otlptracegrpc/client.go | 299 + .../otlp/otlptrace/otlptracegrpc/exporter.go | 31 + .../otlp/otlptrace/otlptracegrpc/options.go | 189 + .../otlp/otlptrace/otlptracehttp/LICENSE | 201 + .../otlp/otlptrace/otlptracehttp/client.go | 341 + .../otlp/otlptrace/otlptracehttp/doc.go | 19 + .../otlp/otlptrace/otlptracehttp/exporter.go | 31 + .../otlp/otlptrace/otlptracehttp/options.go | 116 + .../otel/exporters/otlp/otlptrace/version.go | 20 + .../collector/trace/v1/trace_service.pb.go | 367 + .../collector/trace/v1/trace_service.pb.gw.go | 167 + .../trace/v1/trace_service_grpc.pb.go | 109 + .../proto/otlp/trace/v1/trace.pb.go | 1140 ++++ vendor/gonum.org/v1/gonum/AUTHORS | 3 + vendor/gonum.org/v1/gonum/CONTRIBUTORS | 3 + .../gonum.org/v1/gonum/lapack/gonum/dbdsqr.go | 14 +- .../gonum.org/v1/gonum/lapack/gonum/dgecon.go | 16 +- .../gonum.org/v1/gonum/lapack/gonum/dhseqr.go | 2 +- .../gonum.org/v1/gonum/lapack/gonum/dlahqr.go | 26 +- .../v1/gonum/lapack/gonum/dlaqr04.go | 20 +- .../gonum.org/v1/gonum/lapack/gonum/dlaqr5.go | 700 +- .../gonum.org/v1/gonum/lapack/gonum/dlassq.go | 2 +- .../gonum.org/v1/gonum/lapack/gonum/dlatbs.go | 2 +- .../gonum.org/v1/gonum/lapack/gonum/dlatrs.go | 59 +- .../v1/gonum/lapack/lapack64/lapack64.go | 4 +- vendor/gonum.org/v1/gonum/mat/cholesky.go | 204 + vendor/google.golang.org/api/internal/cba.go | 4 +- .../google.golang.org/api/internal/version.go | 2 +- .../api/annotations/field_behavior.pb.go | 22 +- .../admissionregistration/v1/generated.proto | 4 +- .../api/admissionregistration/v1/types.go | 4 +- .../v1/types_swagger_doc_generated.go | 4 +- .../v1alpha1/generated.pb.go | 541 +- .../v1alpha1/generated.proto | 92 +- .../admissionregistration/v1alpha1/types.go | 105 +- .../v1alpha1/types_swagger_doc_generated.go | 25 +- .../v1alpha1/zz_generated.deepcopy.go | 33 +- .../v1beta1/generated.pb.go | 5927 ++++++++++++++--- .../v1beta1/generated.proto | 564 +- .../admissionregistration/v1beta1/register.go | 4 + .../admissionregistration/v1beta1/types.go | 594 +- .../v1beta1/types_swagger_doc_generated.go | 178 +- .../v1beta1/zz_generated.deepcopy.go | 448 +- .../zz_generated.prerelease-lifecycle.go | 72 + .../api/apidiscovery/v2beta1/generated.proto | 4 +- .../k8s.io/api/apidiscovery/v2beta1/types.go | 4 +- .../v1alpha1/generated.pb.go | 148 +- .../v1alpha1/generated.proto | 5 + .../api/apiserverinternal/v1alpha1/types.go | 5 + .../v1alpha1/types_swagger_doc_generated.go | 1 + .../v1alpha1/zz_generated.deepcopy.go | 5 + vendor/k8s.io/api/apps/v1/types.go | 3 +- .../api/authentication/v1/generated.pb.go | 511 +- .../api/authentication/v1/generated.proto | 20 + .../k8s.io/api/authentication/v1/register.go | 1 + vendor/k8s.io/api/authentication/v1/types.go | 25 + .../v1/types_swagger_doc_generated.go | 19 + .../v1/zz_generated.deepcopy.go | 44 + vendor/k8s.io/api/batch/v1/generated.pb.go | 398 +- vendor/k8s.io/api/batch/v1/generated.proto | 62 + vendor/k8s.io/api/batch/v1/types.go | 92 + .../batch/v1/types_swagger_doc_generated.go | 7 +- .../api/batch/v1/zz_generated.deepcopy.go | 25 + .../api/core/v1/annotation_key_constants.go | 6 +- vendor/k8s.io/api/core/v1/generated.pb.go | 3017 +++++---- vendor/k8s.io/api/core/v1/generated.proto | 193 +- vendor/k8s.io/api/core/v1/types.go | 235 +- .../core/v1/types_swagger_doc_generated.go | 66 +- .../k8s.io/api/core/v1/well_known_labels.go | 4 + .../api/core/v1/zz_generated.deepcopy.go | 75 +- .../k8s.io/api/discovery/v1/generated.proto | 2 + vendor/k8s.io/api/discovery/v1/types.go | 2 + .../v1/types_swagger_doc_generated.go | 2 +- .../api/extensions/v1beta1/generated.pb.go | 610 +- .../api/extensions/v1beta1/generated.proto | 17 - vendor/k8s.io/api/extensions/v1beta1/types.go | 50 +- .../v1beta1/types_swagger_doc_generated.go | 10 - .../v1beta1/zz_generated.deepcopy.go | 24 - .../api/flowcontrol/v1alpha1/generated.pb.go | 477 +- .../api/flowcontrol/v1alpha1/generated.proto | 42 + .../k8s.io/api/flowcontrol/v1alpha1/types.go | 45 + .../v1alpha1/types_swagger_doc_generated.go | 11 + .../v1alpha1/zz_generated.deepcopy.go | 31 + .../api/flowcontrol/v1beta1/generated.pb.go | 476 +- .../api/flowcontrol/v1beta1/generated.proto | 42 + .../k8s.io/api/flowcontrol/v1beta1/types.go | 49 +- .../v1beta1/types_swagger_doc_generated.go | 11 + .../v1beta1/zz_generated.deepcopy.go | 31 + .../api/flowcontrol/v1beta2/generated.pb.go | 477 +- .../api/flowcontrol/v1beta2/generated.proto | 42 + .../k8s.io/api/flowcontrol/v1beta2/types.go | 49 +- .../v1beta2/types_swagger_doc_generated.go | 11 + .../v1beta2/zz_generated.deepcopy.go | 31 + .../api/flowcontrol/v1beta3/generated.pb.go | 475 +- .../api/flowcontrol/v1beta3/generated.proto | 46 +- .../k8s.io/api/flowcontrol/v1beta3/types.go | 53 +- .../v1beta3/types_swagger_doc_generated.go | 13 +- .../v1beta3/zz_generated.deepcopy.go | 31 + .../k8s.io/api/networking/v1/generated.pb.go | 443 +- .../k8s.io/api/networking/v1/generated.proto | 17 - vendor/k8s.io/api/networking/v1/types.go | 50 +- .../v1/types_swagger_doc_generated.go | 10 - .../networking/v1/zz_generated.deepcopy.go | 24 - vendor/k8s.io/api/rbac/v1/generated.proto | 2 + vendor/k8s.io/api/rbac/v1/types.go | 2 + .../rbac/v1/types_swagger_doc_generated.go | 4 +- .../k8s.io/apimachinery/pkg/api/errors/OWNERS | 1 - .../k8s.io/apimachinery/pkg/api/meta/help.go | 83 +- .../apimachinery/pkg/api/resource/OWNERS | 1 - .../pkg/apis/meta/v1/generated.proto | 2 - .../apimachinery/pkg/apis/meta/v1/types.go | 22 +- .../apis/meta/v1/unstructured/unstructured.go | 5 + .../meta/v1/unstructured/unstructured_list.go | 9 + .../k8s.io/apimachinery/pkg/runtime/codec.go | 1 - .../apimachinery/pkg/runtime/interfaces.go | 5 + .../pkg/runtime/schema/group_version.go | 2 +- .../k8s.io/apimachinery/pkg/runtime/splice.go | 76 + .../apimachinery/pkg/util/cache/expiring.go | 12 +- .../k8s.io/apimachinery/pkg/util/diff/diff.go | 37 +- .../k8s.io/apimachinery/pkg/util/dump/dump.go | 54 + .../apimachinery/pkg/util/intstr/intstr.go | 7 +- .../managedfields/internal/fieldmanager.go | 25 +- .../managedfields/internal/skipnonapplied.go | 14 +- .../managedfields/internal/structuredmerge.go | 3 + .../managedfields/internal/versioncheck.go | 52 + .../apimachinery/pkg/util/mergepatch/util.go | 4 +- .../k8s.io/apimachinery/pkg/util/net/util.go | 6 + .../pkg/util/strategicpatch/patch.go | 63 +- .../apimachinery/pkg/util/version/version.go | 5 + .../k8s.io/apimachinery/pkg/util/wait/poll.go | 28 +- .../v1alpha1/paramref.go | 27 +- .../v1alpha1/validatingadmissionpolicyspec.go | 14 + .../v1alpha1/variable.go | 48 + .../v1beta1/auditannotation.go | 48 + .../v1beta1/expressionwarning.go | 48 + .../v1beta1/matchresources.go | 90 + .../v1beta1/namedrulewithoperations.go | 95 + .../v1beta1/paramkind.go | 48 + .../admissionregistration/v1beta1/paramref.go | 71 + .../v1beta1/typechecking.go | 44 + .../v1beta1/validatingadmissionpolicy.go | 256 + .../validatingadmissionpolicybinding.go | 247 + .../validatingadmissionpolicybindingspec.go | 72 + .../v1beta1/validatingadmissionpolicyspec.go | 117 + .../validatingadmissionpolicystatus.go | 66 + .../v1beta1/validation.go | 70 + .../admissionregistration/v1beta1/variable.go | 48 + .../v1alpha1/serverstorageversion.go | 11 + .../applyconfigurations/batch/v1/jobspec.go | 27 + .../applyconfigurations/batch/v1/jobstatus.go | 18 + .../applyconfigurations/core/v1/container.go | 9 + .../core/v1/ephemeralcontainer.go | 8 + .../core/v1/ephemeralcontainercommon.go | 9 + .../applyconfigurations/core/v1/hostip.go | 39 + .../core/v1/persistentvolumeclaimstatus.go | 28 +- .../core/v1/persistentvolumestatus.go | 16 +- .../core/v1/podresourceclaimstatus.go | 48 + .../applyconfigurations/core/v1/podstatus.go | 56 +- .../extensions/v1beta1/networkpolicy.go | 11 +- .../extensions/v1beta1/networkpolicystatus.go | 48 - .../exemptprioritylevelconfiguration.go | 48 + .../prioritylevelconfigurationspec.go | 9 + .../exemptprioritylevelconfiguration.go | 48 + .../v1beta1/prioritylevelconfigurationspec.go | 9 + .../exemptprioritylevelconfiguration.go | 48 + .../v1beta2/prioritylevelconfigurationspec.go | 9 + .../exemptprioritylevelconfiguration.go | 48 + .../v1beta3/prioritylevelconfigurationspec.go | 9 + .../applyconfigurations/internal/internal.go | 440 +- .../networking/v1/networkpolicy.go | 11 +- .../networking/v1/networkpolicystatus.go | 48 - .../discovery/aggregated_discovery.go | 6 +- .../client-go/discovery/discovery_client.go | 2 +- .../v1beta1/admissionregistration_client.go | 10 + .../v1beta1/generated_expansion.go | 4 + .../v1beta1/validatingadmissionpolicy.go | 243 + .../validatingadmissionpolicybinding.go | 197 + .../v1/authentication_client.go | 5 + .../authentication/v1/generated_expansion.go | 2 + .../authentication/v1/selfsubjectreview.go | 64 + .../typed/extensions/v1beta1/networkpolicy.go | 48 - .../typed/networking/v1/networkpolicy.go | 48 - .../k8s.io/client-go/openapi/typeconverter.go | 48 + .../plugin/pkg/client/auth/exec/exec.go | 6 +- vendor/k8s.io/client-go/rest/config.go | 10 +- vendor/k8s.io/client-go/rest/request.go | 28 +- vendor/k8s.io/client-go/rest/url_utils.go | 4 +- vendor/k8s.io/client-go/tools/cache/OWNERS | 4 +- .../client-go/tools/cache/controller.go | 4 - .../client-go/tools/cache/object-names.go | 65 + .../k8s.io/client-go/tools/cache/reflector.go | 30 +- .../client-go/tools/cache/shared_informer.go | 37 +- vendor/k8s.io/client-go/tools/cache/store.go | 31 +- .../client-go/tools/clientcmd/api/types.go | 14 +- .../client-go/tools/clientcmd/loader.go | 24 +- .../tools/leaderelection/leaderelection.go | 5 + .../resourcelock/configmaplock.go | 126 - .../resourcelock/endpointslock.go | 121 - .../leaderelection/resourcelock/interface.go | 42 +- .../k8s.io/client-go/tools/metrics/metrics.go | 48 + vendor/k8s.io/client-go/tools/pager/pager.go | 36 +- vendor/k8s.io/client-go/tools/record/event.go | 5 +- vendor/k8s.io/client-go/transport/cache.go | 6 + vendor/k8s.io/client-go/util/cert/cert.go | 7 +- vendor/k8s.io/klog/v2/format.go | 65 + .../klog/v2/internal/serialize/keyvalues.go | 47 +- vendor/k8s.io/klog/v2/k8s_references.go | 12 +- vendor/k8s.io/klog/v2/klog.go | 13 + .../k8s.io/kube-openapi/pkg/cached/cache.go | 166 +- .../kube-openapi/pkg/handler3/handler.go | 2 +- .../kube-openapi/pkg/util/proto/document.go | 2 +- .../pkg/util/proto/document_v3.go | 2 +- .../pkg/validation/spec/gnostic.go | 2 +- vendor/k8s.io/utils/trace/trace.go | 19 + vendor/modules.txt | 309 +- 2559 files changed, 109690 insertions(+), 52896 deletions(-) create mode 100644 docs/releases/v0.33.0.md create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_cloud_cost_data_source.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_cloud_cost_query_definition.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_remote_configuration.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_downtimes.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_spans.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_attributes.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_level.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_test_level.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_create_request.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_create_request_attributes.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_create_request_data.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_included_monitor_type.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_meta.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_meta_page.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_monitor_identifier.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_monitor_identifier_id.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_monitor_identifier_tags.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_monitor_included_attributes.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_monitor_included_item.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_notify_end_state_actions.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_notify_end_state_types.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_relationships.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_relationships_created_by.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_relationships_created_by_data.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_relationships_monitor.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_relationships_monitor_data.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_resource_type.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_response.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_response_attributes.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_response_data.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_response_included_item.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_create_request.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_current_downtime_response.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_one_time_create_update_request.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_one_time_response.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_recurrence_create_update_request.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_recurrence_response.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_recurrences_create_request.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_recurrences_response.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_recurrences_update_request.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_response.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_update_request.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_status.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_update_request.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_update_request_attributes.go rename vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/{model_team_data.go => model_downtime_update_request_data.go} (59%) create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_downtimes_response.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_downtime_match_resource_type.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_downtime_match_response.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_downtime_match_response_attributes.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_downtime_match_response_data.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_on_demand_concurrency_cap_type.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_metadata_type.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_response.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_meta_warnings.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_span.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_bucket.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_bucket_attributes.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_bucket_type.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_bucket_value.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_bucket_value_timeseries.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_bucket_value_timeseries_point.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_data.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_request.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_request_attributes.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_request_type.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_response.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_response_metadata.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_response_status.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_sort.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_sort_type.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregation_function.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_attributes.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_compute.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_compute_type.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_group_by.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_group_by_histogram.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_group_by_missing.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_group_by_total.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_request.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_request_attributes.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_request_data.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_request_page.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_request_type.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_response.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_response_links.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_response_metadata.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_query_filter.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_query_options.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_response_metadata_page.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_sort.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_sort_order.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_type.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_warning.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_relationships_links.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_teams_response_links.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_teams_response_meta.go create mode 100644 vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_teams_response_meta_pagination.go create mode 100644 vendor/github.com/IBM/sarama/.pre-commit-config.yaml create mode 100644 vendor/github.com/antonmedv/expr/ast/dump.go create mode 100644 vendor/github.com/antonmedv/expr/builtin/func.go create mode 100644 vendor/github.com/antonmedv/expr/builtin/utils.go create mode 100644 vendor/github.com/antonmedv/expr/parser/operator/operator.go create mode 100644 vendor/github.com/antonmedv/expr/parser/utils/utils.go create mode 100644 vendor/github.com/goccy/go-json/.codecov.yml create mode 100644 vendor/github.com/goccy/go-json/.gitignore create mode 100644 vendor/github.com/goccy/go-json/.golangci.yml create mode 100644 vendor/github.com/goccy/go-json/CHANGELOG.md create mode 100644 vendor/github.com/goccy/go-json/LICENSE create mode 100644 vendor/github.com/goccy/go-json/Makefile create mode 100644 vendor/github.com/goccy/go-json/README.md create mode 100644 vendor/github.com/goccy/go-json/color.go create mode 100644 vendor/github.com/goccy/go-json/decode.go create mode 100644 vendor/github.com/goccy/go-json/docker-compose.yml create mode 100644 vendor/github.com/goccy/go-json/encode.go create mode 100644 vendor/github.com/goccy/go-json/error.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/anonymous_field.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/array.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/assign.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/bool.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/bytes.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/compile.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/compile_norace.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/compile_race.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/context.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/float.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/func.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/int.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/interface.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/invalid.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/map.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/number.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/option.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/path.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/ptr.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/slice.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/stream.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/string.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/struct.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/type.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/uint.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/unmarshal_json.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/unmarshal_text.go create mode 100644 vendor/github.com/goccy/go-json/internal/decoder/wrapped_string.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/code.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/compact.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/compiler.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/compiler_norace.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/compiler_race.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/context.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/decode_rune.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/encoder.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/indent.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/int.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/map112.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/map113.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/opcode.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/option.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/optype.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/query.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/string.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/string_table.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/vm/debug_vm.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/vm/hack.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/vm/util.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/vm/vm.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/vm_color/debug_vm.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/vm_color/hack.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/vm_color/util.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/vm_color/vm.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/vm_color_indent/debug_vm.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/vm_color_indent/util.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/vm_color_indent/vm.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/vm_indent/debug_vm.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/vm_indent/hack.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/vm_indent/util.go create mode 100644 vendor/github.com/goccy/go-json/internal/encoder/vm_indent/vm.go create mode 100644 vendor/github.com/goccy/go-json/internal/errors/error.go create mode 100644 vendor/github.com/goccy/go-json/internal/runtime/rtype.go create mode 100644 vendor/github.com/goccy/go-json/internal/runtime/struct_field.go create mode 100644 vendor/github.com/goccy/go-json/internal/runtime/type.go create mode 100644 vendor/github.com/goccy/go-json/json.go create mode 100644 vendor/github.com/goccy/go-json/option.go create mode 100644 vendor/github.com/goccy/go-json/path.go create mode 100644 vendor/github.com/goccy/go-json/query.go rename vendor/github.com/google/{gnostic => gnostic-models}/LICENSE (100%) rename vendor/github.com/google/{gnostic => gnostic-models}/compiler/README.md (100%) rename vendor/github.com/google/{gnostic => gnostic-models}/compiler/context.go (100%) rename vendor/github.com/google/{gnostic => gnostic-models}/compiler/error.go (100%) rename vendor/github.com/google/{gnostic => gnostic-models}/compiler/extensions.go (97%) rename vendor/github.com/google/{gnostic => gnostic-models}/compiler/helpers.go (99%) rename vendor/github.com/google/{gnostic => gnostic-models}/compiler/main.go (100%) rename vendor/github.com/google/{gnostic => gnostic-models}/compiler/reader.go (100%) rename vendor/github.com/google/{gnostic => gnostic-models}/extensions/README.md (100%) rename vendor/github.com/google/{gnostic => gnostic-models}/extensions/extension.pb.go (99%) rename vendor/github.com/google/{gnostic => gnostic-models}/extensions/extension.proto (100%) rename vendor/github.com/google/{gnostic => gnostic-models}/extensions/extensions.go (100%) rename vendor/github.com/google/{gnostic => gnostic-models}/jsonschema/README.md (100%) rename vendor/github.com/google/{gnostic => gnostic-models}/jsonschema/base.go (90%) rename vendor/github.com/google/{gnostic => gnostic-models}/jsonschema/display.go (92%) rename vendor/github.com/google/{gnostic => gnostic-models}/jsonschema/models.go (97%) rename vendor/github.com/google/{gnostic => gnostic-models}/jsonschema/operations.go (100%) rename vendor/github.com/google/{gnostic => gnostic-models}/jsonschema/reader.go (99%) rename vendor/github.com/google/{gnostic => gnostic-models}/jsonschema/schema.json (100%) rename vendor/github.com/google/{gnostic => gnostic-models}/jsonschema/writer.go (92%) rename vendor/github.com/google/{gnostic => gnostic-models}/openapiv2/OpenAPIv2.go (99%) rename vendor/github.com/google/{gnostic => gnostic-models}/openapiv2/OpenAPIv2.pb.go (99%) rename vendor/github.com/google/{gnostic => gnostic-models}/openapiv2/OpenAPIv2.proto (100%) rename vendor/github.com/google/{gnostic => gnostic-models}/openapiv2/README.md (100%) rename vendor/github.com/google/{gnostic => gnostic-models}/openapiv2/document.go (96%) rename vendor/github.com/google/{gnostic => gnostic-models}/openapiv2/openapi-2.0.json (100%) rename vendor/github.com/google/{gnostic => gnostic-models}/openapiv3/OpenAPIv3.go (99%) rename vendor/github.com/google/{gnostic => gnostic-models}/openapiv3/OpenAPIv3.pb.go (99%) rename vendor/github.com/google/{gnostic => gnostic-models}/openapiv3/OpenAPIv3.proto (99%) rename vendor/github.com/google/{gnostic => gnostic-models}/openapiv3/README.md (89%) rename vendor/github.com/google/{gnostic => gnostic-models}/openapiv3/document.go (96%) delete mode 100644 vendor/github.com/google/gnostic/openapiv3/annotations.pb.go delete mode 100644 vendor/github.com/google/gnostic/openapiv3/annotations.proto delete mode 100644 vendor/github.com/google/gnostic/openapiv3/openapi-3.0.json delete mode 100644 vendor/github.com/google/gnostic/openapiv3/openapi-3.1.json create mode 100644 vendor/github.com/google/s2a-go/retry/retry.go delete mode 100644 vendor/github.com/google/uuid/.travis.yml create mode 100644 vendor/github.com/google/uuid/CHANGELOG.md create mode 100644 vendor/github.com/klauspost/compress/flate/deflate.go create mode 100644 vendor/github.com/klauspost/compress/flate/dict_decoder.go create mode 100644 vendor/github.com/klauspost/compress/flate/fast_encoder.go create mode 100644 vendor/github.com/klauspost/compress/flate/huffman_bit_writer.go create mode 100644 vendor/github.com/klauspost/compress/flate/huffman_code.go create mode 100644 vendor/github.com/klauspost/compress/flate/huffman_sortByFreq.go create mode 100644 vendor/github.com/klauspost/compress/flate/huffman_sortByLiteral.go create mode 100644 vendor/github.com/klauspost/compress/flate/inflate.go create mode 100644 vendor/github.com/klauspost/compress/flate/inflate_gen.go create mode 100644 vendor/github.com/klauspost/compress/flate/level1.go create mode 100644 vendor/github.com/klauspost/compress/flate/level2.go create mode 100644 vendor/github.com/klauspost/compress/flate/level3.go create mode 100644 vendor/github.com/klauspost/compress/flate/level4.go create mode 100644 vendor/github.com/klauspost/compress/flate/level5.go create mode 100644 vendor/github.com/klauspost/compress/flate/level6.go create mode 100644 vendor/github.com/klauspost/compress/flate/regmask_amd64.go create mode 100644 vendor/github.com/klauspost/compress/flate/regmask_other.go create mode 100644 vendor/github.com/klauspost/compress/flate/stateless.go create mode 100644 vendor/github.com/klauspost/compress/flate/token.go create mode 100644 vendor/github.com/klauspost/compress/gzip/gunzip.go create mode 100644 vendor/github.com/klauspost/compress/gzip/gzip.go rename vendor/github.com/{jaegertracing/jaeger/pkg => open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension/internal}/healthcheck/handler.go (90%) create mode 100644 vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs/func_duration_hours.go create mode 100644 vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs/func_duration_micro.go create mode 100644 vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs/func_duration_milli.go create mode 100644 vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs/func_duration_minutes.go create mode 100644 vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs/func_duration_nano.go create mode 100644 vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs/func_duration_seconds.go create mode 100644 vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs/func_extract_patterns.go create mode 100644 vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus/unit_to_ucum.go create mode 100644 vendor/go.opentelemetry.io/collector/exporter/exporterhelper/internal/mock_storage.go create mode 100644 vendor/go.opentelemetry.io/collector/exporter/exporterhelper/request.go create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/LICENSE create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/README.md create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/clients.go create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/exporter.go create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/header.go create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/options.go create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/tls.go create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/attribute.go create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/resource.go create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/span.go create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/LICENSE create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/exporter.go create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/options.go create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/LICENSE create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/client.go create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/doc.go create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/exporter.go create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/options.go create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go create mode 100644 vendor/go.opentelemetry.io/proto/otlp/collector/trace/v1/trace_service.pb.go create mode 100644 vendor/go.opentelemetry.io/proto/otlp/collector/trace/v1/trace_service.pb.gw.go create mode 100644 vendor/go.opentelemetry.io/proto/otlp/collector/trace/v1/trace_service_grpc.pb.go create mode 100644 vendor/go.opentelemetry.io/proto/otlp/trace/v1/trace.pb.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/splice.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/dump/dump.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/versioncheck.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/variable.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/auditannotation.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/expressionwarning.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/matchresources.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/namedrulewithoperations.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/paramkind.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/paramref.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/typechecking.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicy.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicybinding.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicybindingspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicyspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicystatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validation.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/variable.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/hostip.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/podresourceclaimstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/networkpolicystatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/exemptprioritylevelconfiguration.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/exemptprioritylevelconfiguration.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/exemptprioritylevelconfiguration.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta3/exemptprioritylevelconfiguration.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/networkpolicystatus.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/validatingadmissionpolicy.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/validatingadmissionpolicybinding.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/selfsubjectreview.go create mode 100644 vendor/k8s.io/client-go/openapi/typeconverter.go create mode 100644 vendor/k8s.io/client-go/tools/cache/object-names.go delete mode 100644 vendor/k8s.io/client-go/tools/leaderelection/resourcelock/configmaplock.go delete mode 100644 vendor/k8s.io/client-go/tools/leaderelection/resourcelock/endpointslock.go create mode 100644 vendor/k8s.io/klog/v2/format.go diff --git a/.github/config/testcases.json b/.github/config/testcases.json index dcbf26d78..d7ee3df42 100644 --- a/.github/config/testcases.json +++ b/.github/config/testcases.json @@ -614,7 +614,13 @@ "EKS", "EKS_ARM64" ] + }, + { + "case_name": "statsd_instscopedisabled", + "platforms": [ + "EKS", + "EKS_ARM64" + ] } - ] } \ No newline at end of file diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c384a1190..fd1a64d9a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -50,7 +50,7 @@ env: DDB_TABLE_NAME: BatchTestCache MAX_JOBS: 110 BATCH_INCLUDED_SERVICES: EKS,ECS,EC2,EKS_ARM64,EKS_FARGATE - GO_VERSION: ~1.20.6 + GO_VERSION: ~1.20.8 concurrency: diff --git a/.github/workflows/PR-build.yml b/.github/workflows/PR-build.yml index 5273a1785..e40d42b1e 100644 --- a/.github/workflows/PR-build.yml +++ b/.github/workflows/PR-build.yml @@ -25,7 +25,7 @@ env: IMAGE_NAME: aws-otel-collector PACKAGING_ROOT: build/packages TESTING_FRAMEWORK_REPO: aws-observability/aws-otel-test-framework - GO_VERSION: ~1.20.6 + GO_VERSION: ~1.20.8 concurrency: group: pr-build-${{ github.event.pull_request.number }} diff --git a/.github/workflows/aws-resources-clean.yml b/.github/workflows/aws-resources-clean.yml index 80e993cc0..bd1e72c33 100644 --- a/.github/workflows/aws-resources-clean.yml +++ b/.github/workflows/aws-resources-clean.yml @@ -24,7 +24,7 @@ on: default: "3" env: DAYS_TO_KEEP: 3 - GO_VERSION: ~1.20.6 + GO_VERSION: ~1.20.8 permissions: id-token: write diff --git a/.github/workflows/canary.yml b/.github/workflows/canary.yml index f4565744b..e2ccb7187 100644 --- a/.github/workflows/canary.yml +++ b/.github/workflows/canary.yml @@ -57,7 +57,7 @@ jobs: - name: Set up Go 1.x uses: actions/setup-go@v4 with: - go-version: '~1.20.6' + go-version: '~1.20.8' cache-dependency-path: testing-framework/cmd/aotutil/go.sum - name: Build aotutil run: cd testing-framework/cmd/aotutil && make build diff --git a/.github/workflows/perf.yml b/.github/workflows/perf.yml index d54d24eb6..3dae304b5 100644 --- a/.github/workflows/perf.yml +++ b/.github/workflows/perf.yml @@ -27,7 +27,7 @@ env: COMMIT_USER: Github Actions COMMIT_EMAIL: actions@github.com TESTING_FRAMEWORK_REPO: aws-observability/aws-otel-test-framework - GO_VERSION: ~1.20.6 + GO_VERSION: ~1.20.8 permissions: id-token: write diff --git a/.github/workflows/prod-image-mirror.yml b/.github/workflows/prod-image-mirror.yml index 02ae2715d..c20a72b98 100644 --- a/.github/workflows/prod-image-mirror.yml +++ b/.github/workflows/prod-image-mirror.yml @@ -29,7 +29,7 @@ jobs: - name: Set up Go 1.x uses: actions/setup-go@v4 with: - go-version: ~1.20.6 + go-version: ~1.20.8 - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v2.2.0 diff --git a/README.md b/README.md index e09380de5..548ff228d 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,9 @@ Use the community resources below for getting help with the ADOT Collector. Users of the `statsd` receiver, please refer to GitHub Issue - [Warning: StatsD Receiver → EMF Exporter Metric Pipeline Breaking Change](https://github.com/aws-observability/aws-otel-collector/issues/2249) for information on an upcoming breaking change. +### Notice: ADOT Collector v0.35.0 Breaking Change +Users of the 'awscontainerinsightreceiver', please refer to the GitHub Issue - [Warning: Container Image Default User Change → Important consideration for AWSContainerInsightReceiver](https://github.com/aws-observability/aws-otel-collector/issues/2317) for more information on an upcoming breaking change. + #### ADOT Collector Built-in Components This table represents the supported components of the ADOT Collector. The highlighted components below are developed by AWS in-house. The rest of the components in the table are the essential default components that the ADOT Collector will support. diff --git a/VERSION b/VERSION index 420000f95..7fdbfd64b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v0.32.0 +v0.33.0 diff --git a/cmd/awscollector/main.go b/cmd/awscollector/main.go index f4022dd67..ce26db1ed 100644 --- a/cmd/awscollector/main.go +++ b/cmd/awscollector/main.go @@ -97,6 +97,10 @@ func buildAndParseFlagSet(featgate *featuregate.Registry) (*flag.FlagSet, error) log.Printf("attn: users of the statsd receiver please refer to " + "https://github.com/aws-observability/aws-otel-collector/issues/2249 in regards to an ADOT Collector v0.33.0 " + "breaking change") + // TODO: remove after ADOT Collector v0.35.0 is released + log.Printf("attn: users of the awscontainerinsightreceiver please refer to " + + "https://github.com/aws-observability/aws-otel-collector/issues/2317 in regards to an ADOT Collector v0.35.0 " + + "breaking change") if err := flagSet.Parse(os.Args[1:]); err != nil { return nil, err } diff --git a/docs/releases/v0.33.0.md b/docs/releases/v0.33.0.md new file mode 100644 index 000000000..d97691c16 --- /dev/null +++ b/docs/releases/v0.33.0.md @@ -0,0 +1,15 @@ +# Changelog + +## [v0.33.0](https://github.com/aws-observability/aws-otel-collector/tree/v0.33.0) (2023-09-05) + +[Full Changelog](https://github.com/aws-observability/aws-otel-collector/compare/v0.32.0...v0.33.0) + +**Merged pull requests:** + +- \[aoc-collector non-root user\]: Removing code that changes user [\#2297](https://github.com/aws-observability/aws-otel-collector/pull/2297) ([PaurushGarg](https://github.com/PaurushGarg)) +- Fix control script to avoid sed special characters [\#2267](https://github.com/aws-observability/aws-otel-collector/pull/2267) ([rapphil](https://github.com/rapphil)) +- Fix: don't overwrite .env file [\#2261](https://github.com/aws-observability/aws-otel-collector/pull/2261) ([rapphil](https://github.com/rapphil)) + + + +\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* diff --git a/go.mod b/go.mod index 0b438a927..5374fd5c5 100644 --- a/go.mod +++ b/go.mod @@ -3,66 +3,65 @@ module github.com/aws-observability/aws-otel-collector go 1.19 require ( - github.com/open-telemetry/opentelemetry-collector-contrib/confmap/provider/s3provider v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsemfexporter v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/dynatraceexporter v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/fileexporter v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/loadbalancingexporter v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/logzioexporter v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusexporter v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/sapmexporter v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/signalfxexporter v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsproxy v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer/ecsobserver v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/extension/pprofextension v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/extension/sigv4authextension v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatorateprocessor v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbytraceprocessor v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sattributesprocessor v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricsgenerationprocessor v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricstransformprocessor v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/processor/probabilisticsamplerprocessor v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourceprocessor v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/processor/spanprocessor v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsecscontainermetricsreceiver v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kafkareceiver v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver v0.83.0 - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinreceiver v0.83.0 - github.com/opencontainers/runc v1.1.8 + github.com/open-telemetry/opentelemetry-collector-contrib/confmap/provider/s3provider v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsemfexporter v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/dynatraceexporter v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/fileexporter v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/loadbalancingexporter v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/logzioexporter v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusexporter v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/sapmexporter v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/signalfxexporter v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsproxy v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer/ecsobserver v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/extension/pprofextension v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/extension/sigv4authextension v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatorateprocessor v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbytraceprocessor v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sattributesprocessor v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricsgenerationprocessor v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricstransformprocessor v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/processor/probabilisticsamplerprocessor v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourceprocessor v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/processor/spanprocessor v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsecscontainermetricsreceiver v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kafkareceiver v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver v0.84.0 + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinreceiver v0.84.0 github.com/pkg/errors v0.9.1 github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/collector v0.83.0 - go.opentelemetry.io/collector/component v0.83.0 - go.opentelemetry.io/collector/confmap v0.83.0 - go.opentelemetry.io/collector/exporter v0.83.0 - go.opentelemetry.io/collector/exporter/loggingexporter v0.83.0 - go.opentelemetry.io/collector/exporter/otlpexporter v0.83.0 - go.opentelemetry.io/collector/exporter/otlphttpexporter v0.83.0 - go.opentelemetry.io/collector/extension v0.83.0 - go.opentelemetry.io/collector/extension/ballastextension v0.83.0 - go.opentelemetry.io/collector/extension/zpagesextension v0.83.0 + go.opentelemetry.io/collector v0.84.0 + go.opentelemetry.io/collector/component v0.84.0 + go.opentelemetry.io/collector/confmap v0.84.0 + go.opentelemetry.io/collector/exporter v0.84.0 + go.opentelemetry.io/collector/exporter/loggingexporter v0.84.0 + go.opentelemetry.io/collector/exporter/otlpexporter v0.84.0 + go.opentelemetry.io/collector/exporter/otlphttpexporter v0.84.0 + go.opentelemetry.io/collector/extension v0.84.0 + go.opentelemetry.io/collector/extension/ballastextension v0.84.0 + go.opentelemetry.io/collector/extension/zpagesextension v0.84.0 go.opentelemetry.io/collector/featuregate v1.0.0-rcv0014 - go.opentelemetry.io/collector/processor v0.83.0 - go.opentelemetry.io/collector/processor/batchprocessor v0.83.0 - go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.83.0 - go.opentelemetry.io/collector/receiver v0.83.0 - go.opentelemetry.io/collector/receiver/otlpreceiver v0.83.0 + go.opentelemetry.io/collector/processor v0.84.0 + go.opentelemetry.io/collector/processor/batchprocessor v0.84.0 + go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.84.0 + go.opentelemetry.io/collector/receiver v0.84.0 + go.opentelemetry.io/collector/receiver/otlpreceiver v0.84.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.25.0 golang.org/x/sys v0.11.0 @@ -91,7 +90,7 @@ require ( github.com/DataDog/datadog-agent/pkg/util/log v0.48.0-beta.1 // indirect github.com/DataDog/datadog-agent/pkg/util/pointer v0.48.0-beta.1 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.48.0-beta.1 // indirect - github.com/DataDog/datadog-api-client-go/v2 v2.14.0 // indirect + github.com/DataDog/datadog-api-client-go/v2 v2.16.0 // indirect github.com/DataDog/datadog-go/v5 v5.1.1 // indirect github.com/DataDog/go-tuf v1.0.1-0.5.2 // indirect github.com/DataDog/gohai v0.0.0-20220718130825-1776f9beb9cc // indirect @@ -102,32 +101,32 @@ require ( github.com/DataDog/opentelemetry-mapping-go/pkg/quantile v0.7.0 // indirect github.com/DataDog/sketches-go v1.4.2 // indirect github.com/DataDog/zstd v1.5.2 // indirect - github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.18.0 // indirect - github.com/IBM/sarama v1.40.1 // indirect + github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.19.1 // indirect + github.com/IBM/sarama v1.41.0 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect github.com/Showmax/go-fqdn v1.0.0 // indirect github.com/alecthomas/participle/v2 v2.0.0 // indirect github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect - github.com/antonmedv/expr v1.13.0 // indirect + github.com/antonmedv/expr v1.14.3 // indirect github.com/apache/thrift v0.18.1 // indirect github.com/armon/go-metrics v0.4.1 // indirect - github.com/aws/aws-sdk-go v1.44.323 // indirect - github.com/aws/aws-sdk-go-v2 v1.20.1 // indirect + github.com/aws/aws-sdk-go v1.44.333 // indirect + github.com/aws/aws-sdk-go-v2 v1.21.0 // indirect github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.0.0 // indirect - github.com/aws/aws-sdk-go-v2/config v1.18.33 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.13.32 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.8 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.38 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.32 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.3.39 // indirect + github.com/aws/aws-sdk-go-v2/config v1.18.37 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.13.35 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.3.42 // indirect github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.5.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.32 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.35 // indirect github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.9.0 // indirect github.com/aws/aws-sdk-go-v2/service/s3 v1.19.0 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.13.2 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.15.2 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.21.2 // indirect - github.com/aws/smithy-go v1.14.1 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.13.5 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.15.5 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.21.5 // indirect + github.com/aws/smithy-go v1.14.2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/blang/semver v3.5.1+incompatible // indirect github.com/cenkalti/backoff v2.2.1+incompatible // indirect @@ -151,8 +150,8 @@ require ( github.com/docker/go-units v0.5.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/dynatrace-oss/dynatrace-metric-utils-go v0.5.0 // indirect - github.com/eapache/go-resiliency v1.3.0 // indirect - github.com/eapache/go-xerial-snappy v0.0.0-20230111030713-bf00bc1b83b6 // indirect + github.com/eapache/go-resiliency v1.4.0 // indirect + github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 // indirect github.com/eapache/queue v1.1.0 // indirect github.com/emicklei/go-restful/v3 v3.10.1 // indirect github.com/envoyproxy/go-control-plane v0.11.1-0.20230524094728-9239064ad72f // indirect @@ -173,6 +172,7 @@ require ( github.com/go-stack/stack v1.8.1 // indirect github.com/go-zookeeper/zk v1.0.3 // indirect github.com/gobwas/glob v0.2.3 // indirect + github.com/goccy/go-json v0.10.2 // indirect github.com/godbus/dbus/v5 v5.0.6 // indirect github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -182,19 +182,19 @@ require ( github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/cadvisor v0.47.3 // indirect - github.com/google/gnostic v0.6.9 // indirect + github.com/google/gnostic-models v0.6.8 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/google/gofuzz v1.2.0 // indirect - github.com/google/s2a-go v0.1.4 // indirect - github.com/google/uuid v1.3.0 // indirect + github.com/google/s2a-go v0.1.5 // indirect + github.com/google/uuid v1.3.1 // indirect github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect github.com/googleapis/gax-go/v2 v2.12.0 // indirect github.com/gophercloud/gophercloud v1.3.0 // indirect github.com/gorilla/mux v1.8.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/grafana/regexp v0.0.0-20221122212121-6b5c0a4cb7fd // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.2 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.17.1 // indirect github.com/hashicorp/consul/api v1.24.0 // indirect github.com/hashicorp/cronexpr v1.1.1 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect @@ -217,7 +217,7 @@ require ( github.com/jcmturner/aescts/v2 v2.0.0 // indirect github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect github.com/jcmturner/gofork v1.7.6 // indirect - github.com/jcmturner/gokrb5/v8 v8.4.3 // indirect + github.com/jcmturner/gokrb5/v8 v8.4.4 // indirect github.com/jcmturner/rpc/v2 v2.0.3 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect @@ -249,35 +249,36 @@ require ( github.com/mrunalp/fileutils v0.5.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/cwlogs v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/ecsutil v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/k8s v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/metrics v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/proxy v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/kubelet v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/metadataproviders v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/splunk v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchperresourceattr v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchpersignal v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/experimentalmetricmetadata v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/signalfx v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/zipkin v0.83.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/cwlogs v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/ecsutil v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/k8s v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/metrics v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/proxy v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/kubelet v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/metadataproviders v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/splunk v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchperresourceattr v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchpersignal v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/experimentalmetricmetadata v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/signalfx v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/zipkin v0.84.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc4 // indirect + github.com/opencontainers/runc v1.1.8 // indirect github.com/opencontainers/runtime-spec v1.1.0-rc.3 // indirect github.com/opencontainers/selinux v1.10.0 // indirect github.com/openshift/api v3.9.0+incompatible // indirect @@ -288,7 +289,7 @@ require ( github.com/ovh/go-ovh v1.4.1 // indirect github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/philhofer/fwd v1.1.2 // indirect - github.com/pierrec/lz4/v4 v4.1.17 // indirect + github.com/pierrec/lz4/v4 v4.1.18 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c // indirect github.com/prometheus/client_golang v1.16.0 // indirect @@ -332,20 +333,20 @@ require ( github.com/xdg-go/stringprep v1.0.4 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/collector/config/configauth v0.83.0 // indirect - go.opentelemetry.io/collector/config/configcompression v0.83.0 // indirect - go.opentelemetry.io/collector/config/configgrpc v0.83.0 // indirect - go.opentelemetry.io/collector/config/confighttp v0.83.0 // indirect - go.opentelemetry.io/collector/config/confignet v0.83.0 // indirect - go.opentelemetry.io/collector/config/configopaque v0.83.0 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.83.0 // indirect - go.opentelemetry.io/collector/config/configtls v0.83.0 // indirect - go.opentelemetry.io/collector/config/internal v0.83.0 // indirect - go.opentelemetry.io/collector/connector v0.83.0 // indirect - go.opentelemetry.io/collector/consumer v0.83.0 // indirect - go.opentelemetry.io/collector/extension/auth v0.83.0 // indirect + go.opentelemetry.io/collector/config/configauth v0.84.0 // indirect + go.opentelemetry.io/collector/config/configcompression v0.84.0 // indirect + go.opentelemetry.io/collector/config/configgrpc v0.84.0 // indirect + go.opentelemetry.io/collector/config/confighttp v0.84.0 // indirect + go.opentelemetry.io/collector/config/confignet v0.84.0 // indirect + go.opentelemetry.io/collector/config/configopaque v0.84.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.84.0 // indirect + go.opentelemetry.io/collector/config/configtls v0.84.0 // indirect + go.opentelemetry.io/collector/config/internal v0.84.0 // indirect + go.opentelemetry.io/collector/connector v0.84.0 // indirect + go.opentelemetry.io/collector/consumer v0.84.0 // indirect + go.opentelemetry.io/collector/extension/auth v0.84.0 // indirect go.opentelemetry.io/collector/pdata v1.0.0-rcv0014 // indirect - go.opentelemetry.io/collector/semconv v0.83.0 // indirect + go.opentelemetry.io/collector/semconv v0.84.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.1-0.20230612162650-64be7e574a17 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0 // indirect go.opentelemetry.io/contrib/propagators/b3 v1.17.0 // indirect @@ -356,6 +357,9 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.39.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.39.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.16.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.39.0 // indirect go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.39.0 // indirect go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.16.0 // indirect @@ -367,7 +371,7 @@ require ( go.uber.org/atomic v1.11.0 // indirect go.uber.org/goleak v1.2.1 // indirect golang.org/x/crypto v0.12.0 // indirect - golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect + golang.org/x/exp v0.0.0-20230711023510-fffb14384f22 // indirect golang.org/x/mod v0.12.0 // indirect golang.org/x/net v0.14.0 // indirect golang.org/x/oauth2 v0.11.0 // indirect @@ -375,12 +379,12 @@ require ( golang.org/x/text v0.12.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.12.0 // indirect - gonum.org/v1/gonum v0.13.0 // indirect - google.golang.org/api v0.136.0 // indirect + gonum.org/v1/gonum v0.14.0 // indirect + google.golang.org/api v0.138.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230807174057-1744710a1577 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect google.golang.org/grpc v1.57.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect @@ -388,13 +392,13 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/zorkian/go-datadog-api.v2 v2.30.0 // indirect - k8s.io/api v0.27.4 // indirect - k8s.io/apimachinery v0.27.4 // indirect - k8s.io/client-go v0.27.4 // indirect + k8s.io/api v0.28.1 // indirect + k8s.io/apimachinery v0.28.1 // indirect + k8s.io/client-go v0.28.1 // indirect k8s.io/klog v1.0.0 // indirect - k8s.io/klog/v2 v2.90.1 // indirect - k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect - k8s.io/utils v0.0.0-20230308161112-d77c459e9343 // indirect + k8s.io/klog/v2 v2.100.1 // indirect + k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect + k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect sigs.k8s.io/controller-runtime v0.15.1 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect diff --git a/go.sum b/go.sum index a3da9a8d2..0ba8cc5f7 100644 --- a/go.sum +++ b/go.sum @@ -113,8 +113,8 @@ github.com/DataDog/datadog-agent/pkg/util/pointer v0.48.0-beta.1 h1:detMhMfwchco github.com/DataDog/datadog-agent/pkg/util/pointer v0.48.0-beta.1/go.mod h1:HMpYpkuxDFYuYLjDTKoG0NjtPoAwIymvBEhlA3pJbJk= github.com/DataDog/datadog-agent/pkg/util/scrubber v0.48.0-beta.1 h1:EOrKgyyubncuS4LpF8aCj/12i1+GmPV+PCfj8mDaF2c= github.com/DataDog/datadog-agent/pkg/util/scrubber v0.48.0-beta.1/go.mod h1:Whfh1SJOwtp2YvDUNzqw/jmSbGOOso+HJHOEJULh1+M= -github.com/DataDog/datadog-api-client-go/v2 v2.14.0 h1:cLkqg/D63I6BAxIIg6g8xMWjrAMXcvb5vbD8ixOVVyo= -github.com/DataDog/datadog-api-client-go/v2 v2.14.0/go.mod h1:kntOqXEh1SmjwSDzW/eJkr9kS7EqttvEkelglWtJRbg= +github.com/DataDog/datadog-api-client-go/v2 v2.16.0 h1:wwroXLmBlO5/o+uS1UxDpuMIkhIL6gJAu6m0ttGM5Yc= +github.com/DataDog/datadog-api-client-go/v2 v2.16.0/go.mod h1:uJd7G1BONVIyiVw684VMn2XYI1FfN1tx4bRGenAf2bo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/datadog-go/v5 v5.1.1 h1:JLZ6s2K1pG2h9GkvEvMdEGqMDyVLEAccdX5TltWcLMU= github.com/DataDog/datadog-go/v5 v5.1.1/go.mod h1:KhiYb2Badlv9/rofz+OznKoEF5XKTonWyhx5K83AP8E= @@ -140,15 +140,15 @@ github.com/DataDog/zstd v1.4.4/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t github.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8= github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.18.0 h1:ugYJK/neZQtQeh2jc5xNoDFiMQojlAkoqJMRb7vTu1U= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.18.0/go.mod h1:Xx0VKh7GJ4si3rmElbh19Mejxz68ibWg/J30ZOMrqzU= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.19.1 h1:LyRJCTBJP53P1JURFbhFSRz36gxaBtMAjzjlYupNR7Q= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.19.1/go.mod h1:Xx0VKh7GJ4si3rmElbh19Mejxz68ibWg/J30ZOMrqzU= github.com/HdrHistogram/hdrhistogram-go v0.9.0/go.mod h1:nxrse8/Tzg2tg3DZcZjm6qEclQKK70g0KxO61gFFZD4= github.com/HdrHistogram/hdrhistogram-go v1.0.1/go.mod h1:BWJ+nMSHY3L41Zj7CA3uXnloDp7xxV0YvstAE7nKTaM= github.com/HdrHistogram/hdrhistogram-go v1.1.0/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= github.com/HdrHistogram/hdrhistogram-go v1.1.2 h1:5IcZpTvzydCQeHzK4Ef/D5rrSqwxob0t8PQPMybUNFM= github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= -github.com/IBM/sarama v1.40.1 h1:lL01NNg/iBeigUbT+wpPysuTYW6roHo6kc1QrffRf0k= -github.com/IBM/sarama v1.40.1/go.mod h1:+5OFwA5Du9I6QrznhaMHsuwWdWZNMjaBSIxEWEgKOYE= +github.com/IBM/sarama v1.41.0 h1:c+fV23/HDO+M88dTYFg7TFRlxU0scgfdcFrQh/8s5Z8= +github.com/IBM/sarama v1.41.0/go.mod h1:JFCPURVskaipJdKRFkiE/OZqQHw7jqliaJmRwXCmSSw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= @@ -166,10 +166,8 @@ github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdko github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/sarama v1.22.2-0.20190604114437-cd910a683f9f/go.mod h1:XLH1GYJnLVE0XCr6KdJGVJRTwY30moWNJ4sERjXX6fs= github.com/Shopify/sarama v1.32.0/go.mod h1:+EmJJKZWVT/faR9RcOxJerP+LId4iWdQPBGLy1Y1Njs= -github.com/Shopify/toxiproxy v2.1.4+incompatible h1:TKdv8HiTLgE5wdJuEML90aBgNWsokNbMijUGhmcoBJc= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/Shopify/toxiproxy/v2 v2.3.0/go.mod h1:KvQTtB6RjCJY4zqNJn7C7JDFgsG5uoHYDirfUfpIm0c= -github.com/Shopify/toxiproxy/v2 v2.5.0 h1:i4LPT+qrSlKNtQf5QliVjdP08GyAH8+BUIc9gT0eahc= github.com/Showmax/go-fqdn v1.0.0 h1:0rG5IbmVliNT5O19Mfuvna9LL7zlHyRfsSvBPZmF9tM= github.com/Showmax/go-fqdn v1.0.0/go.mod h1:SfrFBzmDCtCGrnHhoDjuvFnKsWjEQX/Q9ARZvOrJAko= github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= @@ -195,8 +193,8 @@ github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/antonmedv/expr v1.9.0/go.mod h1:5qsM3oLGDND7sDmQGDXHkYfkjYMUX14qsgqmHhwGEk8= -github.com/antonmedv/expr v1.13.0 h1:8YrTtlCzlOtXw+hpeCLDLL2uo0C0k6jmYpYTGws5c5w= -github.com/antonmedv/expr v1.13.0/go.mod h1:FPC8iWArxls7axbVLsW+kpg1mz29A1b2M6jt+hZfDkU= +github.com/antonmedv/expr v1.14.3 h1:GPrP7xKPWkFaLANPS7tPrgkNs7FMHpZdL72Dc5kFykg= +github.com/antonmedv/expr v1.14.3/go.mod h1:FPC8iWArxls7axbVLsW+kpg1mz29A1b2M6jt+hZfDkU= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.16.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU= @@ -225,35 +223,35 @@ github.com/aws/aws-sdk-go v1.35.24/go.mod h1:tlPOdRjfxPBpNIwqDj61rmsnA85v9jc0Ps9 github.com/aws/aws-sdk-go v1.38.35/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/aws/aws-sdk-go v1.38.68/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/aws/aws-sdk-go v1.40.45/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= -github.com/aws/aws-sdk-go v1.44.323 h1:97/dn93DWrN1VfhAWQ2tV+xuE6oO/LO9rSsEsuC4PLU= -github.com/aws/aws-sdk-go v1.44.323/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.44.333 h1:X0j5TGXtHLZzDB/uRcGKLG77ERFtxYQtXefs+Apf2PU= +github.com/aws/aws-sdk-go v1.44.333/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= github.com/aws/aws-sdk-go-v2 v1.7.0/go.mod h1:tb9wi5s61kTDA5qCkcDbt3KRVV74GGslQkl/DRdX/P4= github.com/aws/aws-sdk-go-v2 v1.9.1/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4= github.com/aws/aws-sdk-go-v2 v1.9.2/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4= github.com/aws/aws-sdk-go-v2 v1.11.0/go.mod h1:SQfA+m2ltnu1cA0soUkj4dRSsmITiVQUJvBIZjzfPyQ= -github.com/aws/aws-sdk-go-v2 v1.20.1 h1:rZBf5DWr7YGrnlTK4kgDQGn1ltqOg5orCYb/UhOFZkg= -github.com/aws/aws-sdk-go-v2 v1.20.1/go.mod h1:NU06lETsFm8fUC6ZjhgDpVBcGZTFQ6XM+LZWZxMI4ac= +github.com/aws/aws-sdk-go-v2 v1.21.0 h1:gMT0IW+03wtYJhRqTVYn0wLzwdnK9sRMcxmtfGzRdJc= +github.com/aws/aws-sdk-go-v2 v1.21.0/go.mod h1:/RfNgGmRxI+iFOB1OeJUyxiU+9s88k3pfHvDagGEp0M= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.0.0 h1:yVUAwvJC/0WNPbyl0nA3j1L6CW1CN8wBubCRqtG7JLI= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.0.0/go.mod h1:Xn6sxgRuIDflLRJFj5Ev7UxABIkNbccFPV/p8itDReM= github.com/aws/aws-sdk-go-v2/config v1.8.3/go.mod h1:4AEiLtAb8kLs7vgw2ZV3p2VZ1+hBavOc84hqxVNpCyw= -github.com/aws/aws-sdk-go-v2/config v1.18.33 h1:JKcw5SFxFW/rpM4mOPjv0VQ11E2kxW13F3exWOy7VZU= -github.com/aws/aws-sdk-go-v2/config v1.18.33/go.mod h1:hXO/l9pgY3K5oZJldamP0pbZHdPqqk+4/maa7DSD3cA= +github.com/aws/aws-sdk-go-v2/config v1.18.37 h1:RNAfbPqw1CstCooHaTPhScz7z1PyocQj0UL+l95CgzI= +github.com/aws/aws-sdk-go-v2/config v1.18.37/go.mod h1:8AnEFxW9/XGKCbjYDCJy7iltVNyEI9Iu9qC21UzhhgQ= github.com/aws/aws-sdk-go-v2/credentials v1.4.3/go.mod h1:FNNC6nQZQUuyhq5aE5c7ata8o9e4ECGmS4lAXC7o1mQ= -github.com/aws/aws-sdk-go-v2/credentials v1.13.32 h1:lIH1eKPcCY1ylR4B6PkBGRWMHO3aVenOKJHWiS4/G2w= -github.com/aws/aws-sdk-go-v2/credentials v1.13.32/go.mod h1:lL8U3v/Y79YRG69WlAho0OHIKUXCyFvSXaIvfo81sls= +github.com/aws/aws-sdk-go-v2/credentials v1.13.35 h1:QpsNitYJu0GgvMBLUIYu9H4yryA5kMksjeIVQfgXrt8= +github.com/aws/aws-sdk-go-v2/credentials v1.13.35/go.mod h1:o7rCaLtvK0hUggAGclf76mNGGkaG5a9KWlp+d9IpcV8= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.6.0/go.mod h1:gqlclDEZp4aqJOancXK6TN24aKhT0W0Ae9MHk3wzTMM= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.8 h1:DK/9C+UN/X+1+Wm8pqaDksQr2tSLzq+8X1/rI/ZxKEQ= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.8/go.mod h1:ce7BgLQfYr5hQFdy67oX2svto3ufGtm6oBvmsHScI1Q= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11 h1:uDZJF1hu0EVT/4bogChk8DyjSF6fof6uL/0Y26Ma7Fg= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11/go.mod h1:TEPP4tENqBGO99KwVpV9MlOX4NSrSLP8u3KRy2CDwA8= github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.0/go.mod h1:NO3Q5ZTTQtO2xIg2+xTXYDiT7knSejfeDm7WGDaOo0U= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.38 h1:c8ed/T9T2K5I+h/JzmF5tpI46+OODQ74dzmdo+QnaMg= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.38/go.mod h1:qggunOChCMu9ZF/UkAfhTz25+U2rLVb3ya0Ua6TTfCA= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41 h1:22dGT7PneFMx4+b3pz7lMTRyN8ZKH7M2cW4GP9yUS2g= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41/go.mod h1:CrObHAuPneJBlfEJ5T3szXOUkLEThaGfvnhTf33buas= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.0.0/go.mod h1:anlUzBoEWglcUxUQwZA7HQOEVEnQALVZsizAapB2hq8= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.32 h1:hNeAAymUY5gu11WrrmFb3CVIp9Dar9hbo44yzzcQpzA= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.32/go.mod h1:0ZXSqrty4FtQ7p8TEuRde/SZm9X05KT18LAUlR40Ln0= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35 h1:SijA0mgjV8E+8G45ltVHs0fvKpTj8xmZJ3VwhGKtUSI= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35/go.mod h1:SJC1nEVVva1g3pHAIdCp7QsRIkMmLAgoDquQ9Rr8kYw= github.com/aws/aws-sdk-go-v2/internal/ini v1.2.4/go.mod h1:ZcBrrI3zBKlhGFNYWvju0I3TR93I7YIgAfy82Fh4lcQ= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.39 h1:fc0ukRAiP1syoSGZYu+DaE+FulSYhTiJ8WpVu5jElU4= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.39/go.mod h1:WLAW8PT7+JhjZfLSWe7WEJaJu0GNo0cKc2Zyo003RBs= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.42 h1:GPUcE/Yq7Ur8YSUk6lVkoIMWnJNO0HT18GUzCWCgCI0= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.42/go.mod h1:rzfdUlfA+jdgLDmPKjd3Chq9V7LVLYo1Nz++Wb91aRo= github.com/aws/aws-sdk-go-v2/service/appconfig v1.4.2/go.mod h1:FZ3HkCe+b10uFZZkFdvf98LHW21k49W8o8J366lqVKY= github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.5.0/go.mod h1:acH3+MQoiMzozT/ivU+DbRg7Ooo2298RdRaWcOv+4vM= github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.8.1/go.mod h1:CM+19rL1+4dFWnOQKwDc7H1KwXTz+h61oUSHyhV0b3o= @@ -261,25 +259,25 @@ github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.5.0 h1:lPLbw4Gn github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.5.0/go.mod h1:80NaCIH9YU3rzTTs/J/ECATjXuRqzo/wB6ukO6MZ0XY= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.3.2/go.mod h1:72HRZDLMtmVQiLG2tLfQcaWLCssELvGl+Zf2WVxMmR8= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.5.0/go.mod h1:Mq6AEc+oEjCUlBuLiK5YwW4shSOAKCQ3tXN0sQeYoBA= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.32 h1:dGAseBFEYxth10V23b5e2mAS+tX7oVbfYHD6dnDdAsg= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.32/go.mod h1:4jwAWKEkCR0anWk5+1RbfSg1R5Gzld7NLiuaq5bTR/Y= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.35 h1:CdzPW9kKitgIiLV1+MHobfR5Xg25iYnyzWZhyQuSlDI= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.35/go.mod h1:QGF2Rs33W5MaN9gYdEQOBBFPLwTZkEhRwI33f7KIG0o= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.9.0 h1:0BOlTqnNnrEO04oYKzDxMMe68t107pmIotn18HtVonY= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.9.0/go.mod h1:xKCZ4YFSF2s4Hnb/J0TLeOsKuGzICzcElaOKNGrVnx4= github.com/aws/aws-sdk-go-v2/service/s3 v1.19.0 h1:5mRAms4TjSTOGYsqKYte5kHr1PzpMJSyLThjF3J+hw0= github.com/aws/aws-sdk-go-v2/service/s3 v1.19.0/go.mod h1:Gwz3aVctJe6mUY9T//bcALArPUaFmNAy2rTB9qN4No8= github.com/aws/aws-sdk-go-v2/service/sso v1.4.2/go.mod h1:NBvT9R1MEF+Ud6ApJKM0G+IkPchKS7p7c2YPKwHmBOk= -github.com/aws/aws-sdk-go-v2/service/sso v1.13.2 h1:A2RlEMo4SJSwbNoUUgkxTAEMduAy/8wG3eB2b2lP4gY= -github.com/aws/aws-sdk-go-v2/service/sso v1.13.2/go.mod h1:ju+nNXUunfIFamXUIZQiICjnO/TPlOmWcYhZcSy7xaE= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.15.2 h1:OJELEgyaT2kmaBGZ+myyZbTTLobfe3ox3FSh5eYK9Qs= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.15.2/go.mod h1:ubDBBaDFs1GHijSOTi8ljppML15GLG0HxhILtbjNNYQ= +github.com/aws/aws-sdk-go-v2/service/sso v1.13.5 h1:oCvTFSDi67AX0pOX3PuPdGFewvLRU2zzFSrTsgURNo0= +github.com/aws/aws-sdk-go-v2/service/sso v1.13.5/go.mod h1:fIAwKQKBFu90pBxx07BFOMJLpRUGu8VOzLJakeY+0K4= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.15.5 h1:dnInJb4S0oy8aQuri1mV6ipLlnZPfnsDNB9BGO9PDNY= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.15.5/go.mod h1:yygr8ACQRY2PrEcy3xsUI357stq2AxnFM6DIsR9lij4= github.com/aws/aws-sdk-go-v2/service/sts v1.7.2/go.mod h1:8EzeIqfWt2wWT4rJVu3f21TfrhJ8AEMzVybRNSb/b4g= -github.com/aws/aws-sdk-go-v2/service/sts v1.21.2 h1:ympg1+Lnq33XLhcK/xTG4yZHPs1Oyxu+6DEWbl7qOzA= -github.com/aws/aws-sdk-go-v2/service/sts v1.21.2/go.mod h1:FQ/DQcOfESELfJi5ED+IPPAjI5xC6nxtSolVVB773jM= +github.com/aws/aws-sdk-go-v2/service/sts v1.21.5 h1:CQBFElb0LS8RojMJlxRSo/HXipvTZW2S44Lt9Mk2aYQ= +github.com/aws/aws-sdk-go-v2/service/sts v1.21.5/go.mod h1:VC7JDqsqiwXukYEDjoHh9U0fOJtNWh04FPQz4ct4GGU= github.com/aws/smithy-go v1.5.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= github.com/aws/smithy-go v1.9.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= -github.com/aws/smithy-go v1.14.1 h1:EFKMUmH/iHMqLiwoEDx2rRjRQpI1YCn5jTysoaDujFs= -github.com/aws/smithy-go v1.14.1/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= +github.com/aws/smithy-go v1.14.2 h1:MJU9hqBGbvWZdApzpvoF2WAIJDbtjK2NDJSiJP7HblQ= +github.com/aws/smithy-go v1.14.2/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -297,7 +295,6 @@ github.com/bmatcuk/doublestar/v4 v4.6.0 h1:HTuxyug8GyFbRkrffIpzNCSK4luc0TY3wzXvz github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/bombsimon/wsl/v3 v3.2.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc= github.com/bsm/sarama-cluster v2.1.13+incompatible/go.mod h1:r7ao+4tTNXvWm+VRpRJchr2kQhqxgmAp2iEX5W96gMM= -github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/casbin/casbin/v2 v2.31.6/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg= github.com/casbin/casbin/v2 v2.37.0/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg= @@ -421,11 +418,11 @@ github.com/dynatrace-oss/dynatrace-metric-utils-go v0.5.0 h1:wHGPJSXvwKQVf/XfhjU github.com/dynatrace-oss/dynatrace-metric-utils-go v0.5.0/go.mod h1:PseHFo8Leko7J4A/TfZ6kkHdkzKBLUta6hRZR/OEbbc= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-resiliency v1.2.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= -github.com/eapache/go-resiliency v1.3.0 h1:RRL0nge+cWGlxXbUzJ7yMcq6w2XBEr19dCN6HECGaT0= -github.com/eapache/go-resiliency v1.3.0/go.mod h1:5yPzW0MIvSe0JDsv0v+DvcjEv2FyD6iZYSs1ZI+iQho= +github.com/eapache/go-resiliency v1.4.0 h1:3OK9bWpPk5q6pbFAaYSEwD9CLUSHG8bnZuqX2yMt3B0= +github.com/eapache/go-resiliency v1.4.0/go.mod h1:5yPzW0MIvSe0JDsv0v+DvcjEv2FyD6iZYSs1ZI+iQho= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= -github.com/eapache/go-xerial-snappy v0.0.0-20230111030713-bf00bc1b83b6 h1:8yY/I9ndfrgrXUbOGObLHKBR4Fl3nZXwM2c7OYTT8hM= -github.com/eapache/go-xerial-snappy v0.0.0-20230111030713-bf00bc1b83b6/go.mod h1:YvSRo5mw33fLEx1+DlK6L2VV43tJt5Eyel9n9XBcR+0= +github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 h1:Oy0F4ALJ04o5Qqpdz8XLIpNA3WM/iSIXqxtqo7UGVws= +github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3/go.mod h1:YvSRo5mw33fLEx1+DlK6L2VV43tJt5Eyel9n9XBcR+0= github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= @@ -472,7 +469,6 @@ github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSw github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/flowstack/go-jsonschema v0.1.1/go.mod h1:yL7fNggx1o8rm9RlgXv7hTBWxdBM0rVwpMwimd3F3N0= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= @@ -665,6 +661,8 @@ github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/V github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= +github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= +github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/gocql/gocql v0.0.0-20200228163523-cd4b606dd2fb/go.mod h1:DL0ekTmBSTdlNF25Orwt/JMzqIq3EJ4MVa/J/uK64OY= github.com/gocql/gocql v0.0.0-20211222173705-d73e6b1002a7/go.mod h1:3gM2c4D3AnkISwBxGnMMsS8Oy4y2lhbPRsH4xnJrHG8= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -746,8 +744,8 @@ github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= github.com/google/cadvisor v0.47.3 h1:5XKTHBduWlBjmgw07uwEiC+Xa/FRd0MZI37oqlTagO0= github.com/google/cadvisor v0.47.3/go.mod h1:iJdTjcjyKHjLCf7OSTzwP5GxdfrkPusw2x5bwGvuLUw= github.com/google/flatbuffers v1.12.1/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= -github.com/google/gnostic v0.6.9 h1:ZK/5VhkoX835RikCHpSUJV9a+S3e1zLh59YnyWeBW+0= -github.com/google/gnostic v0.6.9/go.mod h1:Nm8234We1lq6iB9OmlgNv3nH91XLLVZHCDayfA3xq+E= +github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= +github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -791,13 +789,14 @@ github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20230406165453-00490a63f317 h1:hFhpt7CTmR3DX+b4R19ydQFtofxT0Sv3QsKNMVQYTMQ= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= -github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= +github.com/google/s2a-go v0.1.5 h1:8IYp3w9nysqv3JH+NJgXJzGbDHzLOTj43BmSkp+O7qg= +github.com/google/s2a-go v0.1.5/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.2.5 h1:UR4rDjcgpgEnqpIEvkiqTYKBCKLNmlge2eVjoZfySzM= github.com/googleapis/enterprise-certificate-proxy v0.2.5/go.mod h1:RxW0N9901Cko1VOCW3SXCpWP+mlIEkk2tP7jnHy9a3w= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= @@ -854,8 +853,8 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t github.com/grpc-ecosystem/grpc-gateway v1.14.5/go.mod h1:UJ0EZAp832vCd54Wev9N1BMKEyvcZ5+IM0AwDrnlkEc= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.2 h1:dygLcbEBA+t/P7ck6a8AkXv6juQ4cK0RHBoh32jxhHM= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.2/go.mod h1:Ap9RLCIJVtgQg1/BBgVEfypOAySvvlcpcVQkSzJCH4Y= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.17.1 h1:LSsiG61v9IzzxMkqEr6nrix4miJI62xlRjwT7BYD2SM= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.17.1/go.mod h1:Hbb13e3/WtqQ8U5hLGkek9gJvBLasHuPFI0UEGfnQ10= github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645/go.mod h1:6iZfnjpejD4L/4DwD7NryNaJyCQdzwWwH2MWhCA90Kw= github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= @@ -995,8 +994,8 @@ github.com/jcmturner/gofork v1.7.6/go.mod h1:1622LH6i/EZqLloHfE7IeZ0uEJwMSUyQ/nD github.com/jcmturner/goidentity/v6 v6.0.1 h1:VKnZd2oEIMorCTsFBnJWbExfNN7yZr3EhJAxwOkZg6o= github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg= github.com/jcmturner/gokrb5/v8 v8.4.2/go.mod h1:sb+Xq/fTY5yktf/VxLsE3wlfPqQjp0aWNYyvBVK62bc= -github.com/jcmturner/gokrb5/v8 v8.4.3 h1:iTonLeSJOn7MVUtyMT+arAn5AKAPrkilzhGw8wE/Tq8= -github.com/jcmturner/gokrb5/v8 v8.4.3/go.mod h1:dqRwJGXznQrzw6cWmyo6kH+E7jksEQG/CyVWsJEsJO0= +github.com/jcmturner/gokrb5/v8 v8.4.4 h1:x1Sv4HaTpepFkXbt2IkL29DXRf8sOfZXo8eRKh687T8= +github.com/jcmturner/gokrb5/v8 v8.4.4/go.mod h1:1btQEpgT6k+unzCwX1KdWMEwPPkkgBtP+F6aCACiMrs= github.com/jcmturner/rpc/v2 v2.0.3 h1:7FXXj8Ti1IaVFpSAziCZWNzbNuZmnvw/i6CqLNdWfZY= github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc= github.com/jgautheron/goconst v1.4.0/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= @@ -1284,151 +1283,151 @@ github.com/onsi/gomega v1.10.4/go.mod h1:g/HbgYopi++010VEqkFgJHKC09uJiW9UkXvMUuK github.com/onsi/gomega v1.13.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je41yGY= github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= -github.com/open-telemetry/opentelemetry-collector-contrib/confmap/provider/s3provider v0.83.0 h1:9AN4dtHA4C8abrNBowBq7CwcrfzAOqkHVzgIe+mi3EM= -github.com/open-telemetry/opentelemetry-collector-contrib/confmap/provider/s3provider v0.83.0/go.mod h1:XQUP9bBRZu4XetB4Pok8qjaWh+hdBnmxriITOuwfUPM= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsemfexporter v0.83.0 h1:xuJ7AgUJqHqBWaFNeph0fjID+4+KgBgv16RJr0WgfMA= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsemfexporter v0.83.0/go.mod h1:3aJHSLrF4WO2LecdoPBcbKeCKhYVONPersDFOMLy1Vs= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.83.0 h1:gnc6xAyFcjhP8C3ebKXSyJHPinM+n2aiT507qfFxGWU= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.83.0/go.mod h1:n3ry12plQOS4XbIYpyeqHJKVl1y7eVZSLKt2M7v00Dk= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter v0.83.0 h1:RahPWJc7FILuSw6Nr5LjjFqhzhRoVp4iiPMQppUnA+0= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter v0.83.0/go.mod h1:OxipJxncCOdyxT1rPl+iVHRAov5JepMgJ9NkuAPmJgM= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/dynatraceexporter v0.83.0 h1:ZSrG3KAWvc4fZA0LPj+uv1qwpovVuWDXaj18ERayib4= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/dynatraceexporter v0.83.0/go.mod h1:eeaXESKotV8YV/2Rv4vJ+VAJ3bkcq4WKGWEz9AkZMMk= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/fileexporter v0.83.0 h1:GoOSCUUy3pNrVfu1sCzXQCr1/dKDFtgYBza6gCaMsfI= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/fileexporter v0.83.0/go.mod h1:vw5V9r2TOdcnL1kAIVARKtEa67rE90qEm0AH/eS7s/Y= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter v0.83.0 h1:UY9GbD8VBY//agLPuCejj/Fqjf1uAWqT5LCpv11UcDY= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter v0.83.0/go.mod h1:33K8WHr2YXDG1/vK+01BiMefL2Jjwrt4c4zli3Vqp8o= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/loadbalancingexporter v0.83.0 h1:LzwGcOtWKNEoLsyZ8B7fdb73x7zEbyz5ghVdkpJqANg= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/loadbalancingexporter v0.83.0/go.mod h1:fLGts4FyYaBEIxp+7Ag35Gq0bEks5L0tu2qhRFi/3KY= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/logzioexporter v0.83.0 h1:zuOyT4t0uB0Sqw4PnsOezXUyOn+kWp+HslxAiGmB5HE= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/logzioexporter v0.83.0/go.mod h1:09NFg+NzQA8p1CqVSuW52HZHNvdOIFVrSV17UANM9KI= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusexporter v0.83.0 h1:GUovWPxEil/VpfkfPp9KBmidnZHX9SdD5vsfqzcssCM= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusexporter v0.83.0/go.mod h1:zHOElC2vEg1cUv2P2Pwgd/YhYJTQEbOpJohpoZGWRfk= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter v0.83.0 h1:980Ae/Y7mZndgWhngpEi8u5KIVFYQIF4NFpkLEqCZEI= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter v0.83.0/go.mod h1:u2DDzR8+AdbeeMf7o47qqVQcPfX8bzm42/VAq7I1E2s= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/sapmexporter v0.83.0 h1:8qQgO1UgutKov4JFFIEf0WNS1moXK6c+z2vznQNcyf0= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/sapmexporter v0.83.0/go.mod h1:KkzODSIS07pR9yIYXyq1+CvEDILRIv5R7RmemG6w36c= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/signalfxexporter v0.83.0 h1:s2lJhFQl2QTKFNnab9Wk+9hIPOUV2dLV3TQ8GoT+yKI= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/signalfxexporter v0.83.0/go.mod h1:M8tIfUA1ULvRZp4wt5yTWI3dfJ9KMNEQmdyHlCxjaX4= -github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsproxy v0.83.0 h1:lOlIrn4npBaOTnJpjvH+MzqOjusgwmcEmtKGcTWmCzk= -github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsproxy v0.83.0/go.mod h1:YXAQndCP4LY42rn22ELjjnTmqbsxS2yrVerAzsCisQg= -github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension v0.83.0 h1:Kjh+MVsvlV/vmgwnN667ln57kQiz6ZfYxyk+IONS5lA= -github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension v0.83.0/go.mod h1:CMhTUJ14v2P/roC9GrV7fdVS7MCtXwOjw+JprJrfFKM= -github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer/ecsobserver v0.83.0 h1:0mq2UIQlFGuaZANvXaYyMISx44Ft0OEaMR1ByOjhdDk= -github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer/ecsobserver v0.83.0/go.mod h1:ds5yO3Gq5QF5x/lT3zYbQoQCrXdBfTVhYpAV+xINUG8= -github.com/open-telemetry/opentelemetry-collector-contrib/extension/pprofextension v0.83.0 h1:zrwghw5g2Ma5u+mGo/PyodymkAQiAcPLs4Quq4MAZoU= -github.com/open-telemetry/opentelemetry-collector-contrib/extension/pprofextension v0.83.0/go.mod h1:WQ5L7YwarCjW6beHMZy+2g/+HfD9WQOooTiwoQcQR/g= -github.com/open-telemetry/opentelemetry-collector-contrib/extension/sigv4authextension v0.83.0 h1:jM9FjwI22dpD+p/0In2FA8ZVlH9EWiH5gJw8dUMQ3Ik= -github.com/open-telemetry/opentelemetry-collector-contrib/extension/sigv4authextension v0.83.0/go.mod h1:rNSAmQoUAr5c0KpbxBulgo52csvKoM+qKueLFC9ayvA= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil v0.83.0 h1:K2rND8mgBGWDqFsBwjKdphBTBjjbBkcw84lkDVvv/ls= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil v0.83.0/go.mod h1:0pvuvcSdAJ7RopqLmtg1/DPpZH+xazbMACKMVHalCoo= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight v0.83.0 h1:d9Wvwut7FoNSxfXF5SJABNppu9xGxQnf+I1IuBnGIjM= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight v0.83.0/go.mod h1:jxeFqzSwMrDmEGPyCGhCyHY+6J+fA/jXRoa4CEzZ/W8= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/cwlogs v0.83.0 h1:RDQ862swYY3oAqtQE5UEf3gVo2K6STG76CgBurJIY08= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/cwlogs v0.83.0/go.mod h1:u2XpS95ZgRXO8yrTjw6eX9IesTd5aNANP/x3jVIrqc8= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/ecsutil v0.83.0 h1:pBdqndULnylTtLYo9Zg3C29FNZNMniZXIj31jYfjcTI= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/ecsutil v0.83.0/go.mod h1:BsWcWAne29O8gfMOvkPR4+OTshTvqpg+3ERZS2hnFNQ= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/k8s v0.83.0 h1:WrSJTAoVnqL74klHYl+ylGcWzw5B/iuHsICDG4Wg+pg= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/k8s v0.83.0/go.mod h1:gGNH996LguY9CzDK7xyPqjCPJkfRKg8Y3WZA0jgnw00= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/metrics v0.83.0 h1:1QgMSYj3rKm3BftrCSDVIf+zXYxdv3NNCkI+/zePTQM= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/metrics v0.83.0/go.mod h1:WAScm+oitM87OWSy+pPAC6eCzg3xhYz3VBSef2+zV60= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/proxy v0.83.0 h1:ovGXkuMEqzGjDAU+CC7BeAsTL/qwmmOJhkWrv1AmA1U= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/proxy v0.83.0/go.mod h1:zhysB7B8qSgvKI+TvNqAELwdCQ7I26IzuFNAWC+tILg= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray v0.83.0 h1:PLzi6IkVCbnNc3dyrmBSBqEng87LWCNca2np21XI2hQ= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray v0.83.0/go.mod h1:WWKANqgoMjOyn8yKjF1oEhpss9bmfiyWH1+mkE/y9m4= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.83.0 h1:pzq9yVMgLzeo8ZsgtjDzsR+B/dt+Fc3FROAu9SV+Qu4= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.83.0/go.mod h1:6XJ+dV/QjwFJf55/2nnVfVqA+qwa8Y/iYR6taPJN7n0= +github.com/open-telemetry/opentelemetry-collector-contrib/confmap/provider/s3provider v0.84.0 h1:HsmmlynJLwC8PT0p6dVZW+x3FI9d7he4Z/w9G32Nn04= +github.com/open-telemetry/opentelemetry-collector-contrib/confmap/provider/s3provider v0.84.0/go.mod h1:Po0M1GEWQleRFH2uZEU2DOjS2cFvTmJEbtpSDAXP7vU= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsemfexporter v0.84.0 h1:2dZwGmlUsz0M52W6ngSDFWKJxrlW+Om9AJAw9lbs8T4= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsemfexporter v0.84.0/go.mod h1:Klb+WunyXs+ZrP5MbDO9T+ZdwxQaztVsKew4EhEa2GI= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.84.0 h1:gmcjZQeIxySxYqfJc0SnNH7YIfRnP6hRxawJ5TC/V88= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.84.0/go.mod h1:cDljc1KnsULjJwe9iL2LCwvuvuk4poUdyYJWG/+4L1U= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter v0.84.0 h1:rJ+O2/xUKpIjCX2+B90Kc7TOgmOs8J3lXb5OC9P1PD8= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter v0.84.0/go.mod h1:CdZ9zz179u0LbDrfp+Ed/K0y10OVaSe1nsLh7twKOv8= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/dynatraceexporter v0.84.0 h1:YYFQ79SzYDR48oU4zYnEsFDXCS/BKqLo9b5jFfWQrJs= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/dynatraceexporter v0.84.0/go.mod h1:cISp1TT+sj4RXHcpk2VOOCZHc7WpQHNyV5T0yVhS9Ew= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/fileexporter v0.84.0 h1:37CMjRzqDNRUxo6M8Zahl0dwmPQMHTYwyNFw+hdUuhI= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/fileexporter v0.84.0/go.mod h1:ILHEwIQG2aZuxpGBM6uetYFGOKnp59kmzQZ2yxeI9is= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter v0.84.0 h1:OkFcyyzTnciuRO2sQjUcwJxk+sFDcftO9GmbS8Wj4+I= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter v0.84.0/go.mod h1:QehQjxD77uCWfxlVfVbsj4NI65v/FTIUIY8UuC8B9Co= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/loadbalancingexporter v0.84.0 h1:7C/Pr7As5xtfAJueq8bcJHpwS5Fs8BPUId4H/aywQ70= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/loadbalancingexporter v0.84.0/go.mod h1:TaBl9rZNGWDXdGTb7UJ72wQdMn9nOWsXYLSO4OGJlPY= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/logzioexporter v0.84.0 h1:60rywH3JfP0kYqQbYalGgiaZZgU4SPNqXfdrobzh3SE= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/logzioexporter v0.84.0/go.mod h1:PyhKbCz3iSRZon0fmSr3uoqDqoZNjF0uorG36PEmp1E= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusexporter v0.84.0 h1:3njXrd7vPXcxpJf/HNe8vU0bZjzeeeLpEc8K2nUKiWU= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusexporter v0.84.0/go.mod h1:7nX3UNJnV3XQz5MM4j8takEvHSvuGvRZHHQtKXQs40s= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter v0.84.0 h1:WFCStS52a3bMG9nEG6Eo8+EfgtXfGclTN/H4as7jdkE= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter v0.84.0/go.mod h1:jivmN8Ak9Hf1yP+W0RoAwZagyLjMH7HBGgS45uiuuos= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/sapmexporter v0.84.0 h1:5YebnbW2/qbabWabqtkDPZ1R4JE/hfjeQ1tXy/hBVPw= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/sapmexporter v0.84.0/go.mod h1:aEBjuyMJqJ7aCre96KqD/64rLwhLHEH/QinD82oGQbg= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/signalfxexporter v0.84.0 h1:17K4Vz5oAA0JLzkNcfu2CcfIpNhydpAEPulaS1tPBrk= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/signalfxexporter v0.84.0/go.mod h1:/T7Osxob+tAi4aTiEfXX2k/IRAGbwWIKZ0fxad0Bgto= +github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsproxy v0.84.0 h1:ysq9+0eESy8Dj7Yp3Ijn6uDAtvR+h+LoTwzZbw78gRc= +github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsproxy v0.84.0/go.mod h1:CwZNGQC/yVWCJrltkkGGGPeUUqtWuLQyADWfmqfol+Q= +github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension v0.84.0 h1:9G7QLkloZCu4Kz+YddCokyyHWoJwFH5iKMF2P5+hmFM= +github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension v0.84.0/go.mod h1:HlqBRg9x9ZSaL4rnaC5OeFMlQBHgj/IjgxzF3n021yk= +github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer/ecsobserver v0.84.0 h1:+nJyvy0EQMPBeIwoN2OyuwZMnbYgRRpXQ0KrXg2LqEQ= +github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer/ecsobserver v0.84.0/go.mod h1:DY1+Nxc6/UZauynoDMhKT1yoxVtOgJx9Avh5+ZQR6W4= +github.com/open-telemetry/opentelemetry-collector-contrib/extension/pprofextension v0.84.0 h1:ne6ci3q47j1DAcKcLQ2TEDRQerGO8N56qqK0aoiWZOY= +github.com/open-telemetry/opentelemetry-collector-contrib/extension/pprofextension v0.84.0/go.mod h1:RNIYyAITWq6n1EtjU42p0Gts79GYscYEL9ZMJdcX77o= +github.com/open-telemetry/opentelemetry-collector-contrib/extension/sigv4authextension v0.84.0 h1:nkIUYabzEhZawDfhzi130nNkeEGQS5EgIL20fRPIG+A= +github.com/open-telemetry/opentelemetry-collector-contrib/extension/sigv4authextension v0.84.0/go.mod h1:xYEy77gi+22BTTYukFRXydx1uo7TyZkUeKKSCWFriPQ= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil v0.84.0 h1:CJxvUC/EVb2nem+ncEzpZCGolIT1ovibbEkPtBgp1MU= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil v0.84.0/go.mod h1:ficUNYmjfPFXriyhQ7q3ZHofl28IfWge4zKHLAgALZk= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight v0.84.0 h1:9LUp2/bLVeksboDUdFqmfmPVtfYHymI308F9GaImtX4= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight v0.84.0/go.mod h1:jxeFqzSwMrDmEGPyCGhCyHY+6J+fA/jXRoa4CEzZ/W8= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/cwlogs v0.84.0 h1:Rhx4zUfBxbCFw60viWW6qwMvTcOHllQTx11nF0awzME= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/cwlogs v0.84.0/go.mod h1:RBOl8PVgMgQMGNewpVw+cmaiwV8SLgTkEHA9JK7gfP0= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/ecsutil v0.84.0 h1:BWVaklpLBrFOLlW/nqT3o2onEhaMIOr2/LBnEciDVjQ= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/ecsutil v0.84.0/go.mod h1:e/k1LzterZSHvxWF3HG9Wo2VtuVrYAt0DE+inTVaD+g= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/k8s v0.84.0 h1:oDtwVMCNCGZYBm03+jozRL7VmAF/JivHzLWA+RPaqUI= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/k8s v0.84.0/go.mod h1:qyHME9n7WSuKe/jv6dH9IPgIcmxtJjlx47eoAQhA0Nw= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/metrics v0.84.0 h1:KwJDgnqegui18ebzCfxHURRstPjY2CfM/yGRugcdOT8= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/metrics v0.84.0/go.mod h1:WAScm+oitM87OWSy+pPAC6eCzg3xhYz3VBSef2+zV60= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/proxy v0.84.0 h1:vfZIgsfOkrY+bqh3HGYWDtvxN5SR4B+IYJqY1733j+8= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/proxy v0.84.0/go.mod h1:usmD73QN6Rpydh47E9lg60NqAHGy+GfeMdSwIzjiiaM= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray v0.84.0 h1:xdqzNUPUZjBCLBxX+qJ0KVUC2FVILgoposXS81VNgpY= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray v0.84.0/go.mod h1:RT5011nic9yp8k1vUwBJd90fI5KedrIw2M4uhMkwYD8= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.84.0 h1:Z6mmJnj4t47FLifxesZsuGN9mZRCT6pUY5Y5g8SWJkw= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.84.0/go.mod h1:6XJ+dV/QjwFJf55/2nnVfVqA+qwa8Y/iYR6taPJN7n0= github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.52.0/go.mod h1:CIX1MWy+2JYdeYhqjK89vrRpCGbz6LTLinp+SM8kZyo= github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.54.0/go.mod h1:CSe1wsnLhSAEgAEXLfi8wTyl0VwPVkq7925aV8xm0oM= github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.57.2/go.mod h1:xPchY5YNOL9jr6phVkJEvkEakMYr8HMD4uGYEoKXIek= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.83.0 h1:rwaJhPhZf/4A0exUs4cjALn6jnFU2QAL5cSJ/FwzcsE= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.83.0/go.mod h1:DaoCKBiconWYmXeexLiQeVOWLWbo4N5vJdVs+9X4V+c= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/docker v0.83.0 h1:dFsDXpyWukqXZRLw1GwG6npvLaTXuOQbVJ/57IP9LrM= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.83.0 h1:s7sUZ3/LCX3Tr0C0FfTwE3X9GwTeTBskoMaLlqPv8Kw= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.83.0/go.mod h1:3bOPivfVZIaylsOk9yhWGNeobT0Pn25UZs4OnuC+azA= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig v0.83.0 h1:KllNzprs78NOFj4pLDu3hVImiJNiG3v9Hti+mvMpOBA= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig v0.83.0/go.mod h1:oOJY5unMZP3pPkcZl2VdBOiJzS+8xh4o9oq5NEglCXc= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8stest v0.83.0 h1:lzm0ei+Q+jToNok1HM1YPC5sH+2LuWTwf5NhCztCgdk= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/kubelet v0.83.0 h1:wuArO/CYSrTcpO4h/3vfLC0Li4vuVSeERxz4OOWTPh4= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/kubelet v0.83.0/go.mod h1:rWbscJhWZAr/o+1RAZAKuXl2sGowDcs9jbR/DYQvysg= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/metadataproviders v0.83.0 h1:tNUrUu6UFAycjz6NtL8/Zz0LF/2UpYvW4PL5xIYtw0I= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/metadataproviders v0.83.0/go.mod h1:3UHvuM+X9vt8DXR3t/lt8JdpYhkVleQqc2SzvXLcfy0= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent v0.83.0 h1:5TbtbiKZMwDVf1sEpN14Y4wqwANRpzmGWR0yLB4fNKU= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent v0.83.0/go.mod h1:tGB4+26zqjQRyHhxMWy/YZFOzWQwqm9OS1Q+jKHVabw= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/splunk v0.83.0 h1:s/mJMnap31p/fM/DGj3GWkubQRmaHMjo0RwDz0iAjl4= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/splunk v0.83.0/go.mod h1:J3PBJi93/0NuvJGCSugg0Dt38G/LqTrgL5t9cFl4Q/A= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchperresourceattr v0.83.0 h1:xvFXYVkdzUsIuoi8asZU2Hm59msjdFbnp9gxydplIQo= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchperresourceattr v0.83.0/go.mod h1:/BdkcVWo8+/yO//dRT30o/eNgKfu6EGtAby00vl0VPw= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchpersignal v0.83.0 h1:/qrROLCRzwIVrDVnEo9BOAGLzRIN8eCUXCO76Wi00Bs= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchpersignal v0.83.0/go.mod h1:RBkF+g8DRJs+k+JhIVAxnUW+a7vlCajpWNZQ2yD61sU= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/experimentalmetricmetadata v0.83.0 h1:qhLG2aVClSG2RMO2ERDfoUFn0YhHv0VhRoYJGyNXyEM= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/experimentalmetricmetadata v0.83.0/go.mod h1:IdqHQZWFAyMN5/yHz8oFts8AVj2osf2b6DTvc44IMLI= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.83.0 h1:6DE+t1L3OjJMouOo+Ss5w1W/IJkPNFFJDb8f534eFnc= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.83.0/go.mod h1:uL+EJyqlx798NEB4FuY+05IZY9aXSbw5f+2YFNvOA0A= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.83.0 h1:/6X4L5BrCyy5Uz/jnLwkiv9E6VfuJl9EFJztWtkWvps= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.83.0 h1:yEuD/gKHNVMwjT4mRZAeUVCe/VO2tqeb5+aFim5jQJs= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.83.0/go.mod h1:WoSzL9NAVwvEy1lMwM2utn68g0Khoxm591WliToPnDQ= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.83.0 h1:e2j+kbNwZ1AAfh2RexJz8a07E/36IUmGW9SID7JtK+g= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.83.0/go.mod h1:fxZoTFjoKeAwXk7fiFTLbB6ptMk8vgj97e3nVyE/fJw= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza v0.83.0 h1:Ru7vas+V32Py0ld/jaKAAeCfCL1PqOuMmhG4gX/1GR0= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.84.0 h1:EMdLjuWUpbkbYQ/lEg+qZk3lGEG2iPiU+t6g7g/J/5s= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.84.0/go.mod h1:sEq5Vn7ZiuT79tcx/CxDFyhrx1f2jV7kMQhOpdVTAa0= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/docker v0.84.0 h1:EdOIt4jT6SbB63EaX2/rS7w3k7a0HoCfkzORyd3Vpto= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.84.0 h1:j3AO19nlnNahMxE4ozYbagJJVm/v6Sx0Lkt9GM8quiA= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.84.0/go.mod h1:ljL7PRBjYFEPMwfRPDgDxnejMBRjrxiBpVvj+hjXMFY= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig v0.84.0 h1:OOtqiVIRcv3eWpCoziXjq/Xr4O2KoqZZ3g5pRjug/Nk= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig v0.84.0/go.mod h1:iL+tGP94Xdes4iUmss/Me8OOqvJhWeBWPcW8OgHQZyo= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8stest v0.84.0 h1:jqruZBzNjzHQ9bfNbZ1BXUB3KIzaWQUPVQblkWt3bwA= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/kubelet v0.84.0 h1:ezuTl9JDE/v83DnyJk5jLEumkgu0nxdoWXNTKmJ/+KA= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/kubelet v0.84.0/go.mod h1:u8PmrJN1vhdnUtyMkxoze478uOzX/bVTeJebvM5xyHU= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/metadataproviders v0.84.0 h1:4xV4X+Zze+nNLkyK35LkD1AOL/V7qxgptsJLEWfxhj4= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/metadataproviders v0.84.0/go.mod h1:rcxnHaBL7R/VoO8yahgIFL7NZIdFaakl4Jpy2tbNeGc= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent v0.84.0 h1:EivvMHRis/wMhyeAo8FfGk1NS739w5+dK+qUz3TSE+E= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent v0.84.0/go.mod h1:R7lpqmyo0OYBeu5OaFUwzVaO0ihMoaGGxd5BIxbl0jU= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/splunk v0.84.0 h1:hou2HQ4vt1t1z8fvY8UCyE1fICinkJPhVznJfBkz8aY= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/splunk v0.84.0/go.mod h1:hkmQphXEFE/kpQOZtFNefzv8A36ftYrV79ekEYsQdzY= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchperresourceattr v0.84.0 h1:FgIjzlDhSwIN3wXkuC6Cb2z5Eo9E61YE+VHP63kIwvs= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchperresourceattr v0.84.0/go.mod h1:+TN30V/uryI58nABe8ui9MNqKNGCg8JUCWQds1/44fI= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchpersignal v0.84.0 h1:Es2xrBG6w4kDWRzYfA93eSN4CeI3sBS0OudDZc7nr/I= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchpersignal v0.84.0/go.mod h1:RBkF+g8DRJs+k+JhIVAxnUW+a7vlCajpWNZQ2yD61sU= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/experimentalmetricmetadata v0.84.0 h1:I+hRazXMAIrCi0L9ui7wAc9/m8uawJb+DxRYcLmezH0= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/experimentalmetricmetadata v0.84.0/go.mod h1:IdqHQZWFAyMN5/yHz8oFts8AVj2osf2b6DTvc44IMLI= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.84.0 h1:hCHJbiLdDwsswhfllFCq4fjRWUCz2GAHhzOB1n7jHK4= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.84.0/go.mod h1:0us3rAudWnHES0nOtmTsUjgQtlKJyiozaC5osgJM7cU= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.84.0 h1:NXzx/YViPbapdfI0RZ2RJk4XgKU099Ci9rGBsZ/div8= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.84.0 h1:Zuk1i/92HvV5cI6dtsG/VWSKwaLGh17q9a26qP9DBbo= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.84.0/go.mod h1:WoSzL9NAVwvEy1lMwM2utn68g0Khoxm591WliToPnDQ= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.84.0 h1:jrkXndFdbFMSLWKTva9NEIfxqslPpRCMwgmlctPBxqY= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.84.0/go.mod h1:I6U5NVX6YWcqQY2Rg8SFrmQfaPVM3ZpypUSSg14f0JQ= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza v0.84.0 h1:tI6GXaZenBDWGo0QeSWm8Ki41Q12L9WxFi87W3QTiME= github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.52.0/go.mod h1:tU7s/ki/QePSIZ7ExYGWLMb9erCAt66brQHBEHxr8HU= github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.54.0/go.mod h1:uWFgO68sLEqWrQxL8rws1CkB8EUNQaedP3FWI1gMJOU= github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.57.2/go.mod h1:4rFuWKMbzM9H39RbDvPtJfAp/fxsHydhJhKns6skmK0= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.83.0 h1:fGK6FQaUCOFGywGRvsiDtjlfGLZGcgkmgZlIomdsr3Q= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.83.0/go.mod h1:wvJRWQDZGEeTvcfzNHII+niIHWMlO/fg6vSS3x7XYzE= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.83.0 h1:qEO5xxh8yRYiWhXiQhEcXxFV4RcO7lUkejfxBjXLPNo= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.83.0/go.mod h1:a8Jm3NY18nTt9mM8XJeWvwmiPxDKJQvbpYIlzA7H3Yc= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite v0.83.0 h1:q5QvnGvi9JNh4vPmK3BuX/C7C8YWZetCrli3BxCAZKU= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite v0.83.0/go.mod h1:dZGmQr+gcI6fUEs6sPxlUQyV/4j9KcL31YcsHL9OJ9k= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/signalfx v0.83.0 h1:asapsoRz2d/HRjT0tWfJsCqBe0qwFSw44P5VKYx2OGw= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/signalfx v0.83.0/go.mod h1:SQ+BuwNerr2p1jmezJDF4ruJ1WojRgqQinkyey6NaMg= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/zipkin v0.83.0 h1:1FnX4XXS9IOC9h5nA8gQsPv21n0rbECjBqW/VfJ4c8o= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/zipkin v0.83.0/go.mod h1:BK0l1fWX36sfssQie9lH46tzVzV/UTOcUPRKytLbb/I= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor v0.83.0 h1:zre+RUseqdEblLwaE9FidObbtmx3Mm7tiwMC3Fejoy8= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor v0.83.0/go.mod h1:QEy9JCi68LCoxfwPn2v1byOf3KxSe3bJ/p3jgNzpsOY= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor v0.83.0 h1:cnmSn6LVIIkBRfaSuBQNNphLXonFr5qD0+bCHgvAFws= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor v0.83.0/go.mod h1:bHhc2kT0wki+U0boNf5E0bmDbPDaI6AyzdXh/zvtFrE= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatorateprocessor v0.83.0 h1:de91BCQwWkwZ+Tp7OsCpkrrc7vBRdzPQhDE5ENcxPMI= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatorateprocessor v0.83.0/go.mod h1:7NGof68ffjxgOoN7NE0TSMNAmGXxpxVmw6p9KGvxerU= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor v0.83.0 h1:Ul48EqO0xeSn57H8jYK2GNQzJfF7W9l1nQemlfUGYEs= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor v0.83.0/go.mod h1:ZIMmKTtWzTrpj4z1+yBu7tbzSHi4PbtyLNAWq+AwmlU= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbytraceprocessor v0.83.0 h1:g2YnCEJ4SUQG0m7yqDpSPOYsfPe74M1ivy2JYqWUCWY= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbytraceprocessor v0.83.0/go.mod h1:vtc7IGVX6m4tYkNs0KLdEA7HpuRgxRhHqJiFBLyWdyc= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sattributesprocessor v0.83.0 h1:hv92fwXj9f834zUGLoyxtF07zpEM34yDL76OAwVTdqY= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sattributesprocessor v0.83.0/go.mod h1:3wxQn8Bp5c19UgSvGx+32/xVLsOZMjNaTU3g3n6t6Cc= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricsgenerationprocessor v0.83.0 h1:88XaF5XSbe7b9J77yvr/joO+pT7ZVpmm5GoHjI5/Wes= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricsgenerationprocessor v0.83.0/go.mod h1:14tnFp/J3PFriWAuvi3Jf5hOkc/p4zhfZORbNDzoHH0= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricstransformprocessor v0.83.0 h1:rfTAZuRV54Qb/Aah8sdnpF5Z9qmtotyR1L8Z79R/QYU= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricstransformprocessor v0.83.0/go.mod h1:C3P6u4x0CwtLgTVdeAvSR9m1CPjHeJRjklfaTvQ7JRU= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/probabilisticsamplerprocessor v0.83.0 h1:3S7vb8bttl9eC3qQRi5Rm4q01taM+ue8loomADB0qSA= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/probabilisticsamplerprocessor v0.83.0/go.mod h1:Y9TezTRfqJ3cOTsjWxe7rgDKZU71uU28mJ10GKYBK5g= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.83.0 h1:TNoRtrLHLk5Xr8JZwxiHxnpy0+UYnDHl7SPtZIoTC0E= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.83.0/go.mod h1:KDZS6tI2Q8aZ7TCJzZuqEbrwDJPBAaSQIbeXsO6Nvvs= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourceprocessor v0.83.0 h1:Jpa2cCa1CxWgc6kUP6fTfYvqRZzpNcMDFyzjzoXzWPA= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourceprocessor v0.83.0/go.mod h1:a7EPC0J3PIU+x3BZSDKxhB7cxeJjf6mgy6nmdhGGQ8M= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/spanprocessor v0.83.0 h1:mchNw/c+HM4jW22fFhHRjYX7pyk4t7eiG/QFhoUv020= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/spanprocessor v0.83.0/go.mod h1:yJJ/GpM8NeloEgznZyGTH8neThCL4KzQd8gsI+eJDxM= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor v0.83.0 h1:4D72ZwITvSbNchy/LAISnFlCjGDZYblPmaqn3LKFKiE= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor v0.83.0/go.mod h1:HP+yAae+1agolvpTo2GRT3BXgPDt1NaYfm5PWtPrI7I= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.83.0 h1:pJTvexBqzytA/I5Djq8MXsKlqyT+wZ3ZmZLqkBX0GTI= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.83.0/go.mod h1:Z5rds2ALV45/OFitkS3ayHhe1u2Lxo3+nRQ9mFwMaxA= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsecscontainermetricsreceiver v0.83.0 h1:wANd57Lpv/ueBpmqVzusAMWyXy+y5ko09QwZxGZw5+Y= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsecscontainermetricsreceiver v0.83.0/go.mod h1:RT4UNOaHyOXGMEq1Azp6Bnm5qUHpx6BT0Ih8o0n9GP8= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.83.0 h1:NKNHzx3qvSl5G5drW90XeiDLNZL0Qmgf3j5EdPv36UE= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.83.0/go.mod h1:yDRLZz1bwaTXmyTo5b317TN7a5oHkHMuio19nyJdK90= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/dockerstatsreceiver v0.83.0 h1:3mtM33u9B2CqZmG5ryP349HvaDYQs8useSJIA441Vgs= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/filelogreceiver v0.83.0 h1:TNBKlerQbOS5cTMNxn/pfxxE/PpYLajPaJYQ8wiHrIw= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver v0.83.0 h1:6y1yhypoixL19d4PpmNlPbDt9zhs3btg54RQiC6D7lg= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver v0.83.0 h1:wu0ZdOTDqjl0Ug6J7rAO43GIe7nW/hvPXZ/Kcs7Hmis= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver v0.83.0/go.mod h1:qhWK3ADYGvYaS54XbaH6yK8/iPGQLtimdtIcXevTLkw= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kafkareceiver v0.83.0 h1:rVuP6uUEXa/z8+D6N/Z9ni4czrFEjs7hsWe+DozKpqE= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kafkareceiver v0.83.0/go.mod h1:7sh5S7LJEtuknmYyRzQoWlqbYerr5OvViF/AdkGUsOQ= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.83.0 h1:WaisWqr64HIHo0Gj+FJO2YzjRAwXpq29HRaMbstnXeg= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.83.0/go.mod h1:3Q0ttKtPcn9wY7VvT3P0E6Y6FMDA+yOu64xbr4bqHrM= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver v0.83.0 h1:7MpD62lDNplm6ONFQTQB+Gkb+slo2MzCkpxurldcJAk= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver v0.83.0/go.mod h1:MHvgdYigNKOZmiO6N7Fqa1ZerEyIlLL7cCydn3n9R+c= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinreceiver v0.83.0 h1:IJdOOFBDG2Z16utgTc9DnLBc3Q0eiRUgudBjlh85x7o= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinreceiver v0.83.0/go.mod h1:1z7uIIoZgcqjYfDefFnjfO6frg3t2UorVaxB1DzcHlA= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.84.0 h1:Ch0cB4xwB3EksIu2BEnNgBxzksU3FYvePjeAzy0TPas= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.84.0/go.mod h1:orl+1f4pGXhTiZH/6lkPA03e7Gx3q/1/CS5swdNMSI0= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.84.0 h1:uYYn5SIejB+AZ7D1U/uqArifD4HfDBHCz7EkFNmVYn0= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.84.0/go.mod h1:tfmxciJw1uQ7eeaDwqCp9RMUeWEQfIs74mVj6FW+FYQ= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite v0.84.0 h1:EuRz/++XprYiwsmIYcbn/DLrrCySdmObPPUURLcQzcE= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite v0.84.0/go.mod h1:fwGawLbxB1Hdmh9Vy3WEE6AJLAPCVBmM8RRsXW79JHw= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/signalfx v0.84.0 h1:8uRr7fOoazstNz1v+SMjciEplAcMWJS54VAq8pmRb3w= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/signalfx v0.84.0/go.mod h1:EEiJsp+kaZ6UBo1/AyEO0VltSQpxzrF6ID/M4V8whcU= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/zipkin v0.84.0 h1:+BVHFN9tkJRQIi1IleHt9oO7UObaQeApJgHQTch7CgQ= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/zipkin v0.84.0/go.mod h1:vIB7VwkvKdSlwaKbNuhxS5kCWcvpdtSGK/H7qp9Uh4M= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor v0.84.0 h1:qUWN/AG2Dmj92zIwMLt+1F9VI0DzytmSVjGdBO3ozTw= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor v0.84.0/go.mod h1:gVsBAVjxjbq4Z9eCcYn6a17OcBJczacnR6943rdScEY= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor v0.84.0 h1:YVAvWqElpzNZixXVZHGKIE1NmNgiHGiTFGeGO5Oyy8s= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor v0.84.0/go.mod h1:w052rJTu13UOoIKMjYJGJNj8KhnodFAOWZozNZxYo7o= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatorateprocessor v0.84.0 h1:1yttb7xC/+9mOv3QJ4kj34JLX5evDgWBc1fHwZYjVjw= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatorateprocessor v0.84.0/go.mod h1:6cfvoTwM9sZIdcn5AjIgx4trIelFAIy31zsLEbzvnyo= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor v0.84.0 h1:4dPSHgkRNakkXyW0KhERwBzG2pm7/jb0IRZt7M8l2C4= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor v0.84.0/go.mod h1:bPJSw6vjeUl7W5RmkbLxcL0xkeU62q4N3FpOZLZEskc= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbytraceprocessor v0.84.0 h1:a+MiWvAfyg4QSsu0PuuItV2juzQwB8FHGg3SFu0Q5og= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbytraceprocessor v0.84.0/go.mod h1:4hvk+lTGFCAE2/+QiuEv791inWnZENmjIpcFB1B++s8= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sattributesprocessor v0.84.0 h1:/mRWmV3mzu9jRiANmBNW0NQq4y6a/LNhjtTctAQLITE= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sattributesprocessor v0.84.0/go.mod h1:4V8U8jzqz4/aV5f4zQy1joVa8WQt9cl+Y+Y26QkteF4= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricsgenerationprocessor v0.84.0 h1:wkdDwvPzBTGHGL2yu1bU2/SY1T2C9YbArs46rK46ocM= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricsgenerationprocessor v0.84.0/go.mod h1:aNsXR1nYFF+cp8nK3ObLgz8xlyH3qxFvlooEsfWLFc8= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricstransformprocessor v0.84.0 h1:m1I3xM+vnWFBSTCvP9Eq3iodVmmuKw5LnhyiMJOHJtw= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricstransformprocessor v0.84.0/go.mod h1:XM27X56rqpFDdTXge+JFpVIVwZa3VkJXLOZ3an2/9wM= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/probabilisticsamplerprocessor v0.84.0 h1:kpU0J0ilSzUJ8c9NCQPON2j7cplv0Po63SPAbqiLpVw= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/probabilisticsamplerprocessor v0.84.0/go.mod h1:ZbTPu4nBWYT6vs74tTFPbM0dX1CZ83JxvCawRQ6cFLo= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.84.0 h1:F+Zam/dMSQAuDl15pXEFTcljL9jQfkpRgMdVxnxh3To= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.84.0/go.mod h1:CXioiwzuR9YaxCtT+bobWx3aeNd6KTlFpIWlnNpfriI= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourceprocessor v0.84.0 h1:63ocfTOX403x0RlOIxiqoIxfhlnz5bYNjKFinaMUAFc= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourceprocessor v0.84.0/go.mod h1:mcxeCwBWxyIFEOfrHczRwmWknNU/mr7X/p1SKz5oKc8= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/spanprocessor v0.84.0 h1:VcMWE6RRZTffWA9B46JRRuE/at5rcjqCZxX0ngydOOA= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/spanprocessor v0.84.0/go.mod h1:rbx0mJK75euw8jKxUOCiX0iIC3AzOTU3PFwQG0l1Glo= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor v0.84.0 h1:nY70u0NNt1DYZduGoKpqTKJV8jg7wEt258B788JwvDQ= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor v0.84.0/go.mod h1:e2unmaPxVdSAumcBPSKiCEZQrWwrYpWnUQYxd1+ThcY= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.84.0 h1:G6xhhVKr0HhrXdCEALbec2DjqZkrjRavHBL+cylR9Lk= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.84.0/go.mod h1:keWoqPccFPjwxLdMi0HxFHJZuvA0UctbdE6eDlSqewM= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsecscontainermetricsreceiver v0.84.0 h1:Kp42oWlqFUfGfZwHG/2hgIgHaviavNeS17wqnJg3anc= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsecscontainermetricsreceiver v0.84.0/go.mod h1:IpH2OjamrdbV6ln03ym9ZSiVbdD+u6j2opXJzQbZxjU= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.84.0 h1:YHVz3EKgQIxhZIuxODAKXmPG1d0bJuj1DCwxKrQ+WCU= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.84.0/go.mod h1:eJ+aRpCDufSTNeSfn2sDZ02M9zSkQLMv3vvJ9DqMSRI= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/dockerstatsreceiver v0.84.0 h1:o2CZ1tedxiw4ZG3dCP0q1L5shoUUNETVWeDu2gfoc6E= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/filelogreceiver v0.84.0 h1:Nv9JywcY7nBSZ3tIw/SjW0GUlgy/SeS05CIdRg0GqWk= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver v0.84.0 h1:za3AHuElLqcNVh60svQ1dAqJrIWqLhg9gT8iNXXe2Gs= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver v0.84.0 h1:pO1YQoqP7AJecTleizOWgwsDPLGtY4LFMXfzvmPLHjk= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver v0.84.0/go.mod h1:B0j/2fRXpYkcIlt5iXfO4+w5J8loBfG21L3J4caS4NI= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kafkareceiver v0.84.0 h1:f8b+QA+QsJA2kx9ATqZdFyum7jWFfuBsESbjPKwu7Hc= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kafkareceiver v0.84.0/go.mod h1:ILyaN7Wme6HzNueiXlKtQnqnhYwEc7LbXH4oBqSBVYY= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.84.0 h1:SJ/d51cAEEpIZIUes3rzhad5XAc2GzLdJfc/dDWquas= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.84.0/go.mod h1:oGO6rQfWdYRR2LjACUPTMdz+8L4aBQO3H5XbkmWCS5w= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver v0.84.0 h1:U9UNaj+HCPR0rwDs8mTSKtsK9/aZPqw0E+q5d0DqUn4= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver v0.84.0/go.mod h1:eJnUNMvKh59U+EncWtPglHvdEt3R+VPHf/IXIjcxbkc= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinreceiver v0.84.0 h1:+Xe8V/MMtAGkV/nSDc5Ggqw3D8QKmFLrKlX95no289I= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinreceiver v0.84.0/go.mod h1:MIA7istfJapmbDZXpKds68A63eii0AhiYdrnvZQ9Vqc= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= @@ -1504,8 +1503,8 @@ github.com/pierrec/lz4 v2.4.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pierrec/lz4/v3 v3.3.4/go.mod h1:280XNCGS8jAcG++AHdd6SeWnzyJ1w9oow2vbORyey8Q= github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= -github.com/pierrec/lz4/v4 v4.1.17 h1:kV4Ip+/hUBC+8T6+2EgburRtkE9ef4nbY3f4dFhGjMc= -github.com/pierrec/lz4/v4 v4.1.17/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= +github.com/pierrec/lz4/v4 v4.1.18 h1:xaKrnTkyoqfh1YItXl56+6KJNVYWlEEPuAQW9xsplYQ= +github.com/pierrec/lz4/v4 v4.1.18/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -1604,7 +1603,7 @@ github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.6.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/cors v1.9.0 h1:l9HGsTsHJcvW14Nk7J9KFz8bzeAWXn3CG6bgt7LsrAE= @@ -1718,7 +1717,6 @@ github.com/spf13/viper v1.11.0/go.mod h1:djo0X/bA5+tYVoCn+C7cAYJGcVn/qYLFTG8gdUs github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI= github.com/spf13/viper v1.14.0 h1:Rg7d3Lo706X9tHsJMUjdiwMpHB7W8WnSVOssIY+JElU= github.com/ssgreg/nlreturn/v2 v2.1.0/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= -github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= @@ -1830,9 +1828,6 @@ github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gi github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= -github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= -github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= @@ -1883,50 +1878,50 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/collector v0.52.0/go.mod h1:a9GvaOhyc0nVOUzqvdv5mxyWghCSso/WRO2GgRl4I1g= go.opentelemetry.io/collector v0.54.0/go.mod h1:FgNzyfb4sAGb5cqusB5znETJ8Pz4OQUBGbOeGIZ2rlQ= go.opentelemetry.io/collector v0.57.2/go.mod h1:9TwWyMRhbFNzaaGLtm/6poWNDJw+etvQMS6Fy+8/8Xs= -go.opentelemetry.io/collector v0.83.0 h1:rKFch1CANepajPwBTvzYj/hKz7RsMyUkPPPNjRCpJ/I= -go.opentelemetry.io/collector v0.83.0/go.mod h1:MNN79VDXXaRP2ZqcDVOfWH0Jl8BbcMttJ3SY/pU6vxo= -go.opentelemetry.io/collector/component v0.83.0 h1:7bMbOHQezVx9RhSLu9KQRBhjXmO+CbOVhBk5uySb0fY= -go.opentelemetry.io/collector/component v0.83.0/go.mod h1:Qy2mIP32UKN1x8rsjJbkgB9obAVu4hRusc1wKNFeV+o= -go.opentelemetry.io/collector/config/configauth v0.83.0 h1:caIkUszP+kTRVx9HW6z7x05CMnzlaBoP2BKyWDIr2ag= -go.opentelemetry.io/collector/config/configauth v0.83.0/go.mod h1:PqSIaQryPWiPVMuxlNPEvTpuvhdRq8ySN9nKlk3YbH4= -go.opentelemetry.io/collector/config/configcompression v0.83.0 h1:WwGfHyGey8JSUsBGUmRHaOzwllrLmsjjo5SZCYfSP14= -go.opentelemetry.io/collector/config/configcompression v0.83.0/go.mod h1:Mi1/3D+qNlRohrVMbBOj6XSHo7YKAKbgWYisNW2Qobc= -go.opentelemetry.io/collector/config/configgrpc v0.83.0 h1:bmX6M/L0+gtBSqAvPGh2cV8c4htNFfxa/9ZT8FreOHE= -go.opentelemetry.io/collector/config/configgrpc v0.83.0/go.mod h1:VpRhSIukmgVjx0HISN5r+y6EYQNGDYLU8j8hVUlcMjc= -go.opentelemetry.io/collector/config/confighttp v0.83.0 h1:yBra00XanzqXL0kLs3Aaas7RLoL50bM/Za8223vwJik= -go.opentelemetry.io/collector/config/confighttp v0.83.0/go.mod h1:Eu2WVZa8cy3F8mlxXIFPgzeAeLnaVc5UZzcEtufrOWs= -go.opentelemetry.io/collector/config/confignet v0.83.0 h1:xaQkMXvId8y7o6ke2qVRZZDqNc315CGkIcZ6LSVxDE0= -go.opentelemetry.io/collector/config/confignet v0.83.0/go.mod h1:I0iJQDhns1GgXBIumB64WHLPMmJpNdDaEDHQnmaaqsU= -go.opentelemetry.io/collector/config/configopaque v0.83.0 h1:nhYguW1zVFnQlaZWhwbXJS4/+WEPdQSEL8kTF/j/zeI= -go.opentelemetry.io/collector/config/configopaque v0.83.0/go.mod h1:Ga1x7xLQXWmwxfW1pPqjI4qT+eNxf9wu2/Mx7O2u01U= -go.opentelemetry.io/collector/config/configtelemetry v0.83.0 h1:Dx+POy68CFsec9JDYd7cxQPULLfSOAG8ma5Jl3ZZ3+Y= -go.opentelemetry.io/collector/config/configtelemetry v0.83.0/go.mod h1:8wZuTKLdcWwdB82Jd07TOHsHKuv8l47T+MUGEsPe4z4= -go.opentelemetry.io/collector/config/configtls v0.83.0 h1:qeAqwvw7qs3fY8wVZzN54E+SNMES7YdATY0ASEbJlUw= -go.opentelemetry.io/collector/config/configtls v0.83.0/go.mod h1:YMf+YSUhPB/LD5pZSyb3wRi7x6vbiMbONXOWFQnJnZ4= -go.opentelemetry.io/collector/config/internal v0.83.0 h1:yQZegCOPl4dWUVkr/fscVFU/AjANT5+Tu5XpKztTTSA= -go.opentelemetry.io/collector/config/internal v0.83.0/go.mod h1:BQs+X52s4BCIshht8qgbT4dqCM5YM2h6RQWln6zWhRA= -go.opentelemetry.io/collector/confmap v0.83.0 h1:eUaiFdhTLkFdNpMi5FLSHSQ6X2FcEHe0KfEUt9ZtVlI= -go.opentelemetry.io/collector/confmap v0.83.0/go.mod h1:ZsmLyJ+4VeO+qz5o1RKadRoY4Db+d8PYwiLCJ3Z5Et8= -go.opentelemetry.io/collector/connector v0.83.0 h1:wUxpqBTjJ9WSgZnosU26ALGYtwPVzEQxQk7w+mKSOs4= -go.opentelemetry.io/collector/connector v0.83.0/go.mod h1:o9xnA7C+2JzYQMSyWIJz/28tc3lGs3JkKLpckpAdzB8= -go.opentelemetry.io/collector/consumer v0.83.0 h1:8wg0UfFxxaGYsTkQGWuf1pE7C/dTvPkkYmBtR6N5BKc= -go.opentelemetry.io/collector/consumer v0.83.0/go.mod h1:YLbmTqvgIOYUlEeWun8wQ4RZ0HaYjsABWKw7nwU9F3c= -go.opentelemetry.io/collector/exporter v0.83.0 h1:1MPrMaCFvEvl291pAE0hTgPb7YybjSak9O5akzXqnXs= -go.opentelemetry.io/collector/exporter v0.83.0/go.mod h1:5XIrrkfRI7Ndt5FnH0CC6It0VxTHRviGv/I350EWGBs= -go.opentelemetry.io/collector/exporter/loggingexporter v0.83.0 h1:1k0zCEqUfNhWYw8X9zuQ4LNU4o5qwG6f1J3+P8lpe+E= -go.opentelemetry.io/collector/exporter/loggingexporter v0.83.0/go.mod h1:/Sa1r32rwJpBRHSzWclacQlyr6BG/uRuaXqi/CmPvb0= -go.opentelemetry.io/collector/exporter/otlpexporter v0.83.0 h1:k5bJVlXJCJGraslJtOcQPELbRE3gB5MCzzvYurp5aF4= -go.opentelemetry.io/collector/exporter/otlpexporter v0.83.0/go.mod h1:MIGlrd6rhbfsRUgFqGfu7xWfBlG72ZFNGUj2ZR53LGE= -go.opentelemetry.io/collector/exporter/otlphttpexporter v0.83.0 h1:5JeQ6JKiZiRlrcjw4LkzpTkdb3wOflvzYj1kbmr1h+I= -go.opentelemetry.io/collector/exporter/otlphttpexporter v0.83.0/go.mod h1:twNJ2isyvMaDZ7K3OeBtwOHW95uYQ5ylpgMbgyJqhks= -go.opentelemetry.io/collector/extension v0.83.0 h1:O47qpJTeav6jATvnIUvUrO5KBMqa6ySMA5i+7XXW7GY= -go.opentelemetry.io/collector/extension v0.83.0/go.mod h1:gPfwNimQiscUpaUGC/pUniTn4b5O+8IxHVKHDUkGqSI= -go.opentelemetry.io/collector/extension/auth v0.83.0 h1:H0orp7a7/NZae4/ymnC5JpuvO6GNcGLNz+nEDAw9ciU= -go.opentelemetry.io/collector/extension/auth v0.83.0/go.mod h1:Br0OyLU0p+2xS0UvQRvgWmH0Kv/4kPkNVr9AMzee5GM= -go.opentelemetry.io/collector/extension/ballastextension v0.83.0 h1:t0ITNPF7JAXa3+PA4INN6sORIYYgleP84ufPV+yceyU= -go.opentelemetry.io/collector/extension/ballastextension v0.83.0/go.mod h1:ZcsZT3S2EcM8DXz1R5tSVNL9AZmoxpbB65itsrWblhU= -go.opentelemetry.io/collector/extension/zpagesextension v0.83.0 h1:a2Avt+yjaJbHPbiST3I/4GgfxrB3iEpTtgIEGermItw= -go.opentelemetry.io/collector/extension/zpagesextension v0.83.0/go.mod h1:oJBN3N0uusy36qMo7FeWCUv2F9S6JCYw1omvtMtUQ4o= +go.opentelemetry.io/collector v0.84.0 h1:zzsegdPlDR0iJufPsHTJhXkv9q2kbpTTTI6nTyya2wA= +go.opentelemetry.io/collector v0.84.0/go.mod h1:+cv/zxludfiiDuK3z+5eXkxAJhkCCcy8Chtvv0nOlr0= +go.opentelemetry.io/collector/component v0.84.0 h1:bh4Is5Z7TjuyF7Mab0rSNh2q3y15fImdNDRXqrqGlbA= +go.opentelemetry.io/collector/component v0.84.0/go.mod h1:uXteRaacYXXYhzeCJe5ClLz5gLzleXWz01IZ730w7FA= +go.opentelemetry.io/collector/config/configauth v0.84.0 h1:N2cnOZYJ3DKg4NF28qLqrDj5Arl8IFt2rK3voDImTUU= +go.opentelemetry.io/collector/config/configauth v0.84.0/go.mod h1:8Uoq8FyFLhlELIHApKwGa9mhhTtQKGAfKDcBAw1aM8M= +go.opentelemetry.io/collector/config/configcompression v0.84.0 h1:NyyBsDlZDLKY6/+Ki2T5muQII6bq4ZGNMHTz9XKLskI= +go.opentelemetry.io/collector/config/configcompression v0.84.0/go.mod h1:LaavoxZsro5lL7qh1g9DMifG0qixWPEecW18Qr8bpag= +go.opentelemetry.io/collector/config/configgrpc v0.84.0 h1:wWYWbmm8EHm33Xllfe1o+AEmVHbjx4A5bDSx9TfM3bc= +go.opentelemetry.io/collector/config/configgrpc v0.84.0/go.mod h1:cs/g9nIJZh/R6G8XoBIO8chtU0RoiaG3DcP454pKenY= +go.opentelemetry.io/collector/config/confighttp v0.84.0 h1:SQK89DAe4VSACnMN79opyzEZa8DaN206nNsQbjbeu60= +go.opentelemetry.io/collector/config/confighttp v0.84.0/go.mod h1:lC4RRRZSAqDbppfKKtATQ8nZtC4wYowvpkXwYhnHkFY= +go.opentelemetry.io/collector/config/confignet v0.84.0 h1:AGaAdhKgV/lxNxHL/RqqpKjVGuIPSO8whTZyBbP3KK0= +go.opentelemetry.io/collector/config/confignet v0.84.0/go.mod h1:cpO8JYWGONaViOygKVw+Hd2UoBcn2cUiyi0WWeFTwJY= +go.opentelemetry.io/collector/config/configopaque v0.84.0 h1:EjALh+TaICWGcHAwTV87niSgWoI3fTQ3h6ureyo8ksw= +go.opentelemetry.io/collector/config/configopaque v0.84.0/go.mod h1:TPCHaU+QXiEV+JXbgyr6mSErTI9chwQyasDVMdJr3eY= +go.opentelemetry.io/collector/config/configtelemetry v0.84.0 h1:pnZiYtppJN6SlzJNcrkA8R+Ur63e33qMO260m8JbK18= +go.opentelemetry.io/collector/config/configtelemetry v0.84.0/go.mod h1:+LAXM5WFMW/UbTlAuSs6L/W72WC+q8TBJt/6z39FPOU= +go.opentelemetry.io/collector/config/configtls v0.84.0 h1:0rE1cdCLBx98nm6UgHnWFbytY0leZi/dr5bJ+i6Zup0= +go.opentelemetry.io/collector/config/configtls v0.84.0/go.mod h1:7zgWZBbH1+ZZLxNzDS+Kz0Em9dAXdlYmRqjXTWxZK2o= +go.opentelemetry.io/collector/config/internal v0.84.0 h1:LX1gO0q3+/y8JeRCOnYuMiF73gLZ7CwMSiov8Cqmumw= +go.opentelemetry.io/collector/config/internal v0.84.0/go.mod h1:XN8Y+Vhq/RqxGry7CGKwhMXJptUrmWTHdC6ZeI+Uy9E= +go.opentelemetry.io/collector/confmap v0.84.0 h1:fS62yIRrsTQwe1gyuEc8TQM0yUNfSAzPVi0A1665ZpQ= +go.opentelemetry.io/collector/confmap v0.84.0/go.mod h1:/SNHqYkLagF0TjBjQyCy2Gt3ZF6hTK8VKbaan/ZHuJs= +go.opentelemetry.io/collector/connector v0.84.0 h1:glvKR5FCHX/KuXKrItzVhSNaP3/n19LHrewaaFaRnWI= +go.opentelemetry.io/collector/connector v0.84.0/go.mod h1:VzBR1lHPntgGZkTYry35xyEtJLeHB8nQ/pcEeSt54H0= +go.opentelemetry.io/collector/consumer v0.84.0 h1:sz8mXIdPACJArlRyFNXA1SScVoo954IU1qp9V78VUxc= +go.opentelemetry.io/collector/consumer v0.84.0/go.mod h1:Mu+KeuorwHHWd6iGxU7DMAhgsHZmmzmQgf3sSWkugmM= +go.opentelemetry.io/collector/exporter v0.84.0 h1:OWvHJghs7/R6Qwr2fh7HrgEqsIUbCgLddLQsmqN95kM= +go.opentelemetry.io/collector/exporter v0.84.0/go.mod h1:Bz7MTaVosTIz6ZISszKYLDOewjathUJuVgT5W4Ee/wU= +go.opentelemetry.io/collector/exporter/loggingexporter v0.84.0 h1:O+w3MWYJ+Kf1WquqULRQzba1RnX+3JKIBCLCu1VTMYY= +go.opentelemetry.io/collector/exporter/loggingexporter v0.84.0/go.mod h1:bNnrdNDr4r9lt+/C4DHU3zC7FAqyIjrBGxSc27VmYdk= +go.opentelemetry.io/collector/exporter/otlpexporter v0.84.0 h1:LS0LHzQ6/LBjkduD+iMxUhH4H9DZ5BzQXojtJcnaDcg= +go.opentelemetry.io/collector/exporter/otlpexporter v0.84.0/go.mod h1:R7pJ3eg3QhLmphkjywUHIwK2X9bw4EChE5Iu6bO9iJ4= +go.opentelemetry.io/collector/exporter/otlphttpexporter v0.84.0 h1:/PK1ekCGGsk3nHD5UchD0F1g8IQzg/dwoJYmGr98Jok= +go.opentelemetry.io/collector/exporter/otlphttpexporter v0.84.0/go.mod h1:dSXH+tnJ+Taj8wz4OVXFKIds5rsoK9idM77um8S9uCU= +go.opentelemetry.io/collector/extension v0.84.0 h1:HN4otmncTE/eaeRcvBGTf0ApcX+dIQWsnShs6bgiKYA= +go.opentelemetry.io/collector/extension v0.84.0/go.mod h1:FoUzonXMAjVbFuSLM06F1260iVcbnMLMAEQk/xBfN1Y= +go.opentelemetry.io/collector/extension/auth v0.84.0 h1:e6IgIzLFdtTBImOC2qtH64PP/D/U6it3azMrAQ3/22I= +go.opentelemetry.io/collector/extension/auth v0.84.0/go.mod h1:eYm6kN05PyJrNjousma3CXiwzBsI582tlKjF9AUxnpQ= +go.opentelemetry.io/collector/extension/ballastextension v0.84.0 h1:aAkdlLomt2VAcH/GPYAE34ExGVFkCuIU32e7T7qcc28= +go.opentelemetry.io/collector/extension/ballastextension v0.84.0/go.mod h1:h7s5V05auYg/OBywzT0W/vPlukSMdfFQyHoyhqp9k6Y= +go.opentelemetry.io/collector/extension/zpagesextension v0.84.0 h1:huytVHKFVKDQBnLvy5tL/AUmzE3ydOwPClOZq1iZp50= +go.opentelemetry.io/collector/extension/zpagesextension v0.84.0/go.mod h1:R6tfHCmRP1FUFKmsUqMTNPN+6LA54DaZLjai90ijMtc= go.opentelemetry.io/collector/featuregate v1.0.0-rcv0014 h1:C9o0mbP0MyygqFnKueVQK/v9jef6zvuttmTGlKaqhgw= go.opentelemetry.io/collector/featuregate v1.0.0-rcv0014/go.mod h1:0mE3mDLmUrOXVoNsuvj+7dV14h/9HFl/Fy9YTLoLObo= go.opentelemetry.io/collector/model v0.49.0/go.mod h1:nOYQv9KoFPs6ihJwOi24qB209EOhS9HkwhGj54YiEAw= @@ -1937,22 +1932,22 @@ go.opentelemetry.io/collector/pdata v0.56.0/go.mod h1:mYcCREWiIJyHss0dbU+GSiz2tm go.opentelemetry.io/collector/pdata v0.57.2/go.mod h1:RU9I8lwBUxucwOsSYzHEcHi15M9QaX78hgQ2PRdSxV0= go.opentelemetry.io/collector/pdata v1.0.0-rcv0014 h1:iT5qH0NLmkGeIdDtnBogYDx7L58t6CaWGL378DEo2QY= go.opentelemetry.io/collector/pdata v1.0.0-rcv0014/go.mod h1:BRvDrx43kiSoUx3mr7SoA7h9B8+OY99mUK+CZSQFWW4= -go.opentelemetry.io/collector/processor v0.83.0 h1:oWMpPzHLkzlPXRIa27UsfsaDSbXaF/0qeiCn3BaesGo= -go.opentelemetry.io/collector/processor v0.83.0/go.mod h1:sLxTTqkIhmNtekO0HebXgVclPpm/xoQ4+g8CbzgYBCM= -go.opentelemetry.io/collector/processor/batchprocessor v0.83.0 h1:Zj4VKcO+NPXEONd0pr6y94nbJdJr/I2VLNxCYcfH0Go= -go.opentelemetry.io/collector/processor/batchprocessor v0.83.0/go.mod h1:ZA8h5ZJYFzcRqp33+I/M81RZjnnLWrtQ9Q/I5lVBlLs= -go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.83.0 h1:OZPN7wOunbPnMeoCDPkoseUamtuG8CjiY+hhmD+yU7w= -go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.83.0/go.mod h1:8DM+L0qvJudvIxSwd7wiVMZpiipYJgX5GnS9Zq7hZzQ= -go.opentelemetry.io/collector/receiver v0.83.0 h1:T2LI6BGNGMGBN8DLWUy7KyFXVaQR8ah+7ssCwb8OqNs= -go.opentelemetry.io/collector/receiver v0.83.0/go.mod h1:yEo8Mv57a53Psd2BvUbP/he5ZtdrwHezeLUCTUtf6PA= -go.opentelemetry.io/collector/receiver/otlpreceiver v0.83.0 h1:A0xNr1N/d5jkO+42G9CQ7C69UZhcTsnAibo1FzRA/PA= -go.opentelemetry.io/collector/receiver/otlpreceiver v0.83.0/go.mod h1:h+WL9WneDgX4uHVBdt/yVINSB/NUzVTOqukoBF1F7uc= +go.opentelemetry.io/collector/processor v0.84.0 h1:6VM5HLdkroeqNZ/jvjxA4nsgweJ87FDMsnNnzVBHpcY= +go.opentelemetry.io/collector/processor v0.84.0/go.mod h1:KWgBNQuA6wmmRqJwfvPaRybK2Di9X8nE2fraGuVLNJo= +go.opentelemetry.io/collector/processor/batchprocessor v0.84.0 h1:U7M0bhno88+zSDUdatJnhP8B3B9H2YHazo4N9KNDZxY= +go.opentelemetry.io/collector/processor/batchprocessor v0.84.0/go.mod h1:oH0ruRQ7lFbPSu8G87yVM2H8XBHaKHbqj5pXfswYWTY= +go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.84.0 h1:KUFX6eFnd4z+5VslFWywYGLI+GQ8+FGQoKsp2rXhhV8= +go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.84.0/go.mod h1:mrCzpXymIQfkr4DgCwWhr5j6JQP6s9CODHSbjKOBlzs= +go.opentelemetry.io/collector/receiver v0.84.0 h1:5bN0A18UMAVu9AsFv5AYDgzEFEJ/nFaD1OK2rk7Ygy0= +go.opentelemetry.io/collector/receiver v0.84.0/go.mod h1:QvjpfmMUA4tW59QJBagoNEbRT5JGYZN333GAOuWIRr4= +go.opentelemetry.io/collector/receiver/otlpreceiver v0.84.0 h1:IP15rNEGPyBW5s2bbaJeTsNK3unmq4ZXKx02FvnSVhY= +go.opentelemetry.io/collector/receiver/otlpreceiver v0.84.0/go.mod h1:g3S6hF8pIczEJ620ZAmpB2Cz/SIhh7jJjJGIP8w1mCc= go.opentelemetry.io/collector/semconv v0.52.0/go.mod h1:SxK0rUnUP7YeDakexzbE/vhimTOHwE6m/4aKKd9e27Q= go.opentelemetry.io/collector/semconv v0.54.0/go.mod h1:HAGkPKNMhc4kEHevEqVIEtUuvsRQMIbUWBb8yBrqEwk= go.opentelemetry.io/collector/semconv v0.56.0/go.mod h1:EH1wbDvTyqKpKBBpoMIe0KQk2plCcFS66Mo17WtR7CQ= go.opentelemetry.io/collector/semconv v0.57.2/go.mod h1:84YnUjmm+nhGu4YTDLnHCbxnL74ooWpismPG79tFD7w= -go.opentelemetry.io/collector/semconv v0.83.0 h1:zfBJaGiC7XI8dLD/8QIyKre98RHcq3DaG1g1B+U/Dow= -go.opentelemetry.io/collector/semconv v0.83.0/go.mod h1:j/8THcqVxFna1FpvA2zYIsUperEtOaRaqoLYIN4doWw= +go.opentelemetry.io/collector/semconv v0.84.0 h1:sI1B8ebHhfJPd87iyba66TDnluVFvYu8CEpSjKHqIDc= +go.opentelemetry.io/collector/semconv v0.84.0/go.mod h1:j/8THcqVxFna1FpvA2zYIsUperEtOaRaqoLYIN4doWw= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.32.0/go.mod h1:J0dBVrt7dPS/lKJyQoW0xzQiUr4r2Ik1VwPjAUWnofI= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.33.0/go.mod h1:y/SlJpJQPd2UzfBCj0E9Flk9FDCtTyqUmaCB41qFrWI= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.1-0.20230612162650-64be7e574a17 h1:mdcNStUIXngF/mH3xxAo4nbR4g65IXqLL1SvYMjz7JQ= @@ -1982,6 +1977,12 @@ go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.39.0 h1:rm+ go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.39.0/go.mod h1:sWFbI3jJ+6JdjOVepA5blpv/TJ20Hw+26561iMbWcwU= go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.39.0 h1:IZXpCEtI7BbX01DRQEWTGDkvjMB6hEhiEZXS+eg2YqY= go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.39.0/go.mod h1:xY111jIZtWb+pUUgT4UiiSonAaY2cD2Ts5zvuKLki3o= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 h1:cbsD4cUcviQGXdw8+bo5x2wazq10SKz8hEbtCRPcU78= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0/go.mod h1:JgXSGah17croqhJfhByOLVY719k1emAXC8MVhCIJlRs= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0 h1:TVQp/bboR4mhZSav+MdgXB8FaRho1RC8UwVn3T0vjVc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0/go.mod h1:I33vtIe0sR96wfrUcilIzLoA3mLHhRmz9S9Te0S3gDo= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.16.0 h1:iqjq9LAB8aK++sKVcELezzn655JnBNdsDhghU4G/So8= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.16.0/go.mod h1:hGXzO5bhhSHZnKvrDaXB82Y9DRFour0Nz/KrBh7reWw= go.opentelemetry.io/otel/exporters/prometheus v0.30.0/go.mod h1:qN5feW+0/d661KDtJuATEmHtw5bKBK7NSvNEP927zSs= go.opentelemetry.io/otel/exporters/prometheus v0.31.0/go.mod h1:QarXIB8L79IwIPoNgG3A6zNvBgVmcppeFogV1d8612s= go.opentelemetry.io/otel/exporters/prometheus v0.39.0 h1:whAaiHxOatgtKd+w0dOi//1KUxj3KoPINZdtDaDj3IA= @@ -2095,8 +2096,8 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 h1:k/i9J1pBpvlfR+9QsetwPyERsqu1GIbi967PQMq3Ivc= -golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= +golang.org/x/exp v0.0.0-20230711023510-fffb14384f22 h1:FqrVOBQxQ8r/UwwXibI0KMolVhvFiGobSfdE33deHJM= +golang.org/x/exp v0.0.0-20230711023510-fffb14384f22/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= @@ -2190,7 +2191,6 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -2201,11 +2201,11 @@ golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220725212005-46097bf591d3/go.mod h1:AaygXjzTFtRAg2ttMY5RMuhpJ3cNnI0XpyFJD1iQRSM= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -2532,8 +2532,8 @@ golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= -gonum.org/v1/gonum v0.13.0 h1:a0T3bh+7fhRyqeNbiC3qVHYmkiQgit3wnNan/2c0HMM= -gonum.org/v1/gonum v0.13.0/go.mod h1:/WPYRckkfWrhWefxyYTfrTtQR0KH4iyHNuzxqXAKyAU= +gonum.org/v1/gonum v0.14.0 h1:2NiG67LD1tEH0D7kM+ps2V+fXmsAnpUeec7n8tcr4S0= +gonum.org/v1/gonum v0.14.0/go.mod h1:AoWeoz0becf9QMWtE8iWXNXc27fK4fNeHNf/oMejGfU= gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= @@ -2576,8 +2576,8 @@ google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRR google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= google.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6rKmw= google.golang.org/api v0.81.0/go.mod h1:FA6Mb/bZxj706H2j+j2d6mHEEaHBmbbWnkfvmorOCko= -google.golang.org/api v0.136.0 h1:e/6enzUE1s4tGPa6Q3ZYShKTtvRc+1Jq0rrafhppmOs= -google.golang.org/api v0.136.0/go.mod h1:XtJfF+V2zgUxelOn5Zs3kECtluMxneJG8ZxUTlLNTPA= +google.golang.org/api v0.138.0 h1:K/tVp05MxNVbHShRw9m7e9VJGdagNeTdMzqPH7AUqr0= +google.golang.org/api v0.138.0/go.mod h1:4xyob8CxC+0GChNBvEUAk8VBKNvYOTWM9T3v3UfRxuY= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -2657,7 +2657,6 @@ google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= @@ -2675,10 +2674,10 @@ google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 h1:L6iMMGrtzgHsWofoFcihmDEMYeDR9KN/ThbPWGrh++g= google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5/go.mod h1:oH/ZOT02u4kWEp7oYBGYFFkCdKS/uYR9Z7+0/xuuFp8= -google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5 h1:nIgk/EEq3/YlnmVVXVnm14rC2oxgs1o0ong4sD/rd44= -google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5/go.mod h1:5DZzOUPCLYL3mNkQ0ms0F3EuUNZ7py1Bqeq6sxzI7/Q= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230807174057-1744710a1577 h1:wukfNtZmZUurLN/atp2hiIeTKn7QJWIQdHzqmsOnAOk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230807174057-1744710a1577/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= +google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= @@ -2806,14 +2805,14 @@ honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.1.1/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= honnef.co/go/tools v0.1.2/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= k8s.io/api v0.21.1/go.mod h1:FstGROTmsSHBarKc8bylzXih8BLNYTiS3TZcsoEDg2s= -k8s.io/api v0.27.4 h1:0pCo/AN9hONazBKlNUdhQymmnfLRbSZjd5H5H3f0bSs= -k8s.io/api v0.27.4/go.mod h1:O3smaaX15NfxjzILfiln1D8Z3+gEYpjEpiNA/1EVK1Y= +k8s.io/api v0.28.1 h1:i+0O8k2NPBCPYaMB+uCkseEbawEt/eFaiRqUx8aB108= +k8s.io/api v0.28.1/go.mod h1:uBYwID+66wiL28Kn2tBjBYQdEU0Xk0z5qF8bIBqk/Dg= k8s.io/apimachinery v0.21.1/go.mod h1:jbreFvJo3ov9rj7eWT7+sYiRx+qZuCYXwWT1bcDswPY= -k8s.io/apimachinery v0.27.4 h1:CdxflD4AF61yewuid0fLl6bM4a3q04jWel0IlP+aYjs= -k8s.io/apimachinery v0.27.4/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= +k8s.io/apimachinery v0.28.1 h1:EJD40og3GizBSV3mkIoXQBsws32okPOy+MkRyzh6nPY= +k8s.io/apimachinery v0.28.1/go.mod h1:X0xh/chESs2hP9koe+SdIAcXWcQ+RM5hy0ZynB+yEvw= k8s.io/client-go v0.21.1/go.mod h1:/kEw4RgW+3xnBGzvp9IWxKSNA+lXn3A7AuH3gdOAzLs= -k8s.io/client-go v0.27.4 h1:vj2YTtSJ6J4KxaC88P4pMPEQECWMY8gqPqsTgUKzvjk= -k8s.io/client-go v0.27.4/go.mod h1:ragcly7lUlN0SRPk5/ZkGnDjPknzb37TICq07WhI6Xc= +k8s.io/client-go v0.28.1 h1:pRhMzB8HyLfVwpngWKE8hDcXRqifh1ga2Z/PU9SXVK8= +k8s.io/client-go v0.28.1/go.mod h1:pEZA3FqOsVkCc07pFVzK076R+P/eXqsgx5zuuRWukNE= k8s.io/code-generator v0.21.1/go.mod h1:hUlps5+9QaTrKx+jiM4rmq7YmH8wPOIko64uZCHDh6Q= k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20201214224949-b6c5ce23f027/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= @@ -2823,15 +2822,15 @@ k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= k8s.io/klog/v2 v2.8.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= -k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw= -k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg= +k8s.io/klog/v2 v2.100.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7/go.mod h1:wXW5VT87nVfh/iLV8FpR2uDvrFyomxbtb1KivDbvPTE= -k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f h1:2kWPakN3i/k81b0gvD5C5FJ2kxm1WrQFanWchyKuqGg= -k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f/go.mod h1:byini6yhqGC14c3ebc/QwanvYwhuMWF6yz2F8uwW8eg= +k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 h1:LyMgNKD2P8Wn1iAwQU5OhxCKlKJy0sHc+PcDwFB24dQ= +k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9/go.mod h1:wZK2AVp1uHCp4VamDVgBP2COHZjqD1T68Rf0CM3YjSM= k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20211116205334-6203023598ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= -k8s.io/utils v0.0.0-20230308161112-d77c459e9343 h1:m7tbIjXGcGIAtpmQr7/NAi7RsWoW3E7Zcm4jI1HicTc= -k8s.io/utils v0.0.0-20230308161112-d77c459e9343/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 h1:qY1Ad8PODbnymg2pRbkyMT/ylpTrCM8P2RJ0yroCyIk= +k8s.io/utils v0.0.0-20230406110748-d93618cff8a2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= mvdan.cc/gofumpt v0.1.0/go.mod h1:yXG1r1WqZVKWbVRtBWKWX9+CxGYfA51nSomhM0woR48= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= diff --git a/patches/statsDfeatGateInstrumentationScope.patch b/patches/statsDfeatGateInstrumentationScope.patch index 6b056c0e8..81302b7f2 100644 --- a/patches/statsDfeatGateInstrumentationScope.patch +++ b/patches/statsDfeatGateInstrumentationScope.patch @@ -21,7 +21,7 @@ index 1cfec5cf..699d6ee7 100644 ) +var instNameFeatGate = featuregate.GlobalRegistry().MustRegister("aws.statsd.populateInstrumentationScope", -+ featuregate.StageAlpha, ++ featuregate.StageBeta, + featuregate.WithRegisterFromVersion("v0.82.0"), + featuregate.WithRegisterDescription("populates instrumentation scope library name on StatsD receiver "+ + "metric data points"), diff --git a/testbed/go.mod b/testbed/go.mod index d99fddd51..ff3bfaae0 100644 --- a/testbed/go.mod +++ b/testbed/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/aws-observability/aws-otel-collector v0.31.0 - github.com/open-telemetry/opentelemetry-collector-contrib/testbed v0.83.0 + github.com/open-telemetry/opentelemetry-collector-contrib/testbed v0.84.0 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/collector/pdata v1.0.0-rcv0014 ) @@ -32,7 +32,7 @@ require ( github.com/DataDog/datadog-agent/pkg/util/log v0.48.0-beta.1 // indirect github.com/DataDog/datadog-agent/pkg/util/pointer v0.48.0-beta.1 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.48.0-beta.1 // indirect - github.com/DataDog/datadog-api-client-go/v2 v2.14.0 // indirect + github.com/DataDog/datadog-api-client-go/v2 v2.16.0 // indirect github.com/DataDog/datadog-go/v5 v5.1.1 // indirect github.com/DataDog/go-tuf v1.0.1-0.5.2 // indirect github.com/DataDog/gohai v0.0.0-20220718130825-1776f9beb9cc // indirect @@ -43,28 +43,28 @@ require ( github.com/DataDog/opentelemetry-mapping-go/pkg/quantile v0.7.0 // indirect github.com/DataDog/sketches-go v1.4.2 // indirect github.com/DataDog/zstd v1.5.2 // indirect - github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.18.0 // indirect - github.com/IBM/sarama v1.40.1 // indirect + github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.19.1 // indirect + github.com/IBM/sarama v1.41.0 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect github.com/Showmax/go-fqdn v1.0.0 // indirect github.com/alecthomas/participle/v2 v2.0.0 // indirect github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect - github.com/antonmedv/expr v1.13.0 // indirect + github.com/antonmedv/expr v1.14.3 // indirect github.com/apache/thrift v0.18.1 // indirect github.com/armon/go-metrics v0.4.1 // indirect - github.com/aws/aws-sdk-go v1.44.323 // indirect - github.com/aws/aws-sdk-go-v2 v1.20.1 // indirect - github.com/aws/aws-sdk-go-v2/config v1.18.33 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.13.32 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.8 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.38 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.32 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.3.39 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.32 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.13.2 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.15.2 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.21.2 // indirect - github.com/aws/smithy-go v1.14.1 // indirect + github.com/aws/aws-sdk-go v1.44.333 // indirect + github.com/aws/aws-sdk-go-v2 v1.21.0 // indirect + github.com/aws/aws-sdk-go-v2/config v1.18.37 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.13.35 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.3.42 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.35 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.13.5 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.15.5 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.21.5 // indirect + github.com/aws/smithy-go v1.14.2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/blang/semver v3.5.1+incompatible // indirect github.com/cenkalti/backoff v2.2.1+incompatible // indirect @@ -89,8 +89,8 @@ require ( github.com/docker/go-units v0.5.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/dynatrace-oss/dynatrace-metric-utils-go v0.5.0 // indirect - github.com/eapache/go-resiliency v1.3.0 // indirect - github.com/eapache/go-xerial-snappy v0.0.0-20230111030713-bf00bc1b83b6 // indirect + github.com/eapache/go-resiliency v1.4.0 // indirect + github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 // indirect github.com/eapache/queue v1.1.0 // indirect github.com/emicklei/go-restful/v3 v3.10.1 // indirect github.com/envoyproxy/go-control-plane v0.11.1-0.20230524094728-9239064ad72f // indirect @@ -112,6 +112,7 @@ require ( github.com/go-stack/stack v1.8.1 // indirect github.com/go-zookeeper/zk v1.0.3 // indirect github.com/gobwas/glob v0.2.3 // indirect + github.com/goccy/go-json v0.10.2 // indirect github.com/godbus/dbus/v5 v5.0.6 // indirect github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -121,19 +122,19 @@ require ( github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/cadvisor v0.47.3 // indirect - github.com/google/gnostic v0.6.9 // indirect + github.com/google/gnostic-models v0.6.8 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/google/gofuzz v1.2.0 // indirect - github.com/google/s2a-go v0.1.4 // indirect - github.com/google/uuid v1.3.0 // indirect + github.com/google/s2a-go v0.1.5 // indirect + github.com/google/uuid v1.3.1 // indirect github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect github.com/googleapis/gax-go/v2 v2.12.0 // indirect github.com/gophercloud/gophercloud v1.3.0 // indirect github.com/gorilla/mux v1.8.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/grafana/regexp v0.0.0-20221122212121-6b5c0a4cb7fd // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.2 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.17.1 // indirect github.com/hashicorp/consul/api v1.24.0 // indirect github.com/hashicorp/cronexpr v1.1.1 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect @@ -156,7 +157,7 @@ require ( github.com/jcmturner/aescts/v2 v2.0.0 // indirect github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect github.com/jcmturner/gofork v1.7.6 // indirect - github.com/jcmturner/gokrb5/v8 v8.4.3 // indirect + github.com/jcmturner/gokrb5/v8 v8.4.4 // indirect github.com/jcmturner/rpc/v2 v2.0.3 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect @@ -188,84 +189,84 @@ require ( github.com/mrunalp/fileutils v0.5.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsemfexporter v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/carbonexporter v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/dynatraceexporter v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/fileexporter v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/jaegerexporter v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/loadbalancingexporter v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/logzioexporter v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/opencensusexporter v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusexporter v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/sapmexporter v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/signalfxexporter v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/zipkinexporter v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsproxy v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer/ecsobserver v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/extension/pprofextension v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/extension/sigv4authextension v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/cwlogs v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/ecsutil v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/k8s v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/metrics v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/proxy v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/kubelet v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/metadataproviders v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/splunk v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchperresourceattr v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchpersignal v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/experimentalmetricmetadata v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/opencensus v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/signalfx v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/zipkin v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatorateprocessor v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbytraceprocessor v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sattributesprocessor v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricsgenerationprocessor v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricstransformprocessor v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/processor/probabilisticsamplerprocessor v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourceprocessor v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/processor/spanprocessor v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsecscontainermetricsreceiver v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/carbonreceiver v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/datadogreceiver v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kafkareceiver v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/opencensusreceiver v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/sapmreceiver v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/signalfxreceiver v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/splunkhecreceiver v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinreceiver v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/testbed/mockdatareceivers/mockawsxrayreceiver v0.83.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/testbed/mockdatasenders/mockdatadogagentexporter v0.83.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsemfexporter v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/carbonexporter v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/dynatraceexporter v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/fileexporter v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/jaegerexporter v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/loadbalancingexporter v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/logzioexporter v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/opencensusexporter v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusexporter v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/sapmexporter v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/signalfxexporter v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/zipkinexporter v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsproxy v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer/ecsobserver v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/extension/pprofextension v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/extension/sigv4authextension v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/cwlogs v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/ecsutil v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/k8s v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/metrics v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/proxy v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/kubelet v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/metadataproviders v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/splunk v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchperresourceattr v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchpersignal v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/experimentalmetricmetadata v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/opencensus v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/signalfx v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/zipkin v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatorateprocessor v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbytraceprocessor v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sattributesprocessor v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricsgenerationprocessor v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricstransformprocessor v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/processor/probabilisticsamplerprocessor v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourceprocessor v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/processor/spanprocessor v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsecscontainermetricsreceiver v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/carbonreceiver v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/datadogreceiver v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kafkareceiver v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/opencensusreceiver v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/sapmreceiver v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/signalfxreceiver v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/splunkhecreceiver v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinreceiver v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/testbed/mockdatareceivers/mockawsxrayreceiver v0.84.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/testbed/mockdatasenders/mockdatadogagentexporter v0.84.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc4 // indirect github.com/opencontainers/runc v1.1.8 // indirect @@ -279,7 +280,7 @@ require ( github.com/ovh/go-ovh v1.4.1 // indirect github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/philhofer/fwd v1.1.2 // indirect - github.com/pierrec/lz4/v4 v4.1.17 // indirect + github.com/pierrec/lz4/v4 v4.1.18 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c // indirect @@ -326,35 +327,35 @@ require ( github.com/xdg-go/stringprep v1.0.4 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/collector v0.83.0 // indirect - go.opentelemetry.io/collector/component v0.83.0 // indirect - go.opentelemetry.io/collector/config/configauth v0.83.0 // indirect - go.opentelemetry.io/collector/config/configcompression v0.83.0 // indirect - go.opentelemetry.io/collector/config/configgrpc v0.83.0 // indirect - go.opentelemetry.io/collector/config/confighttp v0.83.0 // indirect - go.opentelemetry.io/collector/config/confignet v0.83.0 // indirect - go.opentelemetry.io/collector/config/configopaque v0.83.0 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.83.0 // indirect - go.opentelemetry.io/collector/config/configtls v0.83.0 // indirect - go.opentelemetry.io/collector/config/internal v0.83.0 // indirect - go.opentelemetry.io/collector/confmap v0.83.0 // indirect - go.opentelemetry.io/collector/connector v0.83.0 // indirect - go.opentelemetry.io/collector/consumer v0.83.0 // indirect - go.opentelemetry.io/collector/exporter v0.83.0 // indirect - go.opentelemetry.io/collector/exporter/loggingexporter v0.83.0 // indirect - go.opentelemetry.io/collector/exporter/otlpexporter v0.83.0 // indirect - go.opentelemetry.io/collector/exporter/otlphttpexporter v0.83.0 // indirect - go.opentelemetry.io/collector/extension v0.83.0 // indirect - go.opentelemetry.io/collector/extension/auth v0.83.0 // indirect - go.opentelemetry.io/collector/extension/ballastextension v0.83.0 // indirect - go.opentelemetry.io/collector/extension/zpagesextension v0.83.0 // indirect + go.opentelemetry.io/collector v0.84.0 // indirect + go.opentelemetry.io/collector/component v0.84.0 // indirect + go.opentelemetry.io/collector/config/configauth v0.84.0 // indirect + go.opentelemetry.io/collector/config/configcompression v0.84.0 // indirect + go.opentelemetry.io/collector/config/configgrpc v0.84.0 // indirect + go.opentelemetry.io/collector/config/confighttp v0.84.0 // indirect + go.opentelemetry.io/collector/config/confignet v0.84.0 // indirect + go.opentelemetry.io/collector/config/configopaque v0.84.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.84.0 // indirect + go.opentelemetry.io/collector/config/configtls v0.84.0 // indirect + go.opentelemetry.io/collector/config/internal v0.84.0 // indirect + go.opentelemetry.io/collector/confmap v0.84.0 // indirect + go.opentelemetry.io/collector/connector v0.84.0 // indirect + go.opentelemetry.io/collector/consumer v0.84.0 // indirect + go.opentelemetry.io/collector/exporter v0.84.0 // indirect + go.opentelemetry.io/collector/exporter/loggingexporter v0.84.0 // indirect + go.opentelemetry.io/collector/exporter/otlpexporter v0.84.0 // indirect + go.opentelemetry.io/collector/exporter/otlphttpexporter v0.84.0 // indirect + go.opentelemetry.io/collector/extension v0.84.0 // indirect + go.opentelemetry.io/collector/extension/auth v0.84.0 // indirect + go.opentelemetry.io/collector/extension/ballastextension v0.84.0 // indirect + go.opentelemetry.io/collector/extension/zpagesextension v0.84.0 // indirect go.opentelemetry.io/collector/featuregate v1.0.0-rcv0014 // indirect - go.opentelemetry.io/collector/processor v0.83.0 // indirect - go.opentelemetry.io/collector/processor/batchprocessor v0.83.0 // indirect - go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.83.0 // indirect - go.opentelemetry.io/collector/receiver v0.83.0 // indirect - go.opentelemetry.io/collector/receiver/otlpreceiver v0.83.0 // indirect - go.opentelemetry.io/collector/semconv v0.83.0 // indirect + go.opentelemetry.io/collector/processor v0.84.0 // indirect + go.opentelemetry.io/collector/processor/batchprocessor v0.84.0 // indirect + go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.84.0 // indirect + go.opentelemetry.io/collector/receiver v0.84.0 // indirect + go.opentelemetry.io/collector/receiver/otlpreceiver v0.84.0 // indirect + go.opentelemetry.io/collector/semconv v0.84.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.1-0.20230612162650-64be7e574a17 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0 // indirect go.opentelemetry.io/contrib/propagators/b3 v1.17.0 // indirect @@ -365,6 +366,9 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.39.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.39.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.16.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.39.0 // indirect go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.39.0 // indirect go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.16.0 // indirect @@ -378,7 +382,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.25.0 // indirect golang.org/x/crypto v0.12.0 // indirect - golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect + golang.org/x/exp v0.0.0-20230711023510-fffb14384f22 // indirect golang.org/x/mod v0.12.0 // indirect golang.org/x/net v0.14.0 // indirect golang.org/x/oauth2 v0.11.0 // indirect @@ -387,12 +391,12 @@ require ( golang.org/x/text v0.12.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.12.0 // indirect - gonum.org/v1/gonum v0.13.0 // indirect - google.golang.org/api v0.136.0 // indirect + gonum.org/v1/gonum v0.14.0 // indirect + google.golang.org/api v0.138.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230807174057-1744710a1577 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect google.golang.org/grpc v1.57.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect @@ -401,13 +405,13 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/zorkian/go-datadog-api.v2 v2.30.0 // indirect - k8s.io/api v0.27.4 // indirect - k8s.io/apimachinery v0.27.4 // indirect - k8s.io/client-go v0.27.4 // indirect + k8s.io/api v0.28.1 // indirect + k8s.io/apimachinery v0.28.1 // indirect + k8s.io/client-go v0.28.1 // indirect k8s.io/klog v1.0.0 // indirect - k8s.io/klog/v2 v2.90.1 // indirect - k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect - k8s.io/utils v0.0.0-20230308161112-d77c459e9343 // indirect + k8s.io/klog/v2 v2.100.1 // indirect + k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect + k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect sigs.k8s.io/controller-runtime v0.15.1 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect diff --git a/testbed/go.sum b/testbed/go.sum index ce16713a5..bfe867860 100644 --- a/testbed/go.sum +++ b/testbed/go.sum @@ -118,8 +118,8 @@ github.com/DataDog/datadog-agent/pkg/util/pointer v0.48.0-beta.1/go.mod h1:HMpYp github.com/DataDog/datadog-agent/pkg/util/scrubber v0.48.0-beta.1 h1:EOrKgyyubncuS4LpF8aCj/12i1+GmPV+PCfj8mDaF2c= github.com/DataDog/datadog-agent/pkg/util/scrubber v0.48.0-beta.1/go.mod h1:Whfh1SJOwtp2YvDUNzqw/jmSbGOOso+HJHOEJULh1+M= github.com/DataDog/datadog-agent/pkg/util/winutil v0.0.0-20201009092105-58e18918b2db/go.mod h1:EtS4X73GXAyrpVddkLQ4SewSQX+zv284e8iIkVBXgtk= -github.com/DataDog/datadog-api-client-go/v2 v2.14.0 h1:cLkqg/D63I6BAxIIg6g8xMWjrAMXcvb5vbD8ixOVVyo= -github.com/DataDog/datadog-api-client-go/v2 v2.14.0/go.mod h1:kntOqXEh1SmjwSDzW/eJkr9kS7EqttvEkelglWtJRbg= +github.com/DataDog/datadog-api-client-go/v2 v2.16.0 h1:wwroXLmBlO5/o+uS1UxDpuMIkhIL6gJAu6m0ttGM5Yc= +github.com/DataDog/datadog-api-client-go/v2 v2.16.0/go.mod h1:uJd7G1BONVIyiVw684VMn2XYI1FfN1tx4bRGenAf2bo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/datadog-go v3.5.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/datadog-go/v5 v5.1.1 h1:JLZ6s2K1pG2h9GkvEvMdEGqMDyVLEAccdX5TltWcLMU= @@ -146,15 +146,15 @@ github.com/DataDog/zstd v1.4.4/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t github.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8= github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.18.0 h1:ugYJK/neZQtQeh2jc5xNoDFiMQojlAkoqJMRb7vTu1U= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.18.0/go.mod h1:Xx0VKh7GJ4si3rmElbh19Mejxz68ibWg/J30ZOMrqzU= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.19.1 h1:LyRJCTBJP53P1JURFbhFSRz36gxaBtMAjzjlYupNR7Q= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.19.1/go.mod h1:Xx0VKh7GJ4si3rmElbh19Mejxz68ibWg/J30ZOMrqzU= github.com/HdrHistogram/hdrhistogram-go v0.9.0/go.mod h1:nxrse8/Tzg2tg3DZcZjm6qEclQKK70g0KxO61gFFZD4= github.com/HdrHistogram/hdrhistogram-go v1.0.1/go.mod h1:BWJ+nMSHY3L41Zj7CA3uXnloDp7xxV0YvstAE7nKTaM= github.com/HdrHistogram/hdrhistogram-go v1.1.0/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= github.com/HdrHistogram/hdrhistogram-go v1.1.2 h1:5IcZpTvzydCQeHzK4Ef/D5rrSqwxob0t8PQPMybUNFM= github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= -github.com/IBM/sarama v1.40.1 h1:lL01NNg/iBeigUbT+wpPysuTYW6roHo6kc1QrffRf0k= -github.com/IBM/sarama v1.40.1/go.mod h1:+5OFwA5Du9I6QrznhaMHsuwWdWZNMjaBSIxEWEgKOYE= +github.com/IBM/sarama v1.41.0 h1:c+fV23/HDO+M88dTYFg7TFRlxU0scgfdcFrQh/8s5Z8= +github.com/IBM/sarama v1.41.0/go.mod h1:JFCPURVskaipJdKRFkiE/OZqQHw7jqliaJmRwXCmSSw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= @@ -172,10 +172,8 @@ github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdko github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/sarama v1.22.2-0.20190604114437-cd910a683f9f/go.mod h1:XLH1GYJnLVE0XCr6KdJGVJRTwY30moWNJ4sERjXX6fs= github.com/Shopify/sarama v1.32.0/go.mod h1:+EmJJKZWVT/faR9RcOxJerP+LId4iWdQPBGLy1Y1Njs= -github.com/Shopify/toxiproxy v2.1.4+incompatible h1:TKdv8HiTLgE5wdJuEML90aBgNWsokNbMijUGhmcoBJc= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/Shopify/toxiproxy/v2 v2.3.0/go.mod h1:KvQTtB6RjCJY4zqNJn7C7JDFgsG5uoHYDirfUfpIm0c= -github.com/Shopify/toxiproxy/v2 v2.5.0 h1:i4LPT+qrSlKNtQf5QliVjdP08GyAH8+BUIc9gT0eahc= github.com/Showmax/go-fqdn v1.0.0 h1:0rG5IbmVliNT5O19Mfuvna9LL7zlHyRfsSvBPZmF9tM= github.com/Showmax/go-fqdn v1.0.0/go.mod h1:SfrFBzmDCtCGrnHhoDjuvFnKsWjEQX/Q9ARZvOrJAko= github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= @@ -201,8 +199,8 @@ github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/antonmedv/expr v1.9.0/go.mod h1:5qsM3oLGDND7sDmQGDXHkYfkjYMUX14qsgqmHhwGEk8= -github.com/antonmedv/expr v1.13.0 h1:8YrTtlCzlOtXw+hpeCLDLL2uo0C0k6jmYpYTGws5c5w= -github.com/antonmedv/expr v1.13.0/go.mod h1:FPC8iWArxls7axbVLsW+kpg1mz29A1b2M6jt+hZfDkU= +github.com/antonmedv/expr v1.14.3 h1:GPrP7xKPWkFaLANPS7tPrgkNs7FMHpZdL72Dc5kFykg= +github.com/antonmedv/expr v1.14.3/go.mod h1:FPC8iWArxls7axbVLsW+kpg1mz29A1b2M6jt+hZfDkU= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.16.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU= @@ -231,48 +229,48 @@ github.com/aws/aws-sdk-go v1.35.24/go.mod h1:tlPOdRjfxPBpNIwqDj61rmsnA85v9jc0Ps9 github.com/aws/aws-sdk-go v1.38.35/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/aws/aws-sdk-go v1.38.68/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/aws/aws-sdk-go v1.40.45/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= -github.com/aws/aws-sdk-go v1.44.323 h1:97/dn93DWrN1VfhAWQ2tV+xuE6oO/LO9rSsEsuC4PLU= -github.com/aws/aws-sdk-go v1.44.323/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.44.333 h1:X0j5TGXtHLZzDB/uRcGKLG77ERFtxYQtXefs+Apf2PU= +github.com/aws/aws-sdk-go v1.44.333/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= github.com/aws/aws-sdk-go-v2 v1.7.0/go.mod h1:tb9wi5s61kTDA5qCkcDbt3KRVV74GGslQkl/DRdX/P4= github.com/aws/aws-sdk-go-v2 v1.9.1/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4= github.com/aws/aws-sdk-go-v2 v1.9.2/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4= -github.com/aws/aws-sdk-go-v2 v1.20.1 h1:rZBf5DWr7YGrnlTK4kgDQGn1ltqOg5orCYb/UhOFZkg= -github.com/aws/aws-sdk-go-v2 v1.20.1/go.mod h1:NU06lETsFm8fUC6ZjhgDpVBcGZTFQ6XM+LZWZxMI4ac= +github.com/aws/aws-sdk-go-v2 v1.21.0 h1:gMT0IW+03wtYJhRqTVYn0wLzwdnK9sRMcxmtfGzRdJc= +github.com/aws/aws-sdk-go-v2 v1.21.0/go.mod h1:/RfNgGmRxI+iFOB1OeJUyxiU+9s88k3pfHvDagGEp0M= github.com/aws/aws-sdk-go-v2/config v1.8.3/go.mod h1:4AEiLtAb8kLs7vgw2ZV3p2VZ1+hBavOc84hqxVNpCyw= -github.com/aws/aws-sdk-go-v2/config v1.18.33 h1:JKcw5SFxFW/rpM4mOPjv0VQ11E2kxW13F3exWOy7VZU= -github.com/aws/aws-sdk-go-v2/config v1.18.33/go.mod h1:hXO/l9pgY3K5oZJldamP0pbZHdPqqk+4/maa7DSD3cA= +github.com/aws/aws-sdk-go-v2/config v1.18.37 h1:RNAfbPqw1CstCooHaTPhScz7z1PyocQj0UL+l95CgzI= +github.com/aws/aws-sdk-go-v2/config v1.18.37/go.mod h1:8AnEFxW9/XGKCbjYDCJy7iltVNyEI9Iu9qC21UzhhgQ= github.com/aws/aws-sdk-go-v2/credentials v1.4.3/go.mod h1:FNNC6nQZQUuyhq5aE5c7ata8o9e4ECGmS4lAXC7o1mQ= -github.com/aws/aws-sdk-go-v2/credentials v1.13.32 h1:lIH1eKPcCY1ylR4B6PkBGRWMHO3aVenOKJHWiS4/G2w= -github.com/aws/aws-sdk-go-v2/credentials v1.13.32/go.mod h1:lL8U3v/Y79YRG69WlAho0OHIKUXCyFvSXaIvfo81sls= +github.com/aws/aws-sdk-go-v2/credentials v1.13.35 h1:QpsNitYJu0GgvMBLUIYu9H4yryA5kMksjeIVQfgXrt8= +github.com/aws/aws-sdk-go-v2/credentials v1.13.35/go.mod h1:o7rCaLtvK0hUggAGclf76mNGGkaG5a9KWlp+d9IpcV8= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.6.0/go.mod h1:gqlclDEZp4aqJOancXK6TN24aKhT0W0Ae9MHk3wzTMM= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.8 h1:DK/9C+UN/X+1+Wm8pqaDksQr2tSLzq+8X1/rI/ZxKEQ= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.8/go.mod h1:ce7BgLQfYr5hQFdy67oX2svto3ufGtm6oBvmsHScI1Q= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.38 h1:c8ed/T9T2K5I+h/JzmF5tpI46+OODQ74dzmdo+QnaMg= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.38/go.mod h1:qggunOChCMu9ZF/UkAfhTz25+U2rLVb3ya0Ua6TTfCA= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.32 h1:hNeAAymUY5gu11WrrmFb3CVIp9Dar9hbo44yzzcQpzA= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.32/go.mod h1:0ZXSqrty4FtQ7p8TEuRde/SZm9X05KT18LAUlR40Ln0= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11 h1:uDZJF1hu0EVT/4bogChk8DyjSF6fof6uL/0Y26Ma7Fg= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11/go.mod h1:TEPP4tENqBGO99KwVpV9MlOX4NSrSLP8u3KRy2CDwA8= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41 h1:22dGT7PneFMx4+b3pz7lMTRyN8ZKH7M2cW4GP9yUS2g= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41/go.mod h1:CrObHAuPneJBlfEJ5T3szXOUkLEThaGfvnhTf33buas= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35 h1:SijA0mgjV8E+8G45ltVHs0fvKpTj8xmZJ3VwhGKtUSI= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35/go.mod h1:SJC1nEVVva1g3pHAIdCp7QsRIkMmLAgoDquQ9Rr8kYw= github.com/aws/aws-sdk-go-v2/internal/ini v1.2.4/go.mod h1:ZcBrrI3zBKlhGFNYWvju0I3TR93I7YIgAfy82Fh4lcQ= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.39 h1:fc0ukRAiP1syoSGZYu+DaE+FulSYhTiJ8WpVu5jElU4= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.39/go.mod h1:WLAW8PT7+JhjZfLSWe7WEJaJu0GNo0cKc2Zyo003RBs= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.42 h1:GPUcE/Yq7Ur8YSUk6lVkoIMWnJNO0HT18GUzCWCgCI0= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.42/go.mod h1:rzfdUlfA+jdgLDmPKjd3Chq9V7LVLYo1Nz++Wb91aRo= github.com/aws/aws-sdk-go-v2/service/appconfig v1.4.2/go.mod h1:FZ3HkCe+b10uFZZkFdvf98LHW21k49W8o8J366lqVKY= github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.5.0/go.mod h1:acH3+MQoiMzozT/ivU+DbRg7Ooo2298RdRaWcOv+4vM= github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.8.1/go.mod h1:CM+19rL1+4dFWnOQKwDc7H1KwXTz+h61oUSHyhV0b3o= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.3.2/go.mod h1:72HRZDLMtmVQiLG2tLfQcaWLCssELvGl+Zf2WVxMmR8= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.32 h1:dGAseBFEYxth10V23b5e2mAS+tX7oVbfYHD6dnDdAsg= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.32/go.mod h1:4jwAWKEkCR0anWk5+1RbfSg1R5Gzld7NLiuaq5bTR/Y= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.35 h1:CdzPW9kKitgIiLV1+MHobfR5Xg25iYnyzWZhyQuSlDI= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.35/go.mod h1:QGF2Rs33W5MaN9gYdEQOBBFPLwTZkEhRwI33f7KIG0o= github.com/aws/aws-sdk-go-v2/service/sso v1.4.2/go.mod h1:NBvT9R1MEF+Ud6ApJKM0G+IkPchKS7p7c2YPKwHmBOk= -github.com/aws/aws-sdk-go-v2/service/sso v1.13.2 h1:A2RlEMo4SJSwbNoUUgkxTAEMduAy/8wG3eB2b2lP4gY= -github.com/aws/aws-sdk-go-v2/service/sso v1.13.2/go.mod h1:ju+nNXUunfIFamXUIZQiICjnO/TPlOmWcYhZcSy7xaE= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.15.2 h1:OJELEgyaT2kmaBGZ+myyZbTTLobfe3ox3FSh5eYK9Qs= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.15.2/go.mod h1:ubDBBaDFs1GHijSOTi8ljppML15GLG0HxhILtbjNNYQ= +github.com/aws/aws-sdk-go-v2/service/sso v1.13.5 h1:oCvTFSDi67AX0pOX3PuPdGFewvLRU2zzFSrTsgURNo0= +github.com/aws/aws-sdk-go-v2/service/sso v1.13.5/go.mod h1:fIAwKQKBFu90pBxx07BFOMJLpRUGu8VOzLJakeY+0K4= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.15.5 h1:dnInJb4S0oy8aQuri1mV6ipLlnZPfnsDNB9BGO9PDNY= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.15.5/go.mod h1:yygr8ACQRY2PrEcy3xsUI357stq2AxnFM6DIsR9lij4= github.com/aws/aws-sdk-go-v2/service/sts v1.7.2/go.mod h1:8EzeIqfWt2wWT4rJVu3f21TfrhJ8AEMzVybRNSb/b4g= -github.com/aws/aws-sdk-go-v2/service/sts v1.21.2 h1:ympg1+Lnq33XLhcK/xTG4yZHPs1Oyxu+6DEWbl7qOzA= -github.com/aws/aws-sdk-go-v2/service/sts v1.21.2/go.mod h1:FQ/DQcOfESELfJi5ED+IPPAjI5xC6nxtSolVVB773jM= +github.com/aws/aws-sdk-go-v2/service/sts v1.21.5 h1:CQBFElb0LS8RojMJlxRSo/HXipvTZW2S44Lt9Mk2aYQ= +github.com/aws/aws-sdk-go-v2/service/sts v1.21.5/go.mod h1:VC7JDqsqiwXukYEDjoHh9U0fOJtNWh04FPQz4ct4GGU= github.com/aws/smithy-go v1.5.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= -github.com/aws/smithy-go v1.14.1 h1:EFKMUmH/iHMqLiwoEDx2rRjRQpI1YCn5jTysoaDujFs= -github.com/aws/smithy-go v1.14.1/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= +github.com/aws/smithy-go v1.14.2 h1:MJU9hqBGbvWZdApzpvoF2WAIJDbtjK2NDJSiJP7HblQ= +github.com/aws/smithy-go v1.14.2/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -291,7 +289,6 @@ github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4Yn github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/bombsimon/wsl/v3 v3.2.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc= github.com/bsm/sarama-cluster v2.1.13+incompatible/go.mod h1:r7ao+4tTNXvWm+VRpRJchr2kQhqxgmAp2iEX5W96gMM= -github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/casbin/casbin/v2 v2.31.6/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg= github.com/casbin/casbin/v2 v2.37.0/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg= @@ -418,11 +415,11 @@ github.com/dynatrace-oss/dynatrace-metric-utils-go v0.5.0 h1:wHGPJSXvwKQVf/XfhjU github.com/dynatrace-oss/dynatrace-metric-utils-go v0.5.0/go.mod h1:PseHFo8Leko7J4A/TfZ6kkHdkzKBLUta6hRZR/OEbbc= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-resiliency v1.2.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= -github.com/eapache/go-resiliency v1.3.0 h1:RRL0nge+cWGlxXbUzJ7yMcq6w2XBEr19dCN6HECGaT0= -github.com/eapache/go-resiliency v1.3.0/go.mod h1:5yPzW0MIvSe0JDsv0v+DvcjEv2FyD6iZYSs1ZI+iQho= +github.com/eapache/go-resiliency v1.4.0 h1:3OK9bWpPk5q6pbFAaYSEwD9CLUSHG8bnZuqX2yMt3B0= +github.com/eapache/go-resiliency v1.4.0/go.mod h1:5yPzW0MIvSe0JDsv0v+DvcjEv2FyD6iZYSs1ZI+iQho= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= -github.com/eapache/go-xerial-snappy v0.0.0-20230111030713-bf00bc1b83b6 h1:8yY/I9ndfrgrXUbOGObLHKBR4Fl3nZXwM2c7OYTT8hM= -github.com/eapache/go-xerial-snappy v0.0.0-20230111030713-bf00bc1b83b6/go.mod h1:YvSRo5mw33fLEx1+DlK6L2VV43tJt5Eyel9n9XBcR+0= +github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 h1:Oy0F4ALJ04o5Qqpdz8XLIpNA3WM/iSIXqxtqo7UGVws= +github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3/go.mod h1:YvSRo5mw33fLEx1+DlK6L2VV43tJt5Eyel9n9XBcR+0= github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= @@ -469,7 +466,6 @@ github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSw github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/flowstack/go-jsonschema v0.1.1/go.mod h1:yL7fNggx1o8rm9RlgXv7hTBWxdBM0rVwpMwimd3F3N0= github.com/fluent/fluent-logger-golang v1.9.0 h1:zUdY44CHX2oIUc7VTNZc+4m+ORuO/mldQDA7czhWXEg= github.com/fluent/fluent-logger-golang v1.9.0/go.mod h1:2/HCT/jTy78yGyeNGQLGQsjF3zzzAuy6Xlk6FCMV5eU= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= @@ -665,6 +661,8 @@ github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/V github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= +github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= +github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/gocql/gocql v0.0.0-20200228163523-cd4b606dd2fb/go.mod h1:DL0ekTmBSTdlNF25Orwt/JMzqIq3EJ4MVa/J/uK64OY= github.com/gocql/gocql v0.0.0-20211222173705-d73e6b1002a7/go.mod h1:3gM2c4D3AnkISwBxGnMMsS8Oy4y2lhbPRsH4xnJrHG8= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -747,8 +745,8 @@ github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= github.com/google/cadvisor v0.47.3 h1:5XKTHBduWlBjmgw07uwEiC+Xa/FRd0MZI37oqlTagO0= github.com/google/cadvisor v0.47.3/go.mod h1:iJdTjcjyKHjLCf7OSTzwP5GxdfrkPusw2x5bwGvuLUw= github.com/google/flatbuffers v1.12.1/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= -github.com/google/gnostic v0.6.9 h1:ZK/5VhkoX835RikCHpSUJV9a+S3e1zLh59YnyWeBW+0= -github.com/google/gnostic v0.6.9/go.mod h1:Nm8234We1lq6iB9OmlgNv3nH91XLLVZHCDayfA3xq+E= +github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= +github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -792,13 +790,14 @@ github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20230406165453-00490a63f317 h1:hFhpt7CTmR3DX+b4R19ydQFtofxT0Sv3QsKNMVQYTMQ= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= -github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= +github.com/google/s2a-go v0.1.5 h1:8IYp3w9nysqv3JH+NJgXJzGbDHzLOTj43BmSkp+O7qg= +github.com/google/s2a-go v0.1.5/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.2.5 h1:UR4rDjcgpgEnqpIEvkiqTYKBCKLNmlge2eVjoZfySzM= github.com/googleapis/enterprise-certificate-proxy v0.2.5/go.mod h1:RxW0N9901Cko1VOCW3SXCpWP+mlIEkk2tP7jnHy9a3w= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= @@ -855,8 +854,8 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t github.com/grpc-ecosystem/grpc-gateway v1.14.5/go.mod h1:UJ0EZAp832vCd54Wev9N1BMKEyvcZ5+IM0AwDrnlkEc= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.2 h1:dygLcbEBA+t/P7ck6a8AkXv6juQ4cK0RHBoh32jxhHM= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.2/go.mod h1:Ap9RLCIJVtgQg1/BBgVEfypOAySvvlcpcVQkSzJCH4Y= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.17.1 h1:LSsiG61v9IzzxMkqEr6nrix4miJI62xlRjwT7BYD2SM= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.17.1/go.mod h1:Hbb13e3/WtqQ8U5hLGkek9gJvBLasHuPFI0UEGfnQ10= github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645/go.mod h1:6iZfnjpejD4L/4DwD7NryNaJyCQdzwWwH2MWhCA90Kw= github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= @@ -996,8 +995,8 @@ github.com/jcmturner/gofork v1.7.6/go.mod h1:1622LH6i/EZqLloHfE7IeZ0uEJwMSUyQ/nD github.com/jcmturner/goidentity/v6 v6.0.1 h1:VKnZd2oEIMorCTsFBnJWbExfNN7yZr3EhJAxwOkZg6o= github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg= github.com/jcmturner/gokrb5/v8 v8.4.2/go.mod h1:sb+Xq/fTY5yktf/VxLsE3wlfPqQjp0aWNYyvBVK62bc= -github.com/jcmturner/gokrb5/v8 v8.4.3 h1:iTonLeSJOn7MVUtyMT+arAn5AKAPrkilzhGw8wE/Tq8= -github.com/jcmturner/gokrb5/v8 v8.4.3/go.mod h1:dqRwJGXznQrzw6cWmyo6kH+E7jksEQG/CyVWsJEsJO0= +github.com/jcmturner/gokrb5/v8 v8.4.4 h1:x1Sv4HaTpepFkXbt2IkL29DXRf8sOfZXo8eRKh687T8= +github.com/jcmturner/gokrb5/v8 v8.4.4/go.mod h1:1btQEpgT6k+unzCwX1KdWMEwPPkkgBtP+F6aCACiMrs= github.com/jcmturner/rpc/v2 v2.0.3 h1:7FXXj8Ti1IaVFpSAziCZWNzbNuZmnvw/i6CqLNdWfZY= github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc= github.com/jgautheron/goconst v1.4.0/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= @@ -1285,178 +1284,178 @@ github.com/onsi/gomega v1.10.4/go.mod h1:g/HbgYopi++010VEqkFgJHKC09uJiW9UkXvMUuK github.com/onsi/gomega v1.13.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je41yGY= github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsemfexporter v0.83.0 h1:xuJ7AgUJqHqBWaFNeph0fjID+4+KgBgv16RJr0WgfMA= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsemfexporter v0.83.0/go.mod h1:3aJHSLrF4WO2LecdoPBcbKeCKhYVONPersDFOMLy1Vs= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.83.0 h1:gnc6xAyFcjhP8C3ebKXSyJHPinM+n2aiT507qfFxGWU= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.83.0/go.mod h1:n3ry12plQOS4XbIYpyeqHJKVl1y7eVZSLKt2M7v00Dk= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/carbonexporter v0.83.0 h1:gDA4OLeR+1los/r0HOk3QHYSyEKteSCWvy2K4coAByw= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/carbonexporter v0.83.0/go.mod h1:gDdbegXiz2J1jRqt40cZiRng/cY3PRe+oLAwHKNGPSs= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter v0.83.0 h1:RahPWJc7FILuSw6Nr5LjjFqhzhRoVp4iiPMQppUnA+0= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter v0.83.0/go.mod h1:OxipJxncCOdyxT1rPl+iVHRAov5JepMgJ9NkuAPmJgM= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/dynatraceexporter v0.83.0 h1:ZSrG3KAWvc4fZA0LPj+uv1qwpovVuWDXaj18ERayib4= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/dynatraceexporter v0.83.0/go.mod h1:eeaXESKotV8YV/2Rv4vJ+VAJ3bkcq4WKGWEz9AkZMMk= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/fileexporter v0.83.0 h1:GoOSCUUy3pNrVfu1sCzXQCr1/dKDFtgYBza6gCaMsfI= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/fileexporter v0.83.0/go.mod h1:vw5V9r2TOdcnL1kAIVARKtEa67rE90qEm0AH/eS7s/Y= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/jaegerexporter v0.83.0 h1:NVPfnIP870JbKs99pvYs6lvu3a0YG9zbiawX4hbWy3Y= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/jaegerexporter v0.83.0/go.mod h1:MZZc7q2ISS95bCH2Oo13aLAynr2n+rWOeUollKxnQm4= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter v0.83.0 h1:UY9GbD8VBY//agLPuCejj/Fqjf1uAWqT5LCpv11UcDY= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter v0.83.0/go.mod h1:33K8WHr2YXDG1/vK+01BiMefL2Jjwrt4c4zli3Vqp8o= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/loadbalancingexporter v0.83.0 h1:LzwGcOtWKNEoLsyZ8B7fdb73x7zEbyz5ghVdkpJqANg= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/loadbalancingexporter v0.83.0/go.mod h1:fLGts4FyYaBEIxp+7Ag35Gq0bEks5L0tu2qhRFi/3KY= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/logzioexporter v0.83.0 h1:zuOyT4t0uB0Sqw4PnsOezXUyOn+kWp+HslxAiGmB5HE= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/logzioexporter v0.83.0/go.mod h1:09NFg+NzQA8p1CqVSuW52HZHNvdOIFVrSV17UANM9KI= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/opencensusexporter v0.83.0 h1:EXm69xbvQxXhjdUwmwJFCCFRYRUpivGRpONm+DyoBD8= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/opencensusexporter v0.83.0/go.mod h1:orWUFaocRVBHqzn316qgLGwnwx6enXVHFZ0AlT3ZujQ= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusexporter v0.83.0 h1:GUovWPxEil/VpfkfPp9KBmidnZHX9SdD5vsfqzcssCM= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusexporter v0.83.0/go.mod h1:zHOElC2vEg1cUv2P2Pwgd/YhYJTQEbOpJohpoZGWRfk= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter v0.83.0 h1:980Ae/Y7mZndgWhngpEi8u5KIVFYQIF4NFpkLEqCZEI= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter v0.83.0/go.mod h1:u2DDzR8+AdbeeMf7o47qqVQcPfX8bzm42/VAq7I1E2s= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/sapmexporter v0.83.0 h1:8qQgO1UgutKov4JFFIEf0WNS1moXK6c+z2vznQNcyf0= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/sapmexporter v0.83.0/go.mod h1:KkzODSIS07pR9yIYXyq1+CvEDILRIv5R7RmemG6w36c= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/signalfxexporter v0.83.0 h1:s2lJhFQl2QTKFNnab9Wk+9hIPOUV2dLV3TQ8GoT+yKI= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/signalfxexporter v0.83.0/go.mod h1:M8tIfUA1ULvRZp4wt5yTWI3dfJ9KMNEQmdyHlCxjaX4= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/splunkhecexporter v0.83.0 h1:sobY+f0KV1l5lrzzMx8Pssoa3UC1s0B1lfISxR951uU= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/zipkinexporter v0.83.0 h1:fseOiXFQtcyP6DFz8emPJyazIm8dX7Hg2qqlpJeD7BE= -github.com/open-telemetry/opentelemetry-collector-contrib/exporter/zipkinexporter v0.83.0/go.mod h1:FtZpDmvyPusD+MYHyiPS8RTK4aiRpeM9sw0ELEoorRk= -github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsproxy v0.83.0 h1:lOlIrn4npBaOTnJpjvH+MzqOjusgwmcEmtKGcTWmCzk= -github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsproxy v0.83.0/go.mod h1:YXAQndCP4LY42rn22ELjjnTmqbsxS2yrVerAzsCisQg= -github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension v0.83.0 h1:Kjh+MVsvlV/vmgwnN667ln57kQiz6ZfYxyk+IONS5lA= -github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension v0.83.0/go.mod h1:CMhTUJ14v2P/roC9GrV7fdVS7MCtXwOjw+JprJrfFKM= -github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer/ecsobserver v0.83.0 h1:0mq2UIQlFGuaZANvXaYyMISx44Ft0OEaMR1ByOjhdDk= -github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer/ecsobserver v0.83.0/go.mod h1:ds5yO3Gq5QF5x/lT3zYbQoQCrXdBfTVhYpAV+xINUG8= -github.com/open-telemetry/opentelemetry-collector-contrib/extension/pprofextension v0.83.0 h1:zrwghw5g2Ma5u+mGo/PyodymkAQiAcPLs4Quq4MAZoU= -github.com/open-telemetry/opentelemetry-collector-contrib/extension/pprofextension v0.83.0/go.mod h1:WQ5L7YwarCjW6beHMZy+2g/+HfD9WQOooTiwoQcQR/g= -github.com/open-telemetry/opentelemetry-collector-contrib/extension/sigv4authextension v0.83.0 h1:jM9FjwI22dpD+p/0In2FA8ZVlH9EWiH5gJw8dUMQ3Ik= -github.com/open-telemetry/opentelemetry-collector-contrib/extension/sigv4authextension v0.83.0/go.mod h1:rNSAmQoUAr5c0KpbxBulgo52csvKoM+qKueLFC9ayvA= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil v0.83.0 h1:K2rND8mgBGWDqFsBwjKdphBTBjjbBkcw84lkDVvv/ls= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil v0.83.0/go.mod h1:0pvuvcSdAJ7RopqLmtg1/DPpZH+xazbMACKMVHalCoo= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight v0.83.0 h1:d9Wvwut7FoNSxfXF5SJABNppu9xGxQnf+I1IuBnGIjM= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight v0.83.0/go.mod h1:jxeFqzSwMrDmEGPyCGhCyHY+6J+fA/jXRoa4CEzZ/W8= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/cwlogs v0.83.0 h1:RDQ862swYY3oAqtQE5UEf3gVo2K6STG76CgBurJIY08= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/cwlogs v0.83.0/go.mod h1:u2XpS95ZgRXO8yrTjw6eX9IesTd5aNANP/x3jVIrqc8= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/ecsutil v0.83.0 h1:pBdqndULnylTtLYo9Zg3C29FNZNMniZXIj31jYfjcTI= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/ecsutil v0.83.0/go.mod h1:BsWcWAne29O8gfMOvkPR4+OTshTvqpg+3ERZS2hnFNQ= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/k8s v0.83.0 h1:WrSJTAoVnqL74klHYl+ylGcWzw5B/iuHsICDG4Wg+pg= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/k8s v0.83.0/go.mod h1:gGNH996LguY9CzDK7xyPqjCPJkfRKg8Y3WZA0jgnw00= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/metrics v0.83.0 h1:1QgMSYj3rKm3BftrCSDVIf+zXYxdv3NNCkI+/zePTQM= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/metrics v0.83.0/go.mod h1:WAScm+oitM87OWSy+pPAC6eCzg3xhYz3VBSef2+zV60= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/proxy v0.83.0 h1:ovGXkuMEqzGjDAU+CC7BeAsTL/qwmmOJhkWrv1AmA1U= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/proxy v0.83.0/go.mod h1:zhysB7B8qSgvKI+TvNqAELwdCQ7I26IzuFNAWC+tILg= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray v0.83.0 h1:PLzi6IkVCbnNc3dyrmBSBqEng87LWCNca2np21XI2hQ= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray v0.83.0/go.mod h1:WWKANqgoMjOyn8yKjF1oEhpss9bmfiyWH1+mkE/y9m4= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.83.0 h1:pzq9yVMgLzeo8ZsgtjDzsR+B/dt+Fc3FROAu9SV+Qu4= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.83.0/go.mod h1:6XJ+dV/QjwFJf55/2nnVfVqA+qwa8Y/iYR6taPJN7n0= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsemfexporter v0.84.0 h1:2dZwGmlUsz0M52W6ngSDFWKJxrlW+Om9AJAw9lbs8T4= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsemfexporter v0.84.0/go.mod h1:Klb+WunyXs+ZrP5MbDO9T+ZdwxQaztVsKew4EhEa2GI= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.84.0 h1:gmcjZQeIxySxYqfJc0SnNH7YIfRnP6hRxawJ5TC/V88= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.84.0/go.mod h1:cDljc1KnsULjJwe9iL2LCwvuvuk4poUdyYJWG/+4L1U= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/carbonexporter v0.84.0 h1:8xekEQWTQD/S7HbVaIHJEB3CzlDFhAE+ftoDSadC9Jg= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/carbonexporter v0.84.0/go.mod h1:1KbcaN2Pivu13/nmj/lO2OL2pFm3HptAWofiqhPF4S8= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter v0.84.0 h1:rJ+O2/xUKpIjCX2+B90Kc7TOgmOs8J3lXb5OC9P1PD8= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter v0.84.0/go.mod h1:CdZ9zz179u0LbDrfp+Ed/K0y10OVaSe1nsLh7twKOv8= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/dynatraceexporter v0.84.0 h1:YYFQ79SzYDR48oU4zYnEsFDXCS/BKqLo9b5jFfWQrJs= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/dynatraceexporter v0.84.0/go.mod h1:cISp1TT+sj4RXHcpk2VOOCZHc7WpQHNyV5T0yVhS9Ew= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/fileexporter v0.84.0 h1:37CMjRzqDNRUxo6M8Zahl0dwmPQMHTYwyNFw+hdUuhI= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/fileexporter v0.84.0/go.mod h1:ILHEwIQG2aZuxpGBM6uetYFGOKnp59kmzQZ2yxeI9is= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/jaegerexporter v0.84.0 h1:x9rmMuywYjz/Vsr8E/tHjlauJjC5ptUPWCB6jhh/Xq4= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/jaegerexporter v0.84.0/go.mod h1:w3VbSiIjwRjV4YX3na6ohbZ0x/hOKXUUBb/7+YiqSD0= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter v0.84.0 h1:OkFcyyzTnciuRO2sQjUcwJxk+sFDcftO9GmbS8Wj4+I= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter v0.84.0/go.mod h1:QehQjxD77uCWfxlVfVbsj4NI65v/FTIUIY8UuC8B9Co= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/loadbalancingexporter v0.84.0 h1:7C/Pr7As5xtfAJueq8bcJHpwS5Fs8BPUId4H/aywQ70= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/loadbalancingexporter v0.84.0/go.mod h1:TaBl9rZNGWDXdGTb7UJ72wQdMn9nOWsXYLSO4OGJlPY= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/logzioexporter v0.84.0 h1:60rywH3JfP0kYqQbYalGgiaZZgU4SPNqXfdrobzh3SE= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/logzioexporter v0.84.0/go.mod h1:PyhKbCz3iSRZon0fmSr3uoqDqoZNjF0uorG36PEmp1E= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/opencensusexporter v0.84.0 h1:x4+1ctbxR9wJCoPYXZf/w9JrBYhfIv+zYQ1XvOXja60= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/opencensusexporter v0.84.0/go.mod h1:Mu66wWFDOLK/o8G99n6wfKF2r6wsCVZw1MAZLq6HDL4= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusexporter v0.84.0 h1:3njXrd7vPXcxpJf/HNe8vU0bZjzeeeLpEc8K2nUKiWU= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusexporter v0.84.0/go.mod h1:7nX3UNJnV3XQz5MM4j8takEvHSvuGvRZHHQtKXQs40s= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter v0.84.0 h1:WFCStS52a3bMG9nEG6Eo8+EfgtXfGclTN/H4as7jdkE= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter v0.84.0/go.mod h1:jivmN8Ak9Hf1yP+W0RoAwZagyLjMH7HBGgS45uiuuos= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/sapmexporter v0.84.0 h1:5YebnbW2/qbabWabqtkDPZ1R4JE/hfjeQ1tXy/hBVPw= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/sapmexporter v0.84.0/go.mod h1:aEBjuyMJqJ7aCre96KqD/64rLwhLHEH/QinD82oGQbg= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/signalfxexporter v0.84.0 h1:17K4Vz5oAA0JLzkNcfu2CcfIpNhydpAEPulaS1tPBrk= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/signalfxexporter v0.84.0/go.mod h1:/T7Osxob+tAi4aTiEfXX2k/IRAGbwWIKZ0fxad0Bgto= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/splunkhecexporter v0.84.0 h1:zKpCjJ+vcUQF92lTLiGYTK8B1IM9QnSZ9jIQXPQibjU= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/zipkinexporter v0.84.0 h1:92Na/kjpYY8xBQLFIiyee60uGj+oCHtfeZWypA+wbIM= +github.com/open-telemetry/opentelemetry-collector-contrib/exporter/zipkinexporter v0.84.0/go.mod h1:arc8Vm9PlwQ0sATG/X5+3oE2bPh/3jkmEUDPRNaMQ0s= +github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsproxy v0.84.0 h1:ysq9+0eESy8Dj7Yp3Ijn6uDAtvR+h+LoTwzZbw78gRc= +github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsproxy v0.84.0/go.mod h1:CwZNGQC/yVWCJrltkkGGGPeUUqtWuLQyADWfmqfol+Q= +github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension v0.84.0 h1:9G7QLkloZCu4Kz+YddCokyyHWoJwFH5iKMF2P5+hmFM= +github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension v0.84.0/go.mod h1:HlqBRg9x9ZSaL4rnaC5OeFMlQBHgj/IjgxzF3n021yk= +github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer/ecsobserver v0.84.0 h1:+nJyvy0EQMPBeIwoN2OyuwZMnbYgRRpXQ0KrXg2LqEQ= +github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer/ecsobserver v0.84.0/go.mod h1:DY1+Nxc6/UZauynoDMhKT1yoxVtOgJx9Avh5+ZQR6W4= +github.com/open-telemetry/opentelemetry-collector-contrib/extension/pprofextension v0.84.0 h1:ne6ci3q47j1DAcKcLQ2TEDRQerGO8N56qqK0aoiWZOY= +github.com/open-telemetry/opentelemetry-collector-contrib/extension/pprofextension v0.84.0/go.mod h1:RNIYyAITWq6n1EtjU42p0Gts79GYscYEL9ZMJdcX77o= +github.com/open-telemetry/opentelemetry-collector-contrib/extension/sigv4authextension v0.84.0 h1:nkIUYabzEhZawDfhzi130nNkeEGQS5EgIL20fRPIG+A= +github.com/open-telemetry/opentelemetry-collector-contrib/extension/sigv4authextension v0.84.0/go.mod h1:xYEy77gi+22BTTYukFRXydx1uo7TyZkUeKKSCWFriPQ= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil v0.84.0 h1:CJxvUC/EVb2nem+ncEzpZCGolIT1ovibbEkPtBgp1MU= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil v0.84.0/go.mod h1:ficUNYmjfPFXriyhQ7q3ZHofl28IfWge4zKHLAgALZk= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight v0.84.0 h1:9LUp2/bLVeksboDUdFqmfmPVtfYHymI308F9GaImtX4= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight v0.84.0/go.mod h1:jxeFqzSwMrDmEGPyCGhCyHY+6J+fA/jXRoa4CEzZ/W8= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/cwlogs v0.84.0 h1:Rhx4zUfBxbCFw60viWW6qwMvTcOHllQTx11nF0awzME= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/cwlogs v0.84.0/go.mod h1:RBOl8PVgMgQMGNewpVw+cmaiwV8SLgTkEHA9JK7gfP0= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/ecsutil v0.84.0 h1:BWVaklpLBrFOLlW/nqT3o2onEhaMIOr2/LBnEciDVjQ= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/ecsutil v0.84.0/go.mod h1:e/k1LzterZSHvxWF3HG9Wo2VtuVrYAt0DE+inTVaD+g= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/k8s v0.84.0 h1:oDtwVMCNCGZYBm03+jozRL7VmAF/JivHzLWA+RPaqUI= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/k8s v0.84.0/go.mod h1:qyHME9n7WSuKe/jv6dH9IPgIcmxtJjlx47eoAQhA0Nw= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/metrics v0.84.0 h1:KwJDgnqegui18ebzCfxHURRstPjY2CfM/yGRugcdOT8= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/metrics v0.84.0/go.mod h1:WAScm+oitM87OWSy+pPAC6eCzg3xhYz3VBSef2+zV60= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/proxy v0.84.0 h1:vfZIgsfOkrY+bqh3HGYWDtvxN5SR4B+IYJqY1733j+8= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/proxy v0.84.0/go.mod h1:usmD73QN6Rpydh47E9lg60NqAHGy+GfeMdSwIzjiiaM= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray v0.84.0 h1:xdqzNUPUZjBCLBxX+qJ0KVUC2FVILgoposXS81VNgpY= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray v0.84.0/go.mod h1:RT5011nic9yp8k1vUwBJd90fI5KedrIw2M4uhMkwYD8= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.84.0 h1:Z6mmJnj4t47FLifxesZsuGN9mZRCT6pUY5Y5g8SWJkw= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.84.0/go.mod h1:6XJ+dV/QjwFJf55/2nnVfVqA+qwa8Y/iYR6taPJN7n0= github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.52.0/go.mod h1:CIX1MWy+2JYdeYhqjK89vrRpCGbz6LTLinp+SM8kZyo= github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.54.0/go.mod h1:CSe1wsnLhSAEgAEXLfi8wTyl0VwPVkq7925aV8xm0oM= github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.57.2/go.mod h1:xPchY5YNOL9jr6phVkJEvkEakMYr8HMD4uGYEoKXIek= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.83.0 h1:rwaJhPhZf/4A0exUs4cjALn6jnFU2QAL5cSJ/FwzcsE= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.83.0/go.mod h1:DaoCKBiconWYmXeexLiQeVOWLWbo4N5vJdVs+9X4V+c= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/docker v0.83.0 h1:dFsDXpyWukqXZRLw1GwG6npvLaTXuOQbVJ/57IP9LrM= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.83.0 h1:s7sUZ3/LCX3Tr0C0FfTwE3X9GwTeTBskoMaLlqPv8Kw= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.83.0/go.mod h1:3bOPivfVZIaylsOk9yhWGNeobT0Pn25UZs4OnuC+azA= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig v0.83.0 h1:KllNzprs78NOFj4pLDu3hVImiJNiG3v9Hti+mvMpOBA= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig v0.83.0/go.mod h1:oOJY5unMZP3pPkcZl2VdBOiJzS+8xh4o9oq5NEglCXc= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8stest v0.83.0 h1:lzm0ei+Q+jToNok1HM1YPC5sH+2LuWTwf5NhCztCgdk= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/kubelet v0.83.0 h1:wuArO/CYSrTcpO4h/3vfLC0Li4vuVSeERxz4OOWTPh4= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/kubelet v0.83.0/go.mod h1:rWbscJhWZAr/o+1RAZAKuXl2sGowDcs9jbR/DYQvysg= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/metadataproviders v0.83.0 h1:tNUrUu6UFAycjz6NtL8/Zz0LF/2UpYvW4PL5xIYtw0I= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/metadataproviders v0.83.0/go.mod h1:3UHvuM+X9vt8DXR3t/lt8JdpYhkVleQqc2SzvXLcfy0= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent v0.83.0 h1:5TbtbiKZMwDVf1sEpN14Y4wqwANRpzmGWR0yLB4fNKU= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent v0.83.0/go.mod h1:tGB4+26zqjQRyHhxMWy/YZFOzWQwqm9OS1Q+jKHVabw= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/splunk v0.83.0 h1:s/mJMnap31p/fM/DGj3GWkubQRmaHMjo0RwDz0iAjl4= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/splunk v0.83.0/go.mod h1:J3PBJi93/0NuvJGCSugg0Dt38G/LqTrgL5t9cFl4Q/A= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchperresourceattr v0.83.0 h1:xvFXYVkdzUsIuoi8asZU2Hm59msjdFbnp9gxydplIQo= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchperresourceattr v0.83.0/go.mod h1:/BdkcVWo8+/yO//dRT30o/eNgKfu6EGtAby00vl0VPw= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchpersignal v0.83.0 h1:/qrROLCRzwIVrDVnEo9BOAGLzRIN8eCUXCO76Wi00Bs= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchpersignal v0.83.0/go.mod h1:RBkF+g8DRJs+k+JhIVAxnUW+a7vlCajpWNZQ2yD61sU= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/experimentalmetricmetadata v0.83.0 h1:qhLG2aVClSG2RMO2ERDfoUFn0YhHv0VhRoYJGyNXyEM= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/experimentalmetricmetadata v0.83.0/go.mod h1:IdqHQZWFAyMN5/yHz8oFts8AVj2osf2b6DTvc44IMLI= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.83.0 h1:6DE+t1L3OjJMouOo+Ss5w1W/IJkPNFFJDb8f534eFnc= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.83.0/go.mod h1:uL+EJyqlx798NEB4FuY+05IZY9aXSbw5f+2YFNvOA0A= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.83.0 h1:/6X4L5BrCyy5Uz/jnLwkiv9E6VfuJl9EFJztWtkWvps= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.83.0 h1:yEuD/gKHNVMwjT4mRZAeUVCe/VO2tqeb5+aFim5jQJs= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.83.0/go.mod h1:WoSzL9NAVwvEy1lMwM2utn68g0Khoxm591WliToPnDQ= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.83.0 h1:e2j+kbNwZ1AAfh2RexJz8a07E/36IUmGW9SID7JtK+g= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.83.0/go.mod h1:fxZoTFjoKeAwXk7fiFTLbB6ptMk8vgj97e3nVyE/fJw= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza v0.83.0 h1:Ru7vas+V32Py0ld/jaKAAeCfCL1PqOuMmhG4gX/1GR0= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.84.0 h1:EMdLjuWUpbkbYQ/lEg+qZk3lGEG2iPiU+t6g7g/J/5s= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.84.0/go.mod h1:sEq5Vn7ZiuT79tcx/CxDFyhrx1f2jV7kMQhOpdVTAa0= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/docker v0.84.0 h1:EdOIt4jT6SbB63EaX2/rS7w3k7a0HoCfkzORyd3Vpto= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.84.0 h1:j3AO19nlnNahMxE4ozYbagJJVm/v6Sx0Lkt9GM8quiA= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.84.0/go.mod h1:ljL7PRBjYFEPMwfRPDgDxnejMBRjrxiBpVvj+hjXMFY= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig v0.84.0 h1:OOtqiVIRcv3eWpCoziXjq/Xr4O2KoqZZ3g5pRjug/Nk= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig v0.84.0/go.mod h1:iL+tGP94Xdes4iUmss/Me8OOqvJhWeBWPcW8OgHQZyo= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8stest v0.84.0 h1:jqruZBzNjzHQ9bfNbZ1BXUB3KIzaWQUPVQblkWt3bwA= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/kubelet v0.84.0 h1:ezuTl9JDE/v83DnyJk5jLEumkgu0nxdoWXNTKmJ/+KA= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/kubelet v0.84.0/go.mod h1:u8PmrJN1vhdnUtyMkxoze478uOzX/bVTeJebvM5xyHU= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/metadataproviders v0.84.0 h1:4xV4X+Zze+nNLkyK35LkD1AOL/V7qxgptsJLEWfxhj4= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/metadataproviders v0.84.0/go.mod h1:rcxnHaBL7R/VoO8yahgIFL7NZIdFaakl4Jpy2tbNeGc= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent v0.84.0 h1:EivvMHRis/wMhyeAo8FfGk1NS739w5+dK+qUz3TSE+E= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent v0.84.0/go.mod h1:R7lpqmyo0OYBeu5OaFUwzVaO0ihMoaGGxd5BIxbl0jU= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/splunk v0.84.0 h1:hou2HQ4vt1t1z8fvY8UCyE1fICinkJPhVznJfBkz8aY= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/splunk v0.84.0/go.mod h1:hkmQphXEFE/kpQOZtFNefzv8A36ftYrV79ekEYsQdzY= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchperresourceattr v0.84.0 h1:FgIjzlDhSwIN3wXkuC6Cb2z5Eo9E61YE+VHP63kIwvs= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchperresourceattr v0.84.0/go.mod h1:+TN30V/uryI58nABe8ui9MNqKNGCg8JUCWQds1/44fI= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchpersignal v0.84.0 h1:Es2xrBG6w4kDWRzYfA93eSN4CeI3sBS0OudDZc7nr/I= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchpersignal v0.84.0/go.mod h1:RBkF+g8DRJs+k+JhIVAxnUW+a7vlCajpWNZQ2yD61sU= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/experimentalmetricmetadata v0.84.0 h1:I+hRazXMAIrCi0L9ui7wAc9/m8uawJb+DxRYcLmezH0= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/experimentalmetricmetadata v0.84.0/go.mod h1:IdqHQZWFAyMN5/yHz8oFts8AVj2osf2b6DTvc44IMLI= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.84.0 h1:hCHJbiLdDwsswhfllFCq4fjRWUCz2GAHhzOB1n7jHK4= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.84.0/go.mod h1:0us3rAudWnHES0nOtmTsUjgQtlKJyiozaC5osgJM7cU= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.84.0 h1:NXzx/YViPbapdfI0RZ2RJk4XgKU099Ci9rGBsZ/div8= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.84.0 h1:Zuk1i/92HvV5cI6dtsG/VWSKwaLGh17q9a26qP9DBbo= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.84.0/go.mod h1:WoSzL9NAVwvEy1lMwM2utn68g0Khoxm591WliToPnDQ= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.84.0 h1:jrkXndFdbFMSLWKTva9NEIfxqslPpRCMwgmlctPBxqY= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.84.0/go.mod h1:I6U5NVX6YWcqQY2Rg8SFrmQfaPVM3ZpypUSSg14f0JQ= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza v0.84.0 h1:tI6GXaZenBDWGo0QeSWm8Ki41Q12L9WxFi87W3QTiME= github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.52.0/go.mod h1:tU7s/ki/QePSIZ7ExYGWLMb9erCAt66brQHBEHxr8HU= github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.54.0/go.mod h1:uWFgO68sLEqWrQxL8rws1CkB8EUNQaedP3FWI1gMJOU= github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.57.2/go.mod h1:4rFuWKMbzM9H39RbDvPtJfAp/fxsHydhJhKns6skmK0= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.83.0 h1:fGK6FQaUCOFGywGRvsiDtjlfGLZGcgkmgZlIomdsr3Q= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.83.0/go.mod h1:wvJRWQDZGEeTvcfzNHII+niIHWMlO/fg6vSS3x7XYzE= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/opencensus v0.83.0 h1:4beUB/Hg6/2JSPcOf4vMXyvoSEoP092smr4Uft/zxDU= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/opencensus v0.83.0/go.mod h1:18nzlp10gqpvewhRFxlzn5TteLrkHUYXGimf8fAC4k0= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.83.0 h1:qEO5xxh8yRYiWhXiQhEcXxFV4RcO7lUkejfxBjXLPNo= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.83.0/go.mod h1:a8Jm3NY18nTt9mM8XJeWvwmiPxDKJQvbpYIlzA7H3Yc= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite v0.83.0 h1:q5QvnGvi9JNh4vPmK3BuX/C7C8YWZetCrli3BxCAZKU= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite v0.83.0/go.mod h1:dZGmQr+gcI6fUEs6sPxlUQyV/4j9KcL31YcsHL9OJ9k= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/signalfx v0.83.0 h1:asapsoRz2d/HRjT0tWfJsCqBe0qwFSw44P5VKYx2OGw= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/signalfx v0.83.0/go.mod h1:SQ+BuwNerr2p1jmezJDF4ruJ1WojRgqQinkyey6NaMg= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/zipkin v0.83.0 h1:1FnX4XXS9IOC9h5nA8gQsPv21n0rbECjBqW/VfJ4c8o= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/zipkin v0.83.0/go.mod h1:BK0l1fWX36sfssQie9lH46tzVzV/UTOcUPRKytLbb/I= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor v0.83.0 h1:zre+RUseqdEblLwaE9FidObbtmx3Mm7tiwMC3Fejoy8= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor v0.83.0/go.mod h1:QEy9JCi68LCoxfwPn2v1byOf3KxSe3bJ/p3jgNzpsOY= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor v0.83.0 h1:cnmSn6LVIIkBRfaSuBQNNphLXonFr5qD0+bCHgvAFws= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor v0.83.0/go.mod h1:bHhc2kT0wki+U0boNf5E0bmDbPDaI6AyzdXh/zvtFrE= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatorateprocessor v0.83.0 h1:de91BCQwWkwZ+Tp7OsCpkrrc7vBRdzPQhDE5ENcxPMI= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatorateprocessor v0.83.0/go.mod h1:7NGof68ffjxgOoN7NE0TSMNAmGXxpxVmw6p9KGvxerU= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor v0.83.0 h1:Ul48EqO0xeSn57H8jYK2GNQzJfF7W9l1nQemlfUGYEs= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor v0.83.0/go.mod h1:ZIMmKTtWzTrpj4z1+yBu7tbzSHi4PbtyLNAWq+AwmlU= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbytraceprocessor v0.83.0 h1:g2YnCEJ4SUQG0m7yqDpSPOYsfPe74M1ivy2JYqWUCWY= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbytraceprocessor v0.83.0/go.mod h1:vtc7IGVX6m4tYkNs0KLdEA7HpuRgxRhHqJiFBLyWdyc= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sattributesprocessor v0.83.0 h1:hv92fwXj9f834zUGLoyxtF07zpEM34yDL76OAwVTdqY= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sattributesprocessor v0.83.0/go.mod h1:3wxQn8Bp5c19UgSvGx+32/xVLsOZMjNaTU3g3n6t6Cc= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricsgenerationprocessor v0.83.0 h1:88XaF5XSbe7b9J77yvr/joO+pT7ZVpmm5GoHjI5/Wes= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricsgenerationprocessor v0.83.0/go.mod h1:14tnFp/J3PFriWAuvi3Jf5hOkc/p4zhfZORbNDzoHH0= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricstransformprocessor v0.83.0 h1:rfTAZuRV54Qb/Aah8sdnpF5Z9qmtotyR1L8Z79R/QYU= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricstransformprocessor v0.83.0/go.mod h1:C3P6u4x0CwtLgTVdeAvSR9m1CPjHeJRjklfaTvQ7JRU= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/probabilisticsamplerprocessor v0.83.0 h1:3S7vb8bttl9eC3qQRi5Rm4q01taM+ue8loomADB0qSA= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/probabilisticsamplerprocessor v0.83.0/go.mod h1:Y9TezTRfqJ3cOTsjWxe7rgDKZU71uU28mJ10GKYBK5g= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.83.0 h1:TNoRtrLHLk5Xr8JZwxiHxnpy0+UYnDHl7SPtZIoTC0E= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.83.0/go.mod h1:KDZS6tI2Q8aZ7TCJzZuqEbrwDJPBAaSQIbeXsO6Nvvs= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourceprocessor v0.83.0 h1:Jpa2cCa1CxWgc6kUP6fTfYvqRZzpNcMDFyzjzoXzWPA= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourceprocessor v0.83.0/go.mod h1:a7EPC0J3PIU+x3BZSDKxhB7cxeJjf6mgy6nmdhGGQ8M= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/spanprocessor v0.83.0 h1:mchNw/c+HM4jW22fFhHRjYX7pyk4t7eiG/QFhoUv020= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/spanprocessor v0.83.0/go.mod h1:yJJ/GpM8NeloEgznZyGTH8neThCL4KzQd8gsI+eJDxM= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor v0.83.0 h1:4D72ZwITvSbNchy/LAISnFlCjGDZYblPmaqn3LKFKiE= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor v0.83.0/go.mod h1:HP+yAae+1agolvpTo2GRT3BXgPDt1NaYfm5PWtPrI7I= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.83.0 h1:pJTvexBqzytA/I5Djq8MXsKlqyT+wZ3ZmZLqkBX0GTI= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.83.0/go.mod h1:Z5rds2ALV45/OFitkS3ayHhe1u2Lxo3+nRQ9mFwMaxA= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsecscontainermetricsreceiver v0.83.0 h1:wANd57Lpv/ueBpmqVzusAMWyXy+y5ko09QwZxGZw5+Y= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsecscontainermetricsreceiver v0.83.0/go.mod h1:RT4UNOaHyOXGMEq1Azp6Bnm5qUHpx6BT0Ih8o0n9GP8= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.83.0 h1:NKNHzx3qvSl5G5drW90XeiDLNZL0Qmgf3j5EdPv36UE= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.83.0/go.mod h1:yDRLZz1bwaTXmyTo5b317TN7a5oHkHMuio19nyJdK90= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/carbonreceiver v0.83.0 h1:6gICrLbGa3rkGMT7J56W8acDAWefodbQrcs53/tf8UQ= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/carbonreceiver v0.83.0/go.mod h1:tB9vMhTdZ5g/HXOoM1nUVzA/f+SHtA5XZxBKXzOR7SM= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/datadogreceiver v0.83.0 h1:vxkRZ0TsEv6EPd6sgx5NjP3zEezr9nVOumzNkoAjG88= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/datadogreceiver v0.83.0/go.mod h1:RPDOaKR5l+NTaYQN4gB6mdsH8r06qBBes1bmH3cQDmY= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/dockerstatsreceiver v0.83.0 h1:3mtM33u9B2CqZmG5ryP349HvaDYQs8useSJIA441Vgs= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/filelogreceiver v0.83.0 h1:TNBKlerQbOS5cTMNxn/pfxxE/PpYLajPaJYQ8wiHrIw= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver v0.83.0 h1:6y1yhypoixL19d4PpmNlPbDt9zhs3btg54RQiC6D7lg= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver v0.83.0 h1:wu0ZdOTDqjl0Ug6J7rAO43GIe7nW/hvPXZ/Kcs7Hmis= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver v0.83.0/go.mod h1:qhWK3ADYGvYaS54XbaH6yK8/iPGQLtimdtIcXevTLkw= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kafkareceiver v0.83.0 h1:rVuP6uUEXa/z8+D6N/Z9ni4czrFEjs7hsWe+DozKpqE= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kafkareceiver v0.83.0/go.mod h1:7sh5S7LJEtuknmYyRzQoWlqbYerr5OvViF/AdkGUsOQ= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/opencensusreceiver v0.83.0 h1:o1+JwweAu7t1bUHFJeZouEZSMv+2BCVLKc0HJ4ZujSg= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/opencensusreceiver v0.83.0/go.mod h1:eMWB47gXK1J4odbvapm9CyWezoNbbSQkgGKwmPGyNhI= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.83.0 h1:WaisWqr64HIHo0Gj+FJO2YzjRAwXpq29HRaMbstnXeg= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.83.0/go.mod h1:3Q0ttKtPcn9wY7VvT3P0E6Y6FMDA+yOu64xbr4bqHrM= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/sapmreceiver v0.83.0 h1:v6T2SchOCJ3fCQp78PjHMLsLh72n4Z120dg4DrrgpFY= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/sapmreceiver v0.83.0/go.mod h1:98rhYX2mqdrhpVWq15I8QjQclddY6KNpGiSkfxcJZyo= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/signalfxreceiver v0.83.0 h1:RTzQ4V4M1MjA4SQVGhZLqcwwfUCw5c8iQ+J6pDnSFhs= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/signalfxreceiver v0.83.0/go.mod h1:oKch7fKCrlP+JEEzhuk4mAHHm1KWulPQl9DzkwcZjgo= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/splunkhecreceiver v0.83.0 h1:OqnxnU8Ny5lqjGhkmhJpx+P5GoFI41djKkQn39jNrCY= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/splunkhecreceiver v0.83.0/go.mod h1:T1jbxVNo0XY2nA/3aMwoFHChra1GocCBxUuB5BZMarw= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver v0.83.0 h1:7MpD62lDNplm6ONFQTQB+Gkb+slo2MzCkpxurldcJAk= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver v0.83.0/go.mod h1:MHvgdYigNKOZmiO6N7Fqa1ZerEyIlLL7cCydn3n9R+c= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinreceiver v0.83.0 h1:IJdOOFBDG2Z16utgTc9DnLBc3Q0eiRUgudBjlh85x7o= -github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinreceiver v0.83.0/go.mod h1:1z7uIIoZgcqjYfDefFnjfO6frg3t2UorVaxB1DzcHlA= -github.com/open-telemetry/opentelemetry-collector-contrib/testbed v0.83.0 h1:TWe53fopoUzC0MAMYMVDVjap0jiycAjy4eXex+//ceg= -github.com/open-telemetry/opentelemetry-collector-contrib/testbed v0.83.0/go.mod h1:xxEPO/WInd7ETjubvoOgOJweTBuXPPo+x6wBvupEFOY= -github.com/open-telemetry/opentelemetry-collector-contrib/testbed/mockdatareceivers/mockawsxrayreceiver v0.83.0 h1:H98Gr1SIpNp/8m9K3vQPrff868rHRivaeet4Cry5kDE= -github.com/open-telemetry/opentelemetry-collector-contrib/testbed/mockdatareceivers/mockawsxrayreceiver v0.83.0/go.mod h1:EWglPxyAOHEa0/pXNmM1Q6nj8UP7fSTbpmVIe4yiFkI= -github.com/open-telemetry/opentelemetry-collector-contrib/testbed/mockdatasenders/mockdatadogagentexporter v0.83.0 h1:ssskmcYlu4RR6Zs+RLQbFAC68YDGrnKwBBMIzDdRVJI= -github.com/open-telemetry/opentelemetry-collector-contrib/testbed/mockdatasenders/mockdatadogagentexporter v0.83.0/go.mod h1:eRkz1YWkpLT/rwchXgzKlkymV8xMbHwqoCiTQiMrZrk= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.84.0 h1:Ch0cB4xwB3EksIu2BEnNgBxzksU3FYvePjeAzy0TPas= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.84.0/go.mod h1:orl+1f4pGXhTiZH/6lkPA03e7Gx3q/1/CS5swdNMSI0= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/opencensus v0.84.0 h1:rOHAgkTFChnn9Yi6EaLpvkE10inbjijceIbwVAfu2JU= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/opencensus v0.84.0/go.mod h1:knfHj0aUd289wG2L7VjHu7d1+oFkL294xXawinmfQbc= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.84.0 h1:uYYn5SIejB+AZ7D1U/uqArifD4HfDBHCz7EkFNmVYn0= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.84.0/go.mod h1:tfmxciJw1uQ7eeaDwqCp9RMUeWEQfIs74mVj6FW+FYQ= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite v0.84.0 h1:EuRz/++XprYiwsmIYcbn/DLrrCySdmObPPUURLcQzcE= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite v0.84.0/go.mod h1:fwGawLbxB1Hdmh9Vy3WEE6AJLAPCVBmM8RRsXW79JHw= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/signalfx v0.84.0 h1:8uRr7fOoazstNz1v+SMjciEplAcMWJS54VAq8pmRb3w= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/signalfx v0.84.0/go.mod h1:EEiJsp+kaZ6UBo1/AyEO0VltSQpxzrF6ID/M4V8whcU= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/zipkin v0.84.0 h1:+BVHFN9tkJRQIi1IleHt9oO7UObaQeApJgHQTch7CgQ= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/zipkin v0.84.0/go.mod h1:vIB7VwkvKdSlwaKbNuhxS5kCWcvpdtSGK/H7qp9Uh4M= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor v0.84.0 h1:qUWN/AG2Dmj92zIwMLt+1F9VI0DzytmSVjGdBO3ozTw= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor v0.84.0/go.mod h1:gVsBAVjxjbq4Z9eCcYn6a17OcBJczacnR6943rdScEY= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor v0.84.0 h1:YVAvWqElpzNZixXVZHGKIE1NmNgiHGiTFGeGO5Oyy8s= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor v0.84.0/go.mod h1:w052rJTu13UOoIKMjYJGJNj8KhnodFAOWZozNZxYo7o= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatorateprocessor v0.84.0 h1:1yttb7xC/+9mOv3QJ4kj34JLX5evDgWBc1fHwZYjVjw= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatorateprocessor v0.84.0/go.mod h1:6cfvoTwM9sZIdcn5AjIgx4trIelFAIy31zsLEbzvnyo= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor v0.84.0 h1:4dPSHgkRNakkXyW0KhERwBzG2pm7/jb0IRZt7M8l2C4= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor v0.84.0/go.mod h1:bPJSw6vjeUl7W5RmkbLxcL0xkeU62q4N3FpOZLZEskc= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbytraceprocessor v0.84.0 h1:a+MiWvAfyg4QSsu0PuuItV2juzQwB8FHGg3SFu0Q5og= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbytraceprocessor v0.84.0/go.mod h1:4hvk+lTGFCAE2/+QiuEv791inWnZENmjIpcFB1B++s8= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sattributesprocessor v0.84.0 h1:/mRWmV3mzu9jRiANmBNW0NQq4y6a/LNhjtTctAQLITE= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sattributesprocessor v0.84.0/go.mod h1:4V8U8jzqz4/aV5f4zQy1joVa8WQt9cl+Y+Y26QkteF4= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricsgenerationprocessor v0.84.0 h1:wkdDwvPzBTGHGL2yu1bU2/SY1T2C9YbArs46rK46ocM= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricsgenerationprocessor v0.84.0/go.mod h1:aNsXR1nYFF+cp8nK3ObLgz8xlyH3qxFvlooEsfWLFc8= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricstransformprocessor v0.84.0 h1:m1I3xM+vnWFBSTCvP9Eq3iodVmmuKw5LnhyiMJOHJtw= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricstransformprocessor v0.84.0/go.mod h1:XM27X56rqpFDdTXge+JFpVIVwZa3VkJXLOZ3an2/9wM= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/probabilisticsamplerprocessor v0.84.0 h1:kpU0J0ilSzUJ8c9NCQPON2j7cplv0Po63SPAbqiLpVw= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/probabilisticsamplerprocessor v0.84.0/go.mod h1:ZbTPu4nBWYT6vs74tTFPbM0dX1CZ83JxvCawRQ6cFLo= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.84.0 h1:F+Zam/dMSQAuDl15pXEFTcljL9jQfkpRgMdVxnxh3To= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.84.0/go.mod h1:CXioiwzuR9YaxCtT+bobWx3aeNd6KTlFpIWlnNpfriI= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourceprocessor v0.84.0 h1:63ocfTOX403x0RlOIxiqoIxfhlnz5bYNjKFinaMUAFc= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourceprocessor v0.84.0/go.mod h1:mcxeCwBWxyIFEOfrHczRwmWknNU/mr7X/p1SKz5oKc8= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/spanprocessor v0.84.0 h1:VcMWE6RRZTffWA9B46JRRuE/at5rcjqCZxX0ngydOOA= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/spanprocessor v0.84.0/go.mod h1:rbx0mJK75euw8jKxUOCiX0iIC3AzOTU3PFwQG0l1Glo= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor v0.84.0 h1:nY70u0NNt1DYZduGoKpqTKJV8jg7wEt258B788JwvDQ= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor v0.84.0/go.mod h1:e2unmaPxVdSAumcBPSKiCEZQrWwrYpWnUQYxd1+ThcY= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.84.0 h1:G6xhhVKr0HhrXdCEALbec2DjqZkrjRavHBL+cylR9Lk= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.84.0/go.mod h1:keWoqPccFPjwxLdMi0HxFHJZuvA0UctbdE6eDlSqewM= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsecscontainermetricsreceiver v0.84.0 h1:Kp42oWlqFUfGfZwHG/2hgIgHaviavNeS17wqnJg3anc= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsecscontainermetricsreceiver v0.84.0/go.mod h1:IpH2OjamrdbV6ln03ym9ZSiVbdD+u6j2opXJzQbZxjU= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.84.0 h1:YHVz3EKgQIxhZIuxODAKXmPG1d0bJuj1DCwxKrQ+WCU= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.84.0/go.mod h1:eJ+aRpCDufSTNeSfn2sDZ02M9zSkQLMv3vvJ9DqMSRI= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/carbonreceiver v0.84.0 h1:YYSmXj0HxEMYteVSinyTBOsDHSNG0yUuIbKgcPoIT9o= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/carbonreceiver v0.84.0/go.mod h1:/Rj8lhqxxaqNUG/uiCaij4Ar4u9NMX9WmyTSW0xJGZA= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/datadogreceiver v0.84.0 h1:k+5HfeLXESpN5+mcsjVgesRhLIeksDckCTUqZJBqFiU= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/datadogreceiver v0.84.0/go.mod h1:HhdXVsQKu4Q78Q09J5Qn52dGINb6TFsIg3xKq3VwlOg= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/dockerstatsreceiver v0.84.0 h1:o2CZ1tedxiw4ZG3dCP0q1L5shoUUNETVWeDu2gfoc6E= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/filelogreceiver v0.84.0 h1:Nv9JywcY7nBSZ3tIw/SjW0GUlgy/SeS05CIdRg0GqWk= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver v0.84.0 h1:za3AHuElLqcNVh60svQ1dAqJrIWqLhg9gT8iNXXe2Gs= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver v0.84.0 h1:pO1YQoqP7AJecTleizOWgwsDPLGtY4LFMXfzvmPLHjk= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver v0.84.0/go.mod h1:B0j/2fRXpYkcIlt5iXfO4+w5J8loBfG21L3J4caS4NI= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kafkareceiver v0.84.0 h1:f8b+QA+QsJA2kx9ATqZdFyum7jWFfuBsESbjPKwu7Hc= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kafkareceiver v0.84.0/go.mod h1:ILyaN7Wme6HzNueiXlKtQnqnhYwEc7LbXH4oBqSBVYY= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/opencensusreceiver v0.84.0 h1:YagHhbsqfPcNEKVjlaaLVzEp+D1KKmjmJmGhqkkzb1c= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/opencensusreceiver v0.84.0/go.mod h1:SfZfx9bwbLN4gtykFdklLopTZhC3LT6sF7Yrxhj6AWQ= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.84.0 h1:SJ/d51cAEEpIZIUes3rzhad5XAc2GzLdJfc/dDWquas= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.84.0/go.mod h1:oGO6rQfWdYRR2LjACUPTMdz+8L4aBQO3H5XbkmWCS5w= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/sapmreceiver v0.84.0 h1:HMLr3OwBC8VkgJlRHJ48+C5dXmM8zFuhFaYi1HYhm44= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/sapmreceiver v0.84.0/go.mod h1:t/8M2ZbjCTmmJyzbq7YeCuHwKgF0Q2wIB1oOhJaaaFw= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/signalfxreceiver v0.84.0 h1:kEcJcTmQaHtlNyIB8QcXWgzFdgP8Y71Iwd60Rfza3+k= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/signalfxreceiver v0.84.0/go.mod h1:26CBLZBhiDdPra3DaHB0is58Ll0XWDiAE9ewi+rYEOg= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/splunkhecreceiver v0.84.0 h1:sWkFFa7J0E7r0VIPMU2J0/lQWj1Uq84FZi9oftRq9x0= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/splunkhecreceiver v0.84.0/go.mod h1:CbLvYG5OVKTjgnnvZ0fqbkKIGFfSx+24eGjKNEKM8yw= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver v0.84.0 h1:U9UNaj+HCPR0rwDs8mTSKtsK9/aZPqw0E+q5d0DqUn4= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver v0.84.0/go.mod h1:eJnUNMvKh59U+EncWtPglHvdEt3R+VPHf/IXIjcxbkc= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinreceiver v0.84.0 h1:+Xe8V/MMtAGkV/nSDc5Ggqw3D8QKmFLrKlX95no289I= +github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinreceiver v0.84.0/go.mod h1:MIA7istfJapmbDZXpKds68A63eii0AhiYdrnvZQ9Vqc= +github.com/open-telemetry/opentelemetry-collector-contrib/testbed v0.84.0 h1:kjkvTp9H8BN8scfwTCnJILTLyjaTbOwB796mts4OD8A= +github.com/open-telemetry/opentelemetry-collector-contrib/testbed v0.84.0/go.mod h1:pbpV/T3qde1UQdGu5U49JZAPhEDoJtSam9xjx+qsKwM= +github.com/open-telemetry/opentelemetry-collector-contrib/testbed/mockdatareceivers/mockawsxrayreceiver v0.84.0 h1:m/FhKQ4IB4TyYqaTkQPQPf5KHHAJg4d8t6JKBCiwzSY= +github.com/open-telemetry/opentelemetry-collector-contrib/testbed/mockdatareceivers/mockawsxrayreceiver v0.84.0/go.mod h1:lNO/WEBIVsAhSs5vzMhuhCtpk4ppPXu2zKP1JnQhXNA= +github.com/open-telemetry/opentelemetry-collector-contrib/testbed/mockdatasenders/mockdatadogagentexporter v0.84.0 h1:aSM1Kzin6RgZKgcTilJHtmXBhVb7p8W3m7U+f2sLeYM= +github.com/open-telemetry/opentelemetry-collector-contrib/testbed/mockdatasenders/mockdatadogagentexporter v0.84.0/go.mod h1:iwYhIncXkUc5mACtHZpOwIpEal1ADxPGYdVHAQy+GCs= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= @@ -1533,8 +1532,8 @@ github.com/pierrec/lz4 v2.4.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pierrec/lz4/v3 v3.3.4/go.mod h1:280XNCGS8jAcG++AHdd6SeWnzyJ1w9oow2vbORyey8Q= github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= -github.com/pierrec/lz4/v4 v4.1.17 h1:kV4Ip+/hUBC+8T6+2EgburRtkE9ef4nbY3f4dFhGjMc= -github.com/pierrec/lz4/v4 v4.1.17/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= +github.com/pierrec/lz4/v4 v4.1.18 h1:xaKrnTkyoqfh1YItXl56+6KJNVYWlEEPuAQW9xsplYQ= +github.com/pierrec/lz4/v4 v4.1.18/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -1633,7 +1632,7 @@ github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.6.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/cors v1.9.0 h1:l9HGsTsHJcvW14Nk7J9KFz8bzeAWXn3CG6bgt7LsrAE= @@ -1748,7 +1747,6 @@ github.com/spf13/viper v1.11.0/go.mod h1:djo0X/bA5+tYVoCn+C7cAYJGcVn/qYLFTG8gdUs github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI= github.com/spf13/viper v1.14.0 h1:Rg7d3Lo706X9tHsJMUjdiwMpHB7W8WnSVOssIY+JElU= github.com/ssgreg/nlreturn/v2 v2.1.0/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= -github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= @@ -1863,9 +1861,6 @@ github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gi github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= -github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= -github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= @@ -1916,50 +1911,50 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/collector v0.52.0/go.mod h1:a9GvaOhyc0nVOUzqvdv5mxyWghCSso/WRO2GgRl4I1g= go.opentelemetry.io/collector v0.54.0/go.mod h1:FgNzyfb4sAGb5cqusB5znETJ8Pz4OQUBGbOeGIZ2rlQ= go.opentelemetry.io/collector v0.57.2/go.mod h1:9TwWyMRhbFNzaaGLtm/6poWNDJw+etvQMS6Fy+8/8Xs= -go.opentelemetry.io/collector v0.83.0 h1:rKFch1CANepajPwBTvzYj/hKz7RsMyUkPPPNjRCpJ/I= -go.opentelemetry.io/collector v0.83.0/go.mod h1:MNN79VDXXaRP2ZqcDVOfWH0Jl8BbcMttJ3SY/pU6vxo= -go.opentelemetry.io/collector/component v0.83.0 h1:7bMbOHQezVx9RhSLu9KQRBhjXmO+CbOVhBk5uySb0fY= -go.opentelemetry.io/collector/component v0.83.0/go.mod h1:Qy2mIP32UKN1x8rsjJbkgB9obAVu4hRusc1wKNFeV+o= -go.opentelemetry.io/collector/config/configauth v0.83.0 h1:caIkUszP+kTRVx9HW6z7x05CMnzlaBoP2BKyWDIr2ag= -go.opentelemetry.io/collector/config/configauth v0.83.0/go.mod h1:PqSIaQryPWiPVMuxlNPEvTpuvhdRq8ySN9nKlk3YbH4= -go.opentelemetry.io/collector/config/configcompression v0.83.0 h1:WwGfHyGey8JSUsBGUmRHaOzwllrLmsjjo5SZCYfSP14= -go.opentelemetry.io/collector/config/configcompression v0.83.0/go.mod h1:Mi1/3D+qNlRohrVMbBOj6XSHo7YKAKbgWYisNW2Qobc= -go.opentelemetry.io/collector/config/configgrpc v0.83.0 h1:bmX6M/L0+gtBSqAvPGh2cV8c4htNFfxa/9ZT8FreOHE= -go.opentelemetry.io/collector/config/configgrpc v0.83.0/go.mod h1:VpRhSIukmgVjx0HISN5r+y6EYQNGDYLU8j8hVUlcMjc= -go.opentelemetry.io/collector/config/confighttp v0.83.0 h1:yBra00XanzqXL0kLs3Aaas7RLoL50bM/Za8223vwJik= -go.opentelemetry.io/collector/config/confighttp v0.83.0/go.mod h1:Eu2WVZa8cy3F8mlxXIFPgzeAeLnaVc5UZzcEtufrOWs= -go.opentelemetry.io/collector/config/confignet v0.83.0 h1:xaQkMXvId8y7o6ke2qVRZZDqNc315CGkIcZ6LSVxDE0= -go.opentelemetry.io/collector/config/confignet v0.83.0/go.mod h1:I0iJQDhns1GgXBIumB64WHLPMmJpNdDaEDHQnmaaqsU= -go.opentelemetry.io/collector/config/configopaque v0.83.0 h1:nhYguW1zVFnQlaZWhwbXJS4/+WEPdQSEL8kTF/j/zeI= -go.opentelemetry.io/collector/config/configopaque v0.83.0/go.mod h1:Ga1x7xLQXWmwxfW1pPqjI4qT+eNxf9wu2/Mx7O2u01U= -go.opentelemetry.io/collector/config/configtelemetry v0.83.0 h1:Dx+POy68CFsec9JDYd7cxQPULLfSOAG8ma5Jl3ZZ3+Y= -go.opentelemetry.io/collector/config/configtelemetry v0.83.0/go.mod h1:8wZuTKLdcWwdB82Jd07TOHsHKuv8l47T+MUGEsPe4z4= -go.opentelemetry.io/collector/config/configtls v0.83.0 h1:qeAqwvw7qs3fY8wVZzN54E+SNMES7YdATY0ASEbJlUw= -go.opentelemetry.io/collector/config/configtls v0.83.0/go.mod h1:YMf+YSUhPB/LD5pZSyb3wRi7x6vbiMbONXOWFQnJnZ4= -go.opentelemetry.io/collector/config/internal v0.83.0 h1:yQZegCOPl4dWUVkr/fscVFU/AjANT5+Tu5XpKztTTSA= -go.opentelemetry.io/collector/config/internal v0.83.0/go.mod h1:BQs+X52s4BCIshht8qgbT4dqCM5YM2h6RQWln6zWhRA= -go.opentelemetry.io/collector/confmap v0.83.0 h1:eUaiFdhTLkFdNpMi5FLSHSQ6X2FcEHe0KfEUt9ZtVlI= -go.opentelemetry.io/collector/confmap v0.83.0/go.mod h1:ZsmLyJ+4VeO+qz5o1RKadRoY4Db+d8PYwiLCJ3Z5Et8= -go.opentelemetry.io/collector/connector v0.83.0 h1:wUxpqBTjJ9WSgZnosU26ALGYtwPVzEQxQk7w+mKSOs4= -go.opentelemetry.io/collector/connector v0.83.0/go.mod h1:o9xnA7C+2JzYQMSyWIJz/28tc3lGs3JkKLpckpAdzB8= -go.opentelemetry.io/collector/consumer v0.83.0 h1:8wg0UfFxxaGYsTkQGWuf1pE7C/dTvPkkYmBtR6N5BKc= -go.opentelemetry.io/collector/consumer v0.83.0/go.mod h1:YLbmTqvgIOYUlEeWun8wQ4RZ0HaYjsABWKw7nwU9F3c= -go.opentelemetry.io/collector/exporter v0.83.0 h1:1MPrMaCFvEvl291pAE0hTgPb7YybjSak9O5akzXqnXs= -go.opentelemetry.io/collector/exporter v0.83.0/go.mod h1:5XIrrkfRI7Ndt5FnH0CC6It0VxTHRviGv/I350EWGBs= -go.opentelemetry.io/collector/exporter/loggingexporter v0.83.0 h1:1k0zCEqUfNhWYw8X9zuQ4LNU4o5qwG6f1J3+P8lpe+E= -go.opentelemetry.io/collector/exporter/loggingexporter v0.83.0/go.mod h1:/Sa1r32rwJpBRHSzWclacQlyr6BG/uRuaXqi/CmPvb0= -go.opentelemetry.io/collector/exporter/otlpexporter v0.83.0 h1:k5bJVlXJCJGraslJtOcQPELbRE3gB5MCzzvYurp5aF4= -go.opentelemetry.io/collector/exporter/otlpexporter v0.83.0/go.mod h1:MIGlrd6rhbfsRUgFqGfu7xWfBlG72ZFNGUj2ZR53LGE= -go.opentelemetry.io/collector/exporter/otlphttpexporter v0.83.0 h1:5JeQ6JKiZiRlrcjw4LkzpTkdb3wOflvzYj1kbmr1h+I= -go.opentelemetry.io/collector/exporter/otlphttpexporter v0.83.0/go.mod h1:twNJ2isyvMaDZ7K3OeBtwOHW95uYQ5ylpgMbgyJqhks= -go.opentelemetry.io/collector/extension v0.83.0 h1:O47qpJTeav6jATvnIUvUrO5KBMqa6ySMA5i+7XXW7GY= -go.opentelemetry.io/collector/extension v0.83.0/go.mod h1:gPfwNimQiscUpaUGC/pUniTn4b5O+8IxHVKHDUkGqSI= -go.opentelemetry.io/collector/extension/auth v0.83.0 h1:H0orp7a7/NZae4/ymnC5JpuvO6GNcGLNz+nEDAw9ciU= -go.opentelemetry.io/collector/extension/auth v0.83.0/go.mod h1:Br0OyLU0p+2xS0UvQRvgWmH0Kv/4kPkNVr9AMzee5GM= -go.opentelemetry.io/collector/extension/ballastextension v0.83.0 h1:t0ITNPF7JAXa3+PA4INN6sORIYYgleP84ufPV+yceyU= -go.opentelemetry.io/collector/extension/ballastextension v0.83.0/go.mod h1:ZcsZT3S2EcM8DXz1R5tSVNL9AZmoxpbB65itsrWblhU= -go.opentelemetry.io/collector/extension/zpagesextension v0.83.0 h1:a2Avt+yjaJbHPbiST3I/4GgfxrB3iEpTtgIEGermItw= -go.opentelemetry.io/collector/extension/zpagesextension v0.83.0/go.mod h1:oJBN3N0uusy36qMo7FeWCUv2F9S6JCYw1omvtMtUQ4o= +go.opentelemetry.io/collector v0.84.0 h1:zzsegdPlDR0iJufPsHTJhXkv9q2kbpTTTI6nTyya2wA= +go.opentelemetry.io/collector v0.84.0/go.mod h1:+cv/zxludfiiDuK3z+5eXkxAJhkCCcy8Chtvv0nOlr0= +go.opentelemetry.io/collector/component v0.84.0 h1:bh4Is5Z7TjuyF7Mab0rSNh2q3y15fImdNDRXqrqGlbA= +go.opentelemetry.io/collector/component v0.84.0/go.mod h1:uXteRaacYXXYhzeCJe5ClLz5gLzleXWz01IZ730w7FA= +go.opentelemetry.io/collector/config/configauth v0.84.0 h1:N2cnOZYJ3DKg4NF28qLqrDj5Arl8IFt2rK3voDImTUU= +go.opentelemetry.io/collector/config/configauth v0.84.0/go.mod h1:8Uoq8FyFLhlELIHApKwGa9mhhTtQKGAfKDcBAw1aM8M= +go.opentelemetry.io/collector/config/configcompression v0.84.0 h1:NyyBsDlZDLKY6/+Ki2T5muQII6bq4ZGNMHTz9XKLskI= +go.opentelemetry.io/collector/config/configcompression v0.84.0/go.mod h1:LaavoxZsro5lL7qh1g9DMifG0qixWPEecW18Qr8bpag= +go.opentelemetry.io/collector/config/configgrpc v0.84.0 h1:wWYWbmm8EHm33Xllfe1o+AEmVHbjx4A5bDSx9TfM3bc= +go.opentelemetry.io/collector/config/configgrpc v0.84.0/go.mod h1:cs/g9nIJZh/R6G8XoBIO8chtU0RoiaG3DcP454pKenY= +go.opentelemetry.io/collector/config/confighttp v0.84.0 h1:SQK89DAe4VSACnMN79opyzEZa8DaN206nNsQbjbeu60= +go.opentelemetry.io/collector/config/confighttp v0.84.0/go.mod h1:lC4RRRZSAqDbppfKKtATQ8nZtC4wYowvpkXwYhnHkFY= +go.opentelemetry.io/collector/config/confignet v0.84.0 h1:AGaAdhKgV/lxNxHL/RqqpKjVGuIPSO8whTZyBbP3KK0= +go.opentelemetry.io/collector/config/confignet v0.84.0/go.mod h1:cpO8JYWGONaViOygKVw+Hd2UoBcn2cUiyi0WWeFTwJY= +go.opentelemetry.io/collector/config/configopaque v0.84.0 h1:EjALh+TaICWGcHAwTV87niSgWoI3fTQ3h6ureyo8ksw= +go.opentelemetry.io/collector/config/configopaque v0.84.0/go.mod h1:TPCHaU+QXiEV+JXbgyr6mSErTI9chwQyasDVMdJr3eY= +go.opentelemetry.io/collector/config/configtelemetry v0.84.0 h1:pnZiYtppJN6SlzJNcrkA8R+Ur63e33qMO260m8JbK18= +go.opentelemetry.io/collector/config/configtelemetry v0.84.0/go.mod h1:+LAXM5WFMW/UbTlAuSs6L/W72WC+q8TBJt/6z39FPOU= +go.opentelemetry.io/collector/config/configtls v0.84.0 h1:0rE1cdCLBx98nm6UgHnWFbytY0leZi/dr5bJ+i6Zup0= +go.opentelemetry.io/collector/config/configtls v0.84.0/go.mod h1:7zgWZBbH1+ZZLxNzDS+Kz0Em9dAXdlYmRqjXTWxZK2o= +go.opentelemetry.io/collector/config/internal v0.84.0 h1:LX1gO0q3+/y8JeRCOnYuMiF73gLZ7CwMSiov8Cqmumw= +go.opentelemetry.io/collector/config/internal v0.84.0/go.mod h1:XN8Y+Vhq/RqxGry7CGKwhMXJptUrmWTHdC6ZeI+Uy9E= +go.opentelemetry.io/collector/confmap v0.84.0 h1:fS62yIRrsTQwe1gyuEc8TQM0yUNfSAzPVi0A1665ZpQ= +go.opentelemetry.io/collector/confmap v0.84.0/go.mod h1:/SNHqYkLagF0TjBjQyCy2Gt3ZF6hTK8VKbaan/ZHuJs= +go.opentelemetry.io/collector/connector v0.84.0 h1:glvKR5FCHX/KuXKrItzVhSNaP3/n19LHrewaaFaRnWI= +go.opentelemetry.io/collector/connector v0.84.0/go.mod h1:VzBR1lHPntgGZkTYry35xyEtJLeHB8nQ/pcEeSt54H0= +go.opentelemetry.io/collector/consumer v0.84.0 h1:sz8mXIdPACJArlRyFNXA1SScVoo954IU1qp9V78VUxc= +go.opentelemetry.io/collector/consumer v0.84.0/go.mod h1:Mu+KeuorwHHWd6iGxU7DMAhgsHZmmzmQgf3sSWkugmM= +go.opentelemetry.io/collector/exporter v0.84.0 h1:OWvHJghs7/R6Qwr2fh7HrgEqsIUbCgLddLQsmqN95kM= +go.opentelemetry.io/collector/exporter v0.84.0/go.mod h1:Bz7MTaVosTIz6ZISszKYLDOewjathUJuVgT5W4Ee/wU= +go.opentelemetry.io/collector/exporter/loggingexporter v0.84.0 h1:O+w3MWYJ+Kf1WquqULRQzba1RnX+3JKIBCLCu1VTMYY= +go.opentelemetry.io/collector/exporter/loggingexporter v0.84.0/go.mod h1:bNnrdNDr4r9lt+/C4DHU3zC7FAqyIjrBGxSc27VmYdk= +go.opentelemetry.io/collector/exporter/otlpexporter v0.84.0 h1:LS0LHzQ6/LBjkduD+iMxUhH4H9DZ5BzQXojtJcnaDcg= +go.opentelemetry.io/collector/exporter/otlpexporter v0.84.0/go.mod h1:R7pJ3eg3QhLmphkjywUHIwK2X9bw4EChE5Iu6bO9iJ4= +go.opentelemetry.io/collector/exporter/otlphttpexporter v0.84.0 h1:/PK1ekCGGsk3nHD5UchD0F1g8IQzg/dwoJYmGr98Jok= +go.opentelemetry.io/collector/exporter/otlphttpexporter v0.84.0/go.mod h1:dSXH+tnJ+Taj8wz4OVXFKIds5rsoK9idM77um8S9uCU= +go.opentelemetry.io/collector/extension v0.84.0 h1:HN4otmncTE/eaeRcvBGTf0ApcX+dIQWsnShs6bgiKYA= +go.opentelemetry.io/collector/extension v0.84.0/go.mod h1:FoUzonXMAjVbFuSLM06F1260iVcbnMLMAEQk/xBfN1Y= +go.opentelemetry.io/collector/extension/auth v0.84.0 h1:e6IgIzLFdtTBImOC2qtH64PP/D/U6it3azMrAQ3/22I= +go.opentelemetry.io/collector/extension/auth v0.84.0/go.mod h1:eYm6kN05PyJrNjousma3CXiwzBsI582tlKjF9AUxnpQ= +go.opentelemetry.io/collector/extension/ballastextension v0.84.0 h1:aAkdlLomt2VAcH/GPYAE34ExGVFkCuIU32e7T7qcc28= +go.opentelemetry.io/collector/extension/ballastextension v0.84.0/go.mod h1:h7s5V05auYg/OBywzT0W/vPlukSMdfFQyHoyhqp9k6Y= +go.opentelemetry.io/collector/extension/zpagesextension v0.84.0 h1:huytVHKFVKDQBnLvy5tL/AUmzE3ydOwPClOZq1iZp50= +go.opentelemetry.io/collector/extension/zpagesextension v0.84.0/go.mod h1:R6tfHCmRP1FUFKmsUqMTNPN+6LA54DaZLjai90ijMtc= go.opentelemetry.io/collector/featuregate v1.0.0-rcv0014 h1:C9o0mbP0MyygqFnKueVQK/v9jef6zvuttmTGlKaqhgw= go.opentelemetry.io/collector/featuregate v1.0.0-rcv0014/go.mod h1:0mE3mDLmUrOXVoNsuvj+7dV14h/9HFl/Fy9YTLoLObo= go.opentelemetry.io/collector/model v0.49.0/go.mod h1:nOYQv9KoFPs6ihJwOi24qB209EOhS9HkwhGj54YiEAw= @@ -1970,22 +1965,22 @@ go.opentelemetry.io/collector/pdata v0.56.0/go.mod h1:mYcCREWiIJyHss0dbU+GSiz2tm go.opentelemetry.io/collector/pdata v0.57.2/go.mod h1:RU9I8lwBUxucwOsSYzHEcHi15M9QaX78hgQ2PRdSxV0= go.opentelemetry.io/collector/pdata v1.0.0-rcv0014 h1:iT5qH0NLmkGeIdDtnBogYDx7L58t6CaWGL378DEo2QY= go.opentelemetry.io/collector/pdata v1.0.0-rcv0014/go.mod h1:BRvDrx43kiSoUx3mr7SoA7h9B8+OY99mUK+CZSQFWW4= -go.opentelemetry.io/collector/processor v0.83.0 h1:oWMpPzHLkzlPXRIa27UsfsaDSbXaF/0qeiCn3BaesGo= -go.opentelemetry.io/collector/processor v0.83.0/go.mod h1:sLxTTqkIhmNtekO0HebXgVclPpm/xoQ4+g8CbzgYBCM= -go.opentelemetry.io/collector/processor/batchprocessor v0.83.0 h1:Zj4VKcO+NPXEONd0pr6y94nbJdJr/I2VLNxCYcfH0Go= -go.opentelemetry.io/collector/processor/batchprocessor v0.83.0/go.mod h1:ZA8h5ZJYFzcRqp33+I/M81RZjnnLWrtQ9Q/I5lVBlLs= -go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.83.0 h1:OZPN7wOunbPnMeoCDPkoseUamtuG8CjiY+hhmD+yU7w= -go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.83.0/go.mod h1:8DM+L0qvJudvIxSwd7wiVMZpiipYJgX5GnS9Zq7hZzQ= -go.opentelemetry.io/collector/receiver v0.83.0 h1:T2LI6BGNGMGBN8DLWUy7KyFXVaQR8ah+7ssCwb8OqNs= -go.opentelemetry.io/collector/receiver v0.83.0/go.mod h1:yEo8Mv57a53Psd2BvUbP/he5ZtdrwHezeLUCTUtf6PA= -go.opentelemetry.io/collector/receiver/otlpreceiver v0.83.0 h1:A0xNr1N/d5jkO+42G9CQ7C69UZhcTsnAibo1FzRA/PA= -go.opentelemetry.io/collector/receiver/otlpreceiver v0.83.0/go.mod h1:h+WL9WneDgX4uHVBdt/yVINSB/NUzVTOqukoBF1F7uc= +go.opentelemetry.io/collector/processor v0.84.0 h1:6VM5HLdkroeqNZ/jvjxA4nsgweJ87FDMsnNnzVBHpcY= +go.opentelemetry.io/collector/processor v0.84.0/go.mod h1:KWgBNQuA6wmmRqJwfvPaRybK2Di9X8nE2fraGuVLNJo= +go.opentelemetry.io/collector/processor/batchprocessor v0.84.0 h1:U7M0bhno88+zSDUdatJnhP8B3B9H2YHazo4N9KNDZxY= +go.opentelemetry.io/collector/processor/batchprocessor v0.84.0/go.mod h1:oH0ruRQ7lFbPSu8G87yVM2H8XBHaKHbqj5pXfswYWTY= +go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.84.0 h1:KUFX6eFnd4z+5VslFWywYGLI+GQ8+FGQoKsp2rXhhV8= +go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.84.0/go.mod h1:mrCzpXymIQfkr4DgCwWhr5j6JQP6s9CODHSbjKOBlzs= +go.opentelemetry.io/collector/receiver v0.84.0 h1:5bN0A18UMAVu9AsFv5AYDgzEFEJ/nFaD1OK2rk7Ygy0= +go.opentelemetry.io/collector/receiver v0.84.0/go.mod h1:QvjpfmMUA4tW59QJBagoNEbRT5JGYZN333GAOuWIRr4= +go.opentelemetry.io/collector/receiver/otlpreceiver v0.84.0 h1:IP15rNEGPyBW5s2bbaJeTsNK3unmq4ZXKx02FvnSVhY= +go.opentelemetry.io/collector/receiver/otlpreceiver v0.84.0/go.mod h1:g3S6hF8pIczEJ620ZAmpB2Cz/SIhh7jJjJGIP8w1mCc= go.opentelemetry.io/collector/semconv v0.52.0/go.mod h1:SxK0rUnUP7YeDakexzbE/vhimTOHwE6m/4aKKd9e27Q= go.opentelemetry.io/collector/semconv v0.54.0/go.mod h1:HAGkPKNMhc4kEHevEqVIEtUuvsRQMIbUWBb8yBrqEwk= go.opentelemetry.io/collector/semconv v0.56.0/go.mod h1:EH1wbDvTyqKpKBBpoMIe0KQk2plCcFS66Mo17WtR7CQ= go.opentelemetry.io/collector/semconv v0.57.2/go.mod h1:84YnUjmm+nhGu4YTDLnHCbxnL74ooWpismPG79tFD7w= -go.opentelemetry.io/collector/semconv v0.83.0 h1:zfBJaGiC7XI8dLD/8QIyKre98RHcq3DaG1g1B+U/Dow= -go.opentelemetry.io/collector/semconv v0.83.0/go.mod h1:j/8THcqVxFna1FpvA2zYIsUperEtOaRaqoLYIN4doWw= +go.opentelemetry.io/collector/semconv v0.84.0 h1:sI1B8ebHhfJPd87iyba66TDnluVFvYu8CEpSjKHqIDc= +go.opentelemetry.io/collector/semconv v0.84.0/go.mod h1:j/8THcqVxFna1FpvA2zYIsUperEtOaRaqoLYIN4doWw= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.32.0/go.mod h1:J0dBVrt7dPS/lKJyQoW0xzQiUr4r2Ik1VwPjAUWnofI= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.33.0/go.mod h1:y/SlJpJQPd2UzfBCj0E9Flk9FDCtTyqUmaCB41qFrWI= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.1-0.20230612162650-64be7e574a17 h1:mdcNStUIXngF/mH3xxAo4nbR4g65IXqLL1SvYMjz7JQ= @@ -2015,6 +2010,12 @@ go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.39.0 h1:rm+ go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.39.0/go.mod h1:sWFbI3jJ+6JdjOVepA5blpv/TJ20Hw+26561iMbWcwU= go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.39.0 h1:IZXpCEtI7BbX01DRQEWTGDkvjMB6hEhiEZXS+eg2YqY= go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.39.0/go.mod h1:xY111jIZtWb+pUUgT4UiiSonAaY2cD2Ts5zvuKLki3o= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 h1:cbsD4cUcviQGXdw8+bo5x2wazq10SKz8hEbtCRPcU78= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0/go.mod h1:JgXSGah17croqhJfhByOLVY719k1emAXC8MVhCIJlRs= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0 h1:TVQp/bboR4mhZSav+MdgXB8FaRho1RC8UwVn3T0vjVc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0/go.mod h1:I33vtIe0sR96wfrUcilIzLoA3mLHhRmz9S9Te0S3gDo= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.16.0 h1:iqjq9LAB8aK++sKVcELezzn655JnBNdsDhghU4G/So8= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.16.0/go.mod h1:hGXzO5bhhSHZnKvrDaXB82Y9DRFour0Nz/KrBh7reWw= go.opentelemetry.io/otel/exporters/prometheus v0.30.0/go.mod h1:qN5feW+0/d661KDtJuATEmHtw5bKBK7NSvNEP927zSs= go.opentelemetry.io/otel/exporters/prometheus v0.31.0/go.mod h1:QarXIB8L79IwIPoNgG3A6zNvBgVmcppeFogV1d8612s= go.opentelemetry.io/otel/exporters/prometheus v0.39.0 h1:whAaiHxOatgtKd+w0dOi//1KUxj3KoPINZdtDaDj3IA= @@ -2128,8 +2129,8 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 h1:k/i9J1pBpvlfR+9QsetwPyERsqu1GIbi967PQMq3Ivc= -golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= +golang.org/x/exp v0.0.0-20230711023510-fffb14384f22 h1:FqrVOBQxQ8r/UwwXibI0KMolVhvFiGobSfdE33deHJM= +golang.org/x/exp v0.0.0-20230711023510-fffb14384f22/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= @@ -2223,7 +2224,6 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -2234,11 +2234,11 @@ golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220725212005-46097bf591d3/go.mod h1:AaygXjzTFtRAg2ttMY5RMuhpJ3cNnI0XpyFJD1iQRSM= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -2566,8 +2566,8 @@ golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= -gonum.org/v1/gonum v0.13.0 h1:a0T3bh+7fhRyqeNbiC3qVHYmkiQgit3wnNan/2c0HMM= -gonum.org/v1/gonum v0.13.0/go.mod h1:/WPYRckkfWrhWefxyYTfrTtQR0KH4iyHNuzxqXAKyAU= +gonum.org/v1/gonum v0.14.0 h1:2NiG67LD1tEH0D7kM+ps2V+fXmsAnpUeec7n8tcr4S0= +gonum.org/v1/gonum v0.14.0/go.mod h1:AoWeoz0becf9QMWtE8iWXNXc27fK4fNeHNf/oMejGfU= gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= @@ -2610,8 +2610,8 @@ google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRR google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= google.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6rKmw= google.golang.org/api v0.81.0/go.mod h1:FA6Mb/bZxj706H2j+j2d6mHEEaHBmbbWnkfvmorOCko= -google.golang.org/api v0.136.0 h1:e/6enzUE1s4tGPa6Q3ZYShKTtvRc+1Jq0rrafhppmOs= -google.golang.org/api v0.136.0/go.mod h1:XtJfF+V2zgUxelOn5Zs3kECtluMxneJG8ZxUTlLNTPA= +google.golang.org/api v0.138.0 h1:K/tVp05MxNVbHShRw9m7e9VJGdagNeTdMzqPH7AUqr0= +google.golang.org/api v0.138.0/go.mod h1:4xyob8CxC+0GChNBvEUAk8VBKNvYOTWM9T3v3UfRxuY= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -2691,7 +2691,6 @@ google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= @@ -2709,10 +2708,10 @@ google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 h1:L6iMMGrtzgHsWofoFcihmDEMYeDR9KN/ThbPWGrh++g= google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5/go.mod h1:oH/ZOT02u4kWEp7oYBGYFFkCdKS/uYR9Z7+0/xuuFp8= -google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5 h1:nIgk/EEq3/YlnmVVXVnm14rC2oxgs1o0ong4sD/rd44= -google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5/go.mod h1:5DZzOUPCLYL3mNkQ0ms0F3EuUNZ7py1Bqeq6sxzI7/Q= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230807174057-1744710a1577 h1:wukfNtZmZUurLN/atp2hiIeTKn7QJWIQdHzqmsOnAOk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230807174057-1744710a1577/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= +google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= @@ -2840,14 +2839,14 @@ honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.1.1/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= honnef.co/go/tools v0.1.2/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= k8s.io/api v0.21.1/go.mod h1:FstGROTmsSHBarKc8bylzXih8BLNYTiS3TZcsoEDg2s= -k8s.io/api v0.27.4 h1:0pCo/AN9hONazBKlNUdhQymmnfLRbSZjd5H5H3f0bSs= -k8s.io/api v0.27.4/go.mod h1:O3smaaX15NfxjzILfiln1D8Z3+gEYpjEpiNA/1EVK1Y= +k8s.io/api v0.28.1 h1:i+0O8k2NPBCPYaMB+uCkseEbawEt/eFaiRqUx8aB108= +k8s.io/api v0.28.1/go.mod h1:uBYwID+66wiL28Kn2tBjBYQdEU0Xk0z5qF8bIBqk/Dg= k8s.io/apimachinery v0.21.1/go.mod h1:jbreFvJo3ov9rj7eWT7+sYiRx+qZuCYXwWT1bcDswPY= -k8s.io/apimachinery v0.27.4 h1:CdxflD4AF61yewuid0fLl6bM4a3q04jWel0IlP+aYjs= -k8s.io/apimachinery v0.27.4/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= +k8s.io/apimachinery v0.28.1 h1:EJD40og3GizBSV3mkIoXQBsws32okPOy+MkRyzh6nPY= +k8s.io/apimachinery v0.28.1/go.mod h1:X0xh/chESs2hP9koe+SdIAcXWcQ+RM5hy0ZynB+yEvw= k8s.io/client-go v0.21.1/go.mod h1:/kEw4RgW+3xnBGzvp9IWxKSNA+lXn3A7AuH3gdOAzLs= -k8s.io/client-go v0.27.4 h1:vj2YTtSJ6J4KxaC88P4pMPEQECWMY8gqPqsTgUKzvjk= -k8s.io/client-go v0.27.4/go.mod h1:ragcly7lUlN0SRPk5/ZkGnDjPknzb37TICq07WhI6Xc= +k8s.io/client-go v0.28.1 h1:pRhMzB8HyLfVwpngWKE8hDcXRqifh1ga2Z/PU9SXVK8= +k8s.io/client-go v0.28.1/go.mod h1:pEZA3FqOsVkCc07pFVzK076R+P/eXqsgx5zuuRWukNE= k8s.io/code-generator v0.21.1/go.mod h1:hUlps5+9QaTrKx+jiM4rmq7YmH8wPOIko64uZCHDh6Q= k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20201214224949-b6c5ce23f027/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= @@ -2857,15 +2856,15 @@ k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= k8s.io/klog/v2 v2.8.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= -k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw= -k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg= +k8s.io/klog/v2 v2.100.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7/go.mod h1:wXW5VT87nVfh/iLV8FpR2uDvrFyomxbtb1KivDbvPTE= -k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f h1:2kWPakN3i/k81b0gvD5C5FJ2kxm1WrQFanWchyKuqGg= -k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f/go.mod h1:byini6yhqGC14c3ebc/QwanvYwhuMWF6yz2F8uwW8eg= +k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 h1:LyMgNKD2P8Wn1iAwQU5OhxCKlKJy0sHc+PcDwFB24dQ= +k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9/go.mod h1:wZK2AVp1uHCp4VamDVgBP2COHZjqD1T68Rf0CM3YjSM= k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20211116205334-6203023598ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= -k8s.io/utils v0.0.0-20230308161112-d77c459e9343 h1:m7tbIjXGcGIAtpmQr7/NAi7RsWoW3E7Zcm4jI1HicTc= -k8s.io/utils v0.0.0-20230308161112-d77c459e9343/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 h1:qY1Ad8PODbnymg2pRbkyMT/ylpTrCM8P2RJ0yroCyIk= +k8s.io/utils v0.0.0-20230406110748-d93618cff8a2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= mvdan.cc/gofumpt v0.1.0/go.mod h1:yXG1r1WqZVKWbVRtBWKWX9+CxGYfA51nSomhM0woR48= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= diff --git a/tools/packaging/windows/aws-otel-collector.wxs b/tools/packaging/windows/aws-otel-collector.wxs index bb02500a9..308d641b9 100644 --- a/tools/packaging/windows/aws-otel-collector.wxs +++ b/tools/packaging/windows/aws-otel-collector.wxs @@ -3,7 +3,7 @@ diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/.apigentools-info b/vendor/github.com/DataDog/datadog-api-client-go/v2/.apigentools-info index 29855654f..80b168727 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/.apigentools-info +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/.apigentools-info @@ -3,14 +3,14 @@ "info_version": "2", "spec_versions": { "v1": { - "apigentools_version": "1.6.4", - "regenerated": "2023-06-26 19:25:49.064713", - "spec_repo_commit": "6831ab50" + "apigentools_version": "1.6.5", + "regenerated": "2023-08-22 13:54:16.867365", + "spec_repo_commit": "51fe480e" }, "v2": { - "apigentools_version": "1.6.4", - "regenerated": "2023-06-26 19:25:49.077929", - "spec_repo_commit": "6831ab50" + "apigentools_version": "1.6.5", + "regenerated": "2023-08-22 13:54:16.880463", + "spec_repo_commit": "51fe480e" } } } \ No newline at end of file diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/.pre-commit-config.yaml b/vendor/github.com/DataDog/datadog-api-client-go/v2/.pre-commit-config.yaml index 8343ea326..c9bfa6724 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/.pre-commit-config.yaml +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/.pre-commit-config.yaml @@ -30,7 +30,7 @@ repos: name: Format documentation stages: [manual] language: node - language_version: 14.12.0 + language_version: 20.5.0 entry: prettier --write --list-different --ignore-unknown # "types": [text] files: 'README.md' @@ -38,7 +38,7 @@ repos: additional_dependencies: # When updating the version of prettier, make sure to check the pre-commit file # And keep the `entry` here up to date https://github.com/pre-commit/mirrors-prettier/blob/master/.pre-commit-hooks.yaml - - prettier@2.5.1 + - prettier@3.0.0 - id: generator name: generator language: python diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/CHANGELOG.md b/vendor/github.com/DataDog/datadog-api-client-go/v2/CHANGELOG.md index 549f88017..d7d25491f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/CHANGELOG.md +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/CHANGELOG.md @@ -1,5 +1,73 @@ # CHANGELOG +## 2.16.0 / 2023-08-23 + +### Fixed +* Handle `{}` and bool value for additionalProperties by @skarimo in https://github.com/DataDog/datadog-api-client-go/pull/2104 +* Update team schemas by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2103 +* Mark downtime v2 start response as required by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2116 +* Document new properties and fix security monitoring schemas by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2102 +* Add missing CI App fields `page` and `test_level` by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2077 +* Fix `unparsedObject` deserialization for lists by @skarimo in https://github.com/DataDog/datadog-api-client-go/pull/2125 +* Fix unparsedObject early exit by @skarimo in https://github.com/DataDog/datadog-api-client-go/pull/2119 +* Cleanup UnmarshalJSON in models by @skarimo in https://github.com/DataDog/datadog-api-client-go/pull/2127 +### Added +* Update stated limit for api/v2/metrics from 14 days to 30 days by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2110 +* Add missing sensitive data scanner fields by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2099 +* Add Workflow Executions to usage metering API by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2112 +* Add missing `type` field for OnDemandConcurrencyCap response by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2101 +* Add CI Visibility Intelligent Test Runner to usage metering API by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2111 +* Add custom_links to distribution widget schema by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2120 +* Add usage field `region` by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2121 +* Add `message` field to audit logs response by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2123 +* Add `tags` field to dashboard list response by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2122 +* API specs for user team memberships by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2135 +* Document `EQUAL` comparator by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2138 +* Add persistCookies option synthetics test request by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2137 +* Expose sds_scanned_bytes_usage in usage attribution API by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2141 +* Add support in azure integration endpoint for app service plan filters/cspm/custom metrics by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2136 +* Add APM and USM usage attribution type by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2133 +* Document new attributes for team models by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2130 +### Changed +* Update dependencies by @therve in https://github.com/DataDog/datadog-api-client-go/pull/2090 +* Bump go to `1.19` by @skarimo in https://github.com/DataDog/datadog-api-client-go/pull/2128 + + +**Full Changelog**: https://github.com/DataDog/datadog-api-client-go/compare/v2.15.0...v2.16.0 + +## 2.15.0 / 2023-07-20 + +### Fixed +* Spans API docs update by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2070 +* Fix filter indexes parameter in logs search by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2075 +* Fix nullable `enum` default value rendering by @skarimo in https://github.com/DataDog/datadog-api-client-go/pull/2081 +* Remove unused nullable models by @skarimo in https://github.com/DataDog/datadog-api-client-go/pull/2085 +* Fix Spans endpoint schemas by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2095 +### Added +* Add support for geomap widget using response_type `event_list` by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2054 +* Add support for the spans API endpoints by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2060 +* Add a new field additional_query_filters to formula and function slo query by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2071 +* Add support for `enable_custom_metrics` in Confluent Account by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2068 +* Add missing `id` attribute for Confluent Account Response by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2074 +* Fix downtimes v2 schema and add missing field `canceled` by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2080 +* Add cloud_cost data source and query definition to dashboards by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2082 +* Add missing cloud workload security fields by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2089 +* Add `integration_id` field for dashboard list item by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2094 +* Add events response fields `message` and `status` by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2091 +* Add missing `GetRUMApplications` response field `id` by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2092 +* Add missing service definition fields by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2093 +* Add overlay type to Dashboards WidgetDisplayType by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2096 +* Update IP ranges with remote configuration section by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2098 +* Add missing `relationships` to UsersInvitations response by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2100 +* Added optional field filters when creating a cloud configuration rule by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2105 +### Changed +* Use alternative go parser by @therve in https://github.com/DataDog/datadog-api-client-go/pull/2061 +* Add downtime v2 API in private beta by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2026 +* Mark `access_role` as nullable by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-go/pull/2078 + + +**Full Changelog**: https://github.com/DataDog/datadog-api-client-go/compare/v2.14.0...v2.15.0 + ## 2.14.0 / 2023-06-27 ### Fixed diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/LICENSE-3rdparty.csv b/vendor/github.com/DataDog/datadog-api-client-go/v2/LICENSE-3rdparty.csv index 3c6299c40..7d955d8d1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/LICENSE-3rdparty.csv +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/LICENSE-3rdparty.csv @@ -80,4 +80,6 @@ go.sum,google.golang.org/grpc,Apache-2.0,2016 gRPC authors. go.sum,google.golang.org/protobuf,BSD-3-Clause,2018 The Go Authors. go.sum,honnef.co/go/tools,MIT,2016 Dominik Honnef go.sum,github.com/DataDog/zstd,BSD-3-Clause,"2016-Present Datadog, Inc." +go.sum,github.com/goccy/go-json,MIT,2020 Masaaki Goshima +go.sum,github.com/modocache/gover,Apache-2.0,2017 Gover Team run-tests.sh,honnef.co/go/tools/cmd/staticcheck,MIT,2016 Dominik Honnef diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/README.md b/vendor/github.com/DataDog/datadog-api-client-go/v2/README.md index 79aae4f13..8fd320faa 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/README.md +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/README.md @@ -4,7 +4,7 @@ This repository contains a Go API client for the [Datadog API](https://docs.data ## Requirements -- Go 1.17+ +- Go 1.19+ ## Layout diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadog/client.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadog/client.go index adf0a44bd..5237df6f5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadog/client.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadog/client.go @@ -9,7 +9,6 @@ import ( "compress/gzip" "compress/zlib" "context" - "encoding/json" "encoding/xml" "errors" "fmt" @@ -28,6 +27,7 @@ import ( "strings" "time" + "github.com/goccy/go-json" "golang.org/x/oauth2" ) diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadog/configuration.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadog/configuration.go index 4ef4a406d..f0a51c9a8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadog/configuration.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadog/configuration.go @@ -323,6 +323,13 @@ func NewConfiguration() *Configuration { }, }, unstableOperations: map[string]bool{ + "v2.CreateCIAppPipelineEvent": false, + "v2.CancelDowntime": false, + "v2.CreateDowntime": false, + "v2.GetDowntime": false, + "v2.ListDowntimes": false, + "v2.ListMonitorDowntimes": false, + "v2.UpdateDowntime": false, "v2.ListEvents": false, "v2.SearchEvents": false, "v2.CreateIncident": false, diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadog/utils.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadog/utils.go index 5c03c305d..7de4f46bb 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadog/utils.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadog/utils.go @@ -6,13 +6,14 @@ package datadog import ( "bytes" - "encoding/json" "io" "net/http" "reflect" "strings" "time" "unicode/utf8" + + "github.com/goccy/go-json" ) // PtrBool is a helper routine that returns a pointer to given boolean value. diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/api_aws_logs_integration.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/api_aws_logs_integration.go index 2b28cfc9c..35084f896 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/api_aws_logs_integration.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/api_aws_logs_integration.go @@ -101,11 +101,11 @@ func (a *AWSLogsIntegrationApi) CheckAWSLogsLambdaAsync(ctx _context.Context, bo // Done async, so can be repeatedly polled in a non-blocking fashion until // the async request completes. // -// - Returns a status of `created` when it's checking if the permissions exists -// in the AWS account. -// - Returns a status of `waiting` while checking. -// - Returns a status of `checked and ok` if the Lambda exists. -// - Returns a status of `error` if the Lambda does not exist. +// - Returns a status of `created` when it's checking if the permissions exists +// in the AWS account. +// - Returns a status of `waiting` while checking. +// - Returns a status of `checked and ok` if the Lambda exists. +// - Returns a status of `error` if the Lambda does not exist. func (a *AWSLogsIntegrationApi) CheckAWSLogsServicesAsync(ctx _context.Context, body AWSLogsServicesRequest) (AWSLogsAsyncResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/api_usage_metering.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/api_usage_metering.go index 7e3a2e7b6..398bc25f0 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/api_usage_metering.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/api_usage_metering.go @@ -199,9 +199,11 @@ func (r *GetHourlyUsageAttributionOptionalParameters) WithIncludeDescendants(inc // response := GetHourlyUsageAttribution(start_month) // cursor := response.metadata.pagination.next_record_id // WHILE cursor != null BEGIN -// sleep(5 seconds) # Avoid running into rate limit -// response := GetHourlyUsageAttribution(start_month, next_record_id=cursor) -// cursor := response.metadata.pagination.next_record_id +// +// sleep(5 seconds) # Avoid running into rate limit +// response := GetHourlyUsageAttribution(start_month, next_record_id=cursor) +// cursor := response.metadata.pagination.next_record_id +// // END // ``` func (a *UsageMeteringApi) GetHourlyUsageAttribution(ctx _context.Context, startHr time.Time, usageType HourlyUsageAttributionUsageType, o ...GetHourlyUsageAttributionOptionalParameters) (HourlyUsageAttributionResponse, *_nethttp.Response, error) { @@ -689,9 +691,11 @@ func (r *GetMonthlyUsageAttributionOptionalParameters) WithIncludeDescendants(in // response := GetMonthlyUsageAttribution(start_month) // cursor := response.metadata.pagination.next_record_id // WHILE cursor != null BEGIN -// sleep(5 seconds) # Avoid running into rate limit -// response := GetMonthlyUsageAttribution(start_month, next_record_id=cursor) -// cursor := response.metadata.pagination.next_record_id +// +// sleep(5 seconds) # Avoid running into rate limit +// response := GetMonthlyUsageAttribution(start_month, next_record_id=cursor) +// cursor := response.metadata.pagination.next_record_id +// // END // ``` func (a *UsageMeteringApi) GetMonthlyUsageAttribution(ctx _context.Context, startMonth time.Time, fields MonthlyUsageAttributionSupportedMetrics, o ...GetMonthlyUsageAttributionOptionalParameters) (MonthlyUsageAttributionResponse, *_nethttp.Response, error) { diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/doc.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/doc.go index bc44b1909..1eb48a1a2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/doc.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/doc.go @@ -3,230 +3,230 @@ // Copyright 2019-Present Datadog, Inc. // List of APIs: -// - [AWSIntegrationApi.CreateAWSAccount] -// - [AWSIntegrationApi.CreateAWSTagFilter] -// - [AWSIntegrationApi.CreateNewAWSExternalID] -// - [AWSIntegrationApi.DeleteAWSAccount] -// - [AWSIntegrationApi.DeleteAWSTagFilter] -// - [AWSIntegrationApi.ListAWSAccounts] -// - [AWSIntegrationApi.ListAWSTagFilters] -// - [AWSIntegrationApi.ListAvailableAWSNamespaces] -// - [AWSIntegrationApi.UpdateAWSAccount] -// - [AWSLogsIntegrationApi.CheckAWSLogsLambdaAsync] -// - [AWSLogsIntegrationApi.CheckAWSLogsServicesAsync] -// - [AWSLogsIntegrationApi.CreateAWSLambdaARN] -// - [AWSLogsIntegrationApi.DeleteAWSLambdaARN] -// - [AWSLogsIntegrationApi.EnableAWSLogServices] -// - [AWSLogsIntegrationApi.ListAWSLogsIntegrations] -// - [AWSLogsIntegrationApi.ListAWSLogsServices] -// - [AuthenticationApi.Validate] -// - [AzureIntegrationApi.CreateAzureIntegration] -// - [AzureIntegrationApi.DeleteAzureIntegration] -// - [AzureIntegrationApi.ListAzureIntegration] -// - [AzureIntegrationApi.UpdateAzureHostFilters] -// - [AzureIntegrationApi.UpdateAzureIntegration] -// - [DashboardListsApi.CreateDashboardList] -// - [DashboardListsApi.DeleteDashboardList] -// - [DashboardListsApi.GetDashboardList] -// - [DashboardListsApi.ListDashboardLists] -// - [DashboardListsApi.UpdateDashboardList] -// - [DashboardsApi.CreateDashboard] -// - [DashboardsApi.CreatePublicDashboard] -// - [DashboardsApi.DeleteDashboard] -// - [DashboardsApi.DeleteDashboards] -// - [DashboardsApi.DeletePublicDashboard] -// - [DashboardsApi.DeletePublicDashboardInvitation] -// - [DashboardsApi.GetDashboard] -// - [DashboardsApi.GetPublicDashboard] -// - [DashboardsApi.GetPublicDashboardInvitations] -// - [DashboardsApi.ListDashboards] -// - [DashboardsApi.RestoreDashboards] -// - [DashboardsApi.SendPublicDashboardInvitation] -// - [DashboardsApi.UpdateDashboard] -// - [DashboardsApi.UpdatePublicDashboard] -// - [DowntimesApi.CancelDowntime] -// - [DowntimesApi.CancelDowntimesByScope] -// - [DowntimesApi.CreateDowntime] -// - [DowntimesApi.GetDowntime] -// - [DowntimesApi.ListDowntimes] -// - [DowntimesApi.ListMonitorDowntimes] -// - [DowntimesApi.UpdateDowntime] -// - [EventsApi.CreateEvent] -// - [EventsApi.GetEvent] -// - [EventsApi.ListEvents] -// - [GCPIntegrationApi.CreateGCPIntegration] -// - [GCPIntegrationApi.DeleteGCPIntegration] -// - [GCPIntegrationApi.ListGCPIntegration] -// - [GCPIntegrationApi.UpdateGCPIntegration] -// - [HostsApi.GetHostTotals] -// - [HostsApi.ListHosts] -// - [HostsApi.MuteHost] -// - [HostsApi.UnmuteHost] -// - [IPRangesApi.GetIPRanges] -// - [KeyManagementApi.CreateAPIKey] -// - [KeyManagementApi.CreateApplicationKey] -// - [KeyManagementApi.DeleteAPIKey] -// - [KeyManagementApi.DeleteApplicationKey] -// - [KeyManagementApi.GetAPIKey] -// - [KeyManagementApi.GetApplicationKey] -// - [KeyManagementApi.ListAPIKeys] -// - [KeyManagementApi.ListApplicationKeys] -// - [KeyManagementApi.UpdateAPIKey] -// - [KeyManagementApi.UpdateApplicationKey] -// - [LogsApi.ListLogs] -// - [LogsApi.SubmitLog] -// - [LogsIndexesApi.CreateLogsIndex] -// - [LogsIndexesApi.GetLogsIndex] -// - [LogsIndexesApi.GetLogsIndexOrder] -// - [LogsIndexesApi.ListLogIndexes] -// - [LogsIndexesApi.UpdateLogsIndex] -// - [LogsIndexesApi.UpdateLogsIndexOrder] -// - [LogsPipelinesApi.CreateLogsPipeline] -// - [LogsPipelinesApi.DeleteLogsPipeline] -// - [LogsPipelinesApi.GetLogsPipeline] -// - [LogsPipelinesApi.GetLogsPipelineOrder] -// - [LogsPipelinesApi.ListLogsPipelines] -// - [LogsPipelinesApi.UpdateLogsPipeline] -// - [LogsPipelinesApi.UpdateLogsPipelineOrder] -// - [MetricsApi.GetMetricMetadata] -// - [MetricsApi.ListActiveMetrics] -// - [MetricsApi.ListMetrics] -// - [MetricsApi.QueryMetrics] -// - [MetricsApi.SubmitDistributionPoints] -// - [MetricsApi.SubmitMetrics] -// - [MetricsApi.UpdateMetricMetadata] -// - [MonitorsApi.CheckCanDeleteMonitor] -// - [MonitorsApi.CreateMonitor] -// - [MonitorsApi.DeleteMonitor] -// - [MonitorsApi.GetMonitor] -// - [MonitorsApi.ListMonitors] -// - [MonitorsApi.SearchMonitorGroups] -// - [MonitorsApi.SearchMonitors] -// - [MonitorsApi.UpdateMonitor] -// - [MonitorsApi.ValidateExistingMonitor] -// - [MonitorsApi.ValidateMonitor] -// - [NotebooksApi.CreateNotebook] -// - [NotebooksApi.DeleteNotebook] -// - [NotebooksApi.GetNotebook] -// - [NotebooksApi.ListNotebooks] -// - [NotebooksApi.UpdateNotebook] -// - [OrganizationsApi.CreateChildOrg] -// - [OrganizationsApi.DowngradeOrg] -// - [OrganizationsApi.GetOrg] -// - [OrganizationsApi.ListOrgs] -// - [OrganizationsApi.UpdateOrg] -// - [OrganizationsApi.UploadIdPForOrg] -// - [PagerDutyIntegrationApi.CreatePagerDutyIntegrationService] -// - [PagerDutyIntegrationApi.DeletePagerDutyIntegrationService] -// - [PagerDutyIntegrationApi.GetPagerDutyIntegrationService] -// - [PagerDutyIntegrationApi.UpdatePagerDutyIntegrationService] -// - [SecurityMonitoringApi.AddSecurityMonitoringSignalToIncident] -// - [SecurityMonitoringApi.EditSecurityMonitoringSignalAssignee] -// - [SecurityMonitoringApi.EditSecurityMonitoringSignalState] -// - [ServiceChecksApi.SubmitServiceCheck] -// - [ServiceLevelObjectiveCorrectionsApi.CreateSLOCorrection] -// - [ServiceLevelObjectiveCorrectionsApi.DeleteSLOCorrection] -// - [ServiceLevelObjectiveCorrectionsApi.GetSLOCorrection] -// - [ServiceLevelObjectiveCorrectionsApi.ListSLOCorrection] -// - [ServiceLevelObjectiveCorrectionsApi.UpdateSLOCorrection] -// - [ServiceLevelObjectivesApi.CheckCanDeleteSLO] -// - [ServiceLevelObjectivesApi.CreateSLO] -// - [ServiceLevelObjectivesApi.DeleteSLO] -// - [ServiceLevelObjectivesApi.DeleteSLOTimeframeInBulk] -// - [ServiceLevelObjectivesApi.GetSLO] -// - [ServiceLevelObjectivesApi.GetSLOCorrections] -// - [ServiceLevelObjectivesApi.GetSLOHistory] -// - [ServiceLevelObjectivesApi.ListSLOs] -// - [ServiceLevelObjectivesApi.SearchSLO] -// - [ServiceLevelObjectivesApi.UpdateSLO] -// - [SlackIntegrationApi.CreateSlackIntegrationChannel] -// - [SlackIntegrationApi.GetSlackIntegrationChannel] -// - [SlackIntegrationApi.GetSlackIntegrationChannels] -// - [SlackIntegrationApi.RemoveSlackIntegrationChannel] -// - [SlackIntegrationApi.UpdateSlackIntegrationChannel] -// - [SnapshotsApi.GetGraphSnapshot] -// - [SyntheticsApi.CreateGlobalVariable] -// - [SyntheticsApi.CreatePrivateLocation] -// - [SyntheticsApi.CreateSyntheticsAPITest] -// - [SyntheticsApi.CreateSyntheticsBrowserTest] -// - [SyntheticsApi.DeleteGlobalVariable] -// - [SyntheticsApi.DeletePrivateLocation] -// - [SyntheticsApi.DeleteTests] -// - [SyntheticsApi.EditGlobalVariable] -// - [SyntheticsApi.GetAPITest] -// - [SyntheticsApi.GetAPITestLatestResults] -// - [SyntheticsApi.GetAPITestResult] -// - [SyntheticsApi.GetBrowserTest] -// - [SyntheticsApi.GetBrowserTestLatestResults] -// - [SyntheticsApi.GetBrowserTestResult] -// - [SyntheticsApi.GetGlobalVariable] -// - [SyntheticsApi.GetPrivateLocation] -// - [SyntheticsApi.GetSyntheticsCIBatch] -// - [SyntheticsApi.GetSyntheticsDefaultLocations] -// - [SyntheticsApi.GetTest] -// - [SyntheticsApi.ListGlobalVariables] -// - [SyntheticsApi.ListLocations] -// - [SyntheticsApi.ListTests] -// - [SyntheticsApi.TriggerCITests] -// - [SyntheticsApi.TriggerTests] -// - [SyntheticsApi.UpdateAPITest] -// - [SyntheticsApi.UpdateBrowserTest] -// - [SyntheticsApi.UpdatePrivateLocation] -// - [SyntheticsApi.UpdateTestPauseStatus] -// - [TagsApi.CreateHostTags] -// - [TagsApi.DeleteHostTags] -// - [TagsApi.GetHostTags] -// - [TagsApi.ListHostTags] -// - [TagsApi.UpdateHostTags] -// - [UsageMeteringApi.GetDailyCustomReports] -// - [UsageMeteringApi.GetHourlyUsageAttribution] -// - [UsageMeteringApi.GetIncidentManagement] -// - [UsageMeteringApi.GetIngestedSpans] -// - [UsageMeteringApi.GetMonthlyCustomReports] -// - [UsageMeteringApi.GetMonthlyUsageAttribution] -// - [UsageMeteringApi.GetSpecifiedDailyCustomReports] -// - [UsageMeteringApi.GetSpecifiedMonthlyCustomReports] -// - [UsageMeteringApi.GetUsageAnalyzedLogs] -// - [UsageMeteringApi.GetUsageAttribution] -// - [UsageMeteringApi.GetUsageAuditLogs] -// - [UsageMeteringApi.GetUsageBillableSummary] -// - [UsageMeteringApi.GetUsageCIApp] -// - [UsageMeteringApi.GetUsageCWS] -// - [UsageMeteringApi.GetUsageCloudSecurityPostureManagement] -// - [UsageMeteringApi.GetUsageDBM] -// - [UsageMeteringApi.GetUsageFargate] -// - [UsageMeteringApi.GetUsageHosts] -// - [UsageMeteringApi.GetUsageIndexedSpans] -// - [UsageMeteringApi.GetUsageInternetOfThings] -// - [UsageMeteringApi.GetUsageLambda] -// - [UsageMeteringApi.GetUsageLogs] -// - [UsageMeteringApi.GetUsageLogsByIndex] -// - [UsageMeteringApi.GetUsageLogsByRetention] -// - [UsageMeteringApi.GetUsageNetworkFlows] -// - [UsageMeteringApi.GetUsageNetworkHosts] -// - [UsageMeteringApi.GetUsageOnlineArchive] -// - [UsageMeteringApi.GetUsageProfiling] -// - [UsageMeteringApi.GetUsageRumSessions] -// - [UsageMeteringApi.GetUsageRumUnits] -// - [UsageMeteringApi.GetUsageSDS] -// - [UsageMeteringApi.GetUsageSNMP] -// - [UsageMeteringApi.GetUsageSummary] -// - [UsageMeteringApi.GetUsageSynthetics] -// - [UsageMeteringApi.GetUsageSyntheticsAPI] -// - [UsageMeteringApi.GetUsageSyntheticsBrowser] -// - [UsageMeteringApi.GetUsageTimeseries] -// - [UsageMeteringApi.GetUsageTopAvgMetrics] -// - [UsersApi.CreateUser] -// - [UsersApi.DisableUser] -// - [UsersApi.GetUser] -// - [UsersApi.ListUsers] -// - [UsersApi.UpdateUser] -// - [WebhooksIntegrationApi.CreateWebhooksIntegration] -// - [WebhooksIntegrationApi.CreateWebhooksIntegrationCustomVariable] -// - [WebhooksIntegrationApi.DeleteWebhooksIntegration] -// - [WebhooksIntegrationApi.DeleteWebhooksIntegrationCustomVariable] -// - [WebhooksIntegrationApi.GetWebhooksIntegration] -// - [WebhooksIntegrationApi.GetWebhooksIntegrationCustomVariable] -// - [WebhooksIntegrationApi.UpdateWebhooksIntegration] -// - [WebhooksIntegrationApi.UpdateWebhooksIntegrationCustomVariable] +// - [AWSIntegrationApi.CreateAWSAccount] +// - [AWSIntegrationApi.CreateAWSTagFilter] +// - [AWSIntegrationApi.CreateNewAWSExternalID] +// - [AWSIntegrationApi.DeleteAWSAccount] +// - [AWSIntegrationApi.DeleteAWSTagFilter] +// - [AWSIntegrationApi.ListAWSAccounts] +// - [AWSIntegrationApi.ListAWSTagFilters] +// - [AWSIntegrationApi.ListAvailableAWSNamespaces] +// - [AWSIntegrationApi.UpdateAWSAccount] +// - [AWSLogsIntegrationApi.CheckAWSLogsLambdaAsync] +// - [AWSLogsIntegrationApi.CheckAWSLogsServicesAsync] +// - [AWSLogsIntegrationApi.CreateAWSLambdaARN] +// - [AWSLogsIntegrationApi.DeleteAWSLambdaARN] +// - [AWSLogsIntegrationApi.EnableAWSLogServices] +// - [AWSLogsIntegrationApi.ListAWSLogsIntegrations] +// - [AWSLogsIntegrationApi.ListAWSLogsServices] +// - [AuthenticationApi.Validate] +// - [AzureIntegrationApi.CreateAzureIntegration] +// - [AzureIntegrationApi.DeleteAzureIntegration] +// - [AzureIntegrationApi.ListAzureIntegration] +// - [AzureIntegrationApi.UpdateAzureHostFilters] +// - [AzureIntegrationApi.UpdateAzureIntegration] +// - [DashboardListsApi.CreateDashboardList] +// - [DashboardListsApi.DeleteDashboardList] +// - [DashboardListsApi.GetDashboardList] +// - [DashboardListsApi.ListDashboardLists] +// - [DashboardListsApi.UpdateDashboardList] +// - [DashboardsApi.CreateDashboard] +// - [DashboardsApi.CreatePublicDashboard] +// - [DashboardsApi.DeleteDashboard] +// - [DashboardsApi.DeleteDashboards] +// - [DashboardsApi.DeletePublicDashboard] +// - [DashboardsApi.DeletePublicDashboardInvitation] +// - [DashboardsApi.GetDashboard] +// - [DashboardsApi.GetPublicDashboard] +// - [DashboardsApi.GetPublicDashboardInvitations] +// - [DashboardsApi.ListDashboards] +// - [DashboardsApi.RestoreDashboards] +// - [DashboardsApi.SendPublicDashboardInvitation] +// - [DashboardsApi.UpdateDashboard] +// - [DashboardsApi.UpdatePublicDashboard] +// - [DowntimesApi.CancelDowntime] +// - [DowntimesApi.CancelDowntimesByScope] +// - [DowntimesApi.CreateDowntime] +// - [DowntimesApi.GetDowntime] +// - [DowntimesApi.ListDowntimes] +// - [DowntimesApi.ListMonitorDowntimes] +// - [DowntimesApi.UpdateDowntime] +// - [EventsApi.CreateEvent] +// - [EventsApi.GetEvent] +// - [EventsApi.ListEvents] +// - [GCPIntegrationApi.CreateGCPIntegration] +// - [GCPIntegrationApi.DeleteGCPIntegration] +// - [GCPIntegrationApi.ListGCPIntegration] +// - [GCPIntegrationApi.UpdateGCPIntegration] +// - [HostsApi.GetHostTotals] +// - [HostsApi.ListHosts] +// - [HostsApi.MuteHost] +// - [HostsApi.UnmuteHost] +// - [IPRangesApi.GetIPRanges] +// - [KeyManagementApi.CreateAPIKey] +// - [KeyManagementApi.CreateApplicationKey] +// - [KeyManagementApi.DeleteAPIKey] +// - [KeyManagementApi.DeleteApplicationKey] +// - [KeyManagementApi.GetAPIKey] +// - [KeyManagementApi.GetApplicationKey] +// - [KeyManagementApi.ListAPIKeys] +// - [KeyManagementApi.ListApplicationKeys] +// - [KeyManagementApi.UpdateAPIKey] +// - [KeyManagementApi.UpdateApplicationKey] +// - [LogsApi.ListLogs] +// - [LogsApi.SubmitLog] +// - [LogsIndexesApi.CreateLogsIndex] +// - [LogsIndexesApi.GetLogsIndex] +// - [LogsIndexesApi.GetLogsIndexOrder] +// - [LogsIndexesApi.ListLogIndexes] +// - [LogsIndexesApi.UpdateLogsIndex] +// - [LogsIndexesApi.UpdateLogsIndexOrder] +// - [LogsPipelinesApi.CreateLogsPipeline] +// - [LogsPipelinesApi.DeleteLogsPipeline] +// - [LogsPipelinesApi.GetLogsPipeline] +// - [LogsPipelinesApi.GetLogsPipelineOrder] +// - [LogsPipelinesApi.ListLogsPipelines] +// - [LogsPipelinesApi.UpdateLogsPipeline] +// - [LogsPipelinesApi.UpdateLogsPipelineOrder] +// - [MetricsApi.GetMetricMetadata] +// - [MetricsApi.ListActiveMetrics] +// - [MetricsApi.ListMetrics] +// - [MetricsApi.QueryMetrics] +// - [MetricsApi.SubmitDistributionPoints] +// - [MetricsApi.SubmitMetrics] +// - [MetricsApi.UpdateMetricMetadata] +// - [MonitorsApi.CheckCanDeleteMonitor] +// - [MonitorsApi.CreateMonitor] +// - [MonitorsApi.DeleteMonitor] +// - [MonitorsApi.GetMonitor] +// - [MonitorsApi.ListMonitors] +// - [MonitorsApi.SearchMonitorGroups] +// - [MonitorsApi.SearchMonitors] +// - [MonitorsApi.UpdateMonitor] +// - [MonitorsApi.ValidateExistingMonitor] +// - [MonitorsApi.ValidateMonitor] +// - [NotebooksApi.CreateNotebook] +// - [NotebooksApi.DeleteNotebook] +// - [NotebooksApi.GetNotebook] +// - [NotebooksApi.ListNotebooks] +// - [NotebooksApi.UpdateNotebook] +// - [OrganizationsApi.CreateChildOrg] +// - [OrganizationsApi.DowngradeOrg] +// - [OrganizationsApi.GetOrg] +// - [OrganizationsApi.ListOrgs] +// - [OrganizationsApi.UpdateOrg] +// - [OrganizationsApi.UploadIdPForOrg] +// - [PagerDutyIntegrationApi.CreatePagerDutyIntegrationService] +// - [PagerDutyIntegrationApi.DeletePagerDutyIntegrationService] +// - [PagerDutyIntegrationApi.GetPagerDutyIntegrationService] +// - [PagerDutyIntegrationApi.UpdatePagerDutyIntegrationService] +// - [SecurityMonitoringApi.AddSecurityMonitoringSignalToIncident] +// - [SecurityMonitoringApi.EditSecurityMonitoringSignalAssignee] +// - [SecurityMonitoringApi.EditSecurityMonitoringSignalState] +// - [ServiceChecksApi.SubmitServiceCheck] +// - [ServiceLevelObjectiveCorrectionsApi.CreateSLOCorrection] +// - [ServiceLevelObjectiveCorrectionsApi.DeleteSLOCorrection] +// - [ServiceLevelObjectiveCorrectionsApi.GetSLOCorrection] +// - [ServiceLevelObjectiveCorrectionsApi.ListSLOCorrection] +// - [ServiceLevelObjectiveCorrectionsApi.UpdateSLOCorrection] +// - [ServiceLevelObjectivesApi.CheckCanDeleteSLO] +// - [ServiceLevelObjectivesApi.CreateSLO] +// - [ServiceLevelObjectivesApi.DeleteSLO] +// - [ServiceLevelObjectivesApi.DeleteSLOTimeframeInBulk] +// - [ServiceLevelObjectivesApi.GetSLO] +// - [ServiceLevelObjectivesApi.GetSLOCorrections] +// - [ServiceLevelObjectivesApi.GetSLOHistory] +// - [ServiceLevelObjectivesApi.ListSLOs] +// - [ServiceLevelObjectivesApi.SearchSLO] +// - [ServiceLevelObjectivesApi.UpdateSLO] +// - [SlackIntegrationApi.CreateSlackIntegrationChannel] +// - [SlackIntegrationApi.GetSlackIntegrationChannel] +// - [SlackIntegrationApi.GetSlackIntegrationChannels] +// - [SlackIntegrationApi.RemoveSlackIntegrationChannel] +// - [SlackIntegrationApi.UpdateSlackIntegrationChannel] +// - [SnapshotsApi.GetGraphSnapshot] +// - [SyntheticsApi.CreateGlobalVariable] +// - [SyntheticsApi.CreatePrivateLocation] +// - [SyntheticsApi.CreateSyntheticsAPITest] +// - [SyntheticsApi.CreateSyntheticsBrowserTest] +// - [SyntheticsApi.DeleteGlobalVariable] +// - [SyntheticsApi.DeletePrivateLocation] +// - [SyntheticsApi.DeleteTests] +// - [SyntheticsApi.EditGlobalVariable] +// - [SyntheticsApi.GetAPITest] +// - [SyntheticsApi.GetAPITestLatestResults] +// - [SyntheticsApi.GetAPITestResult] +// - [SyntheticsApi.GetBrowserTest] +// - [SyntheticsApi.GetBrowserTestLatestResults] +// - [SyntheticsApi.GetBrowserTestResult] +// - [SyntheticsApi.GetGlobalVariable] +// - [SyntheticsApi.GetPrivateLocation] +// - [SyntheticsApi.GetSyntheticsCIBatch] +// - [SyntheticsApi.GetSyntheticsDefaultLocations] +// - [SyntheticsApi.GetTest] +// - [SyntheticsApi.ListGlobalVariables] +// - [SyntheticsApi.ListLocations] +// - [SyntheticsApi.ListTests] +// - [SyntheticsApi.TriggerCITests] +// - [SyntheticsApi.TriggerTests] +// - [SyntheticsApi.UpdateAPITest] +// - [SyntheticsApi.UpdateBrowserTest] +// - [SyntheticsApi.UpdatePrivateLocation] +// - [SyntheticsApi.UpdateTestPauseStatus] +// - [TagsApi.CreateHostTags] +// - [TagsApi.DeleteHostTags] +// - [TagsApi.GetHostTags] +// - [TagsApi.ListHostTags] +// - [TagsApi.UpdateHostTags] +// - [UsageMeteringApi.GetDailyCustomReports] +// - [UsageMeteringApi.GetHourlyUsageAttribution] +// - [UsageMeteringApi.GetIncidentManagement] +// - [UsageMeteringApi.GetIngestedSpans] +// - [UsageMeteringApi.GetMonthlyCustomReports] +// - [UsageMeteringApi.GetMonthlyUsageAttribution] +// - [UsageMeteringApi.GetSpecifiedDailyCustomReports] +// - [UsageMeteringApi.GetSpecifiedMonthlyCustomReports] +// - [UsageMeteringApi.GetUsageAnalyzedLogs] +// - [UsageMeteringApi.GetUsageAttribution] +// - [UsageMeteringApi.GetUsageAuditLogs] +// - [UsageMeteringApi.GetUsageBillableSummary] +// - [UsageMeteringApi.GetUsageCIApp] +// - [UsageMeteringApi.GetUsageCWS] +// - [UsageMeteringApi.GetUsageCloudSecurityPostureManagement] +// - [UsageMeteringApi.GetUsageDBM] +// - [UsageMeteringApi.GetUsageFargate] +// - [UsageMeteringApi.GetUsageHosts] +// - [UsageMeteringApi.GetUsageIndexedSpans] +// - [UsageMeteringApi.GetUsageInternetOfThings] +// - [UsageMeteringApi.GetUsageLambda] +// - [UsageMeteringApi.GetUsageLogs] +// - [UsageMeteringApi.GetUsageLogsByIndex] +// - [UsageMeteringApi.GetUsageLogsByRetention] +// - [UsageMeteringApi.GetUsageNetworkFlows] +// - [UsageMeteringApi.GetUsageNetworkHosts] +// - [UsageMeteringApi.GetUsageOnlineArchive] +// - [UsageMeteringApi.GetUsageProfiling] +// - [UsageMeteringApi.GetUsageRumSessions] +// - [UsageMeteringApi.GetUsageRumUnits] +// - [UsageMeteringApi.GetUsageSDS] +// - [UsageMeteringApi.GetUsageSNMP] +// - [UsageMeteringApi.GetUsageSummary] +// - [UsageMeteringApi.GetUsageSynthetics] +// - [UsageMeteringApi.GetUsageSyntheticsAPI] +// - [UsageMeteringApi.GetUsageSyntheticsBrowser] +// - [UsageMeteringApi.GetUsageTimeseries] +// - [UsageMeteringApi.GetUsageTopAvgMetrics] +// - [UsersApi.CreateUser] +// - [UsersApi.DisableUser] +// - [UsersApi.GetUser] +// - [UsersApi.ListUsers] +// - [UsersApi.UpdateUser] +// - [WebhooksIntegrationApi.CreateWebhooksIntegration] +// - [WebhooksIntegrationApi.CreateWebhooksIntegrationCustomVariable] +// - [WebhooksIntegrationApi.DeleteWebhooksIntegration] +// - [WebhooksIntegrationApi.DeleteWebhooksIntegrationCustomVariable] +// - [WebhooksIntegrationApi.GetWebhooksIntegration] +// - [WebhooksIntegrationApi.GetWebhooksIntegrationCustomVariable] +// - [WebhooksIntegrationApi.UpdateWebhooksIntegration] +// - [WebhooksIntegrationApi.UpdateWebhooksIntegrationCustomVariable] package datadogV1 diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_access_role.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_access_role.go index a8fee1508..382b281e1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_access_role.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_access_role.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // AccessRole The access role of the user. Options are **st** (standard user), **adm** (admin user), or **ro** (read-only user). diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_add_signal_to_incident_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_add_signal_to_incident_request.go index 4e03aac5e..f5cee5ead 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_add_signal_to_incident_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_add_signal_to_incident_request.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -143,19 +144,13 @@ func (o AddSignalToIncidentRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AddSignalToIncidentRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AddToSignalTimeline *bool `json:"add_to_signal_timeline,omitempty"` IncidentId *int64 `json:"incident_id"` Version *int64 `json:"version,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.IncidentId == nil { return fmt.Errorf("required field incident_id missing") @@ -169,6 +164,7 @@ func (o *AddSignalToIncidentRequest) UnmarshalJSON(bytes []byte) (err error) { o.AddToSignalTimeline = all.AddToSignalTimeline o.IncidentId = *all.IncidentId o.Version = all.Version + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_alert_graph_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_alert_graph_widget_definition.go index 91d1ac811..ebfc08274 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_alert_graph_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_alert_graph_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -265,7 +266,6 @@ func (o AlertGraphWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AlertGraphWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AlertId *string `json:"alert_id"` Time *WidgetTime `json:"time,omitempty"` @@ -276,12 +276,7 @@ func (o *AlertGraphWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { VizType *WidgetVizType `json:"viz_type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.AlertId == nil { return fmt.Errorf("required field alert_id missing") @@ -298,47 +293,38 @@ func (o *AlertGraphWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.VizType; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.AlertId = *all.AlertId if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Time = all.Time o.Title = all.Title - o.TitleAlign = all.TitleAlign + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } o.TitleSize = all.TitleSize - o.Type = *all.Type - o.VizType = *all.VizType + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if !all.VizType.IsValid() { + hasInvalidField = true + } else { + o.VizType = *all.VizType + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_alert_graph_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_alert_graph_widget_definition_type.go index f8b40acbe..d1e568d93 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_alert_graph_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_alert_graph_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // AlertGraphWidgetDefinitionType Type of the alert graph widget. @@ -61,47 +62,3 @@ func (v AlertGraphWidgetDefinitionType) IsValid() bool { func (v AlertGraphWidgetDefinitionType) Ptr() *AlertGraphWidgetDefinitionType { return &v } - -// NullableAlertGraphWidgetDefinitionType handles when a null is used for AlertGraphWidgetDefinitionType. -type NullableAlertGraphWidgetDefinitionType struct { - value *AlertGraphWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableAlertGraphWidgetDefinitionType) Get() *AlertGraphWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableAlertGraphWidgetDefinitionType) Set(val *AlertGraphWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableAlertGraphWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableAlertGraphWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableAlertGraphWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableAlertGraphWidgetDefinitionType(val *AlertGraphWidgetDefinitionType) *NullableAlertGraphWidgetDefinitionType { - return &NullableAlertGraphWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableAlertGraphWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableAlertGraphWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_alert_value_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_alert_value_widget_definition.go index 531552eb5..a2ed291ef 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_alert_value_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_alert_value_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -304,7 +305,6 @@ func (o AlertValueWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AlertValueWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AlertId *string `json:"alert_id"` Precision *int64 `json:"precision,omitempty"` @@ -316,12 +316,7 @@ func (o *AlertValueWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { Unit *string `json:"unit,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.AlertId == nil { return fmt.Errorf("required field alert_id missing") @@ -335,41 +330,36 @@ func (o *AlertValueWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.TextAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.AlertId = *all.AlertId o.Precision = all.Precision - o.TextAlign = all.TextAlign + if all.TextAlign != nil && !all.TextAlign.IsValid() { + hasInvalidField = true + } else { + o.TextAlign = all.TextAlign + } o.Title = all.Title - o.TitleAlign = all.TitleAlign + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } o.TitleSize = all.TitleSize - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } o.Unit = all.Unit + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_alert_value_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_alert_value_widget_definition_type.go index b272c62f1..16d094a0e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_alert_value_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_alert_value_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // AlertValueWidgetDefinitionType Type of the alert value widget. @@ -61,47 +62,3 @@ func (v AlertValueWidgetDefinitionType) IsValid() bool { func (v AlertValueWidgetDefinitionType) Ptr() *AlertValueWidgetDefinitionType { return &v } - -// NullableAlertValueWidgetDefinitionType handles when a null is used for AlertValueWidgetDefinitionType. -type NullableAlertValueWidgetDefinitionType struct { - value *AlertValueWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableAlertValueWidgetDefinitionType) Get() *AlertValueWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableAlertValueWidgetDefinitionType) Set(val *AlertValueWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableAlertValueWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableAlertValueWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableAlertValueWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableAlertValueWidgetDefinitionType(val *AlertValueWidgetDefinitionType) *NullableAlertValueWidgetDefinitionType { - return &NullableAlertValueWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableAlertValueWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableAlertValueWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_api_error_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_api_error_response.go index 4b102bf0a..24f7c8913 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_api_error_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_api_error_response.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o APIErrorResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *APIErrorResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Errors *[]string `json:"errors"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Errors == nil { return fmt.Errorf("required field errors missing") @@ -99,6 +94,7 @@ func (o *APIErrorResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Errors = *all.Errors + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_api_key.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_api_key.go index 1859bdfba..b7f03ec6a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_api_key.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_api_key.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -181,7 +181,6 @@ func (o ApiKey) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ApiKey) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Created *string `json:"created,omitempty"` CreatedBy *string `json:"created_by,omitempty"` @@ -189,12 +188,7 @@ func (o *ApiKey) UnmarshalJSON(bytes []byte) (err error) { 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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,6 +200,7 @@ func (o *ApiKey) UnmarshalJSON(bytes []byte) (err error) { o.CreatedBy = all.CreatedBy o.Key = all.Key o.Name = all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_api_key_list_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_api_key_list_response.go index bc62da772..3c1e06a59 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_api_key_list_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_api_key_list_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o ApiKeyListResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ApiKeyListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApiKeys []ApiKey `json:"api_keys,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *ApiKeyListResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.ApiKeys = all.ApiKeys + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_api_key_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_api_key_response.go index 86686ed0e..80d77a929 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_api_key_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_api_key_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o ApiKeyResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ApiKeyResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApiKey *ApiKey `json:"api_key,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *ApiKeyResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.ApiKey != nil && all.ApiKey.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ApiKey = all.ApiKey + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_apm_stats_query_column_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_apm_stats_query_column_type.go index 2a8e8c5bd..4059c94b6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_apm_stats_query_column_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_apm_stats_query_column_type.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -176,7 +177,6 @@ func (o ApmStatsQueryColumnType) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ApmStatsQueryColumnType) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Alias *string `json:"alias,omitempty"` CellDisplayMode *TableWidgetCellDisplayMode `json:"cell_display_mode,omitempty"` @@ -184,12 +184,7 @@ func (o *ApmStatsQueryColumnType) UnmarshalJSON(bytes []byte) (err error) { Order *WidgetSort `json:"order,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -200,29 +195,28 @@ func (o *ApmStatsQueryColumnType) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.CellDisplayMode; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Order; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Alias = all.Alias - o.CellDisplayMode = all.CellDisplayMode + if all.CellDisplayMode != nil && !all.CellDisplayMode.IsValid() { + hasInvalidField = true + } else { + o.CellDisplayMode = all.CellDisplayMode + } o.Name = *all.Name - o.Order = all.Order + if all.Order != nil && !all.Order.IsValid() { + hasInvalidField = true + } else { + o.Order = all.Order + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_apm_stats_query_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_apm_stats_query_definition.go index 48312039f..155fea609 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_apm_stats_query_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_apm_stats_query_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -251,7 +252,6 @@ func (o ApmStatsQueryDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ApmStatsQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Columns []ApmStatsQueryColumnType `json:"columns,omitempty"` Env *string `json:"env"` @@ -262,12 +262,7 @@ func (o *ApmStatsQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { Service *string `json:"service"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Env == nil { return fmt.Errorf("required field env missing") @@ -290,24 +285,27 @@ func (o *ApmStatsQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.RowType; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Columns = all.Columns o.Env = *all.Env o.Name = *all.Name o.PrimaryTag = *all.PrimaryTag o.Resource = all.Resource - o.RowType = *all.RowType + if !all.RowType.IsValid() { + hasInvalidField = true + } else { + o.RowType = *all.RowType + } o.Service = *all.Service + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_apm_stats_query_row_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_apm_stats_query_row_type.go index 2db7f725d..dbba3d27a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_apm_stats_query_row_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_apm_stats_query_row_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ApmStatsQueryRowType The level of detail for the request. @@ -65,47 +66,3 @@ func (v ApmStatsQueryRowType) IsValid() bool { func (v ApmStatsQueryRowType) Ptr() *ApmStatsQueryRowType { return &v } - -// NullableApmStatsQueryRowType handles when a null is used for ApmStatsQueryRowType. -type NullableApmStatsQueryRowType struct { - value *ApmStatsQueryRowType - isSet bool -} - -// Get returns the associated value. -func (v NullableApmStatsQueryRowType) Get() *ApmStatsQueryRowType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableApmStatsQueryRowType) Set(val *ApmStatsQueryRowType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableApmStatsQueryRowType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableApmStatsQueryRowType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableApmStatsQueryRowType initializes the struct as if Set has been called. -func NewNullableApmStatsQueryRowType(val *ApmStatsQueryRowType) *NullableApmStatsQueryRowType { - return &NullableApmStatsQueryRowType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableApmStatsQueryRowType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableApmStatsQueryRowType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_application_key.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_application_key.go index 841f8ae34..b0b996114 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_application_key.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_application_key.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o ApplicationKey) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ApplicationKey) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Hash *string `json:"hash,omitempty"` Name *string `json:"name,omitempty"` Owner *string `json:"owner,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *ApplicationKey) UnmarshalJSON(bytes []byte) (err error) { o.Hash = all.Hash o.Name = all.Name o.Owner = all.Owner + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_application_key_list_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_application_key_list_response.go index 4b11f9bac..2cef1d40f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_application_key_list_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_application_key_list_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o ApplicationKeyListResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ApplicationKeyListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApplicationKeys []ApplicationKey `json:"application_keys,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *ApplicationKeyListResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.ApplicationKeys = all.ApplicationKeys + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_application_key_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_application_key_response.go index 5944f0852..49cef9c59 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_application_key_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_application_key_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o ApplicationKeyResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ApplicationKeyResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApplicationKey *ApplicationKey `json:"application_key,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *ApplicationKeyResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.ApplicationKey != nil && all.ApplicationKey.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ApplicationKey = all.ApplicationKey + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_authentication_validation_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_authentication_validation_response.go index d5576c3cc..9bd78e773 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_authentication_validation_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_authentication_validation_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o AuthenticationValidationResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuthenticationValidationResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Valid *bool `json:"valid,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *AuthenticationValidationResponse) UnmarshalJSON(bytes []byte) (err erro return err } o.Valid = all.Valid + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_account.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_account.go index 7e0e6bf58..64649cabc 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_account.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_account.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -432,7 +432,6 @@ func (o AWSAccount) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AWSAccount) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AccessKeyId *string `json:"access_key_id,omitempty"` AccountId *string `json:"account_id,omitempty"` @@ -447,12 +446,7 @@ func (o *AWSAccount) UnmarshalJSON(bytes []byte) (err error) { SecretAccessKey *string `json:"secret_access_key,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -471,6 +465,7 @@ func (o *AWSAccount) UnmarshalJSON(bytes []byte) (err error) { o.ResourceCollectionEnabled = all.ResourceCollectionEnabled o.RoleName = all.RoleName o.SecretAccessKey = all.SecretAccessKey + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_account_and_lambda_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_account_and_lambda_request.go index b9ce18afd..62ffff7ab 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_account_and_lambda_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_account_and_lambda_request.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o AWSAccountAndLambdaRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AWSAccountAndLambdaRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AccountId *string `json:"account_id"` LambdaArn *string `json:"lambda_arn"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.AccountId == nil { return fmt.Errorf("required field account_id missing") @@ -131,6 +126,7 @@ func (o *AWSAccountAndLambdaRequest) UnmarshalJSON(bytes []byte) (err error) { } o.AccountId = *all.AccountId o.LambdaArn = *all.LambdaArn + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_account_create_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_account_create_response.go index ddf297099..c57562054 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_account_create_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_account_create_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o AWSAccountCreateResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AWSAccountCreateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ExternalId *string `json:"external_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *AWSAccountCreateResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.ExternalId = all.ExternalId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_account_delete_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_account_delete_request.go index 81fa3c6b7..d37ec4c05 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_account_delete_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_account_delete_request.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o AWSAccountDeleteRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AWSAccountDeleteRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AccessKeyId *string `json:"access_key_id,omitempty"` AccountId *string `json:"account_id,omitempty"` RoleName *string `json:"role_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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *AWSAccountDeleteRequest) UnmarshalJSON(bytes []byte) (err error) { o.AccessKeyId = all.AccessKeyId o.AccountId = all.AccountId o.RoleName = all.RoleName + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_account_list_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_account_list_response.go index 618f5ca83..a824e3a25 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_account_list_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_account_list_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o AWSAccountListResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AWSAccountListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Accounts []AWSAccount `json:"accounts,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *AWSAccountListResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Accounts = all.Accounts + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_logs_async_error.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_logs_async_error.go index 98852c4d4..c8d911815 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_logs_async_error.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_logs_async_error.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o AWSLogsAsyncError) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AWSLogsAsyncError) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Code *string `json:"code,omitempty"` Message *string `json:"message,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *AWSLogsAsyncError) UnmarshalJSON(bytes []byte) (err error) { } o.Code = all.Code o.Message = all.Message + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_logs_async_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_logs_async_response.go index 31129476b..a6cb12c56 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_logs_async_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_logs_async_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o AWSLogsAsyncResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AWSLogsAsyncResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Errors []AWSLogsAsyncError `json:"errors,omitempty"` Status *string `json:"status,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *AWSLogsAsyncResponse) UnmarshalJSON(bytes []byte) (err error) { } o.Errors = all.Errors o.Status = all.Status + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_logs_lambda.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_logs_lambda.go index c12bc8bc9..a16f2c712 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_logs_lambda.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_logs_lambda.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o AWSLogsLambda) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AWSLogsLambda) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Arn *string `json:"arn,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *AWSLogsLambda) UnmarshalJSON(bytes []byte) (err error) { return err } o.Arn = all.Arn + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_logs_list_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_logs_list_response.go index 223a46ec0..636d9009e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_logs_list_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_logs_list_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o AWSLogsListResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AWSLogsListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AccountId *string `json:"account_id,omitempty"` Lambdas []AWSLogsLambda `json:"lambdas,omitempty"` Services []string `json:"services,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *AWSLogsListResponse) UnmarshalJSON(bytes []byte) (err error) { o.AccountId = all.AccountId o.Lambdas = all.Lambdas o.Services = all.Services + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_logs_list_services_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_logs_list_services_response.go index fed1d1426..5388d63d6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_logs_list_services_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_logs_list_services_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o AWSLogsListServicesResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AWSLogsListServicesResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id,omitempty"` Label *string `json:"label,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *AWSLogsListServicesResponse) UnmarshalJSON(bytes []byte) (err error) { } o.Id = all.Id o.Label = all.Label + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_logs_services_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_logs_services_request.go index 26c1aca9e..ac84342a4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_logs_services_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_logs_services_request.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o AWSLogsServicesRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AWSLogsServicesRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AccountId *string `json:"account_id"` Services *[]string `json:"services"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.AccountId == nil { return fmt.Errorf("required field account_id missing") @@ -131,6 +126,7 @@ func (o *AWSLogsServicesRequest) UnmarshalJSON(bytes []byte) (err error) { } o.AccountId = *all.AccountId o.Services = *all.Services + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_namespace.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_namespace.go index be621d392..b922ccfaf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_namespace.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_namespace.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // AWSNamespace The namespace associated with the tag filter entry. @@ -73,47 +74,3 @@ func (v AWSNamespace) IsValid() bool { func (v AWSNamespace) Ptr() *AWSNamespace { return &v } - -// NullableAWSNamespace handles when a null is used for AWSNamespace. -type NullableAWSNamespace struct { - value *AWSNamespace - isSet bool -} - -// Get returns the associated value. -func (v NullableAWSNamespace) Get() *AWSNamespace { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableAWSNamespace) Set(val *AWSNamespace) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableAWSNamespace) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableAWSNamespace) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableAWSNamespace initializes the struct as if Set has been called. -func NewNullableAWSNamespace(val *AWSNamespace) *NullableAWSNamespace { - return &NullableAWSNamespace{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableAWSNamespace) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableAWSNamespace) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_tag_filter.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_tag_filter.go index 74d3f1600..382762913 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_tag_filter.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_tag_filter.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o AWSTagFilter) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AWSTagFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Namespace *AWSNamespace `json:"namespace,omitempty"` TagFilterStr *string `json:"tag_filter_str,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,19 +128,22 @@ func (o *AWSTagFilter) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Namespace; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.Namespace != nil && !all.Namespace.IsValid() { + hasInvalidField = true + } else { + o.Namespace = all.Namespace } - o.Namespace = all.Namespace o.TagFilterStr = all.TagFilterStr + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_tag_filter_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_tag_filter_create_request.go index 79d39c607..693bfe046 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_tag_filter_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_tag_filter_create_request.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o AWSTagFilterCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AWSTagFilterCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AccountId *string `json:"account_id,omitempty"` Namespace *AWSNamespace `json:"namespace,omitempty"` TagFilterStr *string `json:"tag_filter_str,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,20 +162,23 @@ func (o *AWSTagFilterCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Namespace; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.AccountId = all.AccountId - o.Namespace = all.Namespace + if all.Namespace != nil && !all.Namespace.IsValid() { + hasInvalidField = true + } else { + o.Namespace = all.Namespace + } o.TagFilterStr = all.TagFilterStr + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_tag_filter_delete_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_tag_filter_delete_request.go index 02af4a3fc..e94f508d4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_tag_filter_delete_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_tag_filter_delete_request.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o AWSTagFilterDeleteRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AWSTagFilterDeleteRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AccountId *string `json:"account_id,omitempty"` Namespace *AWSNamespace `json:"namespace,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,19 +128,22 @@ func (o *AWSTagFilterDeleteRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Namespace; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.AccountId = all.AccountId - o.Namespace = all.Namespace + if all.Namespace != nil && !all.Namespace.IsValid() { + hasInvalidField = true + } else { + o.Namespace = all.Namespace + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_tag_filter_list_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_tag_filter_list_response.go index c3de688be..fa1318ce2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_tag_filter_list_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_aws_tag_filter_list_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o AWSTagFilterListResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AWSTagFilterListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Filters []AWSTagFilter `json:"filters,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *AWSTagFilterListResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Filters = all.Filters + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_azure_account.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_azure_account.go index 8dc661f1f..b928036ef 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_azure_account.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_azure_account.go @@ -5,19 +5,26 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // AzureAccount Datadog-Azure integrations configured for your organization. type AzureAccount struct { + // Limit the Azure app service plans that are pulled into Datadog using tags. + // Only app service plans that match one of the defined tags are imported into Datadog. + AppServicePlanFilters *string `json:"app_service_plan_filters,omitempty"` // Silence monitors for expected Azure VM shutdowns. Automute *bool `json:"automute,omitempty"` // Your Azure web application ID. ClientId *string `json:"client_id,omitempty"` // Your Azure web application secret key. ClientSecret *string `json:"client_secret,omitempty"` + // Enable Cloud Security Management Misconfigurations for your organization. + CspmEnabled *bool `json:"cspm_enabled,omitempty"` + // Enable custom metrics for your organization. + CustomMetricsEnabled *bool `json:"custom_metrics_enabled,omitempty"` // Errors in your configuration. Errors []string `json:"errors,omitempty"` // Limit the Azure instances that are pulled into Datadog by using tags. @@ -51,6 +58,34 @@ func NewAzureAccountWithDefaults() *AzureAccount { return &this } +// GetAppServicePlanFilters returns the AppServicePlanFilters field value if set, zero value otherwise. +func (o *AzureAccount) GetAppServicePlanFilters() string { + if o == nil || o.AppServicePlanFilters == nil { + var ret string + return ret + } + return *o.AppServicePlanFilters +} + +// GetAppServicePlanFiltersOk returns a tuple with the AppServicePlanFilters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AzureAccount) GetAppServicePlanFiltersOk() (*string, bool) { + if o == nil || o.AppServicePlanFilters == nil { + return nil, false + } + return o.AppServicePlanFilters, true +} + +// HasAppServicePlanFilters returns a boolean if a field has been set. +func (o *AzureAccount) HasAppServicePlanFilters() bool { + return o != nil && o.AppServicePlanFilters != nil +} + +// SetAppServicePlanFilters gets a reference to the given string and assigns it to the AppServicePlanFilters field. +func (o *AzureAccount) SetAppServicePlanFilters(v string) { + o.AppServicePlanFilters = &v +} + // GetAutomute returns the Automute field value if set, zero value otherwise. func (o *AzureAccount) GetAutomute() bool { if o == nil || o.Automute == nil { @@ -135,6 +170,62 @@ func (o *AzureAccount) SetClientSecret(v string) { o.ClientSecret = &v } +// GetCspmEnabled returns the CspmEnabled field value if set, zero value otherwise. +func (o *AzureAccount) GetCspmEnabled() bool { + if o == nil || o.CspmEnabled == nil { + var ret bool + return ret + } + return *o.CspmEnabled +} + +// GetCspmEnabledOk returns a tuple with the CspmEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AzureAccount) GetCspmEnabledOk() (*bool, bool) { + if o == nil || o.CspmEnabled == nil { + return nil, false + } + return o.CspmEnabled, true +} + +// HasCspmEnabled returns a boolean if a field has been set. +func (o *AzureAccount) HasCspmEnabled() bool { + return o != nil && o.CspmEnabled != nil +} + +// SetCspmEnabled gets a reference to the given bool and assigns it to the CspmEnabled field. +func (o *AzureAccount) SetCspmEnabled(v bool) { + o.CspmEnabled = &v +} + +// GetCustomMetricsEnabled returns the CustomMetricsEnabled field value if set, zero value otherwise. +func (o *AzureAccount) GetCustomMetricsEnabled() bool { + if o == nil || o.CustomMetricsEnabled == nil { + var ret bool + return ret + } + return *o.CustomMetricsEnabled +} + +// GetCustomMetricsEnabledOk returns a tuple with the CustomMetricsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AzureAccount) GetCustomMetricsEnabledOk() (*bool, bool) { + if o == nil || o.CustomMetricsEnabled == nil { + return nil, false + } + return o.CustomMetricsEnabled, true +} + +// HasCustomMetricsEnabled returns a boolean if a field has been set. +func (o *AzureAccount) HasCustomMetricsEnabled() bool { + return o != nil && o.CustomMetricsEnabled != nil +} + +// SetCustomMetricsEnabled gets a reference to the given bool and assigns it to the CustomMetricsEnabled field. +func (o *AzureAccount) SetCustomMetricsEnabled(v bool) { + o.CustomMetricsEnabled = &v +} + // GetErrors returns the Errors field value if set, zero value otherwise. func (o *AzureAccount) GetErrors() []string { if o == nil || o.Errors == nil { @@ -281,6 +372,9 @@ func (o AzureAccount) MarshalJSON() ([]byte, error) { if o.UnparsedObject != nil { return json.Marshal(o.UnparsedObject) } + if o.AppServicePlanFilters != nil { + toSerialize["app_service_plan_filters"] = o.AppServicePlanFilters + } if o.Automute != nil { toSerialize["automute"] = o.Automute } @@ -290,6 +384,12 @@ func (o AzureAccount) MarshalJSON() ([]byte, error) { if o.ClientSecret != nil { toSerialize["client_secret"] = o.ClientSecret } + if o.CspmEnabled != nil { + toSerialize["cspm_enabled"] = o.CspmEnabled + } + if o.CustomMetricsEnabled != nil { + toSerialize["custom_metrics_enabled"] = o.CustomMetricsEnabled + } if o.Errors != nil { toSerialize["errors"] = o.Errors } @@ -314,39 +414,40 @@ func (o AzureAccount) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AzureAccount) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { - Automute *bool `json:"automute,omitempty"` - ClientId *string `json:"client_id,omitempty"` - ClientSecret *string `json:"client_secret,omitempty"` - Errors []string `json:"errors,omitempty"` - HostFilters *string `json:"host_filters,omitempty"` - NewClientId *string `json:"new_client_id,omitempty"` - NewTenantName *string `json:"new_tenant_name,omitempty"` - TenantName *string `json:"tenant_name,omitempty"` + AppServicePlanFilters *string `json:"app_service_plan_filters,omitempty"` + Automute *bool `json:"automute,omitempty"` + ClientId *string `json:"client_id,omitempty"` + ClientSecret *string `json:"client_secret,omitempty"` + CspmEnabled *bool `json:"cspm_enabled,omitempty"` + CustomMetricsEnabled *bool `json:"custom_metrics_enabled,omitempty"` + Errors []string `json:"errors,omitempty"` + HostFilters *string `json:"host_filters,omitempty"` + NewClientId *string `json:"new_client_id,omitempty"` + NewTenantName *string `json:"new_tenant_name,omitempty"` + TenantName *string `json:"tenant_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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"automute", "client_id", "client_secret", "errors", "host_filters", "new_client_id", "new_tenant_name", "tenant_name"}) + datadog.DeleteKeys(additionalProperties, &[]string{"app_service_plan_filters", "automute", "client_id", "client_secret", "cspm_enabled", "custom_metrics_enabled", "errors", "host_filters", "new_client_id", "new_tenant_name", "tenant_name"}) } else { return err } + o.AppServicePlanFilters = all.AppServicePlanFilters o.Automute = all.Automute o.ClientId = all.ClientId o.ClientSecret = all.ClientSecret + o.CspmEnabled = all.CspmEnabled + o.CustomMetricsEnabled = all.CustomMetricsEnabled o.Errors = all.Errors o.HostFilters = all.HostFilters o.NewClientId = all.NewClientId o.NewTenantName = all.NewTenantName o.TenantName = all.TenantName + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_cancel_downtimes_by_scope_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_cancel_downtimes_by_scope_request.go index 1249d7822..faa9728af 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_cancel_downtimes_by_scope_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_cancel_downtimes_by_scope_request.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -79,17 +80,11 @@ func (o CancelDowntimesByScopeRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CancelDowntimesByScopeRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Scope *string `json:"scope"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Scope == nil { return fmt.Errorf("required field scope missing") @@ -101,6 +96,7 @@ func (o *CancelDowntimesByScopeRequest) UnmarshalJSON(bytes []byte) (err error) return err } o.Scope = *all.Scope + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_canceled_downtimes_ids.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_canceled_downtimes_ids.go index dfeaf5385..bbd45b83f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_canceled_downtimes_ids.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_canceled_downtimes_ids.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o CanceledDowntimesIds) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CanceledDowntimesIds) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CancelledIds []int64 `json:"cancelled_ids,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *CanceledDowntimesIds) UnmarshalJSON(bytes []byte) (err error) { return err } o.CancelledIds = all.CancelledIds + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_change_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_change_widget_definition.go index d3282481b..698bf1c14 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_change_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_change_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -274,7 +275,6 @@ func (o ChangeWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ChangeWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` Requests *[]ChangeWidgetRequest `json:"requests"` @@ -285,12 +285,7 @@ func (o *ChangeWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { Type *ChangeWidgetDefinitionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Requests == nil { return fmt.Errorf("required field requests missing") @@ -304,39 +299,34 @@ func (o *ChangeWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.CustomLinks = all.CustomLinks o.Requests = *all.Requests if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Time = all.Time o.Title = all.Title - o.TitleAlign = all.TitleAlign + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } o.TitleSize = all.TitleSize - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_change_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_change_widget_definition_type.go index c84ec96bf..dd58c8b97 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_change_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_change_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ChangeWidgetDefinitionType Type of the change widget. @@ -61,47 +62,3 @@ func (v ChangeWidgetDefinitionType) IsValid() bool { func (v ChangeWidgetDefinitionType) Ptr() *ChangeWidgetDefinitionType { return &v } - -// NullableChangeWidgetDefinitionType handles when a null is used for ChangeWidgetDefinitionType. -type NullableChangeWidgetDefinitionType struct { - value *ChangeWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableChangeWidgetDefinitionType) Get() *ChangeWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableChangeWidgetDefinitionType) Set(val *ChangeWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableChangeWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableChangeWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableChangeWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableChangeWidgetDefinitionType(val *ChangeWidgetDefinitionType) *NullableChangeWidgetDefinitionType { - return &NullableChangeWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableChangeWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableChangeWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_change_widget_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_change_widget_request.go index 0bcb3ae23..293e6ec96 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_change_widget_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_change_widget_request.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -40,7 +40,7 @@ type ChangeWidgetRequest struct { Q *string `json:"q,omitempty"` // List of queries that can be returned directly or used in formulas. Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - // Timeseries or Scalar response. + // Timeseries, scalar, or event list response. Event list response formats are supported by Geomap widgets. ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` // The log query. RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` @@ -643,7 +643,6 @@ func (o ChangeWidgetRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ChangeWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` ChangeType *WidgetChangeType `json:"change_type,omitempty"` @@ -665,12 +664,7 @@ func (o *ChangeWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { ShowPresent *bool `json:"show_present,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -678,123 +672,78 @@ func (o *ChangeWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.ChangeType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.CompareTo; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.OrderBy; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.OrderDir; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ResponseFormat; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ApmQuery = all.ApmQuery - o.ChangeType = all.ChangeType - o.CompareTo = all.CompareTo + if all.ChangeType != nil && !all.ChangeType.IsValid() { + hasInvalidField = true + } else { + o.ChangeType = all.ChangeType + } + if all.CompareTo != nil && !all.CompareTo.IsValid() { + hasInvalidField = true + } else { + o.CompareTo = all.CompareTo + } if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.EventQuery = all.EventQuery o.Formulas = all.Formulas o.IncreaseGood = all.IncreaseGood if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LogQuery = all.LogQuery if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.NetworkQuery = all.NetworkQuery - o.OrderBy = all.OrderBy - o.OrderDir = all.OrderDir + if all.OrderBy != nil && !all.OrderBy.IsValid() { + hasInvalidField = true + } else { + o.OrderBy = all.OrderBy + } + if all.OrderDir != nil && !all.OrderDir.IsValid() { + hasInvalidField = true + } else { + o.OrderDir = all.OrderDir + } if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ProcessQuery = all.ProcessQuery if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ProfileMetricsQuery = all.ProfileMetricsQuery o.Q = all.Q o.Queries = all.Queries - o.ResponseFormat = all.ResponseFormat + if all.ResponseFormat != nil && !all.ResponseFormat.IsValid() { + hasInvalidField = true + } else { + o.ResponseFormat = all.ResponseFormat + } if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.RumQuery = all.RumQuery if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.SecurityQuery = all.SecurityQuery o.ShowPresent = all.ShowPresent + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_check_can_delete_monitor_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_check_can_delete_monitor_response.go index bf18db0d9..d4bc7e0d6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_check_can_delete_monitor_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_check_can_delete_monitor_response.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -111,18 +112,12 @@ func (o CheckCanDeleteMonitorResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CheckCanDeleteMonitorResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *CheckCanDeleteMonitorResponseData `json:"data"` Errors map[string][]string `json:"errors,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -133,18 +128,21 @@ func (o *CheckCanDeleteMonitorResponse) UnmarshalJSON(bytes []byte) (err error) } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data o.Errors = all.Errors + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_check_can_delete_monitor_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_check_can_delete_monitor_response_data.go index 9ce1a2d54..f0817461d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_check_can_delete_monitor_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_check_can_delete_monitor_response_data.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o CheckCanDeleteMonitorResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CheckCanDeleteMonitorResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Ok []int64 `json:"ok,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *CheckCanDeleteMonitorResponseData) UnmarshalJSON(bytes []byte) (err err return err } o.Ok = all.Ok + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_check_can_delete_slo_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_check_can_delete_slo_response.go index 192087b4b..d09964914 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_check_can_delete_slo_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_check_can_delete_slo_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o CheckCanDeleteSLOResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CheckCanDeleteSLOResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *CheckCanDeleteSLOResponseData `json:"data,omitempty"` Errors map[string]string `json:"errors,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *CheckCanDeleteSLOResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data o.Errors = all.Errors + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_check_can_delete_slo_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_check_can_delete_slo_response_data.go index 614c46f74..200f93f8a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_check_can_delete_slo_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_check_can_delete_slo_response_data.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o CheckCanDeleteSLOResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CheckCanDeleteSLOResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Ok []string `json:"ok,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *CheckCanDeleteSLOResponseData) UnmarshalJSON(bytes []byte) (err error) return err } o.Ok = all.Ok + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_check_status_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_check_status_widget_definition.go index 3d5d84e93..b8b6e92e3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_check_status_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_check_status_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -364,7 +365,6 @@ func (o CheckStatusWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CheckStatusWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Check *string `json:"check"` Group *string `json:"group,omitempty"` @@ -378,12 +378,7 @@ func (o *CheckStatusWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { Type *CheckStatusWidgetDefinitionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Check == nil { return fmt.Errorf("required field check missing") @@ -400,50 +395,41 @@ func (o *CheckStatusWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Grouping; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Check = *all.Check o.Group = all.Group o.GroupBy = all.GroupBy - o.Grouping = *all.Grouping + if !all.Grouping.IsValid() { + hasInvalidField = true + } else { + o.Grouping = *all.Grouping + } o.Tags = all.Tags if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Time = all.Time o.Title = all.Title - o.TitleAlign = all.TitleAlign + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } o.TitleSize = all.TitleSize - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_check_status_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_check_status_widget_definition_type.go index 17a77fb2c..e68747225 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_check_status_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_check_status_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // CheckStatusWidgetDefinitionType Type of the check status widget. @@ -61,47 +62,3 @@ func (v CheckStatusWidgetDefinitionType) IsValid() bool { func (v CheckStatusWidgetDefinitionType) Ptr() *CheckStatusWidgetDefinitionType { return &v } - -// NullableCheckStatusWidgetDefinitionType handles when a null is used for CheckStatusWidgetDefinitionType. -type NullableCheckStatusWidgetDefinitionType struct { - value *CheckStatusWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableCheckStatusWidgetDefinitionType) Get() *CheckStatusWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCheckStatusWidgetDefinitionType) Set(val *CheckStatusWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCheckStatusWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableCheckStatusWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCheckStatusWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableCheckStatusWidgetDefinitionType(val *CheckStatusWidgetDefinitionType) *NullableCheckStatusWidgetDefinitionType { - return &NullableCheckStatusWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCheckStatusWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCheckStatusWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_content_encoding.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_content_encoding.go index d40437a9b..452270769 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_content_encoding.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_content_encoding.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ContentEncoding HTTP header used to compress the media-type. @@ -63,47 +64,3 @@ func (v ContentEncoding) IsValid() bool { func (v ContentEncoding) Ptr() *ContentEncoding { return &v } - -// NullableContentEncoding handles when a null is used for ContentEncoding. -type NullableContentEncoding struct { - value *ContentEncoding - isSet bool -} - -// Get returns the associated value. -func (v NullableContentEncoding) Get() *ContentEncoding { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableContentEncoding) Set(val *ContentEncoding) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableContentEncoding) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableContentEncoding) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableContentEncoding initializes the struct as if Set has been called. -func NewNullableContentEncoding(val *ContentEncoding) *NullableContentEncoding { - return &NullableContentEncoding{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableContentEncoding) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableContentEncoding) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_creator.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_creator.go index 5a56ac2cc..306a33b86 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_creator.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_creator.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -159,19 +159,13 @@ func (o Creator) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Creator) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Email *string `json:"email,omitempty"` Handle *string `json:"handle,omitempty"` Name datadog.NullableString `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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -182,6 +176,7 @@ func (o *Creator) UnmarshalJSON(bytes []byte) (err error) { o.Email = all.Email o.Handle = all.Handle o.Name = all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard.go index a6c8f4811..47cdd2e8a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard.go @@ -5,10 +5,11 @@ package datadogV1 import ( - "encoding/json" "fmt" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -659,7 +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{}{} all := struct { AuthorHandle *string `json:"author_handle,omitempty"` AuthorName datadog.NullableString `json:"author_name,omitempty"` @@ -680,12 +680,7 @@ func (o *Dashboard) UnmarshalJSON(bytes []byte) (err error) { Widgets *[]Widget `json:"widgets"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.LayoutType == nil { return fmt.Errorf("required field layout_type missing") @@ -702,32 +697,26 @@ func (o *Dashboard) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.LayoutType; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ReflowType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.AuthorHandle = all.AuthorHandle o.AuthorName = all.AuthorName o.CreatedAt = all.CreatedAt o.Description = all.Description o.Id = all.Id o.IsReadOnly = all.IsReadOnly - o.LayoutType = *all.LayoutType + if !all.LayoutType.IsValid() { + hasInvalidField = true + } else { + o.LayoutType = *all.LayoutType + } o.ModifiedAt = all.ModifiedAt o.NotifyList = all.NotifyList - o.ReflowType = all.ReflowType + if all.ReflowType != nil && !all.ReflowType.IsValid() { + hasInvalidField = true + } else { + o.ReflowType = all.ReflowType + } o.RestrictedRoles = all.RestrictedRoles o.Tags = all.Tags o.TemplateVariablePresets = all.TemplateVariablePresets @@ -735,9 +724,14 @@ func (o *Dashboard) UnmarshalJSON(bytes []byte) (err error) { o.Title = *all.Title o.Url = all.Url o.Widgets = *all.Widgets + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_bulk_action_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_bulk_action_data.go index 8d7c06e7f..421c9ac8b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_bulk_action_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_bulk_action_data.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o DashboardBulkActionData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardBulkActionData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id"` Type *DashboardResourceType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -131,19 +126,22 @@ func (o *DashboardBulkActionData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_bulk_delete_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_bulk_delete_request.go index 45b9cd061..6eaaf3856 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_bulk_delete_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_bulk_delete_request.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o DashboardBulkDeleteRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardBulkDeleteRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *[]DashboardBulkActionData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -99,6 +94,7 @@ func (o *DashboardBulkDeleteRequest) UnmarshalJSON(bytes []byte) (err error) { return err } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_delete_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_delete_response.go index 88f7fd5c4..21deb6bca 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_delete_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_delete_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o DashboardDeleteResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardDeleteResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DeletedDashboardId *string `json:"deleted_dashboard_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *DashboardDeleteResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.DeletedDashboardId = all.DeletedDashboardId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_global_time.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_global_time.go index 298789797..a9a8ee60f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_global_time.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_global_time.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o DashboardGlobalTime) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardGlobalTime) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { LiveSpan *DashboardGlobalTimeLiveSpan `json:"live_span,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,18 +94,21 @@ func (o *DashboardGlobalTime) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.LiveSpan; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.LiveSpan != nil && !all.LiveSpan.IsValid() { + hasInvalidField = true + } else { + o.LiveSpan = all.LiveSpan } - o.LiveSpan = all.LiveSpan + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_global_time_live_span.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_global_time_live_span.go index 35c723294..a096128a6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_global_time_live_span.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_global_time_live_span.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // DashboardGlobalTimeLiveSpan Dashboard global time live_span selection @@ -75,47 +76,3 @@ func (v DashboardGlobalTimeLiveSpan) IsValid() bool { func (v DashboardGlobalTimeLiveSpan) Ptr() *DashboardGlobalTimeLiveSpan { return &v } - -// NullableDashboardGlobalTimeLiveSpan handles when a null is used for DashboardGlobalTimeLiveSpan. -type NullableDashboardGlobalTimeLiveSpan struct { - value *DashboardGlobalTimeLiveSpan - isSet bool -} - -// Get returns the associated value. -func (v NullableDashboardGlobalTimeLiveSpan) Get() *DashboardGlobalTimeLiveSpan { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableDashboardGlobalTimeLiveSpan) Set(val *DashboardGlobalTimeLiveSpan) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableDashboardGlobalTimeLiveSpan) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableDashboardGlobalTimeLiveSpan) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableDashboardGlobalTimeLiveSpan initializes the struct as if Set has been called. -func NewNullableDashboardGlobalTimeLiveSpan(val *DashboardGlobalTimeLiveSpan) *NullableDashboardGlobalTimeLiveSpan { - return &NullableDashboardGlobalTimeLiveSpan{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableDashboardGlobalTimeLiveSpan) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableDashboardGlobalTimeLiveSpan) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_invite_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_invite_type.go index 5eb371e32..dbec920f8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_invite_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_invite_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // DashboardInviteType Type for shared dashboard invitation request body. @@ -61,47 +62,3 @@ func (v DashboardInviteType) IsValid() bool { func (v DashboardInviteType) Ptr() *DashboardInviteType { return &v } - -// NullableDashboardInviteType handles when a null is used for DashboardInviteType. -type NullableDashboardInviteType struct { - value *DashboardInviteType - isSet bool -} - -// Get returns the associated value. -func (v NullableDashboardInviteType) Get() *DashboardInviteType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableDashboardInviteType) Set(val *DashboardInviteType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableDashboardInviteType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableDashboardInviteType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableDashboardInviteType initializes the struct as if Set has been called. -func NewNullableDashboardInviteType(val *DashboardInviteType) *NullableDashboardInviteType { - return &NullableDashboardInviteType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableDashboardInviteType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableDashboardInviteType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_layout_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_layout_type.go index 1b328a30e..3314d20eb 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_layout_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_layout_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // DashboardLayoutType Layout type of the dashboard. @@ -63,47 +64,3 @@ func (v DashboardLayoutType) IsValid() bool { func (v DashboardLayoutType) Ptr() *DashboardLayoutType { return &v } - -// NullableDashboardLayoutType handles when a null is used for DashboardLayoutType. -type NullableDashboardLayoutType struct { - value *DashboardLayoutType - isSet bool -} - -// Get returns the associated value. -func (v NullableDashboardLayoutType) Get() *DashboardLayoutType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableDashboardLayoutType) Set(val *DashboardLayoutType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableDashboardLayoutType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableDashboardLayoutType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableDashboardLayoutType initializes the struct as if Set has been called. -func NewNullableDashboardLayoutType(val *DashboardLayoutType) *NullableDashboardLayoutType { - return &NullableDashboardLayoutType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableDashboardLayoutType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableDashboardLayoutType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_list.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_list.go index a47795aff..a3f702858 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_list.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_list.go @@ -5,10 +5,11 @@ package datadogV1 import ( - "encoding/json" "fmt" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -317,7 +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{}{} all := struct { Author *Creator `json:"author,omitempty"` Created *time.Time `json:"created,omitempty"` @@ -329,12 +329,7 @@ func (o *DashboardList) UnmarshalJSON(bytes []byte) (err error) { Type *string `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -345,12 +340,10 @@ func (o *DashboardList) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Author != nil && all.Author.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Author = all.Author o.Created = all.Created @@ -360,9 +353,14 @@ func (o *DashboardList) UnmarshalJSON(bytes []byte) (err error) { o.Modified = all.Modified o.Name = *all.Name o.Type = all.Type + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_list_delete_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_list_delete_response.go index 5a6369074..51ee10d92 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_list_delete_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_list_delete_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o DashboardListDeleteResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardListDeleteResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DeletedDashboardListId *int64 `json:"deleted_dashboard_list_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *DashboardListDeleteResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.DeletedDashboardListId = all.DeletedDashboardListId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_list_list_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_list_list_response.go index 92673f883..7275f094f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_list_list_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_list_list_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o DashboardListListResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardListListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DashboardLists []DashboardList `json:"dashboard_lists,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *DashboardListListResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.DashboardLists = all.DashboardLists + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_reflow_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_reflow_type.go index 78e0d9e0d..2603be612 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_reflow_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_reflow_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // DashboardReflowType Reflow type for a **new dashboard layout** dashboard. Set this only when layout type is 'ordered'. @@ -65,47 +66,3 @@ func (v DashboardReflowType) IsValid() bool { func (v DashboardReflowType) Ptr() *DashboardReflowType { return &v } - -// NullableDashboardReflowType handles when a null is used for DashboardReflowType. -type NullableDashboardReflowType struct { - value *DashboardReflowType - isSet bool -} - -// Get returns the associated value. -func (v NullableDashboardReflowType) Get() *DashboardReflowType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableDashboardReflowType) Set(val *DashboardReflowType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableDashboardReflowType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableDashboardReflowType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableDashboardReflowType initializes the struct as if Set has been called. -func NewNullableDashboardReflowType(val *DashboardReflowType) *NullableDashboardReflowType { - return &NullableDashboardReflowType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableDashboardReflowType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableDashboardReflowType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_resource_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_resource_type.go index d8489100f..f602e2c9c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_resource_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_resource_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // DashboardResourceType Dashboard resource type. @@ -61,47 +62,3 @@ func (v DashboardResourceType) IsValid() bool { func (v DashboardResourceType) Ptr() *DashboardResourceType { return &v } - -// NullableDashboardResourceType handles when a null is used for DashboardResourceType. -type NullableDashboardResourceType struct { - value *DashboardResourceType - isSet bool -} - -// Get returns the associated value. -func (v NullableDashboardResourceType) Get() *DashboardResourceType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableDashboardResourceType) Set(val *DashboardResourceType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableDashboardResourceType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableDashboardResourceType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableDashboardResourceType initializes the struct as if Set has been called. -func NewNullableDashboardResourceType(val *DashboardResourceType) *NullableDashboardResourceType { - return &NullableDashboardResourceType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableDashboardResourceType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableDashboardResourceType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_restore_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_restore_request.go index f58c53bf3..3ac10187a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_restore_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_restore_request.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o DashboardRestoreRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardRestoreRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *[]DashboardBulkActionData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -99,6 +94,7 @@ func (o *DashboardRestoreRequest) UnmarshalJSON(bytes []byte) (err error) { return err } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_share_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_share_type.go index 9c318939c..ec0191b3f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_share_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_share_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // DashboardShareType Type of sharing access (either open to anyone who has the public URL or invite-only). diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_summary.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_summary.go index 1d8b4da11..841a302dc 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_summary.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_summary.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o DashboardSummary) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardSummary) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Dashboards []DashboardSummaryDefinition `json:"dashboards,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *DashboardSummary) UnmarshalJSON(bytes []byte) (err error) { return err } o.Dashboards = all.Dashboards + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_summary_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_summary_definition.go index d28f62b35..6b16f8d77 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_summary_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_summary_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -366,7 +367,6 @@ func (o DashboardSummaryDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardSummaryDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AuthorHandle *string `json:"author_handle,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` @@ -379,12 +379,7 @@ func (o *DashboardSummaryDefinition) UnmarshalJSON(bytes []byte) (err error) { Url *string `json:"url,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -392,26 +387,29 @@ func (o *DashboardSummaryDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.LayoutType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.AuthorHandle = all.AuthorHandle o.CreatedAt = all.CreatedAt o.Description = all.Description o.Id = all.Id o.IsReadOnly = all.IsReadOnly - o.LayoutType = all.LayoutType + if all.LayoutType != nil && !all.LayoutType.IsValid() { + hasInvalidField = true + } else { + o.LayoutType = all.LayoutType + } o.ModifiedAt = all.ModifiedAt o.Title = all.Title o.Url = all.Url + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_template_variable.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_template_variable.go index b07f267ac..e974f6a53 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_template_variable.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_template_variable.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -246,7 +247,6 @@ func (o DashboardTemplateVariable) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardTemplateVariable) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AvailableValues datadog.NullableList[string] `json:"available_values,omitempty"` Default datadog.NullableString `json:"default,omitempty"` @@ -255,12 +255,7 @@ func (o *DashboardTemplateVariable) UnmarshalJSON(bytes []byte) (err error) { Prefix datadog.NullableString `json:"prefix,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -276,6 +271,7 @@ func (o *DashboardTemplateVariable) UnmarshalJSON(bytes []byte) (err error) { o.Defaults = all.Defaults o.Name = *all.Name o.Prefix = all.Prefix + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_template_variable_preset.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_template_variable_preset.go index b7f281437..3364d1293 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_template_variable_preset.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_template_variable_preset.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o DashboardTemplateVariablePreset) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardTemplateVariablePreset) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Name *string `json:"name,omitempty"` TemplateVariables []DashboardTemplateVariablePresetValue `json:"template_variables,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *DashboardTemplateVariablePreset) UnmarshalJSON(bytes []byte) (err error } o.Name = all.Name o.TemplateVariables = all.TemplateVariables + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_template_variable_preset_value.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_template_variable_preset_value.go index 93334da46..78069df0a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_template_variable_preset_value.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_template_variable_preset_value.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o DashboardTemplateVariablePresetValue) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardTemplateVariablePresetValue) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Name *string `json:"name,omitempty"` Value *string `json:"value,omitempty"` Values []string `json:"values,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -175,6 +169,7 @@ func (o *DashboardTemplateVariablePresetValue) UnmarshalJSON(bytes []byte) (err o.Name = all.Name o.Value = all.Value o.Values = all.Values + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_type.go index b7a399337..ce8ff3587 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_dashboard_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // DashboardType The type of the associated private dashboard. @@ -63,47 +64,3 @@ func (v DashboardType) IsValid() bool { func (v DashboardType) Ptr() *DashboardType { return &v } - -// NullableDashboardType handles when a null is used for DashboardType. -type NullableDashboardType struct { - value *DashboardType - isSet bool -} - -// Get returns the associated value. -func (v NullableDashboardType) Get() *DashboardType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableDashboardType) Set(val *DashboardType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableDashboardType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableDashboardType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableDashboardType initializes the struct as if Set has been called. -func NewNullableDashboardType(val *DashboardType) *NullableDashboardType { - return &NullableDashboardType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableDashboardType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableDashboardType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_delete_shared_dashboard_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_delete_shared_dashboard_response.go index 79980c464..0b1929bde 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_delete_shared_dashboard_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_delete_shared_dashboard_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o DeleteSharedDashboardResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DeleteSharedDashboardResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DeletedPublicDashboardToken *string `json:"deleted_public_dashboard_token,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *DeleteSharedDashboardResponse) UnmarshalJSON(bytes []byte) (err error) return err } o.DeletedPublicDashboardToken = all.DeletedPublicDashboardToken + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_deleted_monitor.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_deleted_monitor.go index f43594a88..f259aa5e4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_deleted_monitor.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_deleted_monitor.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o DeletedMonitor) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DeletedMonitor) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DeletedMonitorId *int64 `json:"deleted_monitor_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *DeletedMonitor) UnmarshalJSON(bytes []byte) (err error) { return err } o.DeletedMonitorId = all.DeletedMonitorId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_point_item.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_point_item.go index 6e18e4d5c..6ffa4becc 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_point_item.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_point_item.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" ) // DistributionPointItem - List of distribution point. @@ -103,53 +103,3 @@ func (obj *DistributionPointItem) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableDistributionPointItem handles when a null is used for DistributionPointItem. -type NullableDistributionPointItem struct { - value *DistributionPointItem - isSet bool -} - -// Get returns the associated value. -func (v NullableDistributionPointItem) Get() *DistributionPointItem { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableDistributionPointItem) Set(val *DistributionPointItem) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableDistributionPointItem) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableDistributionPointItem) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableDistributionPointItem initializes the struct as if Set has been called. -func NewNullableDistributionPointItem(val *DistributionPointItem) *NullableDistributionPointItem { - return &NullableDistributionPointItem{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableDistributionPointItem) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableDistributionPointItem) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_points_content_encoding.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_points_content_encoding.go index 91f1b5684..b2ca6192d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_points_content_encoding.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_points_content_encoding.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // DistributionPointsContentEncoding HTTP header used to compress the media-type. @@ -61,47 +62,3 @@ func (v DistributionPointsContentEncoding) IsValid() bool { func (v DistributionPointsContentEncoding) Ptr() *DistributionPointsContentEncoding { return &v } - -// NullableDistributionPointsContentEncoding handles when a null is used for DistributionPointsContentEncoding. -type NullableDistributionPointsContentEncoding struct { - value *DistributionPointsContentEncoding - isSet bool -} - -// Get returns the associated value. -func (v NullableDistributionPointsContentEncoding) Get() *DistributionPointsContentEncoding { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableDistributionPointsContentEncoding) Set(val *DistributionPointsContentEncoding) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableDistributionPointsContentEncoding) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableDistributionPointsContentEncoding) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableDistributionPointsContentEncoding initializes the struct as if Set has been called. -func NewNullableDistributionPointsContentEncoding(val *DistributionPointsContentEncoding) *NullableDistributionPointsContentEncoding { - return &NullableDistributionPointsContentEncoding{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableDistributionPointsContentEncoding) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableDistributionPointsContentEncoding) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_points_payload.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_points_payload.go index 7aa963b5a..afb949e99 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_points_payload.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_points_payload.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o DistributionPointsPayload) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DistributionPointsPayload) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Series *[]DistributionPointsSeries `json:"series"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Series == nil { return fmt.Errorf("required field series missing") @@ -99,6 +94,7 @@ func (o *DistributionPointsPayload) UnmarshalJSON(bytes []byte) (err error) { return err } o.Series = *all.Series + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_points_series.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_points_series.go index ad617a600..c2860d42b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_points_series.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_points_series.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -207,7 +208,6 @@ func (o DistributionPointsSeries) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DistributionPointsSeries) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Host *string `json:"host,omitempty"` Metric *string `json:"metric"` @@ -216,12 +216,7 @@ func (o *DistributionPointsSeries) UnmarshalJSON(bytes []byte) (err error) { Type *DistributionPointsType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Metric == nil { return fmt.Errorf("required field metric missing") @@ -235,22 +230,25 @@ func (o *DistributionPointsSeries) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Host = all.Host o.Metric = *all.Metric o.Points = *all.Points o.Tags = all.Tags - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_points_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_points_type.go index a4a949ecb..8559d67bd 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_points_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_points_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // DistributionPointsType The type of the distribution point. @@ -61,47 +62,3 @@ func (v DistributionPointsType) IsValid() bool { func (v DistributionPointsType) Ptr() *DistributionPointsType { return &v } - -// NullableDistributionPointsType handles when a null is used for DistributionPointsType. -type NullableDistributionPointsType struct { - value *DistributionPointsType - isSet bool -} - -// Get returns the associated value. -func (v NullableDistributionPointsType) Get() *DistributionPointsType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableDistributionPointsType) Set(val *DistributionPointsType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableDistributionPointsType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableDistributionPointsType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableDistributionPointsType initializes the struct as if Set has been called. -func NewNullableDistributionPointsType(val *DistributionPointsType) *NullableDistributionPointsType { - return &NullableDistributionPointsType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableDistributionPointsType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableDistributionPointsType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_definition.go index f1642040f..86f4725b1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -15,6 +16,8 @@ import ( // aggregated across one or several tags, such as hosts. // Unlike the heat map, a distribution graph’s x-axis is quantity rather than time. type DistributionWidgetDefinition struct { + // A list of custom links. + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` // (Deprecated) The widget legend was replaced by a tooltip and sidebar. // Deprecated LegendSize *string `json:"legend_size,omitempty"` @@ -68,6 +71,34 @@ func NewDistributionWidgetDefinitionWithDefaults() *DistributionWidgetDefinition return &this } +// GetCustomLinks returns the CustomLinks field value if set, zero value otherwise. +func (o *DistributionWidgetDefinition) GetCustomLinks() []WidgetCustomLink { + if o == nil || o.CustomLinks == nil { + var ret []WidgetCustomLink + return ret + } + return o.CustomLinks +} + +// GetCustomLinksOk returns a tuple with the CustomLinks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetDefinition) GetCustomLinksOk() (*[]WidgetCustomLink, bool) { + if o == nil || o.CustomLinks == nil { + return nil, false + } + return &o.CustomLinks, true +} + +// HasCustomLinks returns a boolean if a field has been set. +func (o *DistributionWidgetDefinition) HasCustomLinks() bool { + return o != nil && o.CustomLinks != nil +} + +// SetCustomLinks gets a reference to the given []WidgetCustomLink and assigns it to the CustomLinks field. +func (o *DistributionWidgetDefinition) SetCustomLinks(v []WidgetCustomLink) { + o.CustomLinks = v +} + // GetLegendSize returns the LegendSize field value if set, zero value otherwise. // Deprecated func (o *DistributionWidgetDefinition) GetLegendSize() string { @@ -378,6 +409,9 @@ func (o DistributionWidgetDefinition) MarshalJSON() ([]byte, error) { if o.UnparsedObject != nil { return json.Marshal(o.UnparsedObject) } + if o.CustomLinks != nil { + toSerialize["custom_links"] = o.CustomLinks + } if o.LegendSize != nil { toSerialize["legend_size"] = o.LegendSize } @@ -416,27 +450,22 @@ func (o DistributionWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DistributionWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} 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"` + CustomLinks []WidgetCustomLink `json:"custom_links,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"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Requests == nil { return fmt.Errorf("required field requests missing") @@ -446,61 +475,49 @@ func (o *DistributionWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } 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"}) + datadog.DeleteKeys(additionalProperties, &[]string{"custom_links", "legend_size", "markers", "requests", "show_legend", "time", "title", "title_align", "title_size", "type", "xaxis", "yaxis"}) } else { return err } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false + o.CustomLinks = all.CustomLinks o.LegendSize = all.LegendSize o.Markers = all.Markers o.Requests = *all.Requests o.ShowLegend = all.ShowLegend if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Time = all.Time o.Title = all.Title - o.TitleAlign = all.TitleAlign + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } o.TitleSize = all.TitleSize - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } if all.Xaxis != nil && all.Xaxis.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Xaxis = all.Xaxis if all.Yaxis != nil && all.Yaxis.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Yaxis = all.Yaxis + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_definition_type.go index 42b7b0a52..13844dd66 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // DistributionWidgetDefinitionType Type of the distribution widget. @@ -61,47 +62,3 @@ func (v DistributionWidgetDefinitionType) IsValid() bool { func (v DistributionWidgetDefinitionType) Ptr() *DistributionWidgetDefinitionType { return &v } - -// NullableDistributionWidgetDefinitionType handles when a null is used for DistributionWidgetDefinitionType. -type NullableDistributionWidgetDefinitionType struct { - value *DistributionWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableDistributionWidgetDefinitionType) Get() *DistributionWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableDistributionWidgetDefinitionType) Set(val *DistributionWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableDistributionWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableDistributionWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableDistributionWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableDistributionWidgetDefinitionType(val *DistributionWidgetDefinitionType) *NullableDistributionWidgetDefinitionType { - return &NullableDistributionWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableDistributionWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableDistributionWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_histogram_request_query.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_histogram_request_query.go index 2d6d1e901..8af5b1d5a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_histogram_request_query.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_histogram_request_query.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" ) // DistributionWidgetHistogramRequestQuery - Query definition for Distribution Widget Histogram Request @@ -135,53 +135,3 @@ func (obj *DistributionWidgetHistogramRequestQuery) GetActualInstance() interfac // all schemas are nil return nil } - -// NullableDistributionWidgetHistogramRequestQuery handles when a null is used for DistributionWidgetHistogramRequestQuery. -type NullableDistributionWidgetHistogramRequestQuery struct { - value *DistributionWidgetHistogramRequestQuery - isSet bool -} - -// Get returns the associated value. -func (v NullableDistributionWidgetHistogramRequestQuery) Get() *DistributionWidgetHistogramRequestQuery { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableDistributionWidgetHistogramRequestQuery) Set(val *DistributionWidgetHistogramRequestQuery) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableDistributionWidgetHistogramRequestQuery) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableDistributionWidgetHistogramRequestQuery) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableDistributionWidgetHistogramRequestQuery initializes the struct as if Set has been called. -func NewNullableDistributionWidgetHistogramRequestQuery(val *DistributionWidgetHistogramRequestQuery) *NullableDistributionWidgetHistogramRequestQuery { - return &NullableDistributionWidgetHistogramRequestQuery{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableDistributionWidgetHistogramRequestQuery) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableDistributionWidgetHistogramRequestQuery) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_histogram_request_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_histogram_request_type.go index 171477068..9b392fb02 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_histogram_request_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_histogram_request_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // DistributionWidgetHistogramRequestType Request type for the histogram request. @@ -61,47 +62,3 @@ func (v DistributionWidgetHistogramRequestType) IsValid() bool { func (v DistributionWidgetHistogramRequestType) Ptr() *DistributionWidgetHistogramRequestType { return &v } - -// NullableDistributionWidgetHistogramRequestType handles when a null is used for DistributionWidgetHistogramRequestType. -type NullableDistributionWidgetHistogramRequestType struct { - value *DistributionWidgetHistogramRequestType - isSet bool -} - -// Get returns the associated value. -func (v NullableDistributionWidgetHistogramRequestType) Get() *DistributionWidgetHistogramRequestType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableDistributionWidgetHistogramRequestType) Set(val *DistributionWidgetHistogramRequestType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableDistributionWidgetHistogramRequestType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableDistributionWidgetHistogramRequestType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableDistributionWidgetHistogramRequestType initializes the struct as if Set has been called. -func NewNullableDistributionWidgetHistogramRequestType(val *DistributionWidgetHistogramRequestType) *NullableDistributionWidgetHistogramRequestType { - return &NullableDistributionWidgetHistogramRequestType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableDistributionWidgetHistogramRequestType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableDistributionWidgetHistogramRequestType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_request.go index 29d4d24ff..180fb365d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_request.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -478,7 +478,6 @@ func (o DistributionWidgetRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DistributionWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` ApmStatsQuery *ApmStatsQueryDefinition `json:"apm_stats_query,omitempty"` @@ -495,12 +494,7 @@ func (o *DistributionWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { Style *WidgetStyle `json:"style,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -508,100 +502,63 @@ func (o *DistributionWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.RequestType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ApmQuery = all.ApmQuery if all.ApmStatsQuery != nil && all.ApmStatsQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ApmStatsQuery = all.ApmStatsQuery if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.EventQuery = all.EventQuery if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LogQuery = all.LogQuery if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.NetworkQuery = all.NetworkQuery if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ProcessQuery = all.ProcessQuery if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ProfileMetricsQuery = all.ProfileMetricsQuery o.Q = all.Q o.Query = all.Query - o.RequestType = all.RequestType + if all.RequestType != nil && !all.RequestType.IsValid() { + hasInvalidField = true + } else { + o.RequestType = all.RequestType + } if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.RumQuery = all.RumQuery if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.SecurityQuery = all.SecurityQuery if all.Style != nil && all.Style.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Style = all.Style + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_x_axis.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_x_axis.go index acf106671..3efc45495 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_x_axis.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_x_axis.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -193,7 +193,6 @@ func (o DistributionWidgetXAxis) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DistributionWidgetXAxis) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IncludeZero *bool `json:"include_zero,omitempty"` Max *string `json:"max,omitempty"` @@ -201,12 +200,7 @@ func (o *DistributionWidgetXAxis) UnmarshalJSON(bytes []byte) (err error) { Scale *string `json:"scale,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -218,6 +212,7 @@ func (o *DistributionWidgetXAxis) UnmarshalJSON(bytes []byte) (err error) { o.Max = all.Max o.Min = all.Min o.Scale = all.Scale + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_y_axis.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_y_axis.go index d8a292c81..5a94fcff3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_y_axis.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_distribution_widget_y_axis.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -226,7 +226,6 @@ func (o DistributionWidgetYAxis) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DistributionWidgetYAxis) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IncludeZero *bool `json:"include_zero,omitempty"` Label *string `json:"label,omitempty"` @@ -235,12 +234,7 @@ func (o *DistributionWidgetYAxis) UnmarshalJSON(bytes []byte) (err error) { Scale *string `json:"scale,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -253,6 +247,7 @@ func (o *DistributionWidgetYAxis) UnmarshalJSON(bytes []byte) (err error) { o.Max = all.Max o.Min = all.Min o.Scale = all.Scale + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_downtime.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_downtime.go index 07ab51564..76ae07cdb 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_downtime.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_downtime.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -815,7 +815,6 @@ func (o Downtime) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Downtime) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Active *bool `json:"active,omitempty"` ActiveChild NullableDowntimeChild `json:"active_child,omitempty"` @@ -839,12 +838,7 @@ func (o *Downtime) UnmarshalJSON(bytes []byte) (err error) { UpdaterId datadog.NullableInt32 `json:"updater_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -872,6 +866,7 @@ func (o *Downtime) UnmarshalJSON(bytes []byte) (err error) { o.Start = all.Start o.Timezone = all.Timezone o.UpdaterId = all.UpdaterId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_downtime_child.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_downtime_child.go index be4810d3c..9982a259d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_downtime_child.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_downtime_child.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -768,7 +768,6 @@ func (o DowntimeChild) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DowntimeChild) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Active *bool `json:"active,omitempty"` Canceled datadog.NullableInt64 `json:"canceled,omitempty"` @@ -791,12 +790,7 @@ func (o *DowntimeChild) UnmarshalJSON(bytes []byte) (err error) { UpdaterId datadog.NullableInt32 `json:"updater_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -823,6 +817,7 @@ func (o *DowntimeChild) UnmarshalJSON(bytes []byte) (err error) { o.Start = all.Start o.Timezone = all.Timezone o.UpdaterId = all.UpdaterId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_downtime_recurrence.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_downtime_recurrence.go index 06b6dc1bb..ddd476166 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_downtime_recurrence.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_downtime_recurrence.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -289,7 +289,6 @@ func (o DowntimeRecurrence) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DowntimeRecurrence) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Period *int32 `json:"period,omitempty"` Rrule *string `json:"rrule,omitempty"` @@ -299,12 +298,7 @@ func (o *DowntimeRecurrence) UnmarshalJSON(bytes []byte) (err error) { WeekDays datadog.NullableList[string] `json:"week_days,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -318,6 +312,7 @@ func (o *DowntimeRecurrence) UnmarshalJSON(bytes []byte) (err error) { o.UntilDate = all.UntilDate o.UntilOccurrences = all.UntilOccurrences o.WeekDays = all.WeekDays + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event.go index 10bdc1896..6d26899b3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -497,7 +497,6 @@ func (o Event) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Event) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AlertType *EventAlertType `json:"alert_type,omitempty"` DateHappened *int64 `json:"date_happened,omitempty"` @@ -514,12 +513,7 @@ func (o *Event) UnmarshalJSON(bytes []byte) (err error) { Url *string `json:"url,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -527,38 +521,37 @@ func (o *Event) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.AlertType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Priority; v.Get() != nil && !v.Get().IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AlertType = all.AlertType + + hasInvalidField := false + if all.AlertType != nil && !all.AlertType.IsValid() { + hasInvalidField = true + } else { + o.AlertType = all.AlertType + } o.DateHappened = all.DateHappened o.DeviceName = all.DeviceName o.Host = all.Host o.Id = all.Id o.IdStr = all.IdStr o.Payload = all.Payload - o.Priority = all.Priority + if all.Priority.Get() != nil && !all.Priority.Get().IsValid() { + hasInvalidField = true + } else { + o.Priority = all.Priority + } o.SourceTypeName = all.SourceTypeName o.Tags = all.Tags o.Text = all.Text o.Title = all.Title o.Url = all.Url + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_alert_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_alert_type.go index 09ef816c8..d5fa9c61a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_alert_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_alert_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // EventAlertType If an alert event is enabled, set its type. @@ -75,47 +76,3 @@ func (v EventAlertType) IsValid() bool { func (v EventAlertType) Ptr() *EventAlertType { return &v } - -// NullableEventAlertType handles when a null is used for EventAlertType. -type NullableEventAlertType struct { - value *EventAlertType - isSet bool -} - -// Get returns the associated value. -func (v NullableEventAlertType) Get() *EventAlertType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableEventAlertType) Set(val *EventAlertType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableEventAlertType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableEventAlertType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableEventAlertType initializes the struct as if Set has been called. -func NewNullableEventAlertType(val *EventAlertType) *NullableEventAlertType { - return &NullableEventAlertType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableEventAlertType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableEventAlertType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_create_request.go index dcbd8edfa..b4f9616ef 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_create_request.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -420,7 +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{}{} all := struct { AggregationKey *string `json:"aggregation_key,omitempty"` AlertType *EventAlertType `json:"alert_type,omitempty"` @@ -435,12 +435,7 @@ func (o *EventCreateRequest) UnmarshalJSON(bytes []byte) (err error) { Title *string `json:"title"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Text == nil { return fmt.Errorf("required field text missing") @@ -454,36 +449,35 @@ func (o *EventCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.AlertType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Priority; v.Get() != nil && !v.Get().IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.AggregationKey = all.AggregationKey - o.AlertType = all.AlertType + if all.AlertType != nil && !all.AlertType.IsValid() { + hasInvalidField = true + } else { + o.AlertType = all.AlertType + } o.DateHappened = all.DateHappened o.DeviceName = all.DeviceName o.Host = all.Host - o.Priority = all.Priority + if all.Priority.Get() != nil && !all.Priority.Get().IsValid() { + hasInvalidField = true + } else { + o.Priority = all.Priority + } o.RelatedEventId = all.RelatedEventId o.SourceTypeName = all.SourceTypeName o.Tags = all.Tags o.Text = *all.Text o.Title = *all.Title + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_create_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_create_response.go index cdc1e8c36..cf3fd83da 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_create_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_create_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o EventCreateResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventCreateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Event *Event `json:"event,omitempty"` Status *string `json:"status,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *EventCreateResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Event != nil && all.Event.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Event = all.Event o.Status = all.Status + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_list_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_list_response.go index b553363b6..18c7c0c9b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_list_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_list_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o EventListResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Events []Event `json:"events,omitempty"` Status *string `json:"status,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *EventListResponse) UnmarshalJSON(bytes []byte) (err error) { } o.Events = all.Events o.Status = all.Status + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_priority.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_priority.go index ce3ec3ad1..01974d658 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_priority.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_priority.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // EventPriority The priority of the event. For example, `normal` or `low`. diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_query_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_query_definition.go index 002fe21cf..a1483243c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_query_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_query_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o EventQueryDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Search *string `json:"search"` TagsExecution *string `json:"tags_execution"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Search == nil { return fmt.Errorf("required field search missing") @@ -131,6 +126,7 @@ func (o *EventQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { } o.Search = *all.Search o.TagsExecution = *all.TagsExecution + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_response.go index 0a1752cc5..87e87f1cd 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o EventResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Event *Event `json:"event,omitempty"` Status *string `json:"status,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *EventResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Event != nil && all.Event.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Event = all.Event o.Status = all.Status + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_stream_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_stream_widget_definition.go index ecb2bc374..9b90e975c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_stream_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_stream_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -305,7 +306,6 @@ func (o EventStreamWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { EventSize *WidgetEventSize `json:"event_size,omitempty"` Query *string `json:"query"` @@ -317,12 +317,7 @@ func (o *EventStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { Type *EventStreamWidgetDefinitionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Query == nil { return fmt.Errorf("required field query missing") @@ -336,48 +331,39 @@ func (o *EventStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.EventSize; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.EventSize = all.EventSize + + hasInvalidField := false + if all.EventSize != nil && !all.EventSize.IsValid() { + hasInvalidField = true + } else { + o.EventSize = all.EventSize + } o.Query = *all.Query o.TagsExecution = all.TagsExecution if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Time = all.Time o.Title = all.Title - o.TitleAlign = all.TitleAlign + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } o.TitleSize = all.TitleSize - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_stream_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_stream_widget_definition_type.go index 62b492694..c30e3f2c9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_stream_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_stream_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // EventStreamWidgetDefinitionType Type of the event stream widget. @@ -61,47 +62,3 @@ func (v EventStreamWidgetDefinitionType) IsValid() bool { func (v EventStreamWidgetDefinitionType) Ptr() *EventStreamWidgetDefinitionType { return &v } - -// NullableEventStreamWidgetDefinitionType handles when a null is used for EventStreamWidgetDefinitionType. -type NullableEventStreamWidgetDefinitionType struct { - value *EventStreamWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableEventStreamWidgetDefinitionType) Get() *EventStreamWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableEventStreamWidgetDefinitionType) Set(val *EventStreamWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableEventStreamWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableEventStreamWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableEventStreamWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableEventStreamWidgetDefinitionType(val *EventStreamWidgetDefinitionType) *NullableEventStreamWidgetDefinitionType { - return &NullableEventStreamWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableEventStreamWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableEventStreamWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_timeline_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_timeline_widget_definition.go index dcbdd023f..9ef3470ca 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_timeline_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_timeline_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -271,7 +272,6 @@ func (o EventTimelineWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventTimelineWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Query *string `json:"query"` TagsExecution *string `json:"tags_execution,omitempty"` @@ -282,12 +282,7 @@ func (o *EventTimelineWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) Type *EventTimelineWidgetDefinitionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Query == nil { return fmt.Errorf("required field query missing") @@ -301,39 +296,34 @@ func (o *EventTimelineWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Query = *all.Query o.TagsExecution = all.TagsExecution if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Time = all.Time o.Title = all.Title - o.TitleAlign = all.TitleAlign + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } o.TitleSize = all.TitleSize - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_timeline_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_timeline_widget_definition_type.go index d54ad4846..bc349b307 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_timeline_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_event_timeline_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // EventTimelineWidgetDefinitionType Type of the event timeline widget. @@ -61,47 +62,3 @@ func (v EventTimelineWidgetDefinitionType) IsValid() bool { func (v EventTimelineWidgetDefinitionType) Ptr() *EventTimelineWidgetDefinitionType { return &v } - -// NullableEventTimelineWidgetDefinitionType handles when a null is used for EventTimelineWidgetDefinitionType. -type NullableEventTimelineWidgetDefinitionType struct { - value *EventTimelineWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableEventTimelineWidgetDefinitionType) Get() *EventTimelineWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableEventTimelineWidgetDefinitionType) Set(val *EventTimelineWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableEventTimelineWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableEventTimelineWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableEventTimelineWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableEventTimelineWidgetDefinitionType(val *EventTimelineWidgetDefinitionType) *NullableEventTimelineWidgetDefinitionType { - return &NullableEventTimelineWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableEventTimelineWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableEventTimelineWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_apm_dependency_stat_name.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_apm_dependency_stat_name.go index 597f0d557..79657c5fb 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_apm_dependency_stat_name.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_apm_dependency_stat_name.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // FormulaAndFunctionApmDependencyStatName APM statistic. @@ -73,47 +74,3 @@ func (v FormulaAndFunctionApmDependencyStatName) IsValid() bool { func (v FormulaAndFunctionApmDependencyStatName) Ptr() *FormulaAndFunctionApmDependencyStatName { return &v } - -// NullableFormulaAndFunctionApmDependencyStatName handles when a null is used for FormulaAndFunctionApmDependencyStatName. -type NullableFormulaAndFunctionApmDependencyStatName struct { - value *FormulaAndFunctionApmDependencyStatName - isSet bool -} - -// Get returns the associated value. -func (v NullableFormulaAndFunctionApmDependencyStatName) Get() *FormulaAndFunctionApmDependencyStatName { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFormulaAndFunctionApmDependencyStatName) Set(val *FormulaAndFunctionApmDependencyStatName) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFormulaAndFunctionApmDependencyStatName) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFormulaAndFunctionApmDependencyStatName) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFormulaAndFunctionApmDependencyStatName initializes the struct as if Set has been called. -func NewNullableFormulaAndFunctionApmDependencyStatName(val *FormulaAndFunctionApmDependencyStatName) *NullableFormulaAndFunctionApmDependencyStatName { - return &NullableFormulaAndFunctionApmDependencyStatName{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFormulaAndFunctionApmDependencyStatName) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFormulaAndFunctionApmDependencyStatName) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_apm_dependency_stats_data_source.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_apm_dependency_stats_data_source.go index 123581ea0..65098349d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_apm_dependency_stats_data_source.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_apm_dependency_stats_data_source.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // FormulaAndFunctionApmDependencyStatsDataSource Data source for APM dependency stats queries. @@ -61,47 +62,3 @@ func (v FormulaAndFunctionApmDependencyStatsDataSource) IsValid() bool { func (v FormulaAndFunctionApmDependencyStatsDataSource) Ptr() *FormulaAndFunctionApmDependencyStatsDataSource { return &v } - -// NullableFormulaAndFunctionApmDependencyStatsDataSource handles when a null is used for FormulaAndFunctionApmDependencyStatsDataSource. -type NullableFormulaAndFunctionApmDependencyStatsDataSource struct { - value *FormulaAndFunctionApmDependencyStatsDataSource - isSet bool -} - -// Get returns the associated value. -func (v NullableFormulaAndFunctionApmDependencyStatsDataSource) Get() *FormulaAndFunctionApmDependencyStatsDataSource { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFormulaAndFunctionApmDependencyStatsDataSource) Set(val *FormulaAndFunctionApmDependencyStatsDataSource) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFormulaAndFunctionApmDependencyStatsDataSource) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFormulaAndFunctionApmDependencyStatsDataSource) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFormulaAndFunctionApmDependencyStatsDataSource initializes the struct as if Set has been called. -func NewNullableFormulaAndFunctionApmDependencyStatsDataSource(val *FormulaAndFunctionApmDependencyStatsDataSource) *NullableFormulaAndFunctionApmDependencyStatsDataSource { - return &NullableFormulaAndFunctionApmDependencyStatsDataSource{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFormulaAndFunctionApmDependencyStatsDataSource) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFormulaAndFunctionApmDependencyStatsDataSource) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_apm_dependency_stats_query_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_apm_dependency_stats_query_definition.go index 0dd445db2..0544e4f48 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_apm_dependency_stats_query_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_apm_dependency_stats_query_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -338,7 +339,6 @@ func (o FormulaAndFunctionApmDependencyStatsQueryDefinition) MarshalJSON() ([]by // UnmarshalJSON deserializes the given payload. func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DataSource *FormulaAndFunctionApmDependencyStatsDataSource `json:"data_source"` Env *string `json:"env"` @@ -352,12 +352,7 @@ func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) UnmarshalJSON(byte Stat *FormulaAndFunctionApmDependencyStatName `json:"stat"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.DataSource == nil { return fmt.Errorf("required field data_source missing") @@ -386,23 +381,13 @@ func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) UnmarshalJSON(byte } else { return err } - if v := all.DataSource; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Stat; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.DataSource = *all.DataSource + + hasInvalidField := false + if !all.DataSource.IsValid() { + hasInvalidField = true + } else { + o.DataSource = *all.DataSource + } o.Env = *all.Env o.IsUpstream = all.IsUpstream o.Name = *all.Name @@ -411,10 +396,19 @@ func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) UnmarshalJSON(byte o.PrimaryTagValue = all.PrimaryTagValue o.ResourceName = *all.ResourceName o.Service = *all.Service - o.Stat = *all.Stat + if !all.Stat.IsValid() { + hasInvalidField = true + } else { + o.Stat = *all.Stat + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_apm_resource_stat_name.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_apm_resource_stat_name.go index 104869296..956ef6362 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_apm_resource_stat_name.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_apm_resource_stat_name.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // FormulaAndFunctionApmResourceStatName APM resource stat name. @@ -81,47 +82,3 @@ func (v FormulaAndFunctionApmResourceStatName) IsValid() bool { func (v FormulaAndFunctionApmResourceStatName) Ptr() *FormulaAndFunctionApmResourceStatName { return &v } - -// NullableFormulaAndFunctionApmResourceStatName handles when a null is used for FormulaAndFunctionApmResourceStatName. -type NullableFormulaAndFunctionApmResourceStatName struct { - value *FormulaAndFunctionApmResourceStatName - isSet bool -} - -// Get returns the associated value. -func (v NullableFormulaAndFunctionApmResourceStatName) Get() *FormulaAndFunctionApmResourceStatName { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFormulaAndFunctionApmResourceStatName) Set(val *FormulaAndFunctionApmResourceStatName) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFormulaAndFunctionApmResourceStatName) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFormulaAndFunctionApmResourceStatName) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFormulaAndFunctionApmResourceStatName initializes the struct as if Set has been called. -func NewNullableFormulaAndFunctionApmResourceStatName(val *FormulaAndFunctionApmResourceStatName) *NullableFormulaAndFunctionApmResourceStatName { - return &NullableFormulaAndFunctionApmResourceStatName{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFormulaAndFunctionApmResourceStatName) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFormulaAndFunctionApmResourceStatName) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_apm_resource_stats_data_source.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_apm_resource_stats_data_source.go index 7c8408537..641b5fd13 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_apm_resource_stats_data_source.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_apm_resource_stats_data_source.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // FormulaAndFunctionApmResourceStatsDataSource Data source for APM resource stats queries. @@ -61,47 +62,3 @@ func (v FormulaAndFunctionApmResourceStatsDataSource) IsValid() bool { func (v FormulaAndFunctionApmResourceStatsDataSource) Ptr() *FormulaAndFunctionApmResourceStatsDataSource { return &v } - -// NullableFormulaAndFunctionApmResourceStatsDataSource handles when a null is used for FormulaAndFunctionApmResourceStatsDataSource. -type NullableFormulaAndFunctionApmResourceStatsDataSource struct { - value *FormulaAndFunctionApmResourceStatsDataSource - isSet bool -} - -// Get returns the associated value. -func (v NullableFormulaAndFunctionApmResourceStatsDataSource) Get() *FormulaAndFunctionApmResourceStatsDataSource { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFormulaAndFunctionApmResourceStatsDataSource) Set(val *FormulaAndFunctionApmResourceStatsDataSource) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFormulaAndFunctionApmResourceStatsDataSource) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFormulaAndFunctionApmResourceStatsDataSource) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFormulaAndFunctionApmResourceStatsDataSource initializes the struct as if Set has been called. -func NewNullableFormulaAndFunctionApmResourceStatsDataSource(val *FormulaAndFunctionApmResourceStatsDataSource) *NullableFormulaAndFunctionApmResourceStatsDataSource { - return &NullableFormulaAndFunctionApmResourceStatsDataSource{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFormulaAndFunctionApmResourceStatsDataSource) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFormulaAndFunctionApmResourceStatsDataSource) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_apm_resource_stats_query_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_apm_resource_stats_query_definition.go index f077598e7..b6b677ed3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_apm_resource_stats_query_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_apm_resource_stats_query_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -350,7 +351,6 @@ func (o FormulaAndFunctionApmResourceStatsQueryDefinition) MarshalJSON() ([]byte // UnmarshalJSON deserializes the given payload. func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DataSource *FormulaAndFunctionApmResourceStatsDataSource `json:"data_source"` Env *string `json:"env"` @@ -364,12 +364,7 @@ func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) UnmarshalJSON(bytes Stat *FormulaAndFunctionApmResourceStatName `json:"stat"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.DataSource == nil { return fmt.Errorf("required field data_source missing") @@ -392,23 +387,13 @@ func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) UnmarshalJSON(bytes } else { return err } - if v := all.DataSource; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Stat; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.DataSource = *all.DataSource + + hasInvalidField := false + if !all.DataSource.IsValid() { + hasInvalidField = true + } else { + o.DataSource = *all.DataSource + } o.Env = *all.Env o.GroupBy = all.GroupBy o.Name = *all.Name @@ -417,10 +402,19 @@ func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) UnmarshalJSON(bytes o.PrimaryTagValue = all.PrimaryTagValue o.ResourceName = all.ResourceName o.Service = *all.Service - o.Stat = *all.Stat + if !all.Stat.IsValid() { + hasInvalidField = true + } else { + o.Stat = *all.Stat + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_cloud_cost_data_source.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_cloud_cost_data_source.go new file mode 100644 index 000000000..ee2c3a990 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_cloud_cost_data_source.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV1 + +import ( + "fmt" + + "github.com/goccy/go-json" +) + +// FormulaAndFunctionCloudCostDataSource Data source for Cloud Cost queries. +type FormulaAndFunctionCloudCostDataSource string + +// List of FormulaAndFunctionCloudCostDataSource. +const ( + FORMULAANDFUNCTIONCLOUDCOSTDATASOURCE_CLOUD_COST FormulaAndFunctionCloudCostDataSource = "cloud_cost" +) + +var allowedFormulaAndFunctionCloudCostDataSourceEnumValues = []FormulaAndFunctionCloudCostDataSource{ + FORMULAANDFUNCTIONCLOUDCOSTDATASOURCE_CLOUD_COST, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *FormulaAndFunctionCloudCostDataSource) GetAllowedValues() []FormulaAndFunctionCloudCostDataSource { + return allowedFormulaAndFunctionCloudCostDataSourceEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *FormulaAndFunctionCloudCostDataSource) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = FormulaAndFunctionCloudCostDataSource(value) + return nil +} + +// NewFormulaAndFunctionCloudCostDataSourceFromValue returns a pointer to a valid FormulaAndFunctionCloudCostDataSource +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewFormulaAndFunctionCloudCostDataSourceFromValue(v string) (*FormulaAndFunctionCloudCostDataSource, error) { + ev := FormulaAndFunctionCloudCostDataSource(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for FormulaAndFunctionCloudCostDataSource: valid values are %v", v, allowedFormulaAndFunctionCloudCostDataSourceEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v FormulaAndFunctionCloudCostDataSource) IsValid() bool { + for _, existing := range allowedFormulaAndFunctionCloudCostDataSourceEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FormulaAndFunctionCloudCostDataSource value. +func (v FormulaAndFunctionCloudCostDataSource) Ptr() *FormulaAndFunctionCloudCostDataSource { + return &v +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_cloud_cost_query_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_cloud_cost_query_definition.go new file mode 100644 index 000000000..94cc00f50 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_cloud_cost_query_definition.go @@ -0,0 +1,216 @@ +// Unless explicitly stated otherwise all files in this repository 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 datadogV1 + +import ( + "fmt" + + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FormulaAndFunctionCloudCostQueryDefinition A formula and functions Cloud Cost query. +type FormulaAndFunctionCloudCostQueryDefinition struct { + // Aggregator used for the request. + Aggregator *WidgetAggregator `json:"aggregator,omitempty"` + // Data source for Cloud Cost queries. + DataSource FormulaAndFunctionCloudCostDataSource `json:"data_source"` + // Name of the query for use in formulas. + Name string `json:"name"` + // Query for Cloud Cost data. + Query string `json:"query"` + // 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{} +} + +// NewFormulaAndFunctionCloudCostQueryDefinition instantiates a new FormulaAndFunctionCloudCostQueryDefinition 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 NewFormulaAndFunctionCloudCostQueryDefinition(dataSource FormulaAndFunctionCloudCostDataSource, name string, query string) *FormulaAndFunctionCloudCostQueryDefinition { + this := FormulaAndFunctionCloudCostQueryDefinition{} + this.DataSource = dataSource + this.Name = name + this.Query = query + return &this +} + +// NewFormulaAndFunctionCloudCostQueryDefinitionWithDefaults instantiates a new FormulaAndFunctionCloudCostQueryDefinition 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 NewFormulaAndFunctionCloudCostQueryDefinitionWithDefaults() *FormulaAndFunctionCloudCostQueryDefinition { + this := FormulaAndFunctionCloudCostQueryDefinition{} + return &this +} + +// GetAggregator returns the Aggregator field value if set, zero value otherwise. +func (o *FormulaAndFunctionCloudCostQueryDefinition) GetAggregator() WidgetAggregator { + if o == nil || o.Aggregator == nil { + var ret WidgetAggregator + return ret + } + return *o.Aggregator +} + +// GetAggregatorOk returns a tuple with the Aggregator field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionCloudCostQueryDefinition) GetAggregatorOk() (*WidgetAggregator, bool) { + if o == nil || o.Aggregator == nil { + return nil, false + } + return o.Aggregator, true +} + +// HasAggregator returns a boolean if a field has been set. +func (o *FormulaAndFunctionCloudCostQueryDefinition) HasAggregator() bool { + return o != nil && o.Aggregator != nil +} + +// SetAggregator gets a reference to the given WidgetAggregator and assigns it to the Aggregator field. +func (o *FormulaAndFunctionCloudCostQueryDefinition) SetAggregator(v WidgetAggregator) { + o.Aggregator = &v +} + +// GetDataSource returns the DataSource field value. +func (o *FormulaAndFunctionCloudCostQueryDefinition) GetDataSource() FormulaAndFunctionCloudCostDataSource { + if o == nil { + var ret FormulaAndFunctionCloudCostDataSource + return ret + } + return o.DataSource +} + +// GetDataSourceOk returns a tuple with the DataSource field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionCloudCostQueryDefinition) GetDataSourceOk() (*FormulaAndFunctionCloudCostDataSource, bool) { + if o == nil { + return nil, false + } + return &o.DataSource, true +} + +// SetDataSource sets field value. +func (o *FormulaAndFunctionCloudCostQueryDefinition) SetDataSource(v FormulaAndFunctionCloudCostDataSource) { + o.DataSource = v +} + +// GetName returns the Name field value. +func (o *FormulaAndFunctionCloudCostQueryDefinition) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionCloudCostQueryDefinition) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *FormulaAndFunctionCloudCostQueryDefinition) SetName(v string) { + o.Name = v +} + +// GetQuery returns the Query field value. +func (o *FormulaAndFunctionCloudCostQueryDefinition) GetQuery() string { + if o == nil { + var ret string + return ret + } + return o.Query +} + +// GetQueryOk returns a tuple with the Query field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionCloudCostQueryDefinition) GetQueryOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Query, true +} + +// SetQuery sets field value. +func (o *FormulaAndFunctionCloudCostQueryDefinition) SetQuery(v string) { + o.Query = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FormulaAndFunctionCloudCostQueryDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Aggregator != nil { + toSerialize["aggregator"] = o.Aggregator + } + toSerialize["data_source"] = o.DataSource + toSerialize["name"] = o.Name + toSerialize["query"] = o.Query + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FormulaAndFunctionCloudCostQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Aggregator *WidgetAggregator `json:"aggregator,omitempty"` + DataSource *FormulaAndFunctionCloudCostDataSource `json:"data_source"` + Name *string `json:"name"` + Query *string `json:"query"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + 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"}) + } else { + return err + } + + hasInvalidField := false + if all.Aggregator != nil && !all.Aggregator.IsValid() { + hasInvalidField = true + } else { + o.Aggregator = all.Aggregator + } + if !all.DataSource.IsValid() { + hasInvalidField = true + } else { + o.DataSource = *all.DataSource + } + o.Name = *all.Name + o.Query = *all.Query + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_event_aggregation.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_event_aggregation.go index 2791e44ad..8c95c9857 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_event_aggregation.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_event_aggregation.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // FormulaAndFunctionEventAggregation Aggregation methods for event platform queries. @@ -83,47 +84,3 @@ func (v FormulaAndFunctionEventAggregation) IsValid() bool { func (v FormulaAndFunctionEventAggregation) Ptr() *FormulaAndFunctionEventAggregation { return &v } - -// NullableFormulaAndFunctionEventAggregation handles when a null is used for FormulaAndFunctionEventAggregation. -type NullableFormulaAndFunctionEventAggregation struct { - value *FormulaAndFunctionEventAggregation - isSet bool -} - -// Get returns the associated value. -func (v NullableFormulaAndFunctionEventAggregation) Get() *FormulaAndFunctionEventAggregation { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFormulaAndFunctionEventAggregation) Set(val *FormulaAndFunctionEventAggregation) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFormulaAndFunctionEventAggregation) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFormulaAndFunctionEventAggregation) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFormulaAndFunctionEventAggregation initializes the struct as if Set has been called. -func NewNullableFormulaAndFunctionEventAggregation(val *FormulaAndFunctionEventAggregation) *NullableFormulaAndFunctionEventAggregation { - return &NullableFormulaAndFunctionEventAggregation{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFormulaAndFunctionEventAggregation) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFormulaAndFunctionEventAggregation) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_event_query_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_event_query_definition.go index bd55db58b..b6af82fe2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_event_query_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_event_query_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -263,7 +264,6 @@ func (o FormulaAndFunctionEventQueryDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FormulaAndFunctionEventQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Compute *FormulaAndFunctionEventQueryDefinitionCompute `json:"compute"` DataSource *FormulaAndFunctionEventsDataSource `json:"data_source"` @@ -274,12 +274,7 @@ func (o *FormulaAndFunctionEventQueryDefinition) UnmarshalJSON(bytes []byte) (er Storage *string `json:"storage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Compute == nil { return fmt.Errorf("required field compute missing") @@ -296,38 +291,33 @@ func (o *FormulaAndFunctionEventQueryDefinition) UnmarshalJSON(bytes []byte) (er } else { return err } - if v := all.DataSource; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Compute.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Compute = *all.Compute - o.DataSource = *all.DataSource + if !all.DataSource.IsValid() { + hasInvalidField = true + } else { + o.DataSource = *all.DataSource + } o.GroupBy = all.GroupBy o.Indexes = all.Indexes o.Name = *all.Name if all.Search != nil && all.Search.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Search = all.Search o.Storage = all.Storage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_event_query_definition_compute.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_event_query_definition_compute.go index 2d20734d7..df6740152 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_event_query_definition_compute.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_event_query_definition_compute.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -143,19 +144,13 @@ func (o FormulaAndFunctionEventQueryDefinitionCompute) MarshalJSON() ([]byte, er // UnmarshalJSON deserializes the given payload. func (o *FormulaAndFunctionEventQueryDefinitionCompute) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregation *FormulaAndFunctionEventAggregation `json:"aggregation"` Interval *int64 `json:"interval,omitempty"` Metric *string `json:"metric,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Aggregation == nil { return fmt.Errorf("required field aggregation missing") @@ -166,20 +161,23 @@ func (o *FormulaAndFunctionEventQueryDefinitionCompute) UnmarshalJSON(bytes []by } else { return err } - if v := all.Aggregation; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if !all.Aggregation.IsValid() { + hasInvalidField = true + } else { + o.Aggregation = *all.Aggregation } - o.Aggregation = *all.Aggregation o.Interval = all.Interval o.Metric = all.Metric + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_event_query_definition_search.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_event_query_definition_search.go index bc751d4ac..a8fa5b88b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_event_query_definition_search.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_event_query_definition_search.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o FormulaAndFunctionEventQueryDefinitionSearch) MarshalJSON() ([]byte, err // UnmarshalJSON deserializes the given payload. func (o *FormulaAndFunctionEventQueryDefinitionSearch) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Query *string `json:"query"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Query == nil { return fmt.Errorf("required field query missing") @@ -99,6 +94,7 @@ func (o *FormulaAndFunctionEventQueryDefinitionSearch) UnmarshalJSON(bytes []byt return err } o.Query = *all.Query + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_event_query_group_by.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_event_query_group_by.go index 014fced64..111dcfe8a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_event_query_group_by.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_event_query_group_by.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -143,19 +144,13 @@ func (o FormulaAndFunctionEventQueryGroupBy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FormulaAndFunctionEventQueryGroupBy) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Facet *string `json:"facet"` Limit *int64 `json:"limit,omitempty"` Sort *FormulaAndFunctionEventQueryGroupBySort `json:"sort,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Facet == nil { return fmt.Errorf("required field facet missing") @@ -166,19 +161,22 @@ func (o *FormulaAndFunctionEventQueryGroupBy) UnmarshalJSON(bytes []byte) (err e } else { return err } + + hasInvalidField := false o.Facet = *all.Facet o.Limit = all.Limit if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Sort = all.Sort + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_event_query_group_by_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_event_query_group_by_sort.go index 3c5e3a141..561c50e16 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_event_query_group_by_sort.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_event_query_group_by_sort.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -147,19 +148,13 @@ func (o FormulaAndFunctionEventQueryGroupBySort) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FormulaAndFunctionEventQueryGroupBySort) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregation *FormulaAndFunctionEventAggregation `json:"aggregation"` Metric *string `json:"metric,omitempty"` Order *QuerySortOrder `json:"order,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Aggregation == nil { return fmt.Errorf("required field aggregation missing") @@ -170,28 +165,27 @@ func (o *FormulaAndFunctionEventQueryGroupBySort) UnmarshalJSON(bytes []byte) (e } else { return err } - if v := all.Aggregation; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Order; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregation = *all.Aggregation + + hasInvalidField := false + if !all.Aggregation.IsValid() { + hasInvalidField = true + } else { + o.Aggregation = *all.Aggregation + } o.Metric = all.Metric - o.Order = all.Order + if all.Order != nil && !all.Order.IsValid() { + hasInvalidField = true + } else { + o.Order = all.Order + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_events_data_source.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_events_data_source.go index f19df3524..a5910d926 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_events_data_source.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_events_data_source.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // FormulaAndFunctionEventsDataSource Data source for event platform-based queries. @@ -79,47 +80,3 @@ func (v FormulaAndFunctionEventsDataSource) IsValid() bool { func (v FormulaAndFunctionEventsDataSource) Ptr() *FormulaAndFunctionEventsDataSource { return &v } - -// NullableFormulaAndFunctionEventsDataSource handles when a null is used for FormulaAndFunctionEventsDataSource. -type NullableFormulaAndFunctionEventsDataSource struct { - value *FormulaAndFunctionEventsDataSource - isSet bool -} - -// Get returns the associated value. -func (v NullableFormulaAndFunctionEventsDataSource) Get() *FormulaAndFunctionEventsDataSource { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFormulaAndFunctionEventsDataSource) Set(val *FormulaAndFunctionEventsDataSource) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFormulaAndFunctionEventsDataSource) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFormulaAndFunctionEventsDataSource) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFormulaAndFunctionEventsDataSource initializes the struct as if Set has been called. -func NewNullableFormulaAndFunctionEventsDataSource(val *FormulaAndFunctionEventsDataSource) *NullableFormulaAndFunctionEventsDataSource { - return &NullableFormulaAndFunctionEventsDataSource{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFormulaAndFunctionEventsDataSource) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFormulaAndFunctionEventsDataSource) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_metric_aggregation.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_metric_aggregation.go index 971820783..3e12439c9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_metric_aggregation.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_metric_aggregation.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // FormulaAndFunctionMetricAggregation The aggregation methods available for metrics queries. @@ -75,47 +76,3 @@ func (v FormulaAndFunctionMetricAggregation) IsValid() bool { func (v FormulaAndFunctionMetricAggregation) Ptr() *FormulaAndFunctionMetricAggregation { return &v } - -// NullableFormulaAndFunctionMetricAggregation handles when a null is used for FormulaAndFunctionMetricAggregation. -type NullableFormulaAndFunctionMetricAggregation struct { - value *FormulaAndFunctionMetricAggregation - isSet bool -} - -// Get returns the associated value. -func (v NullableFormulaAndFunctionMetricAggregation) Get() *FormulaAndFunctionMetricAggregation { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFormulaAndFunctionMetricAggregation) Set(val *FormulaAndFunctionMetricAggregation) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFormulaAndFunctionMetricAggregation) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFormulaAndFunctionMetricAggregation) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFormulaAndFunctionMetricAggregation initializes the struct as if Set has been called. -func NewNullableFormulaAndFunctionMetricAggregation(val *FormulaAndFunctionMetricAggregation) *NullableFormulaAndFunctionMetricAggregation { - return &NullableFormulaAndFunctionMetricAggregation{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFormulaAndFunctionMetricAggregation) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFormulaAndFunctionMetricAggregation) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_metric_data_source.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_metric_data_source.go index 318c5843b..da8ce738c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_metric_data_source.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_metric_data_source.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // FormulaAndFunctionMetricDataSource Data source for metrics queries. @@ -61,47 +62,3 @@ func (v FormulaAndFunctionMetricDataSource) IsValid() bool { func (v FormulaAndFunctionMetricDataSource) Ptr() *FormulaAndFunctionMetricDataSource { return &v } - -// NullableFormulaAndFunctionMetricDataSource handles when a null is used for FormulaAndFunctionMetricDataSource. -type NullableFormulaAndFunctionMetricDataSource struct { - value *FormulaAndFunctionMetricDataSource - isSet bool -} - -// Get returns the associated value. -func (v NullableFormulaAndFunctionMetricDataSource) Get() *FormulaAndFunctionMetricDataSource { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFormulaAndFunctionMetricDataSource) Set(val *FormulaAndFunctionMetricDataSource) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFormulaAndFunctionMetricDataSource) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFormulaAndFunctionMetricDataSource) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFormulaAndFunctionMetricDataSource initializes the struct as if Set has been called. -func NewNullableFormulaAndFunctionMetricDataSource(val *FormulaAndFunctionMetricDataSource) *NullableFormulaAndFunctionMetricDataSource { - return &NullableFormulaAndFunctionMetricDataSource{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFormulaAndFunctionMetricDataSource) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFormulaAndFunctionMetricDataSource) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_metric_query_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_metric_query_definition.go index 01996f888..4f5823646 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_metric_query_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_metric_query_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -164,7 +165,6 @@ func (o FormulaAndFunctionMetricQueryDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FormulaAndFunctionMetricQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregator *FormulaAndFunctionMetricAggregation `json:"aggregator,omitempty"` DataSource *FormulaAndFunctionMetricDataSource `json:"data_source"` @@ -172,12 +172,7 @@ func (o *FormulaAndFunctionMetricQueryDefinition) UnmarshalJSON(bytes []byte) (e Query *string `json:"query"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.DataSource == nil { return fmt.Errorf("required field data_source missing") @@ -194,29 +189,28 @@ func (o *FormulaAndFunctionMetricQueryDefinition) UnmarshalJSON(bytes []byte) (e } else { return err } - if v := all.Aggregator; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.DataSource; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregator = all.Aggregator - o.DataSource = *all.DataSource + + hasInvalidField := false + if all.Aggregator != nil && !all.Aggregator.IsValid() { + hasInvalidField = true + } else { + o.Aggregator = all.Aggregator + } + if !all.DataSource.IsValid() { + hasInvalidField = true + } else { + o.DataSource = *all.DataSource + } o.Name = *all.Name o.Query = *all.Query + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_process_query_data_source.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_process_query_data_source.go index 0eabfdbec..3a9fe3bb2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_process_query_data_source.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_process_query_data_source.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // FormulaAndFunctionProcessQueryDataSource Data sources that rely on the process backend. @@ -63,47 +64,3 @@ func (v FormulaAndFunctionProcessQueryDataSource) IsValid() bool { func (v FormulaAndFunctionProcessQueryDataSource) Ptr() *FormulaAndFunctionProcessQueryDataSource { return &v } - -// NullableFormulaAndFunctionProcessQueryDataSource handles when a null is used for FormulaAndFunctionProcessQueryDataSource. -type NullableFormulaAndFunctionProcessQueryDataSource struct { - value *FormulaAndFunctionProcessQueryDataSource - isSet bool -} - -// Get returns the associated value. -func (v NullableFormulaAndFunctionProcessQueryDataSource) Get() *FormulaAndFunctionProcessQueryDataSource { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFormulaAndFunctionProcessQueryDataSource) Set(val *FormulaAndFunctionProcessQueryDataSource) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFormulaAndFunctionProcessQueryDataSource) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFormulaAndFunctionProcessQueryDataSource) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFormulaAndFunctionProcessQueryDataSource initializes the struct as if Set has been called. -func NewNullableFormulaAndFunctionProcessQueryDataSource(val *FormulaAndFunctionProcessQueryDataSource) *NullableFormulaAndFunctionProcessQueryDataSource { - return &NullableFormulaAndFunctionProcessQueryDataSource{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFormulaAndFunctionProcessQueryDataSource) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFormulaAndFunctionProcessQueryDataSource) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_process_query_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_process_query_definition.go index 8539a85c4..80dd610b7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_process_query_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_process_query_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -333,7 +334,6 @@ func (o FormulaAndFunctionProcessQueryDefinition) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *FormulaAndFunctionProcessQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregator *FormulaAndFunctionMetricAggregation `json:"aggregator,omitempty"` DataSource *FormulaAndFunctionProcessQueryDataSource `json:"data_source"` @@ -346,12 +346,7 @@ func (o *FormulaAndFunctionProcessQueryDefinition) UnmarshalJSON(bytes []byte) ( TextFilter *string `json:"text_filter,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.DataSource == nil { return fmt.Errorf("required field data_source missing") @@ -368,42 +363,37 @@ func (o *FormulaAndFunctionProcessQueryDefinition) UnmarshalJSON(bytes []byte) ( } else { return err } - if v := all.Aggregator; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.DataSource; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Sort; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregator = all.Aggregator - o.DataSource = *all.DataSource + + hasInvalidField := false + if all.Aggregator != nil && !all.Aggregator.IsValid() { + hasInvalidField = true + } else { + o.Aggregator = all.Aggregator + } + if !all.DataSource.IsValid() { + hasInvalidField = true + } else { + o.DataSource = *all.DataSource + } o.IsNormalizedCpu = all.IsNormalizedCpu o.Limit = all.Limit o.Metric = *all.Metric o.Name = *all.Name - o.Sort = all.Sort + if all.Sort != nil && !all.Sort.IsValid() { + hasInvalidField = true + } else { + o.Sort = all.Sort + } o.TagFilters = all.TagFilters o.TextFilter = all.TextFilter + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_query_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_query_definition.go index 0a0f8659e..45aeb16db 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_query_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_query_definition.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" ) // FormulaAndFunctionQueryDefinition - A formula and function query. @@ -16,6 +16,7 @@ type FormulaAndFunctionQueryDefinition struct { FormulaAndFunctionApmDependencyStatsQueryDefinition *FormulaAndFunctionApmDependencyStatsQueryDefinition FormulaAndFunctionApmResourceStatsQueryDefinition *FormulaAndFunctionApmResourceStatsQueryDefinition FormulaAndFunctionSLOQueryDefinition *FormulaAndFunctionSLOQueryDefinition + FormulaAndFunctionCloudCostQueryDefinition *FormulaAndFunctionCloudCostQueryDefinition // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject interface{} @@ -51,6 +52,11 @@ func FormulaAndFunctionSLOQueryDefinitionAsFormulaAndFunctionQueryDefinition(v * return FormulaAndFunctionQueryDefinition{FormulaAndFunctionSLOQueryDefinition: v} } +// FormulaAndFunctionCloudCostQueryDefinitionAsFormulaAndFunctionQueryDefinition is a convenience function that returns FormulaAndFunctionCloudCostQueryDefinition wrapped in FormulaAndFunctionQueryDefinition. +func FormulaAndFunctionCloudCostQueryDefinitionAsFormulaAndFunctionQueryDefinition(v *FormulaAndFunctionCloudCostQueryDefinition) FormulaAndFunctionQueryDefinition { + return FormulaAndFunctionQueryDefinition{FormulaAndFunctionCloudCostQueryDefinition: v} +} + // UnmarshalJSON turns data into one of the pointers in the struct. func (obj *FormulaAndFunctionQueryDefinition) UnmarshalJSON(data []byte) error { var err error @@ -157,6 +163,23 @@ func (obj *FormulaAndFunctionQueryDefinition) UnmarshalJSON(data []byte) error { obj.FormulaAndFunctionSLOQueryDefinition = nil } + // try to unmarshal data into FormulaAndFunctionCloudCostQueryDefinition + err = json.Unmarshal(data, &obj.FormulaAndFunctionCloudCostQueryDefinition) + if err == nil { + if obj.FormulaAndFunctionCloudCostQueryDefinition != nil && obj.FormulaAndFunctionCloudCostQueryDefinition.UnparsedObject == nil { + jsonFormulaAndFunctionCloudCostQueryDefinition, _ := json.Marshal(obj.FormulaAndFunctionCloudCostQueryDefinition) + if string(jsonFormulaAndFunctionCloudCostQueryDefinition) == "{}" { // empty struct + obj.FormulaAndFunctionCloudCostQueryDefinition = nil + } else { + match++ + } + } else { + obj.FormulaAndFunctionCloudCostQueryDefinition = nil + } + } else { + obj.FormulaAndFunctionCloudCostQueryDefinition = nil + } + if match != 1 { // more than 1 match // reset to nil obj.FormulaAndFunctionMetricQueryDefinition = nil @@ -165,6 +188,7 @@ func (obj *FormulaAndFunctionQueryDefinition) UnmarshalJSON(data []byte) error { obj.FormulaAndFunctionApmDependencyStatsQueryDefinition = nil obj.FormulaAndFunctionApmResourceStatsQueryDefinition = nil obj.FormulaAndFunctionSLOQueryDefinition = nil + obj.FormulaAndFunctionCloudCostQueryDefinition = nil return json.Unmarshal(data, &obj.UnparsedObject) } return nil // exactly one match @@ -196,6 +220,10 @@ func (obj FormulaAndFunctionQueryDefinition) MarshalJSON() ([]byte, error) { return json.Marshal(&obj.FormulaAndFunctionSLOQueryDefinition) } + if obj.FormulaAndFunctionCloudCostQueryDefinition != nil { + return json.Marshal(&obj.FormulaAndFunctionCloudCostQueryDefinition) + } + if obj.UnparsedObject != nil { return json.Marshal(obj.UnparsedObject) } @@ -228,56 +256,10 @@ func (obj *FormulaAndFunctionQueryDefinition) GetActualInstance() interface{} { return obj.FormulaAndFunctionSLOQueryDefinition } - // all schemas are nil - return nil -} - -// NullableFormulaAndFunctionQueryDefinition handles when a null is used for FormulaAndFunctionQueryDefinition. -type NullableFormulaAndFunctionQueryDefinition struct { - value *FormulaAndFunctionQueryDefinition - isSet bool -} - -// Get returns the associated value. -func (v NullableFormulaAndFunctionQueryDefinition) Get() *FormulaAndFunctionQueryDefinition { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFormulaAndFunctionQueryDefinition) Set(val *FormulaAndFunctionQueryDefinition) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFormulaAndFunctionQueryDefinition) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableFormulaAndFunctionQueryDefinition) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFormulaAndFunctionQueryDefinition initializes the struct as if Set has been called. -func NewNullableFormulaAndFunctionQueryDefinition(val *FormulaAndFunctionQueryDefinition) *NullableFormulaAndFunctionQueryDefinition { - return &NullableFormulaAndFunctionQueryDefinition{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFormulaAndFunctionQueryDefinition) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFormulaAndFunctionQueryDefinition) 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 + if obj.FormulaAndFunctionCloudCostQueryDefinition != nil { + return obj.FormulaAndFunctionCloudCostQueryDefinition } - return json.Unmarshal(src, &v.value) + // all schemas are nil + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_response_format.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_response_format.go index b13575ee8..c1b298829 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_response_format.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_response_format.go @@ -5,22 +5,25 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) -// FormulaAndFunctionResponseFormat Timeseries or Scalar response. +// FormulaAndFunctionResponseFormat Timeseries, scalar, or event list response. Event list response formats are supported by Geomap widgets. type FormulaAndFunctionResponseFormat string // List of FormulaAndFunctionResponseFormat. const ( FORMULAANDFUNCTIONRESPONSEFORMAT_TIMESERIES FormulaAndFunctionResponseFormat = "timeseries" FORMULAANDFUNCTIONRESPONSEFORMAT_SCALAR FormulaAndFunctionResponseFormat = "scalar" + FORMULAANDFUNCTIONRESPONSEFORMAT_EVENT_LIST FormulaAndFunctionResponseFormat = "event_list" ) var allowedFormulaAndFunctionResponseFormatEnumValues = []FormulaAndFunctionResponseFormat{ FORMULAANDFUNCTIONRESPONSEFORMAT_TIMESERIES, FORMULAANDFUNCTIONRESPONSEFORMAT_SCALAR, + FORMULAANDFUNCTIONRESPONSEFORMAT_EVENT_LIST, } // GetAllowedValues reeturns the list of possible values. @@ -63,47 +66,3 @@ func (v FormulaAndFunctionResponseFormat) IsValid() bool { func (v FormulaAndFunctionResponseFormat) Ptr() *FormulaAndFunctionResponseFormat { return &v } - -// NullableFormulaAndFunctionResponseFormat handles when a null is used for FormulaAndFunctionResponseFormat. -type NullableFormulaAndFunctionResponseFormat struct { - value *FormulaAndFunctionResponseFormat - isSet bool -} - -// Get returns the associated value. -func (v NullableFormulaAndFunctionResponseFormat) Get() *FormulaAndFunctionResponseFormat { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFormulaAndFunctionResponseFormat) Set(val *FormulaAndFunctionResponseFormat) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFormulaAndFunctionResponseFormat) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFormulaAndFunctionResponseFormat) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFormulaAndFunctionResponseFormat initializes the struct as if Set has been called. -func NewNullableFormulaAndFunctionResponseFormat(val *FormulaAndFunctionResponseFormat) *NullableFormulaAndFunctionResponseFormat { - return &NullableFormulaAndFunctionResponseFormat{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFormulaAndFunctionResponseFormat) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFormulaAndFunctionResponseFormat) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_slo_data_source.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_slo_data_source.go index 86fb8f8dc..07deebeea 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_slo_data_source.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_slo_data_source.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // FormulaAndFunctionSLODataSource Data source for SLO measures queries. @@ -61,47 +62,3 @@ func (v FormulaAndFunctionSLODataSource) IsValid() bool { func (v FormulaAndFunctionSLODataSource) Ptr() *FormulaAndFunctionSLODataSource { return &v } - -// NullableFormulaAndFunctionSLODataSource handles when a null is used for FormulaAndFunctionSLODataSource. -type NullableFormulaAndFunctionSLODataSource struct { - value *FormulaAndFunctionSLODataSource - isSet bool -} - -// Get returns the associated value. -func (v NullableFormulaAndFunctionSLODataSource) Get() *FormulaAndFunctionSLODataSource { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFormulaAndFunctionSLODataSource) Set(val *FormulaAndFunctionSLODataSource) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFormulaAndFunctionSLODataSource) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFormulaAndFunctionSLODataSource) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFormulaAndFunctionSLODataSource initializes the struct as if Set has been called. -func NewNullableFormulaAndFunctionSLODataSource(val *FormulaAndFunctionSLODataSource) *NullableFormulaAndFunctionSLODataSource { - return &NullableFormulaAndFunctionSLODataSource{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFormulaAndFunctionSLODataSource) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFormulaAndFunctionSLODataSource) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_slo_group_mode.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_slo_group_mode.go index 2b9366f8d..31abb7c13 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_slo_group_mode.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_slo_group_mode.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // FormulaAndFunctionSLOGroupMode Group mode to query measures. @@ -63,47 +64,3 @@ func (v FormulaAndFunctionSLOGroupMode) IsValid() bool { func (v FormulaAndFunctionSLOGroupMode) Ptr() *FormulaAndFunctionSLOGroupMode { return &v } - -// NullableFormulaAndFunctionSLOGroupMode handles when a null is used for FormulaAndFunctionSLOGroupMode. -type NullableFormulaAndFunctionSLOGroupMode struct { - value *FormulaAndFunctionSLOGroupMode - isSet bool -} - -// Get returns the associated value. -func (v NullableFormulaAndFunctionSLOGroupMode) Get() *FormulaAndFunctionSLOGroupMode { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFormulaAndFunctionSLOGroupMode) Set(val *FormulaAndFunctionSLOGroupMode) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFormulaAndFunctionSLOGroupMode) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFormulaAndFunctionSLOGroupMode) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFormulaAndFunctionSLOGroupMode initializes the struct as if Set has been called. -func NewNullableFormulaAndFunctionSLOGroupMode(val *FormulaAndFunctionSLOGroupMode) *NullableFormulaAndFunctionSLOGroupMode { - return &NullableFormulaAndFunctionSLOGroupMode{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFormulaAndFunctionSLOGroupMode) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFormulaAndFunctionSLOGroupMode) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_slo_measure.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_slo_measure.go index 47952fbec..831f553c9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_slo_measure.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_slo_measure.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // FormulaAndFunctionSLOMeasure SLO measures queries. @@ -71,47 +72,3 @@ func (v FormulaAndFunctionSLOMeasure) IsValid() bool { func (v FormulaAndFunctionSLOMeasure) Ptr() *FormulaAndFunctionSLOMeasure { return &v } - -// NullableFormulaAndFunctionSLOMeasure handles when a null is used for FormulaAndFunctionSLOMeasure. -type NullableFormulaAndFunctionSLOMeasure struct { - value *FormulaAndFunctionSLOMeasure - isSet bool -} - -// Get returns the associated value. -func (v NullableFormulaAndFunctionSLOMeasure) Get() *FormulaAndFunctionSLOMeasure { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFormulaAndFunctionSLOMeasure) Set(val *FormulaAndFunctionSLOMeasure) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFormulaAndFunctionSLOMeasure) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFormulaAndFunctionSLOMeasure) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFormulaAndFunctionSLOMeasure initializes the struct as if Set has been called. -func NewNullableFormulaAndFunctionSLOMeasure(val *FormulaAndFunctionSLOMeasure) *NullableFormulaAndFunctionSLOMeasure { - return &NullableFormulaAndFunctionSLOMeasure{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFormulaAndFunctionSLOMeasure) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFormulaAndFunctionSLOMeasure) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_slo_query_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_slo_query_definition.go index 48a990d24..5a78c2f08 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_slo_query_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_slo_query_definition.go @@ -5,14 +5,17 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // FormulaAndFunctionSLOQueryDefinition A formula and functions metrics query. type FormulaAndFunctionSLOQueryDefinition struct { + // Additional filters applied to the SLO query. + AdditionalQueryFilters *string `json:"additional_query_filters,omitempty"` // Data source for SLO measures queries. DataSource FormulaAndFunctionSLODataSource `json:"data_source"` // Group mode to query measures. @@ -50,6 +53,34 @@ func NewFormulaAndFunctionSLOQueryDefinitionWithDefaults() *FormulaAndFunctionSL return &this } +// GetAdditionalQueryFilters returns the AdditionalQueryFilters field value if set, zero value otherwise. +func (o *FormulaAndFunctionSLOQueryDefinition) GetAdditionalQueryFilters() string { + if o == nil || o.AdditionalQueryFilters == nil { + var ret string + return ret + } + return *o.AdditionalQueryFilters +} + +// GetAdditionalQueryFiltersOk returns a tuple with the AdditionalQueryFilters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionSLOQueryDefinition) GetAdditionalQueryFiltersOk() (*string, bool) { + if o == nil || o.AdditionalQueryFilters == nil { + return nil, false + } + return o.AdditionalQueryFilters, true +} + +// HasAdditionalQueryFilters returns a boolean if a field has been set. +func (o *FormulaAndFunctionSLOQueryDefinition) HasAdditionalQueryFilters() bool { + return o != nil && o.AdditionalQueryFilters != nil +} + +// SetAdditionalQueryFilters gets a reference to the given string and assigns it to the AdditionalQueryFilters field. +func (o *FormulaAndFunctionSLOQueryDefinition) SetAdditionalQueryFilters(v string) { + o.AdditionalQueryFilters = &v +} + // GetDataSource returns the DataSource field value. func (o *FormulaAndFunctionSLOQueryDefinition) GetDataSource() FormulaAndFunctionSLODataSource { if o == nil { @@ -209,6 +240,9 @@ func (o FormulaAndFunctionSLOQueryDefinition) MarshalJSON() ([]byte, error) { if o.UnparsedObject != nil { return json.Marshal(o.UnparsedObject) } + if o.AdditionalQueryFilters != nil { + toSerialize["additional_query_filters"] = o.AdditionalQueryFilters + } toSerialize["data_source"] = o.DataSource if o.GroupMode != nil { toSerialize["group_mode"] = o.GroupMode @@ -230,22 +264,17 @@ func (o FormulaAndFunctionSLOQueryDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FormulaAndFunctionSLOQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} 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"` + AdditionalQueryFilters *string `json:"additional_query_filters,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"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.DataSource == nil { return fmt.Errorf("required field data_source missing") @@ -258,51 +287,43 @@ func (o *FormulaAndFunctionSLOQueryDefinition) UnmarshalJSON(bytes []byte) (err } 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"}) + datadog.DeleteKeys(additionalProperties, &[]string{"additional_query_filters", "data_source", "group_mode", "measure", "name", "slo_id", "slo_query_type"}) } else { return err } - if v := all.DataSource; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.GroupMode; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + o.AdditionalQueryFilters = all.AdditionalQueryFilters + if !all.DataSource.IsValid() { + hasInvalidField = true + } else { + o.DataSource = *all.DataSource } - if v := all.Measure; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + if all.GroupMode != nil && !all.GroupMode.IsValid() { + hasInvalidField = true + } else { + o.GroupMode = all.GroupMode } - if v := all.SloQueryType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + if !all.Measure.IsValid() { + hasInvalidField = true + } else { + o.Measure = *all.Measure } - o.DataSource = *all.DataSource - o.GroupMode = all.GroupMode - o.Measure = *all.Measure o.Name = all.Name o.SloId = *all.SloId - o.SloQueryType = all.SloQueryType + if all.SloQueryType != nil && !all.SloQueryType.IsValid() { + hasInvalidField = true + } else { + o.SloQueryType = all.SloQueryType + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_slo_query_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_slo_query_type.go index 296204580..fb6371bb6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_slo_query_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_formula_and_function_slo_query_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // FormulaAndFunctionSLOQueryType Name of the query for use in formulas. @@ -61,47 +62,3 @@ func (v FormulaAndFunctionSLOQueryType) IsValid() bool { func (v FormulaAndFunctionSLOQueryType) Ptr() *FormulaAndFunctionSLOQueryType { return &v } - -// NullableFormulaAndFunctionSLOQueryType handles when a null is used for FormulaAndFunctionSLOQueryType. -type NullableFormulaAndFunctionSLOQueryType struct { - value *FormulaAndFunctionSLOQueryType - isSet bool -} - -// Get returns the associated value. -func (v NullableFormulaAndFunctionSLOQueryType) Get() *FormulaAndFunctionSLOQueryType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFormulaAndFunctionSLOQueryType) Set(val *FormulaAndFunctionSLOQueryType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFormulaAndFunctionSLOQueryType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFormulaAndFunctionSLOQueryType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFormulaAndFunctionSLOQueryType initializes the struct as if Set has been called. -func NewNullableFormulaAndFunctionSLOQueryType(val *FormulaAndFunctionSLOQueryType) *NullableFormulaAndFunctionSLOQueryType { - return &NullableFormulaAndFunctionSLOQueryType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFormulaAndFunctionSLOQueryType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFormulaAndFunctionSLOQueryType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_free_text_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_free_text_widget_definition.go index f41061a24..afab66a9b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_free_text_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_free_text_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -205,7 +206,6 @@ func (o FreeTextWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FreeTextWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Color *string `json:"color,omitempty"` FontSize *string `json:"font_size,omitempty"` @@ -214,12 +214,7 @@ func (o *FreeTextWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { Type *FreeTextWidgetDefinitionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Text == nil { return fmt.Errorf("required field text missing") @@ -233,30 +228,29 @@ func (o *FreeTextWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.TextAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Color = all.Color o.FontSize = all.FontSize o.Text = *all.Text - o.TextAlign = all.TextAlign - o.Type = *all.Type + if all.TextAlign != nil && !all.TextAlign.IsValid() { + hasInvalidField = true + } else { + o.TextAlign = all.TextAlign + } + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_free_text_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_free_text_widget_definition_type.go index f4f435a42..90db94a2a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_free_text_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_free_text_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // FreeTextWidgetDefinitionType Type of the free text widget. @@ -61,47 +62,3 @@ func (v FreeTextWidgetDefinitionType) IsValid() bool { func (v FreeTextWidgetDefinitionType) Ptr() *FreeTextWidgetDefinitionType { return &v } - -// NullableFreeTextWidgetDefinitionType handles when a null is used for FreeTextWidgetDefinitionType. -type NullableFreeTextWidgetDefinitionType struct { - value *FreeTextWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableFreeTextWidgetDefinitionType) Get() *FreeTextWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFreeTextWidgetDefinitionType) Set(val *FreeTextWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFreeTextWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFreeTextWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFreeTextWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableFreeTextWidgetDefinitionType(val *FreeTextWidgetDefinitionType) *NullableFreeTextWidgetDefinitionType { - return &NullableFreeTextWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFreeTextWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFreeTextWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_query.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_query.go index 8f7ee045b..9a40b35e2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_query.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_query.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -133,19 +134,13 @@ func (o FunnelQuery) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FunnelQuery) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DataSource *FunnelSource `json:"data_source"` QueryString *string `json:"query_string"` Steps *[]FunnelStep `json:"steps"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.DataSource == nil { return fmt.Errorf("required field data_source missing") @@ -162,20 +157,23 @@ func (o *FunnelQuery) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.DataSource; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if !all.DataSource.IsValid() { + hasInvalidField = true + } else { + o.DataSource = *all.DataSource } - o.DataSource = *all.DataSource o.QueryString = *all.QueryString o.Steps = *all.Steps + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_request_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_request_type.go index 1bd061ab4..815b09a01 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_request_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_request_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // FunnelRequestType Widget request type. @@ -61,47 +62,3 @@ func (v FunnelRequestType) IsValid() bool { func (v FunnelRequestType) Ptr() *FunnelRequestType { return &v } - -// NullableFunnelRequestType handles when a null is used for FunnelRequestType. -type NullableFunnelRequestType struct { - value *FunnelRequestType - isSet bool -} - -// Get returns the associated value. -func (v NullableFunnelRequestType) Get() *FunnelRequestType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFunnelRequestType) Set(val *FunnelRequestType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFunnelRequestType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFunnelRequestType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFunnelRequestType initializes the struct as if Set has been called. -func NewNullableFunnelRequestType(val *FunnelRequestType) *NullableFunnelRequestType { - return &NullableFunnelRequestType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFunnelRequestType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFunnelRequestType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_source.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_source.go index dd601f5d9..7ef722092 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_source.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_source.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // FunnelSource Source from which to query items to display in the funnel. @@ -61,47 +62,3 @@ func (v FunnelSource) IsValid() bool { func (v FunnelSource) Ptr() *FunnelSource { return &v } - -// NullableFunnelSource handles when a null is used for FunnelSource. -type NullableFunnelSource struct { - value *FunnelSource - isSet bool -} - -// Get returns the associated value. -func (v NullableFunnelSource) Get() *FunnelSource { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFunnelSource) Set(val *FunnelSource) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFunnelSource) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFunnelSource) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFunnelSource initializes the struct as if Set has been called. -func NewNullableFunnelSource(val *FunnelSource) *NullableFunnelSource { - return &NullableFunnelSource{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFunnelSource) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFunnelSource) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_step.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_step.go index 1b100a858..1f6a677bb 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_step.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_step.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o FunnelStep) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FunnelStep) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Facet *string `json:"facet"` Value *string `json:"value"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Facet == nil { return fmt.Errorf("required field facet missing") @@ -131,6 +126,7 @@ func (o *FunnelStep) UnmarshalJSON(bytes []byte) (err error) { } o.Facet = *all.Facet o.Value = *all.Value + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_widget_definition.go index e9a739f58..dba38ed77 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_widget_definition.go @@ -5,14 +5,14 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // FunnelWidgetDefinition The funnel visualization displays a funnel of user sessions that maps a sequence of view navigation and user interaction in your application. -// type FunnelWidgetDefinition struct { // Request payload used to query items. Requests []FunnelWidgetRequest `json:"requests"` @@ -239,7 +239,6 @@ func (o FunnelWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FunnelWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Requests *[]FunnelWidgetRequest `json:"requests"` Time *WidgetTime `json:"time,omitempty"` @@ -249,12 +248,7 @@ func (o *FunnelWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { Type *FunnelWidgetDefinitionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Requests == nil { return fmt.Errorf("required field requests missing") @@ -268,38 +262,33 @@ func (o *FunnelWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Requests = *all.Requests if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Time = all.Time o.Title = all.Title - o.TitleAlign = all.TitleAlign + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } o.TitleSize = all.TitleSize - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_widget_definition_type.go index 42f89ec77..7fb1f9e43 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // FunnelWidgetDefinitionType Type of funnel widget. @@ -61,47 +62,3 @@ func (v FunnelWidgetDefinitionType) IsValid() bool { func (v FunnelWidgetDefinitionType) Ptr() *FunnelWidgetDefinitionType { return &v } - -// NullableFunnelWidgetDefinitionType handles when a null is used for FunnelWidgetDefinitionType. -type NullableFunnelWidgetDefinitionType struct { - value *FunnelWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableFunnelWidgetDefinitionType) Get() *FunnelWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFunnelWidgetDefinitionType) Set(val *FunnelWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFunnelWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFunnelWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFunnelWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableFunnelWidgetDefinitionType(val *FunnelWidgetDefinitionType) *NullableFunnelWidgetDefinitionType { - return &NullableFunnelWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFunnelWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFunnelWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_widget_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_widget_request.go index b7aa2f0fd..564c0f8c1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_widget_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_funnel_widget_request.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o FunnelWidgetRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FunnelWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Query *FunnelQuery `json:"query"` RequestType *FunnelRequestType `json:"request_type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Query == nil { return fmt.Errorf("required field query missing") @@ -129,26 +124,25 @@ func (o *FunnelWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.RequestType; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Query.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Query = *all.Query - o.RequestType = *all.RequestType + if !all.RequestType.IsValid() { + hasInvalidField = true + } else { + o.RequestType = *all.RequestType + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_gcp_account.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_gcp_account.go index d30834fc0..cf587bde7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_gcp_account.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_gcp_account.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -517,7 +517,6 @@ func (o GCPAccount) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *GCPAccount) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AuthProviderX509CertUrl *string `json:"auth_provider_x509_cert_url,omitempty"` AuthUri *string `json:"auth_uri,omitempty"` @@ -535,12 +534,7 @@ func (o *GCPAccount) UnmarshalJSON(bytes []byte) (err error) { Type *string `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -562,6 +556,7 @@ func (o *GCPAccount) UnmarshalJSON(bytes []byte) (err error) { o.ProjectId = all.ProjectId o.TokenUri = all.TokenUri o.Type = all.Type + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_geomap_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_geomap_widget_definition.go index c00121efb..8dec530ed 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_geomap_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_geomap_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -328,7 +329,6 @@ func (o GeomapWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *GeomapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` Requests *[]GeomapWidgetRequest `json:"requests"` @@ -341,12 +341,7 @@ func (o *GeomapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { View *GeomapWidgetDefinitionView `json:"view"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Requests == nil { return fmt.Errorf("required field requests missing") @@ -366,55 +361,42 @@ func (o *GeomapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.CustomLinks = all.CustomLinks o.Requests = *all.Requests if all.Style.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Style = *all.Style if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Time = all.Time o.Title = all.Title - o.TitleAlign = all.TitleAlign + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } o.TitleSize = all.TitleSize - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } if all.View.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.View = *all.View + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_geomap_widget_definition_style.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_geomap_widget_definition_style.go index 2a443abe0..e147fbb79 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_geomap_widget_definition_style.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_geomap_widget_definition_style.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o GeomapWidgetDefinitionStyle) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *GeomapWidgetDefinitionStyle) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Palette *string `json:"palette"` PaletteFlip *bool `json:"palette_flip"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Palette == nil { return fmt.Errorf("required field palette missing") @@ -131,6 +126,7 @@ func (o *GeomapWidgetDefinitionStyle) UnmarshalJSON(bytes []byte) (err error) { } o.Palette = *all.Palette o.PaletteFlip = *all.PaletteFlip + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_geomap_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_geomap_widget_definition_type.go index ecc2cc11f..db69be498 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_geomap_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_geomap_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // GeomapWidgetDefinitionType Type of the geomap widget. @@ -61,47 +62,3 @@ func (v GeomapWidgetDefinitionType) IsValid() bool { func (v GeomapWidgetDefinitionType) Ptr() *GeomapWidgetDefinitionType { return &v } - -// NullableGeomapWidgetDefinitionType handles when a null is used for GeomapWidgetDefinitionType. -type NullableGeomapWidgetDefinitionType struct { - value *GeomapWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableGeomapWidgetDefinitionType) Get() *GeomapWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableGeomapWidgetDefinitionType) Set(val *GeomapWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableGeomapWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableGeomapWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableGeomapWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableGeomapWidgetDefinitionType(val *GeomapWidgetDefinitionType) *NullableGeomapWidgetDefinitionType { - return &NullableGeomapWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableGeomapWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableGeomapWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_geomap_widget_definition_view.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_geomap_widget_definition_view.go index c6cb635d6..1d1707bb7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_geomap_widget_definition_view.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_geomap_widget_definition_view.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o GeomapWidgetDefinitionView) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *GeomapWidgetDefinitionView) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Focus *string `json:"focus"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Focus == nil { return fmt.Errorf("required field focus missing") @@ -99,6 +94,7 @@ func (o *GeomapWidgetDefinitionView) UnmarshalJSON(bytes []byte) (err error) { return err } o.Focus = *all.Focus + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_geomap_widget_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_geomap_widget_request.go index 841447d74..de490e48b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_geomap_widget_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_geomap_widget_request.go @@ -5,13 +5,15 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // GeomapWidgetRequest An updated geomap widget. type GeomapWidgetRequest struct { + // Widget columns. + Columns []ListStreamColumn `json:"columns,omitempty"` // List of formulas that operate on queries. Formulas []WidgetFormula `json:"formulas,omitempty"` // The log query. @@ -20,7 +22,9 @@ type GeomapWidgetRequest struct { Q *string `json:"q,omitempty"` // List of queries that can be returned directly or used in formulas. Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - // Timeseries or Scalar response. + // Updated list stream widget. + Query *ListStreamQuery `json:"query,omitempty"` + // Timeseries, scalar, or event list response. Event list response formats are supported by Geomap widgets. ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` // The log query. RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` @@ -48,6 +52,34 @@ func NewGeomapWidgetRequestWithDefaults() *GeomapWidgetRequest { return &this } +// GetColumns returns the Columns field value if set, zero value otherwise. +func (o *GeomapWidgetRequest) GetColumns() []ListStreamColumn { + if o == nil || o.Columns == nil { + var ret []ListStreamColumn + return ret + } + return o.Columns +} + +// GetColumnsOk returns a tuple with the Columns field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GeomapWidgetRequest) GetColumnsOk() (*[]ListStreamColumn, bool) { + if o == nil || o.Columns == nil { + return nil, false + } + return &o.Columns, true +} + +// HasColumns returns a boolean if a field has been set. +func (o *GeomapWidgetRequest) HasColumns() bool { + return o != nil && o.Columns != nil +} + +// SetColumns gets a reference to the given []ListStreamColumn and assigns it to the Columns field. +func (o *GeomapWidgetRequest) SetColumns(v []ListStreamColumn) { + o.Columns = v +} + // GetFormulas returns the Formulas field value if set, zero value otherwise. func (o *GeomapWidgetRequest) GetFormulas() []WidgetFormula { if o == nil || o.Formulas == nil { @@ -160,6 +192,34 @@ func (o *GeomapWidgetRequest) SetQueries(v []FormulaAndFunctionQueryDefinition) o.Queries = v } +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *GeomapWidgetRequest) GetQuery() ListStreamQuery { + if o == nil || o.Query == nil { + var ret ListStreamQuery + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GeomapWidgetRequest) GetQueryOk() (*ListStreamQuery, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *GeomapWidgetRequest) HasQuery() bool { + return o != nil && o.Query != nil +} + +// SetQuery gets a reference to the given ListStreamQuery and assigns it to the Query field. +func (o *GeomapWidgetRequest) SetQuery(v ListStreamQuery) { + o.Query = &v +} + // GetResponseFormat returns the ResponseFormat field value if set, zero value otherwise. func (o *GeomapWidgetRequest) GetResponseFormat() FormulaAndFunctionResponseFormat { if o == nil || o.ResponseFormat == nil { @@ -250,6 +310,9 @@ func (o GeomapWidgetRequest) MarshalJSON() ([]byte, error) { if o.UnparsedObject != nil { return json.Marshal(o.UnparsedObject) } + if o.Columns != nil { + toSerialize["columns"] = o.Columns + } if o.Formulas != nil { toSerialize["formulas"] = o.Formulas } @@ -262,6 +325,9 @@ func (o GeomapWidgetRequest) MarshalJSON() ([]byte, error) { if o.Queries != nil { toSerialize["queries"] = o.Queries } + if o.Query != nil { + toSerialize["query"] = o.Query + } if o.ResponseFormat != nil { toSerialize["response_format"] = o.ResponseFormat } @@ -280,69 +346,61 @@ func (o GeomapWidgetRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *GeomapWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { + Columns []ListStreamColumn `json:"columns,omitempty"` Formulas []WidgetFormula `json:"formulas,omitempty"` LogQuery *LogQueryDefinition `json:"log_query,omitempty"` Q *string `json:"q,omitempty"` Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` + Query *ListStreamQuery `json:"query,omitempty"` ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"formulas", "log_query", "q", "queries", "response_format", "rum_query", "security_query"}) + datadog.DeleteKeys(additionalProperties, &[]string{"columns", "formulas", "log_query", "q", "queries", "query", "response_format", "rum_query", "security_query"}) } else { return err } - if v := all.ResponseFormat; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false + o.Columns = all.Columns o.Formulas = all.Formulas if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LogQuery = all.LogQuery o.Q = all.Q o.Queries = all.Queries - o.ResponseFormat = all.ResponseFormat + if all.Query != nil && all.Query.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Query = all.Query + if all.ResponseFormat != nil && !all.ResponseFormat.IsValid() { + hasInvalidField = true + } else { + o.ResponseFormat = all.ResponseFormat + } if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.RumQuery = all.RumQuery if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.SecurityQuery = all.SecurityQuery + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_graph_snapshot.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_graph_snapshot.go index b9bb35d19..6f3ceb01d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_graph_snapshot.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_graph_snapshot.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -150,19 +150,13 @@ func (o GraphSnapshot) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *GraphSnapshot) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { GraphDef *string `json:"graph_def,omitempty"` MetricQuery *string `json:"metric_query,omitempty"` SnapshotUrl *string `json:"snapshot_url,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -173,6 +167,7 @@ func (o *GraphSnapshot) UnmarshalJSON(bytes []byte) (err error) { o.GraphDef = all.GraphDef o.MetricQuery = all.MetricQuery o.SnapshotUrl = all.SnapshotUrl + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_group_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_group_widget_definition.go index a18a0b5ba..bf1b0cc19 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_group_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_group_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -302,7 +303,6 @@ func (o GroupWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *GroupWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { BackgroundColor *string `json:"background_color,omitempty"` BannerImg *string `json:"banner_img,omitempty"` @@ -314,12 +314,7 @@ func (o *GroupWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { Widgets *[]Widget `json:"widgets"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.LayoutType == nil { return fmt.Errorf("required field layout_type missing") @@ -336,41 +331,36 @@ func (o *GroupWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.LayoutType; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.BackgroundColor = all.BackgroundColor o.BannerImg = all.BannerImg - o.LayoutType = *all.LayoutType + if !all.LayoutType.IsValid() { + hasInvalidField = true + } else { + o.LayoutType = *all.LayoutType + } o.ShowTitle = all.ShowTitle o.Title = all.Title - o.TitleAlign = all.TitleAlign - o.Type = *all.Type + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } o.Widgets = *all.Widgets + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_group_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_group_widget_definition_type.go index 1a5a0c37b..b17b3b25d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_group_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_group_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // GroupWidgetDefinitionType Type of the group widget. @@ -61,47 +62,3 @@ func (v GroupWidgetDefinitionType) IsValid() bool { func (v GroupWidgetDefinitionType) Ptr() *GroupWidgetDefinitionType { return &v } - -// NullableGroupWidgetDefinitionType handles when a null is used for GroupWidgetDefinitionType. -type NullableGroupWidgetDefinitionType struct { - value *GroupWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableGroupWidgetDefinitionType) Get() *GroupWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableGroupWidgetDefinitionType) Set(val *GroupWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableGroupWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableGroupWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableGroupWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableGroupWidgetDefinitionType(val *GroupWidgetDefinitionType) *NullableGroupWidgetDefinitionType { - return &NullableGroupWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableGroupWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableGroupWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_heat_map_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_heat_map_widget_definition.go index 7159ab55f..b84a3222e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_heat_map_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_heat_map_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -403,7 +404,6 @@ func (o HeatMapWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HeatMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` Events []WidgetEvent `json:"events,omitempty"` @@ -418,12 +418,7 @@ func (o *HeatMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { Yaxis *WidgetAxis `json:"yaxis,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Requests == nil { return fmt.Errorf("required field requests missing") @@ -437,50 +432,41 @@ func (o *HeatMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.CustomLinks = all.CustomLinks o.Events = all.Events o.LegendSize = all.LegendSize o.Requests = *all.Requests o.ShowLegend = all.ShowLegend if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Time = all.Time o.Title = all.Title - o.TitleAlign = all.TitleAlign + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } o.TitleSize = all.TitleSize - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } if all.Yaxis != nil && all.Yaxis.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Yaxis = all.Yaxis + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_heat_map_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_heat_map_widget_definition_type.go index 1af9e6d6c..4eab1cad8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_heat_map_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_heat_map_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // HeatMapWidgetDefinitionType Type of the heat map widget. @@ -61,47 +62,3 @@ func (v HeatMapWidgetDefinitionType) IsValid() bool { func (v HeatMapWidgetDefinitionType) Ptr() *HeatMapWidgetDefinitionType { return &v } - -// NullableHeatMapWidgetDefinitionType handles when a null is used for HeatMapWidgetDefinitionType. -type NullableHeatMapWidgetDefinitionType struct { - value *HeatMapWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableHeatMapWidgetDefinitionType) Get() *HeatMapWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableHeatMapWidgetDefinitionType) Set(val *HeatMapWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableHeatMapWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableHeatMapWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableHeatMapWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableHeatMapWidgetDefinitionType(val *HeatMapWidgetDefinitionType) *NullableHeatMapWidgetDefinitionType { - return &NullableHeatMapWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableHeatMapWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableHeatMapWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_heat_map_widget_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_heat_map_widget_request.go index 3638add94..b52dd3cb8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_heat_map_widget_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_heat_map_widget_request.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -379,7 +379,6 @@ func (o HeatMapWidgetRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HeatMapWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` EventQuery *EventQueryDefinition `json:"event_query,omitempty"` @@ -393,12 +392,7 @@ func (o *HeatMapWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { Style *WidgetStyle `json:"style,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -406,82 +400,53 @@ func (o *HeatMapWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ApmQuery = all.ApmQuery if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.EventQuery = all.EventQuery if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LogQuery = all.LogQuery if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.NetworkQuery = all.NetworkQuery if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ProcessQuery = all.ProcessQuery if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ProfileMetricsQuery = all.ProfileMetricsQuery o.Q = all.Q if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.RumQuery = all.RumQuery if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.SecurityQuery = all.SecurityQuery if all.Style != nil && all.Style.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Style = all.Style + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host.go index 1447bfdd0..774354f02 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -522,7 +522,6 @@ func (o Host) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Host) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aliases []string `json:"aliases,omitempty"` Apps []string `json:"apps,omitempty"` @@ -540,12 +539,7 @@ func (o *Host) UnmarshalJSON(bytes []byte) (err error) { Up *bool `json:"up,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -553,6 +547,8 @@ func (o *Host) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Aliases = all.Aliases o.Apps = all.Apps o.AwsName = all.AwsName @@ -561,19 +557,11 @@ func (o *Host) UnmarshalJSON(bytes []byte) (err error) { o.IsMuted = all.IsMuted o.LastReportedTime = all.LastReportedTime if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta if all.Metrics != nil && all.Metrics.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Metrics = all.Metrics o.MuteTimeout = all.MuteTimeout @@ -581,9 +569,14 @@ func (o *Host) UnmarshalJSON(bytes []byte) (err error) { o.Sources = all.Sources o.TagsBySource = all.TagsBySource o.Up = all.Up + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_list_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_list_response.go index 33806f236..4ea17f2a6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_list_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_list_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o HostListResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HostListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { HostList []Host `json:"host_list,omitempty"` TotalMatching *int64 `json:"total_matching,omitempty"` TotalReturned *int64 `json:"total_returned,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *HostListResponse) UnmarshalJSON(bytes []byte) (err error) { o.HostList = all.HostList o.TotalMatching = all.TotalMatching o.TotalReturned = all.TotalReturned + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_map_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_map_request.go index d5b52cd2b..c95cacfe1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_map_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_map_request.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -346,7 +346,6 @@ func (o HostMapRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HostMapRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` EventQuery *LogQueryDefinition `json:"event_query,omitempty"` @@ -359,12 +358,7 @@ func (o *HostMapRequest) UnmarshalJSON(bytes []byte) (err error) { SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -372,74 +366,49 @@ func (o *HostMapRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ApmQuery = all.ApmQuery if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.EventQuery = all.EventQuery if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LogQuery = all.LogQuery if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.NetworkQuery = all.NetworkQuery if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ProcessQuery = all.ProcessQuery if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ProfileMetricsQuery = all.ProfileMetricsQuery o.Q = all.Q if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.RumQuery = all.RumQuery if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.SecurityQuery = all.SecurityQuery + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_map_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_map_widget_definition.go index b00c72dd0..7e17106e7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_map_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_map_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -469,7 +470,6 @@ func (o HostMapWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HostMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` Group []string `json:"group,omitempty"` @@ -486,12 +486,7 @@ func (o *HostMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { Type *HostMapWidgetDefinitionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Requests == nil { return fmt.Errorf("required field requests missing") @@ -505,60 +500,47 @@ func (o *HostMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.NodeType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.CustomLinks = all.CustomLinks o.Group = all.Group o.NoGroupHosts = all.NoGroupHosts o.NoMetricHosts = all.NoMetricHosts - o.NodeType = all.NodeType + if all.NodeType != nil && !all.NodeType.IsValid() { + hasInvalidField = true + } else { + o.NodeType = all.NodeType + } o.Notes = all.Notes if all.Requests.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Requests = *all.Requests o.Scope = all.Scope if all.Style != nil && all.Style.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Style = all.Style o.Title = all.Title - o.TitleAlign = all.TitleAlign + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } o.TitleSize = all.TitleSize - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_map_widget_definition_requests.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_map_widget_definition_requests.go index da96debc0..134e4eef9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_map_widget_definition_requests.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_map_widget_definition_requests.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o HostMapWidgetDefinitionRequests) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HostMapWidgetDefinitionRequests) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Fill *HostMapRequest `json:"fill,omitempty"` Size *HostMapRequest `json:"size,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,25 +128,24 @@ func (o *HostMapWidgetDefinitionRequests) UnmarshalJSON(bytes []byte) (err error } else { return err } + + hasInvalidField := false if all.Fill != nil && all.Fill.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Fill = all.Fill if all.Size != nil && all.Size.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Size = all.Size + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_map_widget_definition_style.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_map_widget_definition_style.go index 866bf8d6e..27fedd651 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_map_widget_definition_style.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_map_widget_definition_style.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -181,7 +181,6 @@ func (o HostMapWidgetDefinitionStyle) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HostMapWidgetDefinitionStyle) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { FillMax *string `json:"fill_max,omitempty"` FillMin *string `json:"fill_min,omitempty"` @@ -189,12 +188,7 @@ func (o *HostMapWidgetDefinitionStyle) UnmarshalJSON(bytes []byte) (err error) { PaletteFlip *bool `json:"palette_flip,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,6 +200,7 @@ func (o *HostMapWidgetDefinitionStyle) UnmarshalJSON(bytes []byte) (err error) { o.FillMin = all.FillMin o.Palette = all.Palette o.PaletteFlip = all.PaletteFlip + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_map_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_map_widget_definition_type.go index 390895f63..5cac8943f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_map_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_map_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // HostMapWidgetDefinitionType Type of the host map widget. @@ -61,47 +62,3 @@ func (v HostMapWidgetDefinitionType) IsValid() bool { func (v HostMapWidgetDefinitionType) Ptr() *HostMapWidgetDefinitionType { return &v } - -// NullableHostMapWidgetDefinitionType handles when a null is used for HostMapWidgetDefinitionType. -type NullableHostMapWidgetDefinitionType struct { - value *HostMapWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableHostMapWidgetDefinitionType) Get() *HostMapWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableHostMapWidgetDefinitionType) Set(val *HostMapWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableHostMapWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableHostMapWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableHostMapWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableHostMapWidgetDefinitionType(val *HostMapWidgetDefinitionType) *NullableHostMapWidgetDefinitionType { - return &NullableHostMapWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableHostMapWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableHostMapWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_meta.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_meta.go index f80ef23f4..60ec8fe58 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_meta.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_meta.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -544,7 +544,6 @@ func (o HostMeta) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HostMeta) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AgentChecks [][]interface{} `json:"agent_checks,omitempty"` AgentVersion *string `json:"agent_version,omitempty"` @@ -563,12 +562,7 @@ func (o *HostMeta) UnmarshalJSON(bytes []byte) (err error) { WinV []interface{} `json:"winV,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -576,17 +570,15 @@ func (o *HostMeta) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.AgentChecks = all.AgentChecks o.AgentVersion = all.AgentVersion o.CpuCores = all.CpuCores o.FbsdV = all.FbsdV o.Gohai = all.Gohai if all.InstallMethod != nil && all.InstallMethod.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.InstallMethod = all.InstallMethod o.MacV = all.MacV @@ -598,9 +590,14 @@ func (o *HostMeta) UnmarshalJSON(bytes []byte) (err error) { o.SocketFqdn = all.SocketFqdn o.SocketHostname = all.SocketHostname o.WinV = all.WinV + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_meta_install_method.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_meta_install_method.go index a1c0d0eaf..e37ca5b62 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_meta_install_method.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_meta_install_method.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o HostMetaInstallMethod) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HostMetaInstallMethod) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { InstallerVersion *string `json:"installer_version,omitempty"` Tool *string `json:"tool,omitempty"` ToolVersion *string `json:"tool_version,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *HostMetaInstallMethod) UnmarshalJSON(bytes []byte) (err error) { o.InstallerVersion = all.InstallerVersion o.Tool = all.Tool o.ToolVersion = all.ToolVersion + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_metrics.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_metrics.go index 654209015..81d6181fc 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_metrics.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_metrics.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o HostMetrics) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HostMetrics) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Cpu *float64 `json:"cpu,omitempty"` Iowait *float64 `json:"iowait,omitempty"` Load *float64 `json:"load,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *HostMetrics) UnmarshalJSON(bytes []byte) (err error) { o.Cpu = all.Cpu o.Iowait = all.Iowait o.Load = all.Load + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_mute_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_mute_response.go index 147a96355..039a06885 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_mute_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_mute_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -181,7 +181,6 @@ func (o HostMuteResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HostMuteResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Action *string `json:"action,omitempty"` End *int64 `json:"end,omitempty"` @@ -189,12 +188,7 @@ func (o *HostMuteResponse) UnmarshalJSON(bytes []byte) (err error) { Message *string `json:"message,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,6 +200,7 @@ func (o *HostMuteResponse) UnmarshalJSON(bytes []byte) (err error) { o.End = all.End o.Hostname = all.Hostname o.Message = all.Message + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_mute_settings.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_mute_settings.go index e3135c69e..9976a710a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_mute_settings.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_mute_settings.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o HostMuteSettings) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HostMuteSettings) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { End *int64 `json:"end,omitempty"` Message *string `json:"message,omitempty"` Override *bool `json:"override,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *HostMuteSettings) UnmarshalJSON(bytes []byte) (err error) { o.End = all.End o.Message = all.Message o.Override = all.Override + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_tags.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_tags.go index b6413138a..48698e3f5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_tags.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_tags.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o HostTags) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HostTags) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Host *string `json:"host,omitempty"` Tags []string `json:"tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *HostTags) UnmarshalJSON(bytes []byte) (err error) { } o.Host = all.Host o.Tags = all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_totals.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_totals.go index 49f90728a..6411e05ca 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_totals.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_host_totals.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o HostTotals) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HostTotals) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { TotalActive *int64 `json:"total_active,omitempty"` TotalUp *int64 `json:"total_up,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *HostTotals) UnmarshalJSON(bytes []byte) (err error) { } o.TotalActive = all.TotalActive o.TotalUp = all.TotalUp + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_hourly_usage_attribution_body.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_hourly_usage_attribution_body.go index d5d7d8611..e80fb55c0 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_hourly_usage_attribution_body.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_hourly_usage_attribution_body.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -356,7 +357,6 @@ func (o HourlyUsageAttributionBody) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HourlyUsageAttributionBody) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Hour *time.Time `json:"hour,omitempty"` OrgName *string `json:"org_name,omitempty"` @@ -369,12 +369,7 @@ func (o *HourlyUsageAttributionBody) UnmarshalJSON(bytes []byte) (err error) { UsageType *HourlyUsageAttributionUsageType `json:"usage_type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -382,14 +377,8 @@ func (o *HourlyUsageAttributionBody) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.UsageType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Hour = all.Hour o.OrgName = all.OrgName o.PublicId = all.PublicId @@ -398,10 +387,19 @@ func (o *HourlyUsageAttributionBody) UnmarshalJSON(bytes []byte) (err error) { o.Tags = all.Tags o.TotalUsageSum = all.TotalUsageSum o.UpdatedAt = all.UpdatedAt - o.UsageType = all.UsageType + if all.UsageType != nil && !all.UsageType.IsValid() { + hasInvalidField = true + } else { + o.UsageType = all.UsageType + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_hourly_usage_attribution_metadata.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_hourly_usage_attribution_metadata.go index 8c09d3150..94695d5b7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_hourly_usage_attribution_metadata.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_hourly_usage_attribution_metadata.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o HourlyUsageAttributionMetadata) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HourlyUsageAttributionMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Pagination *HourlyUsageAttributionPagination `json:"pagination,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *HourlyUsageAttributionMetadata) UnmarshalJSON(bytes []byte) (err error) } else { return err } + + hasInvalidField := false if all.Pagination != nil && all.Pagination.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Pagination = all.Pagination + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_hourly_usage_attribution_pagination.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_hourly_usage_attribution_pagination.go index 51bc2dad6..997d62ff5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_hourly_usage_attribution_pagination.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_hourly_usage_attribution_pagination.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -93,17 +93,11 @@ func (o HourlyUsageAttributionPagination) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HourlyUsageAttributionPagination) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { NextRecordId datadog.NullableString `json:"next_record_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -112,6 +106,7 @@ func (o *HourlyUsageAttributionPagination) UnmarshalJSON(bytes []byte) (err erro return err } o.NextRecordId = all.NextRecordId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_hourly_usage_attribution_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_hourly_usage_attribution_response.go index b6bd890ba..e36333a65 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_hourly_usage_attribution_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_hourly_usage_attribution_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o HourlyUsageAttributionResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HourlyUsageAttributionResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Metadata *HourlyUsageAttributionMetadata `json:"metadata,omitempty"` Usage []HourlyUsageAttributionBody `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *HourlyUsageAttributionResponse) UnmarshalJSON(bytes []byte) (err error) } else { return err } + + hasInvalidField := false if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Metadata = all.Metadata o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_hourly_usage_attribution_usage_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_hourly_usage_attribution_usage_type.go index 894fd9708..9e2ffa7dd 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_hourly_usage_attribution_usage_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_hourly_usage_attribution_usage_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // HourlyUsageAttributionUsageType Supported products for hourly usage attribution requests. @@ -17,10 +18,12 @@ const ( HOURLYUSAGEATTRIBUTIONUSAGETYPE_API_USAGE HourlyUsageAttributionUsageType = "api_usage" HOURLYUSAGEATTRIBUTIONUSAGETYPE_APM_FARGATE_USAGE HourlyUsageAttributionUsageType = "apm_fargate_usage" HOURLYUSAGEATTRIBUTIONUSAGETYPE_APM_HOST_USAGE HourlyUsageAttributionUsageType = "apm_host_usage" + HOURLYUSAGEATTRIBUTIONUSAGETYPE_APM_USM_USAGE HourlyUsageAttributionUsageType = "apm_usm_usage" HOURLYUSAGEATTRIBUTIONUSAGETYPE_APPSEC_FARGATE_USAGE HourlyUsageAttributionUsageType = "appsec_fargate_usage" HOURLYUSAGEATTRIBUTIONUSAGETYPE_APPSEC_USAGE HourlyUsageAttributionUsageType = "appsec_usage" HOURLYUSAGEATTRIBUTIONUSAGETYPE_BROWSER_USAGE HourlyUsageAttributionUsageType = "browser_usage" HOURLYUSAGEATTRIBUTIONUSAGETYPE_CONTAINER_EXCL_AGENT_USAGE HourlyUsageAttributionUsageType = "container_excl_agent_usage" + HOURLYUSAGEATTRIBUTIONUSAGETYPE_CI_VISIBILITY_ITR_USAGE HourlyUsageAttributionUsageType = "ci_visibility_itr_usage" HOURLYUSAGEATTRIBUTIONUSAGETYPE_CONTAINER_USAGE HourlyUsageAttributionUsageType = "container_usage" HOURLYUSAGEATTRIBUTIONUSAGETYPE_CSPM_CONTAINERS_USAGE HourlyUsageAttributionUsageType = "cspm_containers_usage" HOURLYUSAGEATTRIBUTIONUSAGETYPE_CSPM_HOSTS_USAGE HourlyUsageAttributionUsageType = "cspm_hosts_usage" @@ -47,16 +50,19 @@ const ( HOURLYUSAGEATTRIBUTIONUSAGETYPE_ESTIMATED_RUM_SESSIONS_USAGE HourlyUsageAttributionUsageType = "estimated_rum_sessions_usage" HOURLYUSAGEATTRIBUTIONUSAGETYPE_UNIVERSAL_SERVICE_MONITORING_USAGE HourlyUsageAttributionUsageType = "universal_service_monitoring_usage" HOURLYUSAGEATTRIBUTIONUSAGETYPE_VULN_MANAGEMENT_HOSTS_USAGE HourlyUsageAttributionUsageType = "vuln_management_hosts_usage" + HOURLYUSAGEATTRIBUTIONUSAGETYPE_SDS_SCANNED_BYTES_USAGE HourlyUsageAttributionUsageType = "sds_scanned_bytes_usage" ) var allowedHourlyUsageAttributionUsageTypeEnumValues = []HourlyUsageAttributionUsageType{ HOURLYUSAGEATTRIBUTIONUSAGETYPE_API_USAGE, HOURLYUSAGEATTRIBUTIONUSAGETYPE_APM_FARGATE_USAGE, HOURLYUSAGEATTRIBUTIONUSAGETYPE_APM_HOST_USAGE, + HOURLYUSAGEATTRIBUTIONUSAGETYPE_APM_USM_USAGE, HOURLYUSAGEATTRIBUTIONUSAGETYPE_APPSEC_FARGATE_USAGE, HOURLYUSAGEATTRIBUTIONUSAGETYPE_APPSEC_USAGE, HOURLYUSAGEATTRIBUTIONUSAGETYPE_BROWSER_USAGE, HOURLYUSAGEATTRIBUTIONUSAGETYPE_CONTAINER_EXCL_AGENT_USAGE, + HOURLYUSAGEATTRIBUTIONUSAGETYPE_CI_VISIBILITY_ITR_USAGE, HOURLYUSAGEATTRIBUTIONUSAGETYPE_CONTAINER_USAGE, HOURLYUSAGEATTRIBUTIONUSAGETYPE_CSPM_CONTAINERS_USAGE, HOURLYUSAGEATTRIBUTIONUSAGETYPE_CSPM_HOSTS_USAGE, @@ -83,6 +89,7 @@ var allowedHourlyUsageAttributionUsageTypeEnumValues = []HourlyUsageAttributionU HOURLYUSAGEATTRIBUTIONUSAGETYPE_ESTIMATED_RUM_SESSIONS_USAGE, HOURLYUSAGEATTRIBUTIONUSAGETYPE_UNIVERSAL_SERVICE_MONITORING_USAGE, HOURLYUSAGEATTRIBUTIONUSAGETYPE_VULN_MANAGEMENT_HOSTS_USAGE, + HOURLYUSAGEATTRIBUTIONUSAGETYPE_SDS_SCANNED_BYTES_USAGE, } // GetAllowedValues reeturns the list of possible values. @@ -125,47 +132,3 @@ func (v HourlyUsageAttributionUsageType) IsValid() bool { func (v HourlyUsageAttributionUsageType) Ptr() *HourlyUsageAttributionUsageType { return &v } - -// NullableHourlyUsageAttributionUsageType handles when a null is used for HourlyUsageAttributionUsageType. -type NullableHourlyUsageAttributionUsageType struct { - value *HourlyUsageAttributionUsageType - isSet bool -} - -// Get returns the associated value. -func (v NullableHourlyUsageAttributionUsageType) Get() *HourlyUsageAttributionUsageType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableHourlyUsageAttributionUsageType) Set(val *HourlyUsageAttributionUsageType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableHourlyUsageAttributionUsageType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableHourlyUsageAttributionUsageType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableHourlyUsageAttributionUsageType initializes the struct as if Set has been called. -func NewNullableHourlyUsageAttributionUsageType(val *HourlyUsageAttributionUsageType) *NullableHourlyUsageAttributionUsageType { - return &NullableHourlyUsageAttributionUsageType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableHourlyUsageAttributionUsageType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableHourlyUsageAttributionUsageType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_http_log_error.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_http_log_error.go index 986df0eeb..4d9631c66 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_http_log_error.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_http_log_error.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o HTTPLogError) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HTTPLogError) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Code *int32 `json:"code"` Message *string `json:"message"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Code == nil { return fmt.Errorf("required field code missing") @@ -131,6 +126,7 @@ func (o *HTTPLogError) UnmarshalJSON(bytes []byte) (err error) { } o.Code = *all.Code o.Message = *all.Message + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_http_log_item.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_http_log_item.go index 9826a66cf..560db5828 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_http_log_item.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_http_log_item.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -215,7 +216,6 @@ func (o HTTPLogItem) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HTTPLogItem) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Ddsource *string `json:"ddsource,omitempty"` Ddtags *string `json:"ddtags,omitempty"` @@ -224,12 +224,7 @@ func (o *HTTPLogItem) UnmarshalJSON(bytes []byte) (err error) { Service *string `json:"service,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Message == nil { return fmt.Errorf("required field message missing") @@ -245,6 +240,7 @@ func (o *HTTPLogItem) UnmarshalJSON(bytes []byte) (err error) { o.Hostname = all.Hostname o.Message = *all.Message o.Service = all.Service + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_i_frame_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_i_frame_widget_definition.go index 67d8bd3f4..e5f12061d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_i_frame_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_i_frame_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o IFrameWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IFrameWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Type *IFrameWidgetDefinitionType `json:"type"` Url *string `json:"url"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -131,19 +126,22 @@ func (o *IFrameWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type } - o.Type = *all.Type o.Url = *all.Url + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_i_frame_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_i_frame_widget_definition_type.go index 81950ff6d..e17f422fe 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_i_frame_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_i_frame_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // IFrameWidgetDefinitionType Type of the iframe widget. @@ -61,47 +62,3 @@ func (v IFrameWidgetDefinitionType) IsValid() bool { func (v IFrameWidgetDefinitionType) Ptr() *IFrameWidgetDefinitionType { return &v } - -// NullableIFrameWidgetDefinitionType handles when a null is used for IFrameWidgetDefinitionType. -type NullableIFrameWidgetDefinitionType struct { - value *IFrameWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableIFrameWidgetDefinitionType) Get() *IFrameWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIFrameWidgetDefinitionType) Set(val *IFrameWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIFrameWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIFrameWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIFrameWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableIFrameWidgetDefinitionType(val *IFrameWidgetDefinitionType) *NullableIFrameWidgetDefinitionType { - return &NullableIFrameWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIFrameWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIFrameWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_idp_form_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_idp_form_data.go index d51c7e4e5..6eb69437e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_idp_form_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_idp_form_data.go @@ -5,10 +5,11 @@ package datadogV1 import ( - "encoding/json" "fmt" "os" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -78,17 +79,11 @@ func (o IdpFormData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IdpFormData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IdpFile **os.File `json:"idp_file"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.IdpFile == nil { return fmt.Errorf("required field idp_file missing") @@ -100,6 +95,7 @@ func (o *IdpFormData) UnmarshalJSON(bytes []byte) (err error) { return err } o.IdpFile = *all.IdpFile + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_idp_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_idp_response.go index 76faed767..81b759b17 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_idp_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_idp_response.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o IdpResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IdpResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Message *string `json:"message"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Message == nil { return fmt.Errorf("required field message missing") @@ -99,6 +94,7 @@ func (o *IdpResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Message = *all.Message + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_image_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_image_widget_definition.go index 49acee531..6b35ea9f9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_image_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_image_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -347,7 +348,6 @@ func (o ImageWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ImageWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { HasBackground *bool `json:"has_background,omitempty"` HasBorder *bool `json:"has_border,omitempty"` @@ -360,12 +360,7 @@ func (o *ImageWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { VerticalAlign *WidgetVerticalAlign `json:"vertical_align,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -379,58 +374,45 @@ func (o *ImageWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.HorizontalAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Margin; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Sizing; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.VerticalAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.HasBackground = all.HasBackground o.HasBorder = all.HasBorder - o.HorizontalAlign = all.HorizontalAlign - o.Margin = all.Margin - o.Sizing = all.Sizing - o.Type = *all.Type + if all.HorizontalAlign != nil && !all.HorizontalAlign.IsValid() { + hasInvalidField = true + } else { + o.HorizontalAlign = all.HorizontalAlign + } + if all.Margin != nil && !all.Margin.IsValid() { + hasInvalidField = true + } else { + o.Margin = all.Margin + } + if all.Sizing != nil && !all.Sizing.IsValid() { + hasInvalidField = true + } else { + o.Sizing = all.Sizing + } + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } o.Url = *all.Url o.UrlDarkTheme = all.UrlDarkTheme - o.VerticalAlign = all.VerticalAlign + if all.VerticalAlign != nil && !all.VerticalAlign.IsValid() { + hasInvalidField = true + } else { + o.VerticalAlign = all.VerticalAlign + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_image_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_image_widget_definition_type.go index 2b3e27372..c832f9b3c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_image_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_image_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ImageWidgetDefinitionType Type of the image widget. @@ -61,47 +62,3 @@ func (v ImageWidgetDefinitionType) IsValid() bool { func (v ImageWidgetDefinitionType) Ptr() *ImageWidgetDefinitionType { return &v } - -// NullableImageWidgetDefinitionType handles when a null is used for ImageWidgetDefinitionType. -type NullableImageWidgetDefinitionType struct { - value *ImageWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableImageWidgetDefinitionType) Get() *ImageWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableImageWidgetDefinitionType) Set(val *ImageWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableImageWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableImageWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableImageWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableImageWidgetDefinitionType(val *ImageWidgetDefinitionType) *NullableImageWidgetDefinitionType { - return &NullableImageWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableImageWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableImageWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_intake_payload_accepted.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_intake_payload_accepted.go index 6de5da6eb..46326db5a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_intake_payload_accepted.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_intake_payload_accepted.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o IntakePayloadAccepted) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IntakePayloadAccepted) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Status *string `json:"status,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *IntakePayloadAccepted) UnmarshalJSON(bytes []byte) (err error) { return err } o.Status = all.Status + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_agents.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_agents.go index cf3445baf..67a191d0f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_agents.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_agents.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o IPPrefixesAgents) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IPPrefixesAgents) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *IPPrefixesAgents) UnmarshalJSON(bytes []byte) (err error) { } o.PrefixesIpv4 = all.PrefixesIpv4 o.PrefixesIpv6 = all.PrefixesIpv6 + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_api.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_api.go index 99a7d5e62..84b032004 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_api.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_api.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o IPPrefixesAPI) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IPPrefixesAPI) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *IPPrefixesAPI) UnmarshalJSON(bytes []byte) (err error) { } o.PrefixesIpv4 = all.PrefixesIpv4 o.PrefixesIpv6 = all.PrefixesIpv6 + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_apm.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_apm.go index a5a737b51..67c390c3b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_apm.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_apm.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o IPPrefixesAPM) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IPPrefixesAPM) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *IPPrefixesAPM) UnmarshalJSON(bytes []byte) (err error) { } o.PrefixesIpv4 = all.PrefixesIpv4 o.PrefixesIpv6 = all.PrefixesIpv6 + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_logs.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_logs.go index 19659b458..5aa95330f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_logs.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_logs.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o IPPrefixesLogs) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IPPrefixesLogs) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *IPPrefixesLogs) UnmarshalJSON(bytes []byte) (err error) { } o.PrefixesIpv4 = all.PrefixesIpv4 o.PrefixesIpv6 = all.PrefixesIpv6 + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_orchestrator.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_orchestrator.go index 88e2d38f0..4be0d20f3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_orchestrator.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_orchestrator.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o IPPrefixesOrchestrator) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IPPrefixesOrchestrator) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *IPPrefixesOrchestrator) UnmarshalJSON(bytes []byte) (err error) { } o.PrefixesIpv4 = all.PrefixesIpv4 o.PrefixesIpv6 = all.PrefixesIpv6 + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_process.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_process.go index f56bb60a1..1d4862df7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_process.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_process.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o IPPrefixesProcess) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IPPrefixesProcess) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *IPPrefixesProcess) UnmarshalJSON(bytes []byte) (err error) { } o.PrefixesIpv4 = all.PrefixesIpv4 o.PrefixesIpv6 = all.PrefixesIpv6 + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_remote_configuration.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_remote_configuration.go new file mode 100644 index 000000000..eedaee240 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_remote_configuration.go @@ -0,0 +1,139 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV1 + +import ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IPPrefixesRemoteConfiguration Available prefix information for the Remote Configuration endpoints. +type IPPrefixesRemoteConfiguration struct { + // List of IPv4 prefixes. + PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` + // List of IPv6 prefixes. + PrefixesIpv6 []string `json:"prefixes_ipv6,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{} +} + +// NewIPPrefixesRemoteConfiguration instantiates a new IPPrefixesRemoteConfiguration 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 NewIPPrefixesRemoteConfiguration() *IPPrefixesRemoteConfiguration { + this := IPPrefixesRemoteConfiguration{} + return &this +} + +// NewIPPrefixesRemoteConfigurationWithDefaults instantiates a new IPPrefixesRemoteConfiguration 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 NewIPPrefixesRemoteConfigurationWithDefaults() *IPPrefixesRemoteConfiguration { + this := IPPrefixesRemoteConfiguration{} + return &this +} + +// GetPrefixesIpv4 returns the PrefixesIpv4 field value if set, zero value otherwise. +func (o *IPPrefixesRemoteConfiguration) GetPrefixesIpv4() []string { + if o == nil || o.PrefixesIpv4 == nil { + var ret []string + return ret + } + return o.PrefixesIpv4 +} + +// GetPrefixesIpv4Ok returns a tuple with the PrefixesIpv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPPrefixesRemoteConfiguration) GetPrefixesIpv4Ok() (*[]string, bool) { + if o == nil || o.PrefixesIpv4 == nil { + return nil, false + } + return &o.PrefixesIpv4, true +} + +// HasPrefixesIpv4 returns a boolean if a field has been set. +func (o *IPPrefixesRemoteConfiguration) HasPrefixesIpv4() bool { + return o != nil && o.PrefixesIpv4 != nil +} + +// SetPrefixesIpv4 gets a reference to the given []string and assigns it to the PrefixesIpv4 field. +func (o *IPPrefixesRemoteConfiguration) SetPrefixesIpv4(v []string) { + o.PrefixesIpv4 = v +} + +// GetPrefixesIpv6 returns the PrefixesIpv6 field value if set, zero value otherwise. +func (o *IPPrefixesRemoteConfiguration) GetPrefixesIpv6() []string { + if o == nil || o.PrefixesIpv6 == nil { + var ret []string + return ret + } + return o.PrefixesIpv6 +} + +// GetPrefixesIpv6Ok returns a tuple with the PrefixesIpv6 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPPrefixesRemoteConfiguration) GetPrefixesIpv6Ok() (*[]string, bool) { + if o == nil || o.PrefixesIpv6 == nil { + return nil, false + } + return &o.PrefixesIpv6, true +} + +// HasPrefixesIpv6 returns a boolean if a field has been set. +func (o *IPPrefixesRemoteConfiguration) HasPrefixesIpv6() bool { + return o != nil && o.PrefixesIpv6 != nil +} + +// SetPrefixesIpv6 gets a reference to the given []string and assigns it to the PrefixesIpv6 field. +func (o *IPPrefixesRemoteConfiguration) SetPrefixesIpv6(v []string) { + o.PrefixesIpv6 = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IPPrefixesRemoteConfiguration) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.PrefixesIpv4 != nil { + toSerialize["prefixes_ipv4"] = o.PrefixesIpv4 + } + if o.PrefixesIpv6 != nil { + toSerialize["prefixes_ipv6"] = o.PrefixesIpv6 + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IPPrefixesRemoteConfiguration) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` + PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"prefixes_ipv4", "prefixes_ipv6"}) + } else { + return err + } + o.PrefixesIpv4 = all.PrefixesIpv4 + o.PrefixesIpv6 = all.PrefixesIpv6 + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_synthetics.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_synthetics.go index 175665e31..11c218041 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_synthetics.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_synthetics.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -181,7 +181,6 @@ func (o IPPrefixesSynthetics) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IPPrefixesSynthetics) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` PrefixesIpv4ByLocation map[string][]string `json:"prefixes_ipv4_by_location,omitempty"` @@ -189,12 +188,7 @@ func (o *IPPrefixesSynthetics) UnmarshalJSON(bytes []byte) (err error) { PrefixesIpv6ByLocation map[string][]string `json:"prefixes_ipv6_by_location,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,6 +200,7 @@ func (o *IPPrefixesSynthetics) UnmarshalJSON(bytes []byte) (err error) { o.PrefixesIpv4ByLocation = all.PrefixesIpv4ByLocation o.PrefixesIpv6 = all.PrefixesIpv6 o.PrefixesIpv6ByLocation = all.PrefixesIpv6ByLocation + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_synthetics_private_locations.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_synthetics_private_locations.go index 5ce9344a5..69a8f435c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_synthetics_private_locations.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_synthetics_private_locations.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o IPPrefixesSyntheticsPrivateLocations) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IPPrefixesSyntheticsPrivateLocations) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *IPPrefixesSyntheticsPrivateLocations) UnmarshalJSON(bytes []byte) (err } o.PrefixesIpv4 = all.PrefixesIpv4 o.PrefixesIpv6 = all.PrefixesIpv6 + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_webhooks.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_webhooks.go index 580c2e5d3..327735ce7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_webhooks.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_prefixes_webhooks.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o IPPrefixesWebhooks) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IPPrefixesWebhooks) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *IPPrefixesWebhooks) UnmarshalJSON(bytes []byte) (err error) { } o.PrefixesIpv4 = all.PrefixesIpv4 o.PrefixesIpv6 = all.PrefixesIpv6 + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_ranges.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_ranges.go index 366f50539..6dbc2d088 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_ranges.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_ip_ranges.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -26,6 +26,8 @@ type IPRanges struct { Orchestrator *IPPrefixesOrchestrator `json:"orchestrator,omitempty"` // Available prefix information for the Process endpoints. Process *IPPrefixesProcess `json:"process,omitempty"` + // Available prefix information for the Remote Configuration endpoints. + RemoteConfiguration *IPPrefixesRemoteConfiguration `json:"remote-configuration,omitempty"` // Available prefix information for the Synthetics endpoints. Synthetics *IPPrefixesSynthetics `json:"synthetics,omitempty"` // Available prefix information for the Synthetics Private Locations endpoints. @@ -252,6 +254,34 @@ func (o *IPRanges) SetProcess(v IPPrefixesProcess) { o.Process = &v } +// GetRemoteConfiguration returns the RemoteConfiguration field value if set, zero value otherwise. +func (o *IPRanges) GetRemoteConfiguration() IPPrefixesRemoteConfiguration { + if o == nil || o.RemoteConfiguration == nil { + var ret IPPrefixesRemoteConfiguration + return ret + } + return *o.RemoteConfiguration +} + +// GetRemoteConfigurationOk returns a tuple with the RemoteConfiguration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPRanges) GetRemoteConfigurationOk() (*IPPrefixesRemoteConfiguration, bool) { + if o == nil || o.RemoteConfiguration == nil { + return nil, false + } + return o.RemoteConfiguration, true +} + +// HasRemoteConfiguration returns a boolean if a field has been set. +func (o *IPRanges) HasRemoteConfiguration() bool { + return o != nil && o.RemoteConfiguration != nil +} + +// SetRemoteConfiguration gets a reference to the given IPPrefixesRemoteConfiguration and assigns it to the RemoteConfiguration field. +func (o *IPRanges) SetRemoteConfiguration(v IPPrefixesRemoteConfiguration) { + o.RemoteConfiguration = &v +} + // GetSynthetics returns the Synthetics field value if set, zero value otherwise. func (o *IPRanges) GetSynthetics() IPPrefixesSynthetics { if o == nil || o.Synthetics == nil { @@ -391,6 +421,9 @@ func (o IPRanges) MarshalJSON() ([]byte, error) { if o.Process != nil { toSerialize["process"] = o.Process } + if o.RemoteConfiguration != nil { + toSerialize["remote-configuration"] = o.RemoteConfiguration + } if o.Synthetics != nil { toSerialize["synthetics"] = o.Synthetics } @@ -412,7 +445,6 @@ func (o IPRanges) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IPRanges) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Agents *IPPrefixesAgents `json:"agents,omitempty"` Api *IPPrefixesAPI `json:"api,omitempty"` @@ -421,102 +453,73 @@ func (o *IPRanges) UnmarshalJSON(bytes []byte) (err error) { Modified *string `json:"modified,omitempty"` Orchestrator *IPPrefixesOrchestrator `json:"orchestrator,omitempty"` Process *IPPrefixesProcess `json:"process,omitempty"` + RemoteConfiguration *IPPrefixesRemoteConfiguration `json:"remote-configuration,omitempty"` Synthetics *IPPrefixesSynthetics `json:"synthetics,omitempty"` SyntheticsPrivateLocations *IPPrefixesSyntheticsPrivateLocations `json:"synthetics-private-locations,omitempty"` Version *int64 `json:"version,omitempty"` Webhooks *IPPrefixesWebhooks `json:"webhooks,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"agents", "api", "apm", "logs", "modified", "orchestrator", "process", "synthetics", "synthetics-private-locations", "version", "webhooks"}) + datadog.DeleteKeys(additionalProperties, &[]string{"agents", "api", "apm", "logs", "modified", "orchestrator", "process", "remote-configuration", "synthetics", "synthetics-private-locations", "version", "webhooks"}) } else { return err } + + hasInvalidField := false if all.Agents != nil && all.Agents.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Agents = all.Agents if all.Api != nil && all.Api.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Api = all.Api if all.Apm != nil && all.Apm.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Apm = all.Apm if all.Logs != nil && all.Logs.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Logs = all.Logs o.Modified = all.Modified if all.Orchestrator != nil && all.Orchestrator.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Orchestrator = all.Orchestrator if all.Process != nil && all.Process.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Process = all.Process + if all.RemoteConfiguration != nil && all.RemoteConfiguration.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.RemoteConfiguration = all.RemoteConfiguration if all.Synthetics != nil && all.Synthetics.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Synthetics = all.Synthetics if all.SyntheticsPrivateLocations != nil && all.SyntheticsPrivateLocations.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.SyntheticsPrivateLocations = all.SyntheticsPrivateLocations o.Version = all.Version if all.Webhooks != nil && all.Webhooks.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Webhooks = all.Webhooks + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_column.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_column.go index bc568b7c0..36e376531 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_column.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_column.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o ListStreamColumn) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ListStreamColumn) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Field *string `json:"field"` Width *ListStreamColumnWidth `json:"width"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Field == nil { return fmt.Errorf("required field field missing") @@ -129,19 +124,22 @@ func (o *ListStreamColumn) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Width; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Field = *all.Field - o.Width = *all.Width + if !all.Width.IsValid() { + hasInvalidField = true + } else { + o.Width = *all.Width + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_column_width.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_column_width.go index 4ab5d5d56..b19754298 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_column_width.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_column_width.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ListStreamColumnWidth Widget column width. @@ -65,47 +66,3 @@ func (v ListStreamColumnWidth) IsValid() bool { func (v ListStreamColumnWidth) Ptr() *ListStreamColumnWidth { return &v } - -// NullableListStreamColumnWidth handles when a null is used for ListStreamColumnWidth. -type NullableListStreamColumnWidth struct { - value *ListStreamColumnWidth - isSet bool -} - -// Get returns the associated value. -func (v NullableListStreamColumnWidth) Get() *ListStreamColumnWidth { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableListStreamColumnWidth) Set(val *ListStreamColumnWidth) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableListStreamColumnWidth) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableListStreamColumnWidth) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableListStreamColumnWidth initializes the struct as if Set has been called. -func NewNullableListStreamColumnWidth(val *ListStreamColumnWidth) *NullableListStreamColumnWidth { - return &NullableListStreamColumnWidth{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableListStreamColumnWidth) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableListStreamColumnWidth) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_compute_aggregation.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_compute_aggregation.go index 2a23e2c3b..1ea50a2ba 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_compute_aggregation.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_compute_aggregation.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ListStreamComputeAggregation Aggregation value. @@ -89,47 +90,3 @@ func (v ListStreamComputeAggregation) IsValid() bool { func (v ListStreamComputeAggregation) Ptr() *ListStreamComputeAggregation { return &v } - -// NullableListStreamComputeAggregation handles when a null is used for ListStreamComputeAggregation. -type NullableListStreamComputeAggregation struct { - value *ListStreamComputeAggregation - isSet bool -} - -// Get returns the associated value. -func (v NullableListStreamComputeAggregation) Get() *ListStreamComputeAggregation { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableListStreamComputeAggregation) Set(val *ListStreamComputeAggregation) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableListStreamComputeAggregation) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableListStreamComputeAggregation) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableListStreamComputeAggregation initializes the struct as if Set has been called. -func NewNullableListStreamComputeAggregation(val *ListStreamComputeAggregation) *NullableListStreamComputeAggregation { - return &NullableListStreamComputeAggregation{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableListStreamComputeAggregation) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableListStreamComputeAggregation) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_compute_items.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_compute_items.go index 3cebddcff..1d9c67a0b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_compute_items.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_compute_items.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o ListStreamComputeItems) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ListStreamComputeItems) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregation *ListStreamComputeAggregation `json:"aggregation"` Facet *string `json:"facet,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Aggregation == nil { return fmt.Errorf("required field aggregation missing") @@ -132,19 +127,22 @@ func (o *ListStreamComputeItems) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Aggregation; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if !all.Aggregation.IsValid() { + hasInvalidField = true + } else { + o.Aggregation = *all.Aggregation } - o.Aggregation = *all.Aggregation o.Facet = all.Facet + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_group_by_items.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_group_by_items.go index 6592b75db..e3463b964 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_group_by_items.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_group_by_items.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o ListStreamGroupByItems) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ListStreamGroupByItems) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Facet *string `json:"facet"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Facet == nil { return fmt.Errorf("required field facet missing") @@ -99,6 +94,7 @@ func (o *ListStreamGroupByItems) UnmarshalJSON(bytes []byte) (err error) { return err } o.Facet = *all.Facet + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_query.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_query.go index c4119982e..972293aac 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_query.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_query.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -304,7 +305,6 @@ func (o ListStreamQuery) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ListStreamQuery) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Compute []ListStreamComputeItems `json:"compute,omitempty"` DataSource *ListStreamSource `json:"data_source"` @@ -316,12 +316,7 @@ func (o *ListStreamQuery) UnmarshalJSON(bytes []byte) (err error) { Storage *string `json:"storage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.DataSource == nil { return fmt.Errorf("required field data_source missing") @@ -335,40 +330,35 @@ func (o *ListStreamQuery) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.DataSource; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.EventSize; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Compute = all.Compute - o.DataSource = *all.DataSource - o.EventSize = all.EventSize + if !all.DataSource.IsValid() { + hasInvalidField = true + } else { + o.DataSource = *all.DataSource + } + if all.EventSize != nil && !all.EventSize.IsValid() { + hasInvalidField = true + } else { + o.EventSize = all.EventSize + } o.GroupBy = all.GroupBy o.Indexes = all.Indexes o.QueryString = *all.QueryString if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Sort = all.Sort o.Storage = all.Storage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_response_format.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_response_format.go index e1f4c5b1f..5488aca85 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_response_format.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_response_format.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ListStreamResponseFormat Widget response format. @@ -61,47 +62,3 @@ func (v ListStreamResponseFormat) IsValid() bool { func (v ListStreamResponseFormat) Ptr() *ListStreamResponseFormat { return &v } - -// NullableListStreamResponseFormat handles when a null is used for ListStreamResponseFormat. -type NullableListStreamResponseFormat struct { - value *ListStreamResponseFormat - isSet bool -} - -// Get returns the associated value. -func (v NullableListStreamResponseFormat) Get() *ListStreamResponseFormat { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableListStreamResponseFormat) Set(val *ListStreamResponseFormat) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableListStreamResponseFormat) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableListStreamResponseFormat) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableListStreamResponseFormat initializes the struct as if Set has been called. -func NewNullableListStreamResponseFormat(val *ListStreamResponseFormat) *NullableListStreamResponseFormat { - return &NullableListStreamResponseFormat{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableListStreamResponseFormat) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableListStreamResponseFormat) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_source.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_source.go index 8bac46468..f85bfd69c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_source.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_source.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ListStreamSource Source from which to query items to display in the stream. @@ -79,47 +80,3 @@ func (v ListStreamSource) IsValid() bool { func (v ListStreamSource) Ptr() *ListStreamSource { return &v } - -// NullableListStreamSource handles when a null is used for ListStreamSource. -type NullableListStreamSource struct { - value *ListStreamSource - isSet bool -} - -// Get returns the associated value. -func (v NullableListStreamSource) Get() *ListStreamSource { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableListStreamSource) Set(val *ListStreamSource) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableListStreamSource) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableListStreamSource) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableListStreamSource initializes the struct as if Set has been called. -func NewNullableListStreamSource(val *ListStreamSource) *NullableListStreamSource { - return &NullableListStreamSource{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableListStreamSource) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableListStreamSource) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_widget_definition.go index 9d7d208bd..1e1ac570f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_widget_definition.go @@ -5,15 +5,15 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // ListStreamWidgetDefinition The list stream visualization displays a table of recent events in your application that // match a search criteria using user-defined columns. -// type ListStreamWidgetDefinition struct { // Available legend sizes for a widget. Should be one of "0", "2", "4", "8", "16", or "auto". LegendSize *string `json:"legend_size,omitempty"` @@ -306,7 +306,6 @@ func (o ListStreamWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ListStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { LegendSize *string `json:"legend_size,omitempty"` Requests *[]ListStreamWidgetRequest `json:"requests"` @@ -318,12 +317,7 @@ func (o *ListStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { Type *ListStreamWidgetDefinitionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Requests == nil { return fmt.Errorf("required field requests missing") @@ -337,40 +331,35 @@ func (o *ListStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.LegendSize = all.LegendSize o.Requests = *all.Requests o.ShowLegend = all.ShowLegend if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Time = all.Time o.Title = all.Title - o.TitleAlign = all.TitleAlign + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } o.TitleSize = all.TitleSize - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_widget_definition_type.go index 5b2c2e5d1..2c237efa8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ListStreamWidgetDefinitionType Type of the list stream widget. @@ -61,47 +62,3 @@ func (v ListStreamWidgetDefinitionType) IsValid() bool { func (v ListStreamWidgetDefinitionType) Ptr() *ListStreamWidgetDefinitionType { return &v } - -// NullableListStreamWidgetDefinitionType handles when a null is used for ListStreamWidgetDefinitionType. -type NullableListStreamWidgetDefinitionType struct { - value *ListStreamWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableListStreamWidgetDefinitionType) Get() *ListStreamWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableListStreamWidgetDefinitionType) Set(val *ListStreamWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableListStreamWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableListStreamWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableListStreamWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableListStreamWidgetDefinitionType(val *ListStreamWidgetDefinitionType) *NullableListStreamWidgetDefinitionType { - return &NullableListStreamWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableListStreamWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableListStreamWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_widget_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_widget_request.go index 4caa3f169..5c455f65c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_widget_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_list_stream_widget_request.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -131,19 +132,13 @@ func (o ListStreamWidgetRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ListStreamWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Columns *[]ListStreamColumn `json:"columns"` Query *ListStreamQuery `json:"query"` ResponseFormat *ListStreamResponseFormat `json:"response_format"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Columns == nil { return fmt.Errorf("required field columns missing") @@ -160,27 +155,26 @@ func (o *ListStreamWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.ResponseFormat; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Columns = *all.Columns if all.Query.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Query = *all.Query - o.ResponseFormat = *all.ResponseFormat + if !all.ResponseFormat.IsValid() { + hasInvalidField = true + } else { + o.ResponseFormat = *all.ResponseFormat + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log.go index 19234b0c5..d8bafc69b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o Log) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Log) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Content *LogContent `json:"content,omitempty"` Id *string `json:"id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *Log) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Content != nil && all.Content.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Content = all.Content o.Id = all.Id + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_content.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_content.go index afbe84aa1..96229d9a5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_content.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_content.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -256,7 +257,6 @@ func (o LogContent) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogContent) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes map[string]interface{} `json:"attributes,omitempty"` Host *string `json:"host,omitempty"` @@ -266,12 +266,7 @@ func (o *LogContent) UnmarshalJSON(bytes []byte) (err error) { Timestamp *time.Time `json:"timestamp,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -285,6 +280,7 @@ func (o *LogContent) UnmarshalJSON(bytes []byte) (err error) { o.Service = all.Service o.Tags = all.Tags o.Timestamp = all.Timestamp + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_query_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_query_definition.go index 9be51ecc2..8444d1bee 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_query_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_query_definition.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -214,7 +214,6 @@ func (o LogQueryDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Compute *LogsQueryCompute `json:"compute,omitempty"` GroupBy []LogQueryDefinitionGroupBy `json:"group_by,omitempty"` @@ -223,12 +222,7 @@ func (o *LogQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { Search *LogQueryDefinitionSearch `json:"search,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -236,28 +230,27 @@ func (o *LogQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Compute != nil && all.Compute.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Compute = all.Compute o.GroupBy = all.GroupBy o.Index = all.Index o.MultiCompute = all.MultiCompute if all.Search != nil && all.Search.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Search = all.Search + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_query_definition_group_by.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_query_definition_group_by.go index 940becb91..e37f1665b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_query_definition_group_by.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_query_definition_group_by.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -143,19 +144,13 @@ func (o LogQueryDefinitionGroupBy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogQueryDefinitionGroupBy) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Facet *string `json:"facet"` Limit *int64 `json:"limit,omitempty"` Sort *LogQueryDefinitionGroupBySort `json:"sort,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Facet == nil { return fmt.Errorf("required field facet missing") @@ -166,19 +161,22 @@ func (o *LogQueryDefinitionGroupBy) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Facet = *all.Facet o.Limit = all.Limit if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Sort = all.Sort + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_query_definition_group_by_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_query_definition_group_by_sort.go index e53dce115..e9997a06d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_query_definition_group_by_sort.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_query_definition_group_by_sort.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -137,19 +138,13 @@ func (o LogQueryDefinitionGroupBySort) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogQueryDefinitionGroupBySort) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregation *string `json:"aggregation"` Facet *string `json:"facet,omitempty"` Order *WidgetSort `json:"order"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Aggregation == nil { return fmt.Errorf("required field aggregation missing") @@ -163,20 +158,23 @@ func (o *LogQueryDefinitionGroupBySort) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.Order; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Aggregation = *all.Aggregation o.Facet = all.Facet - o.Order = *all.Order + if !all.Order.IsValid() { + hasInvalidField = true + } else { + o.Order = *all.Order + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_query_definition_search.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_query_definition_search.go index 6635a4257..5467f622d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_query_definition_search.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_query_definition_search.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o LogQueryDefinitionSearch) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogQueryDefinitionSearch) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Query *string `json:"query"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Query == nil { return fmt.Errorf("required field query missing") @@ -99,6 +94,7 @@ func (o *LogQueryDefinitionSearch) UnmarshalJSON(bytes []byte) (err error) { return err } o.Query = *all.Query + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_stream_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_stream_widget_definition.go index 903d0bf1b..97af8fd7b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_stream_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_stream_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -479,7 +480,6 @@ func (o LogStreamWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Columns []string `json:"columns,omitempty"` Indexes []string `json:"indexes,omitempty"` @@ -496,12 +496,7 @@ func (o *LogStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { Type *LogStreamWidgetDefinitionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -512,60 +507,47 @@ func (o *LogStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.MessageDisplay; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Columns = all.Columns o.Indexes = all.Indexes o.Logset = all.Logset - o.MessageDisplay = all.MessageDisplay + if all.MessageDisplay != nil && !all.MessageDisplay.IsValid() { + hasInvalidField = true + } else { + o.MessageDisplay = all.MessageDisplay + } o.Query = all.Query o.ShowDateColumn = all.ShowDateColumn o.ShowMessageColumn = all.ShowMessageColumn if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Sort = all.Sort if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Time = all.Time o.Title = all.Title - o.TitleAlign = all.TitleAlign + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } o.TitleSize = all.TitleSize - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_stream_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_stream_widget_definition_type.go index 5ba280e25..a157574a6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_stream_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_log_stream_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogStreamWidgetDefinitionType Type of the log stream widget. @@ -61,47 +62,3 @@ func (v LogStreamWidgetDefinitionType) IsValid() bool { func (v LogStreamWidgetDefinitionType) Ptr() *LogStreamWidgetDefinitionType { return &v } - -// NullableLogStreamWidgetDefinitionType handles when a null is used for LogStreamWidgetDefinitionType. -type NullableLogStreamWidgetDefinitionType struct { - value *LogStreamWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogStreamWidgetDefinitionType) Get() *LogStreamWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogStreamWidgetDefinitionType) Set(val *LogStreamWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogStreamWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogStreamWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogStreamWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableLogStreamWidgetDefinitionType(val *LogStreamWidgetDefinitionType) *NullableLogStreamWidgetDefinitionType { - return &NullableLogStreamWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogStreamWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogStreamWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_api_error.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_api_error.go index 2d2848830..7249a439d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_api_error.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_api_error.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o LogsAPIError) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsAPIError) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Code *string `json:"code,omitempty"` Details []LogsAPIError `json:"details,omitempty"` Message *string `json:"message,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *LogsAPIError) UnmarshalJSON(bytes []byte) (err error) { o.Code = all.Code o.Details = all.Details o.Message = all.Message + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_api_error_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_api_error_response.go index ab9636ecf..e6d9ac17c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_api_error_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_api_error_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o LogsAPIErrorResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsAPIErrorResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Error *LogsAPIError `json:"error,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *LogsAPIErrorResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Error != nil && all.Error.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Error = all.Error + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_arithmetic_processor.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_arithmetic_processor.go index 76c13420e..119f2c65e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_arithmetic_processor.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_arithmetic_processor.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -26,12 +27,12 @@ import ( // // *Notes*: // -// - The operator `-` needs to be space split in the formula as it can also be contained in attribute names. -// - If the target attribute already exists, it is overwritten by the result of the formula. -// - Results are rounded up to the 9th decimal. For example, if the result of the formula is `0.1234567891`, -// the actual value stored for the attribute is `0.123456789`. -// - If you need to scale a unit of measure, -// see [Scale Filter](https://docs.datadoghq.com/logs/log_configuration/parsing/?tab=filter#matcher-and-filter). +// - The operator `-` needs to be space split in the formula as it can also be contained in attribute names. +// - If the target attribute already exists, it is overwritten by the result of the formula. +// - Results are rounded up to the 9th decimal. For example, if the result of the formula is `0.1234567891`, +// the actual value stored for the attribute is `0.123456789`. +// - If you need to scale a unit of measure, +// see [Scale Filter](https://docs.datadoghq.com/logs/log_configuration/parsing/?tab=filter#matcher-and-filter). type LogsArithmeticProcessor struct { // Arithmetic operation between one or more log attributes. Expression string `json:"expression"` @@ -261,7 +262,6 @@ func (o LogsArithmeticProcessor) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArithmeticProcessor) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Expression *string `json:"expression"` IsEnabled *bool `json:"is_enabled,omitempty"` @@ -271,12 +271,7 @@ func (o *LogsArithmeticProcessor) UnmarshalJSON(bytes []byte) (err error) { Type *LogsArithmeticProcessorType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Expression == nil { return fmt.Errorf("required field expression missing") @@ -293,23 +288,26 @@ func (o *LogsArithmeticProcessor) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Expression = *all.Expression o.IsEnabled = all.IsEnabled o.IsReplaceMissing = all.IsReplaceMissing o.Name = all.Name o.Target = *all.Target - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_arithmetic_processor_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_arithmetic_processor_type.go index 25cf188b0..c0b10734d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_arithmetic_processor_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_arithmetic_processor_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsArithmeticProcessorType Type of logs arithmetic processor. @@ -61,47 +62,3 @@ func (v LogsArithmeticProcessorType) IsValid() bool { func (v LogsArithmeticProcessorType) Ptr() *LogsArithmeticProcessorType { return &v } - -// NullableLogsArithmeticProcessorType handles when a null is used for LogsArithmeticProcessorType. -type NullableLogsArithmeticProcessorType struct { - value *LogsArithmeticProcessorType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsArithmeticProcessorType) Get() *LogsArithmeticProcessorType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsArithmeticProcessorType) Set(val *LogsArithmeticProcessorType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsArithmeticProcessorType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsArithmeticProcessorType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsArithmeticProcessorType initializes the struct as if Set has been called. -func NewNullableLogsArithmeticProcessorType(val *LogsArithmeticProcessorType) *NullableLogsArithmeticProcessorType { - return &NullableLogsArithmeticProcessorType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsArithmeticProcessorType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsArithmeticProcessorType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_attribute_remapper.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_attribute_remapper.go index 81bf01852..8fffe8770 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_attribute_remapper.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_attribute_remapper.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -388,7 +389,6 @@ func (o LogsAttributeRemapper) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsAttributeRemapper) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IsEnabled *bool `json:"is_enabled,omitempty"` Name *string `json:"name,omitempty"` @@ -402,12 +402,7 @@ func (o *LogsAttributeRemapper) UnmarshalJSON(bytes []byte) (err error) { Type *LogsAttributeRemapperType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Sources == nil { return fmt.Errorf("required field sources missing") @@ -424,22 +419,8 @@ func (o *LogsAttributeRemapper) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.TargetFormat; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.IsEnabled = all.IsEnabled o.Name = all.Name o.OverrideOnConflict = all.OverrideOnConflict @@ -447,12 +428,25 @@ func (o *LogsAttributeRemapper) UnmarshalJSON(bytes []byte) (err error) { o.SourceType = all.SourceType o.Sources = *all.Sources o.Target = *all.Target - o.TargetFormat = all.TargetFormat + if all.TargetFormat != nil && !all.TargetFormat.IsValid() { + hasInvalidField = true + } else { + o.TargetFormat = all.TargetFormat + } o.TargetType = all.TargetType - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_attribute_remapper_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_attribute_remapper_type.go index 8bc719e1b..5e90e47a9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_attribute_remapper_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_attribute_remapper_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsAttributeRemapperType Type of logs attribute remapper. @@ -61,47 +62,3 @@ func (v LogsAttributeRemapperType) IsValid() bool { func (v LogsAttributeRemapperType) Ptr() *LogsAttributeRemapperType { return &v } - -// NullableLogsAttributeRemapperType handles when a null is used for LogsAttributeRemapperType. -type NullableLogsAttributeRemapperType struct { - value *LogsAttributeRemapperType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsAttributeRemapperType) Get() *LogsAttributeRemapperType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsAttributeRemapperType) Set(val *LogsAttributeRemapperType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsAttributeRemapperType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsAttributeRemapperType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsAttributeRemapperType initializes the struct as if Set has been called. -func NewNullableLogsAttributeRemapperType(val *LogsAttributeRemapperType) *NullableLogsAttributeRemapperType { - return &NullableLogsAttributeRemapperType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsAttributeRemapperType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsAttributeRemapperType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_by_retention.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_by_retention.go index 61f7a360c..b46606a23 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_by_retention.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_by_retention.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o LogsByRetention) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsByRetention) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Orgs *LogsByRetentionOrgs `json:"orgs,omitempty"` Usage []LogsRetentionAggSumUsage `json:"usage,omitempty"` UsageByMonth *LogsByRetentionMonthlyUsage `json:"usage_by_month,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,26 +162,25 @@ func (o *LogsByRetention) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Orgs != nil && all.Orgs.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Orgs = all.Orgs o.Usage = all.Usage if all.UsageByMonth != nil && all.UsageByMonth.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.UsageByMonth = all.UsageByMonth + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_by_retention_monthly_usage.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_by_retention_monthly_usage.go index 14facb799..711fcdd7f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_by_retention_monthly_usage.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_by_retention_monthly_usage.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -120,18 +121,12 @@ func (o LogsByRetentionMonthlyUsage) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsByRetentionMonthlyUsage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Date *time.Time `json:"date,omitempty"` Usage []LogsRetentionSumUsage `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -141,6 +136,7 @@ func (o *LogsByRetentionMonthlyUsage) UnmarshalJSON(bytes []byte) (err error) { } o.Date = all.Date o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_by_retention_org_usage.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_by_retention_org_usage.go index e5ee5f488..033f7dd82 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_by_retention_org_usage.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_by_retention_org_usage.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o LogsByRetentionOrgUsage) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsByRetentionOrgUsage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []LogsRetentionSumUsage `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *LogsByRetentionOrgUsage) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_by_retention_orgs.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_by_retention_orgs.go index ca4eab7f7..439490714 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_by_retention_orgs.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_by_retention_orgs.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o LogsByRetentionOrgs) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsByRetentionOrgs) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []LogsByRetentionOrgUsage `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *LogsByRetentionOrgs) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_category_processor.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_category_processor.go index 3693496a3..ff3e8ebb4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_category_processor.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_category_processor.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -17,13 +18,13 @@ import ( // // **Notes**: // -// - The syntax of the query is the one of Logs Explorer search bar. -// The query can be done on any log attribute or tag, whether it is a facet or not. -// Wildcards can also be used inside your query. -// - Once the log has matched one of the Processor queries, it stops. -// Make sure they are properly ordered in case a log could match several queries. -// - The names of the categories must be unique. -// - Once defined in the Category Processor, you can map categories to log status using the Log Status Remapper. +// - The syntax of the query is the one of Logs Explorer search bar. +// The query can be done on any log attribute or tag, whether it is a facet or not. +// Wildcards can also be used inside your query. +// - Once the log has matched one of the Processor queries, it stops. +// Make sure they are properly ordered in case a log could match several queries. +// - The names of the categories must be unique. +// - Once defined in the Category Processor, you can map categories to log status using the Log Status Remapper. type LogsCategoryProcessor struct { // Array of filters to match or not a log and their // corresponding `name` to assign a custom value to the log. @@ -216,7 +217,6 @@ func (o LogsCategoryProcessor) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsCategoryProcessor) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Categories *[]LogsCategoryProcessorCategory `json:"categories"` IsEnabled *bool `json:"is_enabled,omitempty"` @@ -225,12 +225,7 @@ func (o *LogsCategoryProcessor) UnmarshalJSON(bytes []byte) (err error) { Type *LogsCategoryProcessorType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Categories == nil { return fmt.Errorf("required field categories missing") @@ -247,22 +242,25 @@ func (o *LogsCategoryProcessor) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Categories = *all.Categories o.IsEnabled = all.IsEnabled o.Name = all.Name o.Target = *all.Target - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_category_processor_category.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_category_processor_category.go index 1ab86b73a..fd803fe5a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_category_processor_category.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_category_processor_category.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o LogsCategoryProcessorCategory) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsCategoryProcessorCategory) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Filter *LogsFilter `json:"filter,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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *LogsCategoryProcessorCategory) UnmarshalJSON(bytes []byte) (err error) } else { return err } + + hasInvalidField := false if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Filter = all.Filter o.Name = all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_category_processor_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_category_processor_type.go index d72b48c3e..e62f3a625 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_category_processor_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_category_processor_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsCategoryProcessorType Type of logs category processor. @@ -61,47 +62,3 @@ func (v LogsCategoryProcessorType) IsValid() bool { func (v LogsCategoryProcessorType) Ptr() *LogsCategoryProcessorType { return &v } - -// NullableLogsCategoryProcessorType handles when a null is used for LogsCategoryProcessorType. -type NullableLogsCategoryProcessorType struct { - value *LogsCategoryProcessorType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsCategoryProcessorType) Get() *LogsCategoryProcessorType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsCategoryProcessorType) Set(val *LogsCategoryProcessorType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsCategoryProcessorType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsCategoryProcessorType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsCategoryProcessorType initializes the struct as if Set has been called. -func NewNullableLogsCategoryProcessorType(val *LogsCategoryProcessorType) *NullableLogsCategoryProcessorType { - return &NullableLogsCategoryProcessorType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsCategoryProcessorType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsCategoryProcessorType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_date_remapper.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_date_remapper.go index 03a21f8ed..a153b8a8a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_date_remapper.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_date_remapper.go @@ -5,31 +5,37 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // LogsDateRemapper As Datadog receives logs, it timestamps them using the value(s) from any of these default attributes. // // - `timestamp` +// // - `date` +// // - `_timestamp` +// // - `Timestamp` +// // - `eventTime` +// // - `published_date` // -// If your logs put their dates in an attribute not in this list, -// use the log date Remapper Processor to define their date attribute as the official log timestamp. -// The recognized date formats are ISO8601, UNIX (the milliseconds EPOCH format), and RFC3164. +// If your logs put their dates in an attribute not in this list, +// use the log date Remapper Processor to define their date attribute as the official log timestamp. +// The recognized date formats are ISO8601, UNIX (the milliseconds EPOCH format), and RFC3164. // -// **Note:** If your logs don’t contain any of the default attributes -// and you haven’t defined your own date attribute, Datadog timestamps -// the logs with the date it received them. +// **Note:** If your logs don’t contain any of the default attributes +// and you haven’t defined your own date attribute, Datadog timestamps +// the logs with the date it received them. // -// If multiple log date remapper processors can be applied to a given log, -// only the first one (according to the pipelines order) is taken into account. +// If multiple log date remapper processors can be applied to a given log, +// only the first one (according to the pipelines order) is taken into account. type LogsDateRemapper struct { // Whether or not the processor is enabled. IsEnabled *bool `json:"is_enabled,omitempty"` @@ -194,7 +200,6 @@ func (o LogsDateRemapper) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsDateRemapper) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IsEnabled *bool `json:"is_enabled,omitempty"` Name *string `json:"name,omitempty"` @@ -202,12 +207,7 @@ func (o *LogsDateRemapper) UnmarshalJSON(bytes []byte) (err error) { Type *LogsDateRemapperType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Sources == nil { return fmt.Errorf("required field sources missing") @@ -221,21 +221,24 @@ func (o *LogsDateRemapper) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.IsEnabled = all.IsEnabled o.Name = all.Name o.Sources = *all.Sources - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_date_remapper_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_date_remapper_type.go index 5b9fb1719..0f0ab4ac0 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_date_remapper_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_date_remapper_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsDateRemapperType Type of logs date remapper. @@ -61,47 +62,3 @@ func (v LogsDateRemapperType) IsValid() bool { func (v LogsDateRemapperType) Ptr() *LogsDateRemapperType { return &v } - -// NullableLogsDateRemapperType handles when a null is used for LogsDateRemapperType. -type NullableLogsDateRemapperType struct { - value *LogsDateRemapperType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsDateRemapperType) Get() *LogsDateRemapperType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsDateRemapperType) Set(val *LogsDateRemapperType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsDateRemapperType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsDateRemapperType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsDateRemapperType initializes the struct as if Set has been called. -func NewNullableLogsDateRemapperType(val *LogsDateRemapperType) *NullableLogsDateRemapperType { - return &NullableLogsDateRemapperType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsDateRemapperType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsDateRemapperType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_exclusion.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_exclusion.go index c7dab8f87..7dff99ce0 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_exclusion.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_exclusion.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -143,19 +144,13 @@ func (o LogsExclusion) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsExclusion) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Filter *LogsExclusionFilter `json:"filter,omitempty"` IsEnabled *bool `json:"is_enabled,omitempty"` Name *string `json:"name"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -166,19 +161,22 @@ func (o *LogsExclusion) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Filter = all.Filter o.IsEnabled = all.IsEnabled o.Name = *all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_exclusion_filter.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_exclusion_filter.go index 6f2ec6822..72591d59a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_exclusion_filter.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_exclusion_filter.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -112,18 +113,12 @@ func (o LogsExclusionFilter) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsExclusionFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Query *string `json:"query,omitempty"` SampleRate *float64 `json:"sample_rate"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.SampleRate == nil { return fmt.Errorf("required field sample_rate missing") @@ -136,6 +131,7 @@ func (o *LogsExclusionFilter) UnmarshalJSON(bytes []byte) (err error) { } o.Query = all.Query o.SampleRate = *all.SampleRate + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_filter.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_filter.go index a88bcd827..824ace97a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_filter.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_filter.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o LogsFilter) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Query *string `json:"query,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *LogsFilter) UnmarshalJSON(bytes []byte) (err error) { return err } o.Query = all.Query + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_geo_ip_parser.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_geo_ip_parser.go index 48f922fdc..b3390534a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_geo_ip_parser.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_geo_ip_parser.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -206,7 +207,6 @@ func (o LogsGeoIPParser) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsGeoIPParser) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IsEnabled *bool `json:"is_enabled,omitempty"` Name *string `json:"name,omitempty"` @@ -215,12 +215,7 @@ func (o *LogsGeoIPParser) UnmarshalJSON(bytes []byte) (err error) { Type *LogsGeoIPParserType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Sources == nil { return fmt.Errorf("required field sources missing") @@ -237,22 +232,25 @@ func (o *LogsGeoIPParser) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.IsEnabled = all.IsEnabled o.Name = all.Name o.Sources = *all.Sources o.Target = *all.Target - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_geo_ip_parser_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_geo_ip_parser_type.go index a55c76460..1da639ba3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_geo_ip_parser_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_geo_ip_parser_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsGeoIPParserType Type of GeoIP parser. @@ -61,47 +62,3 @@ func (v LogsGeoIPParserType) IsValid() bool { func (v LogsGeoIPParserType) Ptr() *LogsGeoIPParserType { return &v } - -// NullableLogsGeoIPParserType handles when a null is used for LogsGeoIPParserType. -type NullableLogsGeoIPParserType struct { - value *LogsGeoIPParserType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsGeoIPParserType) Get() *LogsGeoIPParserType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsGeoIPParserType) Set(val *LogsGeoIPParserType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsGeoIPParserType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsGeoIPParserType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsGeoIPParserType initializes the struct as if Set has been called. -func NewNullableLogsGeoIPParserType(val *LogsGeoIPParserType) *NullableLogsGeoIPParserType { - return &NullableLogsGeoIPParserType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsGeoIPParserType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsGeoIPParserType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_grok_parser.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_grok_parser.go index 4f3cac892..2caa13a0c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_grok_parser.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_grok_parser.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -239,7 +240,6 @@ func (o LogsGrokParser) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsGrokParser) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Grok *LogsGrokParserRules `json:"grok"` IsEnabled *bool `json:"is_enabled,omitempty"` @@ -249,12 +249,7 @@ func (o *LogsGrokParser) UnmarshalJSON(bytes []byte) (err error) { Type *LogsGrokParserType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Grok == nil { return fmt.Errorf("required field grok missing") @@ -271,30 +266,29 @@ func (o *LogsGrokParser) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Grok.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Grok = *all.Grok o.IsEnabled = all.IsEnabled o.Name = all.Name o.Samples = all.Samples o.Source = *all.Source - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_grok_parser_rules.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_grok_parser_rules.go index 0d2dcfb3f..3c56001ad 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_grok_parser_rules.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_grok_parser_rules.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -114,18 +115,12 @@ func (o LogsGrokParserRules) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsGrokParserRules) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { MatchRules *string `json:"match_rules"` SupportRules *string `json:"support_rules,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.MatchRules == nil { return fmt.Errorf("required field match_rules missing") @@ -138,6 +133,7 @@ func (o *LogsGrokParserRules) UnmarshalJSON(bytes []byte) (err error) { } o.MatchRules = *all.MatchRules o.SupportRules = all.SupportRules + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_grok_parser_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_grok_parser_type.go index 75808c91d..6db3eb9e9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_grok_parser_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_grok_parser_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsGrokParserType Type of logs grok parser. @@ -61,47 +62,3 @@ func (v LogsGrokParserType) IsValid() bool { func (v LogsGrokParserType) Ptr() *LogsGrokParserType { return &v } - -// NullableLogsGrokParserType handles when a null is used for LogsGrokParserType. -type NullableLogsGrokParserType struct { - value *LogsGrokParserType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsGrokParserType) Get() *LogsGrokParserType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsGrokParserType) Set(val *LogsGrokParserType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsGrokParserType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsGrokParserType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsGrokParserType initializes the struct as if Set has been called. -func NewNullableLogsGrokParserType(val *LogsGrokParserType) *NullableLogsGrokParserType { - return &NullableLogsGrokParserType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsGrokParserType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsGrokParserType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_index.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_index.go index c00fa1fa2..617179620 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_index.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_index.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -240,7 +241,6 @@ func (o LogsIndex) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsIndex) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DailyLimit *int64 `json:"daily_limit,omitempty"` ExclusionFilters []LogsExclusion `json:"exclusion_filters,omitempty"` @@ -250,12 +250,7 @@ func (o *LogsIndex) UnmarshalJSON(bytes []byte) (err error) { NumRetentionDays *int64 `json:"num_retention_days,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Filter == nil { return fmt.Errorf("required field filter missing") @@ -269,22 +264,25 @@ func (o *LogsIndex) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.DailyLimit = all.DailyLimit o.ExclusionFilters = all.ExclusionFilters if all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Filter = *all.Filter o.IsRateLimited = all.IsRateLimited o.Name = *all.Name o.NumRetentionDays = all.NumRetentionDays + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_index_list_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_index_list_response.go index 56684eb03..13fc086cc 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_index_list_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_index_list_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o LogsIndexListResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsIndexListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Indexes []LogsIndex `json:"indexes,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *LogsIndexListResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Indexes = all.Indexes + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_index_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_index_update_request.go index 1f4aa4bf8..c7eabb6e0 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_index_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_index_update_request.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -217,7 +218,6 @@ func (o LogsIndexUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsIndexUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DailyLimit *int64 `json:"daily_limit,omitempty"` DisableDailyLimit *bool `json:"disable_daily_limit,omitempty"` @@ -226,12 +226,7 @@ func (o *LogsIndexUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { NumRetentionDays *int64 `json:"num_retention_days,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Filter == nil { return fmt.Errorf("required field filter missing") @@ -242,21 +237,24 @@ func (o *LogsIndexUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.DailyLimit = all.DailyLimit o.DisableDailyLimit = all.DisableDailyLimit o.ExclusionFilters = all.ExclusionFilters if all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Filter = *all.Filter o.NumRetentionDays = all.NumRetentionDays + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_indexes_order.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_indexes_order.go index 27ff9abaa..8a375ef73 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_indexes_order.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_indexes_order.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -79,17 +80,11 @@ func (o LogsIndexesOrder) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsIndexesOrder) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IndexNames *[]string `json:"index_names"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.IndexNames == nil { return fmt.Errorf("required field index_names missing") @@ -101,6 +96,7 @@ func (o *LogsIndexesOrder) UnmarshalJSON(bytes []byte) (err error) { return err } o.IndexNames = *all.IndexNames + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_list_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_list_request.go index 92c670d62..9c491fad2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_list_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_list_request.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -247,7 +248,6 @@ func (o LogsListRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsListRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Index *string `json:"index,omitempty"` Limit *int32 `json:"limit,omitempty"` @@ -257,12 +257,7 @@ func (o *LogsListRequest) UnmarshalJSON(bytes []byte) (err error) { Time *LogsListRequestTime `json:"time"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Time == nil { return fmt.Errorf("required field time missing") @@ -273,30 +268,29 @@ func (o *LogsListRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Sort; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Index = all.Index o.Limit = all.Limit o.Query = all.Query - o.Sort = all.Sort + if all.Sort != nil && !all.Sort.IsValid() { + hasInvalidField = true + } else { + o.Sort = all.Sort + } o.StartAt = all.StartAt if all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Time = *all.Time + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_list_request_time.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_list_request_time.go index fa003b448..58f4cdb53 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_list_request_time.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_list_request_time.go @@ -5,10 +5,11 @@ package datadogV1 import ( - "encoding/json" "fmt" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -147,19 +148,13 @@ func (o LogsListRequestTime) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsListRequestTime) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { From *time.Time `json:"from"` Timezone *string `json:"timezone,omitempty"` To *time.Time `json:"to"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.From == nil { return fmt.Errorf("required field from missing") @@ -176,6 +171,7 @@ func (o *LogsListRequestTime) UnmarshalJSON(bytes []byte) (err error) { o.From = *all.From o.Timezone = all.Timezone o.To = *all.To + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_list_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_list_response.go index 880fb4f05..7b4800a6b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_list_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_list_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -160,19 +160,13 @@ func (o LogsListResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Logs []Log `json:"logs,omitempty"` NextLogId datadog.NullableString `json:"nextLogId,omitempty"` Status *string `json:"status,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -183,6 +177,7 @@ func (o *LogsListResponse) UnmarshalJSON(bytes []byte) (err error) { o.Logs = all.Logs o.NextLogId = all.NextLogId o.Status = all.Status + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_lookup_processor.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_lookup_processor.go index 642f1737e..f0f29cec3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_lookup_processor.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_lookup_processor.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -270,7 +271,6 @@ func (o LogsLookupProcessor) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsLookupProcessor) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DefaultLookup *string `json:"default_lookup,omitempty"` IsEnabled *bool `json:"is_enabled,omitempty"` @@ -281,12 +281,7 @@ func (o *LogsLookupProcessor) UnmarshalJSON(bytes []byte) (err error) { Type *LogsLookupProcessorType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.LookupTable == nil { return fmt.Errorf("required field lookup_table missing") @@ -306,24 +301,27 @@ func (o *LogsLookupProcessor) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.DefaultLookup = all.DefaultLookup o.IsEnabled = all.IsEnabled o.LookupTable = *all.LookupTable o.Name = all.Name o.Source = *all.Source o.Target = *all.Target - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_lookup_processor_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_lookup_processor_type.go index 8d2ee5a87..91c6721b2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_lookup_processor_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_lookup_processor_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsLookupProcessorType Type of logs lookup processor. @@ -61,47 +62,3 @@ func (v LogsLookupProcessorType) IsValid() bool { func (v LogsLookupProcessorType) Ptr() *LogsLookupProcessorType { return &v } - -// NullableLogsLookupProcessorType handles when a null is used for LogsLookupProcessorType. -type NullableLogsLookupProcessorType struct { - value *LogsLookupProcessorType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsLookupProcessorType) Get() *LogsLookupProcessorType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsLookupProcessorType) Set(val *LogsLookupProcessorType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsLookupProcessorType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsLookupProcessorType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsLookupProcessorType initializes the struct as if Set has been called. -func NewNullableLogsLookupProcessorType(val *LogsLookupProcessorType) *NullableLogsLookupProcessorType { - return &NullableLogsLookupProcessorType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsLookupProcessorType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsLookupProcessorType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_message_remapper.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_message_remapper.go index 11d944ea1..7f7bf451b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_message_remapper.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_message_remapper.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -181,7 +182,6 @@ func (o LogsMessageRemapper) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsMessageRemapper) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IsEnabled *bool `json:"is_enabled,omitempty"` Name *string `json:"name,omitempty"` @@ -189,12 +189,7 @@ func (o *LogsMessageRemapper) UnmarshalJSON(bytes []byte) (err error) { Type *LogsMessageRemapperType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Sources == nil { return fmt.Errorf("required field sources missing") @@ -208,21 +203,24 @@ func (o *LogsMessageRemapper) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.IsEnabled = all.IsEnabled o.Name = all.Name o.Sources = *all.Sources - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_message_remapper_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_message_remapper_type.go index e52c6bdf1..0eebfd392 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_message_remapper_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_message_remapper_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsMessageRemapperType Type of logs message remapper. @@ -61,47 +62,3 @@ func (v LogsMessageRemapperType) IsValid() bool { func (v LogsMessageRemapperType) Ptr() *LogsMessageRemapperType { return &v } - -// NullableLogsMessageRemapperType handles when a null is used for LogsMessageRemapperType. -type NullableLogsMessageRemapperType struct { - value *LogsMessageRemapperType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsMessageRemapperType) Get() *LogsMessageRemapperType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsMessageRemapperType) Set(val *LogsMessageRemapperType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsMessageRemapperType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsMessageRemapperType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsMessageRemapperType initializes the struct as if Set has been called. -func NewNullableLogsMessageRemapperType(val *LogsMessageRemapperType) *NullableLogsMessageRemapperType { - return &NullableLogsMessageRemapperType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsMessageRemapperType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsMessageRemapperType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_pipeline.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_pipeline.go index 08c64ae5a..bd0589aed 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_pipeline.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_pipeline.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -279,7 +280,6 @@ func (o LogsPipeline) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsPipeline) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Filter *LogsFilter `json:"filter,omitempty"` Id *string `json:"id,omitempty"` @@ -290,12 +290,7 @@ func (o *LogsPipeline) UnmarshalJSON(bytes []byte) (err error) { Type *string `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -306,12 +301,10 @@ func (o *LogsPipeline) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Filter = all.Filter o.Id = all.Id @@ -320,9 +313,14 @@ func (o *LogsPipeline) UnmarshalJSON(bytes []byte) (err error) { o.Name = *all.Name o.Processors = all.Processors o.Type = all.Type + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_pipeline_processor.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_pipeline_processor.go index 838a46a28..749c9e2b2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_pipeline_processor.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_pipeline_processor.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -219,7 +220,6 @@ func (o LogsPipelineProcessor) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsPipelineProcessor) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Filter *LogsFilter `json:"filter,omitempty"` IsEnabled *bool `json:"is_enabled,omitempty"` @@ -228,12 +228,7 @@ func (o *LogsPipelineProcessor) UnmarshalJSON(bytes []byte) (err error) { Type *LogsPipelineProcessorType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -244,29 +239,28 @@ func (o *LogsPipelineProcessor) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Filter = all.Filter o.IsEnabled = all.IsEnabled o.Name = all.Name o.Processors = all.Processors - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_pipeline_processor_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_pipeline_processor_type.go index 5ed8c25ac..9f6e999d9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_pipeline_processor_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_pipeline_processor_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsPipelineProcessorType Type of logs pipeline processor. @@ -61,47 +62,3 @@ func (v LogsPipelineProcessorType) IsValid() bool { func (v LogsPipelineProcessorType) Ptr() *LogsPipelineProcessorType { return &v } - -// NullableLogsPipelineProcessorType handles when a null is used for LogsPipelineProcessorType. -type NullableLogsPipelineProcessorType struct { - value *LogsPipelineProcessorType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsPipelineProcessorType) Get() *LogsPipelineProcessorType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsPipelineProcessorType) Set(val *LogsPipelineProcessorType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsPipelineProcessorType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsPipelineProcessorType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsPipelineProcessorType initializes the struct as if Set has been called. -func NewNullableLogsPipelineProcessorType(val *LogsPipelineProcessorType) *NullableLogsPipelineProcessorType { - return &NullableLogsPipelineProcessorType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsPipelineProcessorType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsPipelineProcessorType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_pipelines_order.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_pipelines_order.go index 7a4335148..a2e0ce256 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_pipelines_order.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_pipelines_order.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -78,17 +79,11 @@ func (o LogsPipelinesOrder) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsPipelinesOrder) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { PipelineIds *[]string `json:"pipeline_ids"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.PipelineIds == nil { return fmt.Errorf("required field pipeline_ids missing") @@ -100,6 +95,7 @@ func (o *LogsPipelinesOrder) UnmarshalJSON(bytes []byte) (err error) { return err } o.PipelineIds = *all.PipelineIds + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_processor.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_processor.go index 1636ebd34..cff8cf5ba 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_processor.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_processor.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" ) // LogsProcessor - Definition of a logs processor. @@ -551,53 +551,3 @@ func (obj *LogsProcessor) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableLogsProcessor handles when a null is used for LogsProcessor. -type NullableLogsProcessor struct { - value *LogsProcessor - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsProcessor) Get() *LogsProcessor { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsProcessor) Set(val *LogsProcessor) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsProcessor) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableLogsProcessor) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsProcessor initializes the struct as if Set has been called. -func NewNullableLogsProcessor(val *LogsProcessor) *NullableLogsProcessor { - return &NullableLogsProcessor{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsProcessor) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsProcessor) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_query_compute.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_query_compute.go index b48d01ee7..e70f7f28e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_query_compute.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_query_compute.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -143,19 +144,13 @@ func (o LogsQueryCompute) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsQueryCompute) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregation *string `json:"aggregation"` Facet *string `json:"facet,omitempty"` Interval *int64 `json:"interval,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Aggregation == nil { return fmt.Errorf("required field aggregation missing") @@ -169,6 +164,7 @@ func (o *LogsQueryCompute) UnmarshalJSON(bytes []byte) (err error) { o.Aggregation = *all.Aggregation o.Facet = all.Facet o.Interval = all.Interval + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_retention_agg_sum_usage.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_retention_agg_sum_usage.go index a8b7ec920..7015e4a74 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_retention_agg_sum_usage.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_retention_agg_sum_usage.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -181,7 +181,6 @@ func (o LogsRetentionAggSumUsage) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsRetentionAggSumUsage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { LogsIndexedLogsUsageAggSum *int64 `json:"logs_indexed_logs_usage_agg_sum,omitempty"` LogsLiveIndexedLogsUsageAggSum *int64 `json:"logs_live_indexed_logs_usage_agg_sum,omitempty"` @@ -189,12 +188,7 @@ func (o *LogsRetentionAggSumUsage) UnmarshalJSON(bytes []byte) (err error) { Retention *string `json:"retention,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,6 +200,7 @@ func (o *LogsRetentionAggSumUsage) UnmarshalJSON(bytes []byte) (err error) { o.LogsLiveIndexedLogsUsageAggSum = all.LogsLiveIndexedLogsUsageAggSum o.LogsRehydratedIndexedLogsUsageAggSum = all.LogsRehydratedIndexedLogsUsageAggSum o.Retention = all.Retention + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_retention_sum_usage.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_retention_sum_usage.go index 3ba8e03aa..6a8e5bf70 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_retention_sum_usage.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_retention_sum_usage.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -181,7 +181,6 @@ func (o LogsRetentionSumUsage) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsRetentionSumUsage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { LogsIndexedLogsUsageSum *int64 `json:"logs_indexed_logs_usage_sum,omitempty"` LogsLiveIndexedLogsUsageSum *int64 `json:"logs_live_indexed_logs_usage_sum,omitempty"` @@ -189,12 +188,7 @@ func (o *LogsRetentionSumUsage) UnmarshalJSON(bytes []byte) (err error) { Retention *string `json:"retention,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,6 +200,7 @@ func (o *LogsRetentionSumUsage) UnmarshalJSON(bytes []byte) (err error) { o.LogsLiveIndexedLogsUsageSum = all.LogsLiveIndexedLogsUsageSum o.LogsRehydratedIndexedLogsUsageSum = all.LogsRehydratedIndexedLogsUsageSum o.Retention = all.Retention + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_service_remapper.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_service_remapper.go index abd0cba99..d1db9694d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_service_remapper.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_service_remapper.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -179,7 +180,6 @@ func (o LogsServiceRemapper) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsServiceRemapper) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IsEnabled *bool `json:"is_enabled,omitempty"` Name *string `json:"name,omitempty"` @@ -187,12 +187,7 @@ func (o *LogsServiceRemapper) UnmarshalJSON(bytes []byte) (err error) { Type *LogsServiceRemapperType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Sources == nil { return fmt.Errorf("required field sources missing") @@ -206,21 +201,24 @@ func (o *LogsServiceRemapper) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.IsEnabled = all.IsEnabled o.Name = all.Name o.Sources = *all.Sources - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_service_remapper_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_service_remapper_type.go index 5d84c0704..6aa5c6b06 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_service_remapper_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_service_remapper_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsServiceRemapperType Type of logs service remapper. @@ -61,47 +62,3 @@ func (v LogsServiceRemapperType) IsValid() bool { func (v LogsServiceRemapperType) Ptr() *LogsServiceRemapperType { return &v } - -// NullableLogsServiceRemapperType handles when a null is used for LogsServiceRemapperType. -type NullableLogsServiceRemapperType struct { - value *LogsServiceRemapperType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsServiceRemapperType) Get() *LogsServiceRemapperType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsServiceRemapperType) Set(val *LogsServiceRemapperType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsServiceRemapperType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsServiceRemapperType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsServiceRemapperType initializes the struct as if Set has been called. -func NewNullableLogsServiceRemapperType(val *LogsServiceRemapperType) *NullableLogsServiceRemapperType { - return &NullableLogsServiceRemapperType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsServiceRemapperType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsServiceRemapperType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_sort.go index 95d00661b..dbbd3a13b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_sort.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_sort.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsSort Time-ascending `asc` or time-descending `desc` results. @@ -63,47 +64,3 @@ func (v LogsSort) IsValid() bool { func (v LogsSort) Ptr() *LogsSort { return &v } - -// NullableLogsSort handles when a null is used for LogsSort. -type NullableLogsSort struct { - value *LogsSort - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsSort) Get() *LogsSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsSort) Set(val *LogsSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsSort initializes the struct as if Set has been called. -func NewNullableLogsSort(val *LogsSort) *NullableLogsSort { - return &NullableLogsSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_status_remapper.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_status_remapper.go index a9c140182..5b81f3c93 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_status_remapper.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_status_remapper.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -16,19 +17,29 @@ import ( // Each incoming status value is mapped as follows. // // - Integers from 0 to 7 map to the Syslog severity standards +// // - Strings beginning with `emerg` or f (case-insensitive) map to `emerg` (0) +// // - Strings beginning with `a` (case-insensitive) map to `alert` (1) +// // - Strings beginning with `c` (case-insensitive) map to `critical` (2) +// // - Strings beginning with `err` (case-insensitive) map to `error` (3) +// // - Strings beginning with `w` (case-insensitive) map to `warning` (4) +// // - Strings beginning with `n` (case-insensitive) map to `notice` (5) +// // - Strings beginning with `i` (case-insensitive) map to `info` (6) +// // - Strings beginning with `d`, `trace` or `verbose` (case-insensitive) map to `debug` (7) +// // - Strings beginning with `o` or matching `OK` or `Success` (case-insensitive) map to OK +// // - All others map to `info` (6) // -// **Note:** If multiple log status remapper processors can be applied to a given log, -// only the first one (according to the pipelines order) is taken into account. +// **Note:** If multiple log status remapper processors can be applied to a given log, +// only the first one (according to the pipelines order) is taken into account. type LogsStatusRemapper struct { // Whether or not the processor is enabled. IsEnabled *bool `json:"is_enabled,omitempty"` @@ -193,7 +204,6 @@ func (o LogsStatusRemapper) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsStatusRemapper) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IsEnabled *bool `json:"is_enabled,omitempty"` Name *string `json:"name,omitempty"` @@ -201,12 +211,7 @@ func (o *LogsStatusRemapper) UnmarshalJSON(bytes []byte) (err error) { Type *LogsStatusRemapperType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Sources == nil { return fmt.Errorf("required field sources missing") @@ -220,21 +225,24 @@ func (o *LogsStatusRemapper) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.IsEnabled = all.IsEnabled o.Name = all.Name o.Sources = *all.Sources - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_status_remapper_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_status_remapper_type.go index bfeae6284..b5850e1f4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_status_remapper_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_status_remapper_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsStatusRemapperType Type of logs status remapper. @@ -61,47 +62,3 @@ func (v LogsStatusRemapperType) IsValid() bool { func (v LogsStatusRemapperType) Ptr() *LogsStatusRemapperType { return &v } - -// NullableLogsStatusRemapperType handles when a null is used for LogsStatusRemapperType. -type NullableLogsStatusRemapperType struct { - value *LogsStatusRemapperType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsStatusRemapperType) Get() *LogsStatusRemapperType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsStatusRemapperType) Set(val *LogsStatusRemapperType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsStatusRemapperType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsStatusRemapperType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsStatusRemapperType initializes the struct as if Set has been called. -func NewNullableLogsStatusRemapperType(val *LogsStatusRemapperType) *NullableLogsStatusRemapperType { - return &NullableLogsStatusRemapperType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsStatusRemapperType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsStatusRemapperType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_string_builder_processor.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_string_builder_processor.go index 6c2f819c9..4c7a38e2f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_string_builder_processor.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_string_builder_processor.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -19,11 +20,11 @@ import ( // // **Notes**: // -// - The processor only accepts attributes with values or an array of values in the blocks. -// - If an attribute cannot be used (object or array of object), -// it is replaced by an empty string or the entire operation is skipped depending on your selection. -// - If the target attribute already exists, it is overwritten by the result of the template. -// - Results of the template cannot exceed 256 characters. +// - The processor only accepts attributes with values or an array of values in the blocks. +// - If an attribute cannot be used (object or array of object), +// it is replaced by an empty string or the entire operation is skipped depending on your selection. +// - If the target attribute already exists, it is overwritten by the result of the template. +// - Results of the template cannot exceed 256 characters. type LogsStringBuilderProcessor struct { // Whether or not the processor is enabled. IsEnabled *bool `json:"is_enabled,omitempty"` @@ -253,7 +254,6 @@ func (o LogsStringBuilderProcessor) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsStringBuilderProcessor) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IsEnabled *bool `json:"is_enabled,omitempty"` IsReplaceMissing *bool `json:"is_replace_missing,omitempty"` @@ -263,12 +263,7 @@ func (o *LogsStringBuilderProcessor) UnmarshalJSON(bytes []byte) (err error) { Type *LogsStringBuilderProcessorType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Target == nil { return fmt.Errorf("required field target missing") @@ -285,23 +280,26 @@ func (o *LogsStringBuilderProcessor) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.IsEnabled = all.IsEnabled o.IsReplaceMissing = all.IsReplaceMissing o.Name = all.Name o.Target = *all.Target o.Template = *all.Template - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_string_builder_processor_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_string_builder_processor_type.go index 6b7c23aca..f333e7cea 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_string_builder_processor_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_string_builder_processor_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsStringBuilderProcessorType Type of logs string builder processor. @@ -61,47 +62,3 @@ func (v LogsStringBuilderProcessorType) IsValid() bool { func (v LogsStringBuilderProcessorType) Ptr() *LogsStringBuilderProcessorType { return &v } - -// NullableLogsStringBuilderProcessorType handles when a null is used for LogsStringBuilderProcessorType. -type NullableLogsStringBuilderProcessorType struct { - value *LogsStringBuilderProcessorType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsStringBuilderProcessorType) Get() *LogsStringBuilderProcessorType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsStringBuilderProcessorType) Set(val *LogsStringBuilderProcessorType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsStringBuilderProcessorType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsStringBuilderProcessorType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsStringBuilderProcessorType initializes the struct as if Set has been called. -func NewNullableLogsStringBuilderProcessorType(val *LogsStringBuilderProcessorType) *NullableLogsStringBuilderProcessorType { - return &NullableLogsStringBuilderProcessorType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsStringBuilderProcessorType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsStringBuilderProcessorType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_trace_remapper.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_trace_remapper.go index 613d95e03..15d7c29a2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_trace_remapper.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_trace_remapper.go @@ -5,18 +5,19 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // LogsTraceRemapper There are two ways to improve correlation between application traces and logs. // -// 1. Follow the documentation on [how to inject a trace ID in the application logs](https://docs.datadoghq.com/tracing/connect_logs_and_traces) -// and by default log integrations take care of all the rest of the setup. +// 1. Follow the documentation on [how to inject a trace ID in the application logs](https://docs.datadoghq.com/tracing/connect_logs_and_traces) +// and by default log integrations take care of all the rest of the setup. // -// 2. Use the Trace remapper processor to define a log attribute as its associated trace ID. +// 2. Use the Trace remapper processor to define a log attribute as its associated trace ID. type LogsTraceRemapper struct { // Whether or not the processor is enabled. IsEnabled *bool `json:"is_enabled,omitempty"` @@ -187,7 +188,6 @@ func (o LogsTraceRemapper) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsTraceRemapper) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IsEnabled *bool `json:"is_enabled,omitempty"` Name *string `json:"name,omitempty"` @@ -195,12 +195,7 @@ func (o *LogsTraceRemapper) UnmarshalJSON(bytes []byte) (err error) { Type *LogsTraceRemapperType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -211,21 +206,24 @@ func (o *LogsTraceRemapper) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.IsEnabled = all.IsEnabled o.Name = all.Name o.Sources = all.Sources - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_trace_remapper_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_trace_remapper_type.go index addb4f91f..681a175db 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_trace_remapper_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_trace_remapper_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsTraceRemapperType Type of logs trace remapper. @@ -61,47 +62,3 @@ func (v LogsTraceRemapperType) IsValid() bool { func (v LogsTraceRemapperType) Ptr() *LogsTraceRemapperType { return &v } - -// NullableLogsTraceRemapperType handles when a null is used for LogsTraceRemapperType. -type NullableLogsTraceRemapperType struct { - value *LogsTraceRemapperType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsTraceRemapperType) Get() *LogsTraceRemapperType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsTraceRemapperType) Set(val *LogsTraceRemapperType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsTraceRemapperType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsTraceRemapperType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsTraceRemapperType initializes the struct as if Set has been called. -func NewNullableLogsTraceRemapperType(val *LogsTraceRemapperType) *NullableLogsTraceRemapperType { - return &NullableLogsTraceRemapperType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsTraceRemapperType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsTraceRemapperType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_url_parser.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_url_parser.go index 90e7e55fa..f0f2a4229 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_url_parser.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_url_parser.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -253,7 +254,6 @@ func (o LogsURLParser) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsURLParser) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IsEnabled *bool `json:"is_enabled,omitempty"` Name *string `json:"name,omitempty"` @@ -263,12 +263,7 @@ func (o *LogsURLParser) UnmarshalJSON(bytes []byte) (err error) { Type *LogsURLParserType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Sources == nil { return fmt.Errorf("required field sources missing") @@ -285,23 +280,26 @@ func (o *LogsURLParser) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.IsEnabled = all.IsEnabled o.Name = all.Name o.NormalizeEndingSlashes = all.NormalizeEndingSlashes o.Sources = *all.Sources o.Target = *all.Target - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_url_parser_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_url_parser_type.go index c621cd4ec..85eef7530 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_url_parser_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_url_parser_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsURLParserType Type of logs URL parser. @@ -61,47 +62,3 @@ func (v LogsURLParserType) IsValid() bool { func (v LogsURLParserType) Ptr() *LogsURLParserType { return &v } - -// NullableLogsURLParserType handles when a null is used for LogsURLParserType. -type NullableLogsURLParserType struct { - value *LogsURLParserType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsURLParserType) Get() *LogsURLParserType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsURLParserType) Set(val *LogsURLParserType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsURLParserType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsURLParserType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsURLParserType initializes the struct as if Set has been called. -func NewNullableLogsURLParserType(val *LogsURLParserType) *NullableLogsURLParserType { - return &NullableLogsURLParserType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsURLParserType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsURLParserType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_user_agent_parser.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_user_agent_parser.go index 6ce422cb8..8b44b9b99 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_user_agent_parser.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_user_agent_parser.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -243,7 +244,6 @@ func (o LogsUserAgentParser) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsUserAgentParser) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IsEnabled *bool `json:"is_enabled,omitempty"` IsEncoded *bool `json:"is_encoded,omitempty"` @@ -253,12 +253,7 @@ func (o *LogsUserAgentParser) UnmarshalJSON(bytes []byte) (err error) { Type *LogsUserAgentParserType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Sources == nil { return fmt.Errorf("required field sources missing") @@ -275,23 +270,26 @@ func (o *LogsUserAgentParser) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.IsEnabled = all.IsEnabled o.IsEncoded = all.IsEncoded o.Name = all.Name o.Sources = *all.Sources o.Target = *all.Target - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_user_agent_parser_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_user_agent_parser_type.go index 7554d4c28..71e30fff5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_user_agent_parser_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_logs_user_agent_parser_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsUserAgentParserType Type of logs User-Agent parser. @@ -61,47 +62,3 @@ func (v LogsUserAgentParserType) IsValid() bool { func (v LogsUserAgentParserType) Ptr() *LogsUserAgentParserType { return &v } - -// NullableLogsUserAgentParserType handles when a null is used for LogsUserAgentParserType. -type NullableLogsUserAgentParserType struct { - value *LogsUserAgentParserType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsUserAgentParserType) Get() *LogsUserAgentParserType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsUserAgentParserType) Set(val *LogsUserAgentParserType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsUserAgentParserType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsUserAgentParserType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsUserAgentParserType initializes the struct as if Set has been called. -func NewNullableLogsUserAgentParserType(val *LogsUserAgentParserType) *NullableLogsUserAgentParserType { - return &NullableLogsUserAgentParserType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsUserAgentParserType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsUserAgentParserType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_matching_downtime.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_matching_downtime.go index 504ea9fc1..1ad8caf9c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_matching_downtime.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_matching_downtime.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -189,7 +190,6 @@ func (o MatchingDowntime) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MatchingDowntime) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { End datadog.NullableInt64 `json:"end,omitempty"` Id *int64 `json:"id"` @@ -197,12 +197,7 @@ func (o *MatchingDowntime) UnmarshalJSON(bytes []byte) (err error) { Start *int64 `json:"start,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -217,6 +212,7 @@ func (o *MatchingDowntime) UnmarshalJSON(bytes []byte) (err error) { o.Id = *all.Id o.Scope = all.Scope o.Start = all.Start + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metric_content_encoding.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metric_content_encoding.go index 12e24f9d5..b3f7919cf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metric_content_encoding.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metric_content_encoding.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MetricContentEncoding HTTP header used to compress the media-type. @@ -63,47 +64,3 @@ func (v MetricContentEncoding) IsValid() bool { func (v MetricContentEncoding) Ptr() *MetricContentEncoding { return &v } - -// NullableMetricContentEncoding handles when a null is used for MetricContentEncoding. -type NullableMetricContentEncoding struct { - value *MetricContentEncoding - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricContentEncoding) Get() *MetricContentEncoding { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricContentEncoding) Set(val *MetricContentEncoding) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricContentEncoding) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricContentEncoding) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricContentEncoding initializes the struct as if Set has been called. -func NewNullableMetricContentEncoding(val *MetricContentEncoding) *NullableMetricContentEncoding { - return &NullableMetricContentEncoding{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricContentEncoding) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricContentEncoding) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metric_metadata.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metric_metadata.go index 6f247d36a..047cd4c18 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metric_metadata.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metric_metadata.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -280,7 +280,6 @@ func (o MetricMetadata) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Description *string `json:"description,omitempty"` Integration *string `json:"integration,omitempty"` @@ -291,12 +290,7 @@ func (o *MetricMetadata) UnmarshalJSON(bytes []byte) (err error) { Unit *string `json:"unit,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -311,6 +305,7 @@ func (o *MetricMetadata) UnmarshalJSON(bytes []byte) (err error) { o.StatsdInterval = all.StatsdInterval o.Type = all.Type o.Unit = all.Unit + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metric_search_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metric_search_response.go index ac5667ac5..db44b7503 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metric_search_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metric_search_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o MetricSearchResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricSearchResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Results *MetricSearchResponseResults `json:"results,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *MetricSearchResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Results != nil && all.Results.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Results = all.Results + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metric_search_response_results.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metric_search_response_results.go index 9ac93b481..8855c5f0d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metric_search_response_results.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metric_search_response_results.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o MetricSearchResponseResults) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricSearchResponseResults) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Metrics []string `json:"metrics,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *MetricSearchResponseResults) UnmarshalJSON(bytes []byte) (err error) { return err } o.Metrics = all.Metrics + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metrics_list_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metrics_list_response.go index d6e5af094..3ff9c079e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metrics_list_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metrics_list_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o MetricsListResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricsListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { From *string `json:"from,omitempty"` Metrics []string `json:"metrics,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *MetricsListResponse) UnmarshalJSON(bytes []byte) (err error) { } o.From = all.From o.Metrics = all.Metrics + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metrics_payload.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metrics_payload.go index 528b1e589..33ebfc283 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metrics_payload.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metrics_payload.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o MetricsPayload) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricsPayload) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Series *[]Series `json:"series"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Series == nil { return fmt.Errorf("required field series missing") @@ -99,6 +94,7 @@ func (o *MetricsPayload) UnmarshalJSON(bytes []byte) (err error) { return err } o.Series = *all.Series + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metrics_query_metadata.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metrics_query_metadata.go index ecc5a549e..0bbce73b7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metrics_query_metadata.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metrics_query_metadata.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -492,7 +492,6 @@ func (o MetricsQueryMetadata) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricsQueryMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggr datadog.NullableString `json:"aggr,omitempty"` DisplayName *string `json:"display_name,omitempty"` @@ -509,12 +508,7 @@ func (o *MetricsQueryMetadata) UnmarshalJSON(bytes []byte) (err error) { Unit []MetricsQueryUnit `json:"unit,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -535,6 +529,7 @@ func (o *MetricsQueryMetadata) UnmarshalJSON(bytes []byte) (err error) { o.Start = all.Start o.TagSet = all.TagSet o.Unit = all.Unit + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metrics_query_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metrics_query_response.go index a8ae48572..702e083e4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metrics_query_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metrics_query_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -346,7 +346,6 @@ func (o MetricsQueryResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricsQueryResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Error *string `json:"error,omitempty"` FromDate *int64 `json:"from_date,omitempty"` @@ -359,12 +358,7 @@ func (o *MetricsQueryResponse) UnmarshalJSON(bytes []byte) (err error) { ToDate *int64 `json:"to_date,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -381,6 +375,7 @@ func (o *MetricsQueryResponse) UnmarshalJSON(bytes []byte) (err error) { o.Series = all.Series o.Status = all.Status o.ToDate = all.ToDate + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metrics_query_unit.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metrics_query_unit.go index 9fc491a6e..4f5acc34b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metrics_query_unit.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_metrics_query_unit.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -214,7 +214,6 @@ func (o MetricsQueryUnit) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricsQueryUnit) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Family *string `json:"family,omitempty"` Name *string `json:"name,omitempty"` @@ -223,12 +222,7 @@ func (o *MetricsQueryUnit) UnmarshalJSON(bytes []byte) (err error) { ShortName *string `json:"short_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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -241,6 +235,7 @@ func (o *MetricsQueryUnit) UnmarshalJSON(bytes []byte) (err error) { o.Plural = all.Plural o.ScaleFactor = all.ScaleFactor o.ShortName = all.ShortName + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor.go index eb1c3dd84..28d56e163 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor.go @@ -5,10 +5,11 @@ package datadogV1 import ( - "encoding/json" "fmt" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -641,7 +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{}{} all := struct { Created *time.Time `json:"created,omitempty"` Creator *Creator `json:"creator,omitempty"` @@ -662,12 +662,7 @@ func (o *Monitor) UnmarshalJSON(bytes []byte) (err error) { Type *MonitorType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Query == nil { return fmt.Errorf("required field query missing") @@ -681,29 +676,11 @@ func (o *Monitor) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.OverallState; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Created = all.Created if all.Creator != nil && all.Creator.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Creator = all.Creator o.Deleted = all.Deleted @@ -714,30 +691,35 @@ func (o *Monitor) UnmarshalJSON(bytes []byte) (err error) { o.Multi = all.Multi o.Name = all.Name if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Options = all.Options - o.OverallState = all.OverallState + if all.OverallState != nil && !all.OverallState.IsValid() { + hasInvalidField = true + } else { + o.OverallState = all.OverallState + } o.Priority = all.Priority o.Query = *all.Query o.RestrictedRoles = all.RestrictedRoles if all.State != nil && all.State.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.State = all.State o.Tags = all.Tags - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_device_id.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_device_id.go index 143971d2e..2e1dc8b07 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_device_id.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_device_id.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MonitorDeviceID ID of the device the Synthetics monitor is running on. Same as `SyntheticsDeviceID`. @@ -77,47 +78,3 @@ func (v MonitorDeviceID) IsValid() bool { func (v MonitorDeviceID) Ptr() *MonitorDeviceID { return &v } - -// NullableMonitorDeviceID handles when a null is used for MonitorDeviceID. -type NullableMonitorDeviceID struct { - value *MonitorDeviceID - isSet bool -} - -// Get returns the associated value. -func (v NullableMonitorDeviceID) Get() *MonitorDeviceID { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMonitorDeviceID) Set(val *MonitorDeviceID) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMonitorDeviceID) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMonitorDeviceID) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMonitorDeviceID initializes the struct as if Set has been called. -func NewNullableMonitorDeviceID(val *MonitorDeviceID) *NullableMonitorDeviceID { - return &NullableMonitorDeviceID{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMonitorDeviceID) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMonitorDeviceID) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_event_aggregation.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_event_aggregation.go index e93b174e0..58e80f6bf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_event_aggregation.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_event_aggregation.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MonitorFormulaAndFunctionEventAggregation Aggregation methods for event platform queries. @@ -83,47 +84,3 @@ func (v MonitorFormulaAndFunctionEventAggregation) IsValid() bool { func (v MonitorFormulaAndFunctionEventAggregation) Ptr() *MonitorFormulaAndFunctionEventAggregation { return &v } - -// NullableMonitorFormulaAndFunctionEventAggregation handles when a null is used for MonitorFormulaAndFunctionEventAggregation. -type NullableMonitorFormulaAndFunctionEventAggregation struct { - value *MonitorFormulaAndFunctionEventAggregation - isSet bool -} - -// Get returns the associated value. -func (v NullableMonitorFormulaAndFunctionEventAggregation) Get() *MonitorFormulaAndFunctionEventAggregation { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMonitorFormulaAndFunctionEventAggregation) Set(val *MonitorFormulaAndFunctionEventAggregation) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMonitorFormulaAndFunctionEventAggregation) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMonitorFormulaAndFunctionEventAggregation) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMonitorFormulaAndFunctionEventAggregation initializes the struct as if Set has been called. -func NewNullableMonitorFormulaAndFunctionEventAggregation(val *MonitorFormulaAndFunctionEventAggregation) *NullableMonitorFormulaAndFunctionEventAggregation { - return &NullableMonitorFormulaAndFunctionEventAggregation{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMonitorFormulaAndFunctionEventAggregation) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMonitorFormulaAndFunctionEventAggregation) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_event_query_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_event_query_definition.go index 0ed3a75f9..4bf4f4039 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_event_query_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_event_query_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -230,7 +231,6 @@ func (o MonitorFormulaAndFunctionEventQueryDefinition) MarshalJSON() ([]byte, er // UnmarshalJSON deserializes the given payload. func (o *MonitorFormulaAndFunctionEventQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Compute *MonitorFormulaAndFunctionEventQueryDefinitionCompute `json:"compute"` DataSource *MonitorFormulaAndFunctionEventsDataSource `json:"data_source"` @@ -240,12 +240,7 @@ func (o *MonitorFormulaAndFunctionEventQueryDefinition) UnmarshalJSON(bytes []by Search *MonitorFormulaAndFunctionEventQueryDefinitionSearch `json:"search,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Compute == nil { return fmt.Errorf("required field compute missing") @@ -262,37 +257,32 @@ func (o *MonitorFormulaAndFunctionEventQueryDefinition) UnmarshalJSON(bytes []by } else { return err } - if v := all.DataSource; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Compute.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Compute = *all.Compute - o.DataSource = *all.DataSource + if !all.DataSource.IsValid() { + hasInvalidField = true + } else { + o.DataSource = *all.DataSource + } o.GroupBy = all.GroupBy o.Indexes = all.Indexes o.Name = *all.Name if all.Search != nil && all.Search.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Search = all.Search + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_event_query_definition_compute.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_event_query_definition_compute.go index 8457ccc69..ca6fb5722 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_event_query_definition_compute.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_event_query_definition_compute.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -143,19 +144,13 @@ func (o MonitorFormulaAndFunctionEventQueryDefinitionCompute) MarshalJSON() ([]b // UnmarshalJSON deserializes the given payload. func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregation *MonitorFormulaAndFunctionEventAggregation `json:"aggregation"` Interval *int64 `json:"interval,omitempty"` Metric *string `json:"metric,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Aggregation == nil { return fmt.Errorf("required field aggregation missing") @@ -166,20 +161,23 @@ func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) UnmarshalJSON(byt } else { return err } - if v := all.Aggregation; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if !all.Aggregation.IsValid() { + hasInvalidField = true + } else { + o.Aggregation = *all.Aggregation } - o.Aggregation = *all.Aggregation o.Interval = all.Interval o.Metric = all.Metric + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_event_query_definition_search.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_event_query_definition_search.go index 4dae16bde..8d7a74dcb 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_event_query_definition_search.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_event_query_definition_search.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o MonitorFormulaAndFunctionEventQueryDefinitionSearch) MarshalJSON() ([]by // UnmarshalJSON deserializes the given payload. func (o *MonitorFormulaAndFunctionEventQueryDefinitionSearch) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Query *string `json:"query"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Query == nil { return fmt.Errorf("required field query missing") @@ -99,6 +94,7 @@ func (o *MonitorFormulaAndFunctionEventQueryDefinitionSearch) UnmarshalJSON(byte return err } o.Query = *all.Query + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_event_query_group_by.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_event_query_group_by.go index 0d325c450..d6aec8548 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_event_query_group_by.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_event_query_group_by.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -143,19 +144,13 @@ func (o MonitorFormulaAndFunctionEventQueryGroupBy) MarshalJSON() ([]byte, error // UnmarshalJSON deserializes the given payload. func (o *MonitorFormulaAndFunctionEventQueryGroupBy) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Facet *string `json:"facet"` Limit *int64 `json:"limit,omitempty"` Sort *MonitorFormulaAndFunctionEventQueryGroupBySort `json:"sort,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Facet == nil { return fmt.Errorf("required field facet missing") @@ -166,19 +161,22 @@ func (o *MonitorFormulaAndFunctionEventQueryGroupBy) UnmarshalJSON(bytes []byte) } else { return err } + + hasInvalidField := false o.Facet = *all.Facet o.Limit = all.Limit if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Sort = all.Sort + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_event_query_group_by_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_event_query_group_by_sort.go index 8e0d12d8a..1a20d3e2f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_event_query_group_by_sort.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_event_query_group_by_sort.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -147,19 +148,13 @@ func (o MonitorFormulaAndFunctionEventQueryGroupBySort) MarshalJSON() ([]byte, e // UnmarshalJSON deserializes the given payload. func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregation *MonitorFormulaAndFunctionEventAggregation `json:"aggregation"` Metric *string `json:"metric,omitempty"` Order *QuerySortOrder `json:"order,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Aggregation == nil { return fmt.Errorf("required field aggregation missing") @@ -170,28 +165,27 @@ func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) UnmarshalJSON(bytes []b } else { return err } - if v := all.Aggregation; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Order; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregation = *all.Aggregation + + hasInvalidField := false + if !all.Aggregation.IsValid() { + hasInvalidField = true + } else { + o.Aggregation = *all.Aggregation + } o.Metric = all.Metric - o.Order = all.Order + if all.Order != nil && !all.Order.IsValid() { + hasInvalidField = true + } else { + o.Order = all.Order + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_events_data_source.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_events_data_source.go index ab7680927..c55ec61b6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_events_data_source.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_events_data_source.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MonitorFormulaAndFunctionEventsDataSource Data source for event platform-based queries. @@ -73,47 +74,3 @@ func (v MonitorFormulaAndFunctionEventsDataSource) IsValid() bool { func (v MonitorFormulaAndFunctionEventsDataSource) Ptr() *MonitorFormulaAndFunctionEventsDataSource { return &v } - -// NullableMonitorFormulaAndFunctionEventsDataSource handles when a null is used for MonitorFormulaAndFunctionEventsDataSource. -type NullableMonitorFormulaAndFunctionEventsDataSource struct { - value *MonitorFormulaAndFunctionEventsDataSource - isSet bool -} - -// Get returns the associated value. -func (v NullableMonitorFormulaAndFunctionEventsDataSource) Get() *MonitorFormulaAndFunctionEventsDataSource { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMonitorFormulaAndFunctionEventsDataSource) Set(val *MonitorFormulaAndFunctionEventsDataSource) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMonitorFormulaAndFunctionEventsDataSource) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMonitorFormulaAndFunctionEventsDataSource) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMonitorFormulaAndFunctionEventsDataSource initializes the struct as if Set has been called. -func NewNullableMonitorFormulaAndFunctionEventsDataSource(val *MonitorFormulaAndFunctionEventsDataSource) *NullableMonitorFormulaAndFunctionEventsDataSource { - return &NullableMonitorFormulaAndFunctionEventsDataSource{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMonitorFormulaAndFunctionEventsDataSource) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMonitorFormulaAndFunctionEventsDataSource) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_query_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_query_definition.go index f56cc4da9..a87c3e423 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_query_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_formula_and_function_query_definition.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" ) // MonitorFormulaAndFunctionQueryDefinition - A formula and function query. @@ -71,53 +71,3 @@ func (obj *MonitorFormulaAndFunctionQueryDefinition) GetActualInstance() interfa // all schemas are nil return nil } - -// NullableMonitorFormulaAndFunctionQueryDefinition handles when a null is used for MonitorFormulaAndFunctionQueryDefinition. -type NullableMonitorFormulaAndFunctionQueryDefinition struct { - value *MonitorFormulaAndFunctionQueryDefinition - isSet bool -} - -// Get returns the associated value. -func (v NullableMonitorFormulaAndFunctionQueryDefinition) Get() *MonitorFormulaAndFunctionQueryDefinition { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMonitorFormulaAndFunctionQueryDefinition) Set(val *MonitorFormulaAndFunctionQueryDefinition) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMonitorFormulaAndFunctionQueryDefinition) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableMonitorFormulaAndFunctionQueryDefinition) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMonitorFormulaAndFunctionQueryDefinition initializes the struct as if Set has been called. -func NewNullableMonitorFormulaAndFunctionQueryDefinition(val *MonitorFormulaAndFunctionQueryDefinition) *NullableMonitorFormulaAndFunctionQueryDefinition { - return &NullableMonitorFormulaAndFunctionQueryDefinition{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMonitorFormulaAndFunctionQueryDefinition) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMonitorFormulaAndFunctionQueryDefinition) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_group_search_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_group_search_response.go index 112c346cf..d0ac409c5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_group_search_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_group_search_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o MonitorGroupSearchResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorGroupSearchResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Counts *MonitorGroupSearchResponseCounts `json:"counts,omitempty"` Groups []MonitorGroupSearchResult `json:"groups,omitempty"` Metadata *MonitorSearchResponseMetadata `json:"metadata,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,26 +162,25 @@ func (o *MonitorGroupSearchResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Counts != nil && all.Counts.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Counts = all.Counts o.Groups = all.Groups if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Metadata = all.Metadata + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_group_search_response_counts.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_group_search_response_counts.go index 0f6bba97a..19458e4f0 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_group_search_response_counts.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_group_search_response_counts.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o MonitorGroupSearchResponseCounts) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorGroupSearchResponseCounts) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Status []MonitorSearchCountItem `json:"status,omitempty"` Type []MonitorSearchCountItem `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *MonitorGroupSearchResponseCounts) UnmarshalJSON(bytes []byte) (err erro } o.Status = all.Status o.Type = all.Type + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_group_search_result.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_group_search_result.go index 0abfe63f2..a80c92460 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_group_search_result.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_group_search_result.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -291,7 +291,6 @@ func (o MonitorGroupSearchResult) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorGroupSearchResult) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Group *string `json:"group,omitempty"` GroupTags []string `json:"group_tags,omitempty"` @@ -302,12 +301,7 @@ func (o *MonitorGroupSearchResult) UnmarshalJSON(bytes []byte) (err error) { Status *MonitorOverallStates `json:"status,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -315,24 +309,27 @@ func (o *MonitorGroupSearchResult) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Group = all.Group o.GroupTags = all.GroupTags o.LastNodataTs = all.LastNodataTs o.LastTriggeredTs = all.LastTriggeredTs o.MonitorId = all.MonitorId o.MonitorName = all.MonitorName - o.Status = all.Status + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_options.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_options.go index fea7735f1..434c59ec5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_options.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_options.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -1275,7 +1275,6 @@ func (o MonitorOptions) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregation *MonitorOptionsAggregation `json:"aggregation,omitempty"` DeviceIds []MonitorDeviceID `json:"device_ids,omitempty"` @@ -1310,12 +1309,7 @@ func (o *MonitorOptions) UnmarshalJSON(bytes []byte) (err error) { Variables []MonitorFormulaAndFunctionQueryDefinition `json:"variables,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -1323,28 +1317,10 @@ func (o *MonitorOptions) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.NotificationPresetName; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.OnMissingData; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Aggregation != nil && all.Aggregation.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Aggregation = all.Aggregation o.DeviceIds = all.DeviceIds @@ -1361,46 +1337,47 @@ func (o *MonitorOptions) UnmarshalJSON(bytes []byte) (err error) { o.NewGroupDelay = all.NewGroupDelay o.NewHostDelay = all.NewHostDelay o.NoDataTimeframe = all.NoDataTimeframe - o.NotificationPresetName = all.NotificationPresetName + if all.NotificationPresetName != nil && !all.NotificationPresetName.IsValid() { + hasInvalidField = true + } else { + o.NotificationPresetName = all.NotificationPresetName + } o.NotifyAudit = all.NotifyAudit o.NotifyBy = all.NotifyBy o.NotifyNoData = all.NotifyNoData - o.OnMissingData = all.OnMissingData + if all.OnMissingData != nil && !all.OnMissingData.IsValid() { + hasInvalidField = true + } else { + o.OnMissingData = all.OnMissingData + } o.RenotifyInterval = all.RenotifyInterval o.RenotifyOccurrences = all.RenotifyOccurrences o.RenotifyStatuses = all.RenotifyStatuses o.RequireFullWindow = all.RequireFullWindow if all.SchedulingOptions != nil && all.SchedulingOptions.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.SchedulingOptions = all.SchedulingOptions o.Silenced = all.Silenced o.SyntheticsCheckId = all.SyntheticsCheckId if all.ThresholdWindows != nil && all.ThresholdWindows.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ThresholdWindows = all.ThresholdWindows if all.Thresholds != nil && all.Thresholds.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Thresholds = all.Thresholds o.TimeoutH = all.TimeoutH o.Variables = all.Variables + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_options_aggregation.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_options_aggregation.go index 11983b4f8..d096f993d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_options_aggregation.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_options_aggregation.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o MonitorOptionsAggregation) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorOptionsAggregation) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { GroupBy *string `json:"group_by,omitempty"` Metric *string `json:"metric,omitempty"` Type *string `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *MonitorOptionsAggregation) UnmarshalJSON(bytes []byte) (err error) { o.GroupBy = all.GroupBy o.Metric = all.Metric o.Type = all.Type + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_options_notification_presets.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_options_notification_presets.go index 02fe6e6dd..ccf0780ca 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_options_notification_presets.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_options_notification_presets.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MonitorOptionsNotificationPresets Toggles the display of additional content sent in the monitor notification. @@ -67,47 +68,3 @@ func (v MonitorOptionsNotificationPresets) IsValid() bool { func (v MonitorOptionsNotificationPresets) Ptr() *MonitorOptionsNotificationPresets { return &v } - -// NullableMonitorOptionsNotificationPresets handles when a null is used for MonitorOptionsNotificationPresets. -type NullableMonitorOptionsNotificationPresets struct { - value *MonitorOptionsNotificationPresets - isSet bool -} - -// Get returns the associated value. -func (v NullableMonitorOptionsNotificationPresets) Get() *MonitorOptionsNotificationPresets { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMonitorOptionsNotificationPresets) Set(val *MonitorOptionsNotificationPresets) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMonitorOptionsNotificationPresets) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMonitorOptionsNotificationPresets) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMonitorOptionsNotificationPresets initializes the struct as if Set has been called. -func NewNullableMonitorOptionsNotificationPresets(val *MonitorOptionsNotificationPresets) *NullableMonitorOptionsNotificationPresets { - return &NullableMonitorOptionsNotificationPresets{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMonitorOptionsNotificationPresets) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMonitorOptionsNotificationPresets) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_options_scheduling_options.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_options_scheduling_options.go index cd4446721..11340a2b9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_options_scheduling_options.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_options_scheduling_options.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o MonitorOptionsSchedulingOptions) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorOptionsSchedulingOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { EvaluationWindow *MonitorOptionsSchedulingOptionsEvaluationWindow `json:"evaluation_window,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *MonitorOptionsSchedulingOptions) UnmarshalJSON(bytes []byte) (err error } else { return err } + + hasInvalidField := false if all.EvaluationWindow != nil && all.EvaluationWindow.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.EvaluationWindow = all.EvaluationWindow + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_options_scheduling_options_evaluation_window.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_options_scheduling_options_evaluation_window.go index 8a6132958..c5b604021 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_options_scheduling_options_evaluation_window.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_options_scheduling_options_evaluation_window.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o MonitorOptionsSchedulingOptionsEvaluationWindow) MarshalJSON() ([]byte, // UnmarshalJSON deserializes the given payload. func (o *MonitorOptionsSchedulingOptionsEvaluationWindow) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DayStarts *string `json:"day_starts,omitempty"` HourStarts *int32 `json:"hour_starts,omitempty"` MonthStarts *int32 `json:"month_starts,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *MonitorOptionsSchedulingOptionsEvaluationWindow) UnmarshalJSON(bytes [] o.DayStarts = all.DayStarts o.HourStarts = all.HourStarts o.MonthStarts = all.MonthStarts + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_overall_states.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_overall_states.go index 9d777d52a..aa3d82a90 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_overall_states.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_overall_states.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MonitorOverallStates The different states your monitor can be in. @@ -73,47 +74,3 @@ func (v MonitorOverallStates) IsValid() bool { func (v MonitorOverallStates) Ptr() *MonitorOverallStates { return &v } - -// NullableMonitorOverallStates handles when a null is used for MonitorOverallStates. -type NullableMonitorOverallStates struct { - value *MonitorOverallStates - isSet bool -} - -// Get returns the associated value. -func (v NullableMonitorOverallStates) Get() *MonitorOverallStates { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMonitorOverallStates) Set(val *MonitorOverallStates) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMonitorOverallStates) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMonitorOverallStates) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMonitorOverallStates initializes the struct as if Set has been called. -func NewNullableMonitorOverallStates(val *MonitorOverallStates) *NullableMonitorOverallStates { - return &NullableMonitorOverallStates{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMonitorOverallStates) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMonitorOverallStates) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_renotify_status_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_renotify_status_type.go index 05e6ba335..342a89f87 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_renotify_status_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_renotify_status_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MonitorRenotifyStatusType The different statuses for which renotification is supported. @@ -65,47 +66,3 @@ func (v MonitorRenotifyStatusType) IsValid() bool { func (v MonitorRenotifyStatusType) Ptr() *MonitorRenotifyStatusType { return &v } - -// NullableMonitorRenotifyStatusType handles when a null is used for MonitorRenotifyStatusType. -type NullableMonitorRenotifyStatusType struct { - value *MonitorRenotifyStatusType - isSet bool -} - -// Get returns the associated value. -func (v NullableMonitorRenotifyStatusType) Get() *MonitorRenotifyStatusType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMonitorRenotifyStatusType) Set(val *MonitorRenotifyStatusType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMonitorRenotifyStatusType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMonitorRenotifyStatusType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMonitorRenotifyStatusType initializes the struct as if Set has been called. -func NewNullableMonitorRenotifyStatusType(val *MonitorRenotifyStatusType) *NullableMonitorRenotifyStatusType { - return &NullableMonitorRenotifyStatusType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMonitorRenotifyStatusType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMonitorRenotifyStatusType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_search_count_item.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_search_count_item.go index 45fc1a41b..69195434d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_search_count_item.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_search_count_item.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o MonitorSearchCountItem) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorSearchCountItem) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Count *int64 `json:"count,omitempty"` Name interface{} `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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *MonitorSearchCountItem) UnmarshalJSON(bytes []byte) (err error) { } o.Count = all.Count o.Name = all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_search_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_search_response.go index 77462f3c8..d29a2c168 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_search_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_search_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o MonitorSearchResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorSearchResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Counts *MonitorSearchResponseCounts `json:"counts,omitempty"` Metadata *MonitorSearchResponseMetadata `json:"metadata,omitempty"` Monitors []MonitorSearchResult `json:"monitors,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,26 +162,25 @@ func (o *MonitorSearchResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Counts != nil && all.Counts.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Counts = all.Counts if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Metadata = all.Metadata o.Monitors = all.Monitors + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_search_response_counts.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_search_response_counts.go index 327250e1b..2a3ec4d5c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_search_response_counts.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_search_response_counts.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -181,7 +181,6 @@ func (o MonitorSearchResponseCounts) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorSearchResponseCounts) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Muted []MonitorSearchCountItem `json:"muted,omitempty"` Status []MonitorSearchCountItem `json:"status,omitempty"` @@ -189,12 +188,7 @@ func (o *MonitorSearchResponseCounts) UnmarshalJSON(bytes []byte) (err error) { Type []MonitorSearchCountItem `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,6 +200,7 @@ func (o *MonitorSearchResponseCounts) UnmarshalJSON(bytes []byte) (err error) { o.Status = all.Status o.Tag = all.Tag o.Type = all.Type + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_search_response_metadata.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_search_response_metadata.go index 6a6d0c84f..fa79c0d40 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_search_response_metadata.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_search_response_metadata.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -181,7 +181,6 @@ func (o MonitorSearchResponseMetadata) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorSearchResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Page *int64 `json:"page,omitempty"` PageCount *int64 `json:"page_count,omitempty"` @@ -189,12 +188,7 @@ func (o *MonitorSearchResponseMetadata) UnmarshalJSON(bytes []byte) (err error) TotalCount *int64 `json:"total_count,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,6 +200,7 @@ func (o *MonitorSearchResponseMetadata) UnmarshalJSON(bytes []byte) (err error) o.PageCount = all.PageCount o.PerPage = all.PerPage o.TotalCount = all.TotalCount + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_search_result.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_search_result.go index 90f9af3f4..27ab07433 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_search_result.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_search_result.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -492,7 +492,6 @@ func (o MonitorSearchResult) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorSearchResult) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Classification *string `json:"classification,omitempty"` Creator *Creator `json:"creator,omitempty"` @@ -509,12 +508,7 @@ func (o *MonitorSearchResult) UnmarshalJSON(bytes []byte) (err error) { Type *MonitorType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -522,29 +516,11 @@ func (o *MonitorSearchResult) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Classification = all.Classification if all.Creator != nil && all.Creator.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Creator = all.Creator o.Id = all.Id @@ -555,12 +531,25 @@ func (o *MonitorSearchResult) UnmarshalJSON(bytes []byte) (err error) { o.OrgId = all.OrgId o.Query = all.Query o.Scopes = all.Scopes - o.Status = all.Status + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } o.Tags = all.Tags - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_search_result_notification.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_search_result_notification.go index c10837381..caea17d0b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_search_result_notification.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_search_result_notification.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o MonitorSearchResultNotification) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorSearchResultNotification) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Handle *string `json:"handle,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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *MonitorSearchResultNotification) UnmarshalJSON(bytes []byte) (err error } o.Handle = all.Handle o.Name = all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_state.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_state.go index 194e0f0e8..f6a92681c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_state.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_state.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -83,17 +83,11 @@ func (o MonitorState) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorState) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Groups map[string]MonitorStateGroup `json:"groups,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -102,6 +96,7 @@ func (o *MonitorState) UnmarshalJSON(bytes []byte) (err error) { return err } o.Groups = all.Groups + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_state_group.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_state_group.go index 78e7446e6..ee244d8d1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_state_group.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_state_group.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -247,7 +247,6 @@ func (o MonitorStateGroup) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorStateGroup) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { LastNodataTs *int64 `json:"last_nodata_ts,omitempty"` LastNotifiedTs *int64 `json:"last_notified_ts,omitempty"` @@ -257,12 +256,7 @@ func (o *MonitorStateGroup) UnmarshalJSON(bytes []byte) (err error) { Status *MonitorOverallStates `json:"status,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -270,23 +264,26 @@ func (o *MonitorStateGroup) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.LastNodataTs = all.LastNodataTs o.LastNotifiedTs = all.LastNotifiedTs o.LastResolvedTs = all.LastResolvedTs o.LastTriggeredTs = all.LastTriggeredTs o.Name = all.Name - o.Status = all.Status + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_summary_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_summary_widget_definition.go index 888158ffc..b31a99779 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_summary_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_summary_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -514,7 +515,6 @@ func (o MonitorSummaryWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorSummaryWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ColorPreference *WidgetColorPreference `json:"color_preference,omitempty"` Count *int64 `json:"count,omitempty"` @@ -532,12 +532,7 @@ func (o *MonitorSummaryWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) Type *MonitorSummaryWidgetDefinitionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Query == nil { return fmt.Errorf("required field query missing") @@ -551,71 +546,54 @@ func (o *MonitorSummaryWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.ColorPreference; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.DisplayFormat; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Sort; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.SummaryType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ColorPreference = all.ColorPreference + + hasInvalidField := false + if all.ColorPreference != nil && !all.ColorPreference.IsValid() { + hasInvalidField = true + } else { + o.ColorPreference = all.ColorPreference + } o.Count = all.Count - o.DisplayFormat = all.DisplayFormat + if all.DisplayFormat != nil && !all.DisplayFormat.IsValid() { + hasInvalidField = true + } else { + o.DisplayFormat = all.DisplayFormat + } o.HideZeroCounts = all.HideZeroCounts o.Query = *all.Query o.ShowLastTriggered = all.ShowLastTriggered o.ShowPriority = all.ShowPriority - o.Sort = all.Sort + if all.Sort != nil && !all.Sort.IsValid() { + hasInvalidField = true + } else { + o.Sort = all.Sort + } o.Start = all.Start - o.SummaryType = all.SummaryType + if all.SummaryType != nil && !all.SummaryType.IsValid() { + hasInvalidField = true + } else { + o.SummaryType = all.SummaryType + } o.Title = all.Title - o.TitleAlign = all.TitleAlign + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } o.TitleSize = all.TitleSize - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_summary_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_summary_widget_definition_type.go index 61b0ed5c6..6107baf3a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_summary_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_summary_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MonitorSummaryWidgetDefinitionType Type of the monitor summary widget. @@ -61,47 +62,3 @@ func (v MonitorSummaryWidgetDefinitionType) IsValid() bool { func (v MonitorSummaryWidgetDefinitionType) Ptr() *MonitorSummaryWidgetDefinitionType { return &v } - -// NullableMonitorSummaryWidgetDefinitionType handles when a null is used for MonitorSummaryWidgetDefinitionType. -type NullableMonitorSummaryWidgetDefinitionType struct { - value *MonitorSummaryWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableMonitorSummaryWidgetDefinitionType) Get() *MonitorSummaryWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMonitorSummaryWidgetDefinitionType) Set(val *MonitorSummaryWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMonitorSummaryWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMonitorSummaryWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMonitorSummaryWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableMonitorSummaryWidgetDefinitionType(val *MonitorSummaryWidgetDefinitionType) *NullableMonitorSummaryWidgetDefinitionType { - return &NullableMonitorSummaryWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMonitorSummaryWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMonitorSummaryWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_threshold_window_options.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_threshold_window_options.go index 6bce41512..773be6d5a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_threshold_window_options.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_threshold_window_options.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -137,18 +137,12 @@ func (o MonitorThresholdWindowOptions) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorThresholdWindowOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { RecoveryWindow datadog.NullableString `json:"recovery_window,omitempty"` TriggerWindow datadog.NullableString `json:"trigger_window,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -158,6 +152,7 @@ func (o *MonitorThresholdWindowOptions) UnmarshalJSON(bytes []byte) (err error) } o.RecoveryWindow = all.RecoveryWindow o.TriggerWindow = all.TriggerWindow + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_thresholds.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_thresholds.go index 09c75db55..6d5efa51d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_thresholds.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_thresholds.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -302,7 +302,6 @@ func (o MonitorThresholds) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorThresholds) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Critical *float64 `json:"critical,omitempty"` CriticalRecovery datadog.NullableFloat64 `json:"critical_recovery,omitempty"` @@ -312,12 +311,7 @@ func (o *MonitorThresholds) UnmarshalJSON(bytes []byte) (err error) { WarningRecovery datadog.NullableFloat64 `json:"warning_recovery,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -331,6 +325,7 @@ func (o *MonitorThresholds) UnmarshalJSON(bytes []byte) (err error) { o.Unknown = all.Unknown o.Warning = all.Warning o.WarningRecovery = all.WarningRecovery + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_type.go index 887e5a3f7..161494157 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MonitorType The type of the monitor. For more information about `type`, see the [monitor options](https://docs.datadoghq.com/monitors/guide/monitor_api_options/) docs. @@ -93,47 +94,3 @@ func (v MonitorType) IsValid() bool { func (v MonitorType) Ptr() *MonitorType { return &v } - -// NullableMonitorType handles when a null is used for MonitorType. -type NullableMonitorType struct { - value *MonitorType - isSet bool -} - -// Get returns the associated value. -func (v NullableMonitorType) Get() *MonitorType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMonitorType) Set(val *MonitorType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMonitorType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMonitorType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMonitorType initializes the struct as if Set has been called. -func NewNullableMonitorType(val *MonitorType) *NullableMonitorType { - return &NullableMonitorType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMonitorType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMonitorType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_update_request.go index c32df187f..eebc32b51 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monitor_update_request.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -608,7 +609,6 @@ func (o MonitorUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Created *time.Time `json:"created,omitempty"` Creator *Creator `json:"creator,omitempty"` @@ -628,12 +628,7 @@ func (o *MonitorUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { Type *MonitorType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -641,29 +636,11 @@ func (o *MonitorUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.OverallState; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Created = all.Created if all.Creator != nil && all.Creator.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Creator = all.Creator o.Deleted = all.Deleted @@ -673,30 +650,35 @@ func (o *MonitorUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { o.Multi = all.Multi o.Name = all.Name if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Options = all.Options - o.OverallState = all.OverallState + if all.OverallState != nil && !all.OverallState.IsValid() { + hasInvalidField = true + } else { + o.OverallState = all.OverallState + } o.Priority = all.Priority o.Query = all.Query o.RestrictedRoles = all.RestrictedRoles if all.State != nil && all.State.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.State = all.State o.Tags = all.Tags - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monthly_usage_attribution_body.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monthly_usage_attribution_body.go index 8ad1c5f20..1a8980424 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monthly_usage_attribution_body.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monthly_usage_attribution_body.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -327,7 +328,6 @@ func (o MonthlyUsageAttributionBody) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonthlyUsageAttributionBody) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Month *time.Time `json:"month,omitempty"` OrgName *string `json:"org_name,omitempty"` @@ -339,12 +339,7 @@ func (o *MonthlyUsageAttributionBody) UnmarshalJSON(bytes []byte) (err error) { Values *MonthlyUsageAttributionValues `json:"values,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -352,6 +347,8 @@ func (o *MonthlyUsageAttributionBody) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Month = all.Month o.OrgName = all.OrgName o.PublicId = all.PublicId @@ -360,16 +357,17 @@ func (o *MonthlyUsageAttributionBody) UnmarshalJSON(bytes []byte) (err error) { o.Tags = all.Tags o.UpdatedAt = all.UpdatedAt if all.Values != nil && all.Values.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Values = all.Values + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monthly_usage_attribution_metadata.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monthly_usage_attribution_metadata.go index 26ff75915..2bf5d26dc 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monthly_usage_attribution_metadata.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monthly_usage_attribution_metadata.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o MonthlyUsageAttributionMetadata) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonthlyUsageAttributionMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregates []UsageAttributionAggregatesBody `json:"aggregates,omitempty"` Pagination *MonthlyUsageAttributionPagination `json:"pagination,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *MonthlyUsageAttributionMetadata) UnmarshalJSON(bytes []byte) (err error } else { return err } + + hasInvalidField := false o.Aggregates = all.Aggregates if all.Pagination != nil && all.Pagination.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Pagination = all.Pagination + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monthly_usage_attribution_pagination.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monthly_usage_attribution_pagination.go index 892cd0344..76e42386e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monthly_usage_attribution_pagination.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monthly_usage_attribution_pagination.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -93,17 +93,11 @@ func (o MonthlyUsageAttributionPagination) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonthlyUsageAttributionPagination) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { NextRecordId datadog.NullableString `json:"next_record_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -112,6 +106,7 @@ func (o *MonthlyUsageAttributionPagination) UnmarshalJSON(bytes []byte) (err err return err } o.NextRecordId = all.NextRecordId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monthly_usage_attribution_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monthly_usage_attribution_response.go index 84fe5d08a..11f164ba4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monthly_usage_attribution_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monthly_usage_attribution_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o MonthlyUsageAttributionResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonthlyUsageAttributionResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Metadata *MonthlyUsageAttributionMetadata `json:"metadata,omitempty"` Usage []MonthlyUsageAttributionBody `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *MonthlyUsageAttributionResponse) UnmarshalJSON(bytes []byte) (err error } else { return err } + + hasInvalidField := false if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Metadata = all.Metadata o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monthly_usage_attribution_supported_metrics.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monthly_usage_attribution_supported_metrics.go index 763d23084..9bed90159 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monthly_usage_attribution_supported_metrics.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monthly_usage_attribution_supported_metrics.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MonthlyUsageAttributionSupportedMetrics Supported metrics for monthly usage attribution requests. @@ -22,10 +23,14 @@ const ( MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APPSEC_FARGATE_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "appsec_fargate_percentage" MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APM_HOST_USAGE MonthlyUsageAttributionSupportedMetrics = "apm_host_usage" MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APM_HOST_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "apm_host_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APM_USM_USAGE MonthlyUsageAttributionSupportedMetrics = "apm_usm_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APM_USM_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "apm_usm_percentage" MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APPSEC_USAGE MonthlyUsageAttributionSupportedMetrics = "appsec_usage" MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APPSEC_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "appsec_percentage" MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_BROWSER_USAGE MonthlyUsageAttributionSupportedMetrics = "browser_usage" MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_BROWSER_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "browser_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CI_VISIBILITY_ITR_USAGE MonthlyUsageAttributionSupportedMetrics = "ci_visibility_itr_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CI_VISIBILITY_ITR_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "ci_visibility_itr_percentage" MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CONTAINER_EXCL_AGENT_USAGE MonthlyUsageAttributionSupportedMetrics = "container_excl_agent_usage" MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CONTAINER_EXCL_AGENT_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "container_excl_agent_percentage" MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CONTAINER_USAGE MonthlyUsageAttributionSupportedMetrics = "container_usage" @@ -80,6 +85,8 @@ const ( MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_UNIVERSAL_SERVICE_MONITORING_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "universal_service_monitoring_percentage" MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_VULN_MANAGEMENT_HOSTS_USAGE MonthlyUsageAttributionSupportedMetrics = "vuln_management_hosts_usage" MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_VULN_MANAGEMENT_HOSTS_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "vuln_management_hosts_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_SDS_SCANNED_BYTES_USAGE MonthlyUsageAttributionSupportedMetrics = "sds_scanned_bytes_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_SDS_SCANNED_BYTES_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "sds_scanned_bytes_percentage" MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ALL MonthlyUsageAttributionSupportedMetrics = "*" ) @@ -92,10 +99,14 @@ var allowedMonthlyUsageAttributionSupportedMetricsEnumValues = []MonthlyUsageAtt MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APPSEC_FARGATE_PERCENTAGE, MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APM_HOST_USAGE, MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APM_HOST_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APM_USM_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APM_USM_PERCENTAGE, MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APPSEC_USAGE, MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APPSEC_PERCENTAGE, MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_BROWSER_USAGE, MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_BROWSER_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CI_VISIBILITY_ITR_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CI_VISIBILITY_ITR_PERCENTAGE, MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CONTAINER_EXCL_AGENT_USAGE, MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CONTAINER_EXCL_AGENT_PERCENTAGE, MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CONTAINER_USAGE, @@ -150,6 +161,8 @@ var allowedMonthlyUsageAttributionSupportedMetricsEnumValues = []MonthlyUsageAtt MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_UNIVERSAL_SERVICE_MONITORING_PERCENTAGE, MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_VULN_MANAGEMENT_HOSTS_USAGE, MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_VULN_MANAGEMENT_HOSTS_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_SDS_SCANNED_BYTES_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_SDS_SCANNED_BYTES_PERCENTAGE, MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ALL, } @@ -193,47 +206,3 @@ func (v MonthlyUsageAttributionSupportedMetrics) IsValid() bool { func (v MonthlyUsageAttributionSupportedMetrics) Ptr() *MonthlyUsageAttributionSupportedMetrics { return &v } - -// NullableMonthlyUsageAttributionSupportedMetrics handles when a null is used for MonthlyUsageAttributionSupportedMetrics. -type NullableMonthlyUsageAttributionSupportedMetrics struct { - value *MonthlyUsageAttributionSupportedMetrics - isSet bool -} - -// Get returns the associated value. -func (v NullableMonthlyUsageAttributionSupportedMetrics) Get() *MonthlyUsageAttributionSupportedMetrics { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMonthlyUsageAttributionSupportedMetrics) Set(val *MonthlyUsageAttributionSupportedMetrics) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMonthlyUsageAttributionSupportedMetrics) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMonthlyUsageAttributionSupportedMetrics) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMonthlyUsageAttributionSupportedMetrics initializes the struct as if Set has been called. -func NewNullableMonthlyUsageAttributionSupportedMetrics(val *MonthlyUsageAttributionSupportedMetrics) *NullableMonthlyUsageAttributionSupportedMetrics { - return &NullableMonthlyUsageAttributionSupportedMetrics{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMonthlyUsageAttributionSupportedMetrics) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMonthlyUsageAttributionSupportedMetrics) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monthly_usage_attribution_values.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monthly_usage_attribution_values.go index d63b9cce8..ad504752c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monthly_usage_attribution_values.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_monthly_usage_attribution_values.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -24,6 +24,10 @@ type MonthlyUsageAttributionValues struct { ApmHostPercentage *float64 `json:"apm_host_percentage,omitempty"` // The APM host usage by tag(s). ApmHostUsage *float64 `json:"apm_host_usage,omitempty"` + // The percentage of APM and Universal Service Monitoring host usage by tag(s). + ApmUsmPercentage *float64 `json:"apm_usm_percentage,omitempty"` + // The APM and Universal Service Monitoring host usage by tag(s). + ApmUsmUsage *float64 `json:"apm_usm_usage,omitempty"` // The percentage of Application Security Monitoring ECS Fargate task usage by tag(s). AppsecFargatePercentage *float64 `json:"appsec_fargate_percentage,omitempty"` // The Application Security Monitoring ECS Fargate task usage by tag(s). @@ -36,6 +40,10 @@ type MonthlyUsageAttributionValues struct { BrowserPercentage *float64 `json:"browser_percentage,omitempty"` // The synthetic browser test usage by tag(s). BrowserUsage *float64 `json:"browser_usage,omitempty"` + // The percentage of Git committers for Intelligent Test Runner usage by tag(s). + CiVisibilityItrPercentage *float64 `json:"ci_visibility_itr_percentage,omitempty"` + // The Git committers for Intelligent Test Runner usage by tag(s). + CiVisibilityItrUsage *float64 `json:"ci_visibility_itr_usage,omitempty"` // The percentage of container usage without the Datadog Agent by tag(s). ContainerExclAgentPercentage *float64 `json:"container_excl_agent_percentage,omitempty"` // The container usage without the Datadog Agent by tag(s). @@ -132,6 +140,10 @@ type MonthlyUsageAttributionValues struct { ProfiledHostPercentage *float64 `json:"profiled_host_percentage,omitempty"` // The profiled hosts usage by tag(s). ProfiledHostUsage *float64 `json:"profiled_host_usage,omitempty"` + // The percentage of Sensitive Data Scanner usage by tag(s). + SdsScannedBytesPercentage *float64 `json:"sds_scanned_bytes_percentage,omitempty"` + // The total Sensitive Data Scanner usage by tag(s). + SdsScannedBytesUsage *float64 `json:"sds_scanned_bytes_usage,omitempty"` // The percentage of network device usage by tag(s). SnmpPercentage *float64 `json:"snmp_percentage,omitempty"` // The network device usage by tag(s). @@ -334,6 +346,62 @@ func (o *MonthlyUsageAttributionValues) SetApmHostUsage(v float64) { o.ApmHostUsage = &v } +// GetApmUsmPercentage returns the ApmUsmPercentage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetApmUsmPercentage() float64 { + if o == nil || o.ApmUsmPercentage == nil { + var ret float64 + return ret + } + return *o.ApmUsmPercentage +} + +// GetApmUsmPercentageOk returns a tuple with the ApmUsmPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetApmUsmPercentageOk() (*float64, bool) { + if o == nil || o.ApmUsmPercentage == nil { + return nil, false + } + return o.ApmUsmPercentage, true +} + +// HasApmUsmPercentage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasApmUsmPercentage() bool { + return o != nil && o.ApmUsmPercentage != nil +} + +// SetApmUsmPercentage gets a reference to the given float64 and assigns it to the ApmUsmPercentage field. +func (o *MonthlyUsageAttributionValues) SetApmUsmPercentage(v float64) { + o.ApmUsmPercentage = &v +} + +// GetApmUsmUsage returns the ApmUsmUsage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetApmUsmUsage() float64 { + if o == nil || o.ApmUsmUsage == nil { + var ret float64 + return ret + } + return *o.ApmUsmUsage +} + +// GetApmUsmUsageOk returns a tuple with the ApmUsmUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetApmUsmUsageOk() (*float64, bool) { + if o == nil || o.ApmUsmUsage == nil { + return nil, false + } + return o.ApmUsmUsage, true +} + +// HasApmUsmUsage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasApmUsmUsage() bool { + return o != nil && o.ApmUsmUsage != nil +} + +// SetApmUsmUsage gets a reference to the given float64 and assigns it to the ApmUsmUsage field. +func (o *MonthlyUsageAttributionValues) SetApmUsmUsage(v float64) { + o.ApmUsmUsage = &v +} + // GetAppsecFargatePercentage returns the AppsecFargatePercentage field value if set, zero value otherwise. func (o *MonthlyUsageAttributionValues) GetAppsecFargatePercentage() float64 { if o == nil || o.AppsecFargatePercentage == nil { @@ -502,6 +570,62 @@ func (o *MonthlyUsageAttributionValues) SetBrowserUsage(v float64) { o.BrowserUsage = &v } +// GetCiVisibilityItrPercentage returns the CiVisibilityItrPercentage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetCiVisibilityItrPercentage() float64 { + if o == nil || o.CiVisibilityItrPercentage == nil { + var ret float64 + return ret + } + return *o.CiVisibilityItrPercentage +} + +// GetCiVisibilityItrPercentageOk returns a tuple with the CiVisibilityItrPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetCiVisibilityItrPercentageOk() (*float64, bool) { + if o == nil || o.CiVisibilityItrPercentage == nil { + return nil, false + } + return o.CiVisibilityItrPercentage, true +} + +// HasCiVisibilityItrPercentage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasCiVisibilityItrPercentage() bool { + return o != nil && o.CiVisibilityItrPercentage != nil +} + +// SetCiVisibilityItrPercentage gets a reference to the given float64 and assigns it to the CiVisibilityItrPercentage field. +func (o *MonthlyUsageAttributionValues) SetCiVisibilityItrPercentage(v float64) { + o.CiVisibilityItrPercentage = &v +} + +// GetCiVisibilityItrUsage returns the CiVisibilityItrUsage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetCiVisibilityItrUsage() float64 { + if o == nil || o.CiVisibilityItrUsage == nil { + var ret float64 + return ret + } + return *o.CiVisibilityItrUsage +} + +// GetCiVisibilityItrUsageOk returns a tuple with the CiVisibilityItrUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetCiVisibilityItrUsageOk() (*float64, bool) { + if o == nil || o.CiVisibilityItrUsage == nil { + return nil, false + } + return o.CiVisibilityItrUsage, true +} + +// HasCiVisibilityItrUsage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasCiVisibilityItrUsage() bool { + return o != nil && o.CiVisibilityItrUsage != nil +} + +// SetCiVisibilityItrUsage gets a reference to the given float64 and assigns it to the CiVisibilityItrUsage field. +func (o *MonthlyUsageAttributionValues) SetCiVisibilityItrUsage(v float64) { + o.CiVisibilityItrUsage = &v +} + // GetContainerExclAgentPercentage returns the ContainerExclAgentPercentage field value if set, zero value otherwise. func (o *MonthlyUsageAttributionValues) GetContainerExclAgentPercentage() float64 { if o == nil || o.ContainerExclAgentPercentage == nil { @@ -1846,6 +1970,62 @@ func (o *MonthlyUsageAttributionValues) SetProfiledHostUsage(v float64) { o.ProfiledHostUsage = &v } +// GetSdsScannedBytesPercentage returns the SdsScannedBytesPercentage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetSdsScannedBytesPercentage() float64 { + if o == nil || o.SdsScannedBytesPercentage == nil { + var ret float64 + return ret + } + return *o.SdsScannedBytesPercentage +} + +// GetSdsScannedBytesPercentageOk returns a tuple with the SdsScannedBytesPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetSdsScannedBytesPercentageOk() (*float64, bool) { + if o == nil || o.SdsScannedBytesPercentage == nil { + return nil, false + } + return o.SdsScannedBytesPercentage, true +} + +// HasSdsScannedBytesPercentage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasSdsScannedBytesPercentage() bool { + return o != nil && o.SdsScannedBytesPercentage != nil +} + +// SetSdsScannedBytesPercentage gets a reference to the given float64 and assigns it to the SdsScannedBytesPercentage field. +func (o *MonthlyUsageAttributionValues) SetSdsScannedBytesPercentage(v float64) { + o.SdsScannedBytesPercentage = &v +} + +// GetSdsScannedBytesUsage returns the SdsScannedBytesUsage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetSdsScannedBytesUsage() float64 { + if o == nil || o.SdsScannedBytesUsage == nil { + var ret float64 + return ret + } + return *o.SdsScannedBytesUsage +} + +// GetSdsScannedBytesUsageOk returns a tuple with the SdsScannedBytesUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetSdsScannedBytesUsageOk() (*float64, bool) { + if o == nil || o.SdsScannedBytesUsage == nil { + return nil, false + } + return o.SdsScannedBytesUsage, true +} + +// HasSdsScannedBytesUsage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasSdsScannedBytesUsage() bool { + return o != nil && o.SdsScannedBytesUsage != nil +} + +// SetSdsScannedBytesUsage gets a reference to the given float64 and assigns it to the SdsScannedBytesUsage field. +func (o *MonthlyUsageAttributionValues) SetSdsScannedBytesUsage(v float64) { + o.SdsScannedBytesUsage = &v +} + // GetSnmpPercentage returns the SnmpPercentage field value if set, zero value otherwise. func (o *MonthlyUsageAttributionValues) GetSnmpPercentage() float64 { if o == nil || o.SnmpPercentage == nil { @@ -2038,6 +2218,12 @@ func (o MonthlyUsageAttributionValues) MarshalJSON() ([]byte, error) { if o.ApmHostUsage != nil { toSerialize["apm_host_usage"] = o.ApmHostUsage } + if o.ApmUsmPercentage != nil { + toSerialize["apm_usm_percentage"] = o.ApmUsmPercentage + } + if o.ApmUsmUsage != nil { + toSerialize["apm_usm_usage"] = o.ApmUsmUsage + } if o.AppsecFargatePercentage != nil { toSerialize["appsec_fargate_percentage"] = o.AppsecFargatePercentage } @@ -2056,6 +2242,12 @@ func (o MonthlyUsageAttributionValues) MarshalJSON() ([]byte, error) { if o.BrowserUsage != nil { toSerialize["browser_usage"] = o.BrowserUsage } + if o.CiVisibilityItrPercentage != nil { + toSerialize["ci_visibility_itr_percentage"] = o.CiVisibilityItrPercentage + } + if o.CiVisibilityItrUsage != nil { + toSerialize["ci_visibility_itr_usage"] = o.CiVisibilityItrUsage + } if o.ContainerExclAgentPercentage != nil { toSerialize["container_excl_agent_percentage"] = o.ContainerExclAgentPercentage } @@ -2200,6 +2392,12 @@ func (o MonthlyUsageAttributionValues) MarshalJSON() ([]byte, error) { if o.ProfiledHostUsage != nil { toSerialize["profiled_host_usage"] = o.ProfiledHostUsage } + if o.SdsScannedBytesPercentage != nil { + toSerialize["sds_scanned_bytes_percentage"] = o.SdsScannedBytesPercentage + } + if o.SdsScannedBytesUsage != nil { + toSerialize["sds_scanned_bytes_usage"] = o.SdsScannedBytesUsage + } if o.SnmpPercentage != nil { toSerialize["snmp_percentage"] = o.SnmpPercentage } @@ -2227,7 +2425,6 @@ func (o MonthlyUsageAttributionValues) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonthlyUsageAttributionValues) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApiPercentage *float64 `json:"api_percentage,omitempty"` ApiUsage *float64 `json:"api_usage,omitempty"` @@ -2235,12 +2432,16 @@ func (o *MonthlyUsageAttributionValues) UnmarshalJSON(bytes []byte) (err error) ApmFargateUsage *float64 `json:"apm_fargate_usage,omitempty"` ApmHostPercentage *float64 `json:"apm_host_percentage,omitempty"` ApmHostUsage *float64 `json:"apm_host_usage,omitempty"` + ApmUsmPercentage *float64 `json:"apm_usm_percentage,omitempty"` + ApmUsmUsage *float64 `json:"apm_usm_usage,omitempty"` AppsecFargatePercentage *float64 `json:"appsec_fargate_percentage,omitempty"` AppsecFargateUsage *float64 `json:"appsec_fargate_usage,omitempty"` AppsecPercentage *float64 `json:"appsec_percentage,omitempty"` AppsecUsage *float64 `json:"appsec_usage,omitempty"` BrowserPercentage *float64 `json:"browser_percentage,omitempty"` BrowserUsage *float64 `json:"browser_usage,omitempty"` + CiVisibilityItrPercentage *float64 `json:"ci_visibility_itr_percentage,omitempty"` + CiVisibilityItrUsage *float64 `json:"ci_visibility_itr_usage,omitempty"` ContainerExclAgentPercentage *float64 `json:"container_excl_agent_percentage,omitempty"` ContainerExclAgentUsage *float64 `json:"container_excl_agent_usage,omitempty"` ContainerPercentage *float64 `json:"container_percentage,omitempty"` @@ -2289,6 +2490,8 @@ func (o *MonthlyUsageAttributionValues) UnmarshalJSON(bytes []byte) (err error) ProfiledFargateUsage *float64 `json:"profiled_fargate_usage,omitempty"` ProfiledHostPercentage *float64 `json:"profiled_host_percentage,omitempty"` ProfiledHostUsage *float64 `json:"profiled_host_usage,omitempty"` + SdsScannedBytesPercentage *float64 `json:"sds_scanned_bytes_percentage,omitempty"` + SdsScannedBytesUsage *float64 `json:"sds_scanned_bytes_usage,omitempty"` SnmpPercentage *float64 `json:"snmp_percentage,omitempty"` SnmpUsage *float64 `json:"snmp_usage,omitempty"` UniversalServiceMonitoringPercentage *float64 `json:"universal_service_monitoring_percentage,omitempty"` @@ -2297,16 +2500,11 @@ func (o *MonthlyUsageAttributionValues) UnmarshalJSON(bytes []byte) (err error) VulnManagementHostsUsage *float64 `json:"vuln_management_hosts_usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"api_percentage", "api_usage", "apm_fargate_percentage", "apm_fargate_usage", "apm_host_percentage", "apm_host_usage", "appsec_fargate_percentage", "appsec_fargate_usage", "appsec_percentage", "appsec_usage", "browser_percentage", "browser_usage", "container_excl_agent_percentage", "container_excl_agent_usage", "container_percentage", "container_usage", "cspm_containers_percentage", "cspm_containers_usage", "cspm_hosts_percentage", "cspm_hosts_usage", "custom_ingested_timeseries_percentage", "custom_ingested_timeseries_usage", "custom_timeseries_percentage", "custom_timeseries_usage", "cws_containers_percentage", "cws_containers_usage", "cws_hosts_percentage", "cws_hosts_usage", "dbm_hosts_percentage", "dbm_hosts_usage", "dbm_queries_percentage", "dbm_queries_usage", "estimated_indexed_logs_percentage", "estimated_indexed_logs_usage", "estimated_indexed_spans_percentage", "estimated_indexed_spans_usage", "estimated_ingested_logs_percentage", "estimated_ingested_logs_usage", "estimated_ingested_spans_percentage", "estimated_ingested_spans_usage", "estimated_rum_sessions_percentage", "estimated_rum_sessions_usage", "fargate_percentage", "fargate_usage", "functions_percentage", "functions_usage", "infra_host_percentage", "infra_host_usage", "invocations_percentage", "invocations_usage", "npm_host_percentage", "npm_host_usage", "obs_pipeline_bytes_percentage", "obs_pipeline_bytes_usage", "profiled_container_percentage", "profiled_container_usage", "profiled_fargate_percentage", "profiled_fargate_usage", "profiled_host_percentage", "profiled_host_usage", "snmp_percentage", "snmp_usage", "universal_service_monitoring_percentage", "universal_service_monitoring_usage", "vuln_management_hosts_percentage", "vuln_management_hosts_usage"}) + datadog.DeleteKeys(additionalProperties, &[]string{"api_percentage", "api_usage", "apm_fargate_percentage", "apm_fargate_usage", "apm_host_percentage", "apm_host_usage", "apm_usm_percentage", "apm_usm_usage", "appsec_fargate_percentage", "appsec_fargate_usage", "appsec_percentage", "appsec_usage", "browser_percentage", "browser_usage", "ci_visibility_itr_percentage", "ci_visibility_itr_usage", "container_excl_agent_percentage", "container_excl_agent_usage", "container_percentage", "container_usage", "cspm_containers_percentage", "cspm_containers_usage", "cspm_hosts_percentage", "cspm_hosts_usage", "custom_ingested_timeseries_percentage", "custom_ingested_timeseries_usage", "custom_timeseries_percentage", "custom_timeseries_usage", "cws_containers_percentage", "cws_containers_usage", "cws_hosts_percentage", "cws_hosts_usage", "dbm_hosts_percentage", "dbm_hosts_usage", "dbm_queries_percentage", "dbm_queries_usage", "estimated_indexed_logs_percentage", "estimated_indexed_logs_usage", "estimated_indexed_spans_percentage", "estimated_indexed_spans_usage", "estimated_ingested_logs_percentage", "estimated_ingested_logs_usage", "estimated_ingested_spans_percentage", "estimated_ingested_spans_usage", "estimated_rum_sessions_percentage", "estimated_rum_sessions_usage", "fargate_percentage", "fargate_usage", "functions_percentage", "functions_usage", "infra_host_percentage", "infra_host_usage", "invocations_percentage", "invocations_usage", "npm_host_percentage", "npm_host_usage", "obs_pipeline_bytes_percentage", "obs_pipeline_bytes_usage", "profiled_container_percentage", "profiled_container_usage", "profiled_fargate_percentage", "profiled_fargate_usage", "profiled_host_percentage", "profiled_host_usage", "sds_scanned_bytes_percentage", "sds_scanned_bytes_usage", "snmp_percentage", "snmp_usage", "universal_service_monitoring_percentage", "universal_service_monitoring_usage", "vuln_management_hosts_percentage", "vuln_management_hosts_usage"}) } else { return err } @@ -2316,12 +2514,16 @@ func (o *MonthlyUsageAttributionValues) UnmarshalJSON(bytes []byte) (err error) o.ApmFargateUsage = all.ApmFargateUsage o.ApmHostPercentage = all.ApmHostPercentage o.ApmHostUsage = all.ApmHostUsage + o.ApmUsmPercentage = all.ApmUsmPercentage + o.ApmUsmUsage = all.ApmUsmUsage o.AppsecFargatePercentage = all.AppsecFargatePercentage o.AppsecFargateUsage = all.AppsecFargateUsage o.AppsecPercentage = all.AppsecPercentage o.AppsecUsage = all.AppsecUsage o.BrowserPercentage = all.BrowserPercentage o.BrowserUsage = all.BrowserUsage + o.CiVisibilityItrPercentage = all.CiVisibilityItrPercentage + o.CiVisibilityItrUsage = all.CiVisibilityItrUsage o.ContainerExclAgentPercentage = all.ContainerExclAgentPercentage o.ContainerExclAgentUsage = all.ContainerExclAgentUsage o.ContainerPercentage = all.ContainerPercentage @@ -2370,12 +2572,15 @@ func (o *MonthlyUsageAttributionValues) UnmarshalJSON(bytes []byte) (err error) o.ProfiledFargateUsage = all.ProfiledFargateUsage o.ProfiledHostPercentage = all.ProfiledHostPercentage o.ProfiledHostUsage = all.ProfiledHostUsage + o.SdsScannedBytesPercentage = all.SdsScannedBytesPercentage + o.SdsScannedBytesUsage = all.SdsScannedBytesUsage o.SnmpPercentage = all.SnmpPercentage o.SnmpUsage = all.SnmpUsage o.UniversalServiceMonitoringPercentage = all.UniversalServiceMonitoringPercentage o.UniversalServiceMonitoringUsage = all.UniversalServiceMonitoringUsage o.VulnManagementHostsPercentage = all.VulnManagementHostsPercentage o.VulnManagementHostsUsage = all.VulnManagementHostsUsage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_note_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_note_widget_definition.go index 90b96e535..9da26b004 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_note_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_note_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -374,7 +375,6 @@ func (o NoteWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NoteWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { BackgroundColor *string `json:"background_color,omitempty"` Content *string `json:"content"` @@ -388,12 +388,7 @@ func (o *NoteWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { VerticalAlign *WidgetVerticalAlign `json:"vertical_align,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Content == nil { return fmt.Errorf("required field content missing") @@ -407,51 +402,42 @@ func (o *NoteWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.TextAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TickEdge; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.VerticalAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.BackgroundColor = all.BackgroundColor o.Content = *all.Content o.FontSize = all.FontSize o.HasPadding = all.HasPadding o.ShowTick = all.ShowTick - o.TextAlign = all.TextAlign - o.TickEdge = all.TickEdge + if all.TextAlign != nil && !all.TextAlign.IsValid() { + hasInvalidField = true + } else { + o.TextAlign = all.TextAlign + } + if all.TickEdge != nil && !all.TickEdge.IsValid() { + hasInvalidField = true + } else { + o.TickEdge = all.TickEdge + } o.TickPos = all.TickPos - o.Type = *all.Type - o.VerticalAlign = all.VerticalAlign + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if all.VerticalAlign != nil && !all.VerticalAlign.IsValid() { + hasInvalidField = true + } else { + o.VerticalAlign = all.VerticalAlign + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_note_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_note_widget_definition_type.go index 5d79b7521..7ae458949 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_note_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_note_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // NoteWidgetDefinitionType Type of the note widget. @@ -61,47 +62,3 @@ func (v NoteWidgetDefinitionType) IsValid() bool { func (v NoteWidgetDefinitionType) Ptr() *NoteWidgetDefinitionType { return &v } - -// NullableNoteWidgetDefinitionType handles when a null is used for NoteWidgetDefinitionType. -type NullableNoteWidgetDefinitionType struct { - value *NoteWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableNoteWidgetDefinitionType) Get() *NoteWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNoteWidgetDefinitionType) Set(val *NoteWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNoteWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableNoteWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNoteWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableNoteWidgetDefinitionType(val *NoteWidgetDefinitionType) *NullableNoteWidgetDefinitionType { - return &NullableNoteWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNoteWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNoteWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_absolute_time.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_absolute_time.go index 832407bd2..a72d87b44 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_absolute_time.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_absolute_time.go @@ -5,10 +5,11 @@ package datadogV1 import ( - "encoding/json" "fmt" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -146,19 +147,13 @@ func (o NotebookAbsoluteTime) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookAbsoluteTime) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { End *time.Time `json:"end"` Live *bool `json:"live,omitempty"` Start *time.Time `json:"start"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.End == nil { return fmt.Errorf("required field end missing") @@ -175,6 +170,7 @@ func (o *NotebookAbsoluteTime) UnmarshalJSON(bytes []byte) (err error) { o.End = *all.End o.Live = all.Live o.Start = *all.Start + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_author.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_author.go index e901a9bd3..dd962d411 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_author.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_author.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -373,7 +374,6 @@ func (o NotebookAuthor) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookAuthor) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CreatedAt *time.Time `json:"created_at,omitempty"` Disabled *bool `json:"disabled,omitempty"` @@ -386,12 +386,7 @@ func (o *NotebookAuthor) UnmarshalJSON(bytes []byte) (err error) { Verified *bool `json:"verified,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -408,6 +403,7 @@ func (o *NotebookAuthor) UnmarshalJSON(bytes []byte) (err error) { o.Status = all.Status o.Title = all.Title o.Verified = all.Verified + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_create_request.go index 2c2f60675..bdbbd556d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_create_request.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // NotebookCellCreateRequest The description of a notebook cell create request. @@ -100,18 +101,12 @@ func (o NotebookCellCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookCellCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *NotebookCellCreateRequestAttributes `json:"attributes"` Type *NotebookCellResourceType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -119,16 +114,18 @@ func (o *NotebookCellCreateRequest) UnmarshalJSON(bytes []byte) (err error) { 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 { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_create_request_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_create_request_attributes.go index 187e50369..69a6e601a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_create_request_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_create_request_attributes.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" ) // NotebookCellCreateRequestAttributes - The attributes of a notebook cell in create cell request. Valid cell types are `markdown`, `timeseries`, `toplist`, `heatmap`, `distribution`, @@ -232,53 +232,3 @@ func (obj *NotebookCellCreateRequestAttributes) GetActualInstance() interface{} // all schemas are nil return nil } - -// NullableNotebookCellCreateRequestAttributes handles when a null is used for NotebookCellCreateRequestAttributes. -type NullableNotebookCellCreateRequestAttributes struct { - value *NotebookCellCreateRequestAttributes - isSet bool -} - -// Get returns the associated value. -func (v NullableNotebookCellCreateRequestAttributes) Get() *NotebookCellCreateRequestAttributes { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNotebookCellCreateRequestAttributes) Set(val *NotebookCellCreateRequestAttributes) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNotebookCellCreateRequestAttributes) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableNotebookCellCreateRequestAttributes) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNotebookCellCreateRequestAttributes initializes the struct as if Set has been called. -func NewNullableNotebookCellCreateRequestAttributes(val *NotebookCellCreateRequestAttributes) *NullableNotebookCellCreateRequestAttributes { - return &NullableNotebookCellCreateRequestAttributes{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNotebookCellCreateRequestAttributes) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNotebookCellCreateRequestAttributes) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_resource_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_resource_type.go index 41472adf3..8861e7bbd 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_resource_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_resource_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // NotebookCellResourceType Type of the Notebook Cell resource. @@ -61,47 +62,3 @@ func (v NotebookCellResourceType) IsValid() bool { func (v NotebookCellResourceType) Ptr() *NotebookCellResourceType { return &v } - -// NullableNotebookCellResourceType handles when a null is used for NotebookCellResourceType. -type NullableNotebookCellResourceType struct { - value *NotebookCellResourceType - isSet bool -} - -// Get returns the associated value. -func (v NullableNotebookCellResourceType) Get() *NotebookCellResourceType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNotebookCellResourceType) Set(val *NotebookCellResourceType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNotebookCellResourceType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableNotebookCellResourceType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNotebookCellResourceType initializes the struct as if Set has been called. -func NewNullableNotebookCellResourceType(val *NotebookCellResourceType) *NullableNotebookCellResourceType { - return &NullableNotebookCellResourceType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNotebookCellResourceType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNotebookCellResourceType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_response.go index 13a6877de..4127f28f7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_response.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -134,19 +135,13 @@ func (o NotebookCellResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookCellResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *NotebookCellResponseAttributes `json:"attributes"` Id *string `json:"id"` Type *NotebookCellResourceType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -163,20 +158,23 @@ func (o *NotebookCellResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Attributes = *all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_response_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_response_attributes.go index 4905ab818..29b65c6bd 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_response_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_response_attributes.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" ) // NotebookCellResponseAttributes - The attributes of a notebook cell response. Valid cell types are `markdown`, `timeseries`, `toplist`, `heatmap`, `distribution`, @@ -232,53 +232,3 @@ func (obj *NotebookCellResponseAttributes) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableNotebookCellResponseAttributes handles when a null is used for NotebookCellResponseAttributes. -type NullableNotebookCellResponseAttributes struct { - value *NotebookCellResponseAttributes - isSet bool -} - -// Get returns the associated value. -func (v NullableNotebookCellResponseAttributes) Get() *NotebookCellResponseAttributes { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNotebookCellResponseAttributes) Set(val *NotebookCellResponseAttributes) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNotebookCellResponseAttributes) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableNotebookCellResponseAttributes) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNotebookCellResponseAttributes initializes the struct as if Set has been called. -func NewNullableNotebookCellResponseAttributes(val *NotebookCellResponseAttributes) *NullableNotebookCellResponseAttributes { - return &NullableNotebookCellResponseAttributes{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNotebookCellResponseAttributes) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNotebookCellResponseAttributes) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_time.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_time.go index 2a6da2990..7a0e4e35a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_time.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_time.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" ) // NotebookCellTime - Timeframe for the notebook cell. When 'null', the notebook global time is used. diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_update_request.go index 0a8505dd8..998de55e2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_update_request.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -134,19 +135,13 @@ func (o NotebookCellUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookCellUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *NotebookCellUpdateRequestAttributes `json:"attributes"` Id *string `json:"id"` Type *NotebookCellResourceType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -163,20 +158,23 @@ func (o *NotebookCellUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Attributes = *all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_update_request_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_update_request_attributes.go index a2cfc6802..2c5c9f046 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_update_request_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_cell_update_request_attributes.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" ) // NotebookCellUpdateRequestAttributes - The attributes of a notebook cell in update cell request. Valid cell types are `markdown`, `timeseries`, `toplist`, `heatmap`, `distribution`, @@ -232,53 +232,3 @@ func (obj *NotebookCellUpdateRequestAttributes) GetActualInstance() interface{} // all schemas are nil return nil } - -// NullableNotebookCellUpdateRequestAttributes handles when a null is used for NotebookCellUpdateRequestAttributes. -type NullableNotebookCellUpdateRequestAttributes struct { - value *NotebookCellUpdateRequestAttributes - isSet bool -} - -// Get returns the associated value. -func (v NullableNotebookCellUpdateRequestAttributes) Get() *NotebookCellUpdateRequestAttributes { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNotebookCellUpdateRequestAttributes) Set(val *NotebookCellUpdateRequestAttributes) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNotebookCellUpdateRequestAttributes) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableNotebookCellUpdateRequestAttributes) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNotebookCellUpdateRequestAttributes initializes the struct as if Set has been called. -func NewNullableNotebookCellUpdateRequestAttributes(val *NotebookCellUpdateRequestAttributes) *NullableNotebookCellUpdateRequestAttributes { - return &NullableNotebookCellUpdateRequestAttributes{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNotebookCellUpdateRequestAttributes) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNotebookCellUpdateRequestAttributes) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_create_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_create_data.go index 3fc91a8c7..26004b024 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_create_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_create_data.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o NotebookCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *NotebookCreateDataAttributes `json:"attributes"` Type *NotebookResourceType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -131,26 +126,25 @@ func (o *NotebookCreateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_create_data_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_create_data_attributes.go index cb92a2fb4..364d1e2e5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_create_data_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_create_data_attributes.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -201,7 +202,6 @@ func (o NotebookCreateDataAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookCreateDataAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Cells *[]NotebookCellCreateRequest `json:"cells"` Metadata *NotebookMetadata `json:"metadata,omitempty"` @@ -210,12 +210,7 @@ func (o *NotebookCreateDataAttributes) UnmarshalJSON(bytes []byte) (err error) { Time *NotebookGlobalTime `json:"time"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Cells == nil { return fmt.Errorf("required field cells missing") @@ -232,29 +227,28 @@ func (o *NotebookCreateDataAttributes) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Cells = *all.Cells if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Metadata = all.Metadata o.Name = *all.Name - o.Status = all.Status + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } o.Time = *all.Time + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_create_request.go index be6da096e..1f499dc46 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_create_request.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o NotebookCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *NotebookCreateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *NotebookCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_distribution_cell_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_distribution_cell_attributes.go index 1e61e60f1..ec44f38b2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_distribution_cell_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_distribution_cell_attributes.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -189,7 +190,6 @@ func (o NotebookDistributionCellAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookDistributionCellAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Definition *DistributionWidgetDefinition `json:"definition"` GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` @@ -197,12 +197,7 @@ func (o *NotebookDistributionCellAttributes) UnmarshalJSON(bytes []byte) (err er Time NullableNotebookCellTime `json:"time,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Definition == nil { return fmt.Errorf("required field definition missing") @@ -213,35 +208,30 @@ func (o *NotebookDistributionCellAttributes) UnmarshalJSON(bytes []byte) (err er } else { return err } - if v := all.GraphSize; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Definition.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Definition = *all.Definition - o.GraphSize = all.GraphSize + if all.GraphSize != nil && !all.GraphSize.IsValid() { + hasInvalidField = true + } else { + o.GraphSize = all.GraphSize + } if all.SplitBy != nil && all.SplitBy.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.SplitBy = all.SplitBy o.Time = all.Time + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_global_time.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_global_time.go index 0d140fe79..533d17248 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_global_time.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_global_time.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" ) // NotebookGlobalTime - Notebook global timeframe. @@ -103,53 +103,3 @@ func (obj *NotebookGlobalTime) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableNotebookGlobalTime handles when a null is used for NotebookGlobalTime. -type NullableNotebookGlobalTime struct { - value *NotebookGlobalTime - isSet bool -} - -// Get returns the associated value. -func (v NullableNotebookGlobalTime) Get() *NotebookGlobalTime { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNotebookGlobalTime) Set(val *NotebookGlobalTime) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNotebookGlobalTime) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableNotebookGlobalTime) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNotebookGlobalTime initializes the struct as if Set has been called. -func NewNullableNotebookGlobalTime(val *NotebookGlobalTime) *NullableNotebookGlobalTime { - return &NullableNotebookGlobalTime{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNotebookGlobalTime) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNotebookGlobalTime) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_graph_size.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_graph_size.go index 3d8c85c47..81e14ae6d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_graph_size.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_graph_size.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // NotebookGraphSize The size of the graph. @@ -69,47 +70,3 @@ func (v NotebookGraphSize) IsValid() bool { func (v NotebookGraphSize) Ptr() *NotebookGraphSize { return &v } - -// NullableNotebookGraphSize handles when a null is used for NotebookGraphSize. -type NullableNotebookGraphSize struct { - value *NotebookGraphSize - isSet bool -} - -// Get returns the associated value. -func (v NullableNotebookGraphSize) Get() *NotebookGraphSize { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNotebookGraphSize) Set(val *NotebookGraphSize) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNotebookGraphSize) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableNotebookGraphSize) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNotebookGraphSize initializes the struct as if Set has been called. -func NewNullableNotebookGraphSize(val *NotebookGraphSize) *NullableNotebookGraphSize { - return &NullableNotebookGraphSize{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNotebookGraphSize) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNotebookGraphSize) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_heat_map_cell_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_heat_map_cell_attributes.go index efa31cac6..d5d114c6f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_heat_map_cell_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_heat_map_cell_attributes.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -187,7 +188,6 @@ func (o NotebookHeatMapCellAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookHeatMapCellAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Definition *HeatMapWidgetDefinition `json:"definition"` GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` @@ -195,12 +195,7 @@ func (o *NotebookHeatMapCellAttributes) UnmarshalJSON(bytes []byte) (err error) Time NullableNotebookCellTime `json:"time,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Definition == nil { return fmt.Errorf("required field definition missing") @@ -211,35 +206,30 @@ func (o *NotebookHeatMapCellAttributes) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.GraphSize; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Definition.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Definition = *all.Definition - o.GraphSize = all.GraphSize + if all.GraphSize != nil && !all.GraphSize.IsValid() { + hasInvalidField = true + } else { + o.GraphSize = all.GraphSize + } if all.SplitBy != nil && all.SplitBy.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.SplitBy = all.SplitBy o.Time = all.Time + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_log_stream_cell_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_log_stream_cell_attributes.go index f9fa0a0d9..c83023a8e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_log_stream_cell_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_log_stream_cell_attributes.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -154,19 +155,13 @@ func (o NotebookLogStreamCellAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookLogStreamCellAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Definition *LogStreamWidgetDefinition `json:"definition"` GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` Time NullableNotebookCellTime `json:"time,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Definition == nil { return fmt.Errorf("required field definition missing") @@ -177,27 +172,26 @@ func (o *NotebookLogStreamCellAttributes) UnmarshalJSON(bytes []byte) (err error } else { return err } - if v := all.GraphSize; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Definition.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Definition = *all.Definition - o.GraphSize = all.GraphSize + if all.GraphSize != nil && !all.GraphSize.IsValid() { + hasInvalidField = true + } else { + o.GraphSize = all.GraphSize + } o.Time = all.Time + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_markdown_cell_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_markdown_cell_attributes.go index edfe28471..6f2c92245 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_markdown_cell_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_markdown_cell_attributes.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o NotebookMarkdownCellAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookMarkdownCellAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Definition *NotebookMarkdownCellDefinition `json:"definition"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Definition == nil { return fmt.Errorf("required field definition missing") @@ -98,17 +93,20 @@ func (o *NotebookMarkdownCellAttributes) UnmarshalJSON(bytes []byte) (err error) } else { return err } + + hasInvalidField := false if all.Definition.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Definition = *all.Definition + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_markdown_cell_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_markdown_cell_definition.go index d9ffefa14..3354303c1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_markdown_cell_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_markdown_cell_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o NotebookMarkdownCellDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookMarkdownCellDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Text *string `json:"text"` Type *NotebookMarkdownCellDefinitionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Text == nil { return fmt.Errorf("required field text missing") @@ -131,19 +126,22 @@ func (o *NotebookMarkdownCellDefinition) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Text = *all.Text - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_markdown_cell_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_markdown_cell_definition_type.go index 4dc717eb2..278453e76 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_markdown_cell_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_markdown_cell_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // NotebookMarkdownCellDefinitionType Type of the markdown cell. @@ -61,47 +62,3 @@ func (v NotebookMarkdownCellDefinitionType) IsValid() bool { func (v NotebookMarkdownCellDefinitionType) Ptr() *NotebookMarkdownCellDefinitionType { return &v } - -// NullableNotebookMarkdownCellDefinitionType handles when a null is used for NotebookMarkdownCellDefinitionType. -type NullableNotebookMarkdownCellDefinitionType struct { - value *NotebookMarkdownCellDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableNotebookMarkdownCellDefinitionType) Get() *NotebookMarkdownCellDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNotebookMarkdownCellDefinitionType) Set(val *NotebookMarkdownCellDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNotebookMarkdownCellDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableNotebookMarkdownCellDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNotebookMarkdownCellDefinitionType initializes the struct as if Set has been called. -func NewNullableNotebookMarkdownCellDefinitionType(val *NotebookMarkdownCellDefinitionType) *NullableNotebookMarkdownCellDefinitionType { - return &NullableNotebookMarkdownCellDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNotebookMarkdownCellDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNotebookMarkdownCellDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_metadata.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_metadata.go index 3805a438c..60a219749 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_metadata.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_metadata.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -167,19 +167,13 @@ func (o NotebookMetadata) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IsTemplate *bool `json:"is_template,omitempty"` TakeSnapshots *bool `json:"take_snapshots,omitempty"` Type NullableNotebookMetadataType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -187,20 +181,23 @@ func (o *NotebookMetadata) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v.Get() != nil && !v.Get().IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.IsTemplate = all.IsTemplate o.TakeSnapshots = all.TakeSnapshots - o.Type = all.Type + if all.Type.Get() != nil && !all.Type.Get().IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_metadata_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_metadata_type.go index 8be1537e7..0272d2020 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_metadata_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_metadata_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // NotebookMetadataType Metadata type of the notebook. diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_relative_time.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_relative_time.go index 4bca43c63..37c77c93a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_relative_time.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_relative_time.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o NotebookRelativeTime) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookRelativeTime) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { LiveSpan *WidgetLiveSpan `json:"live_span"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.LiveSpan == nil { return fmt.Errorf("required field live_span missing") @@ -98,19 +93,22 @@ func (o *NotebookRelativeTime) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.LiveSpan; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if !all.LiveSpan.IsValid() { + hasInvalidField = true + } else { + o.LiveSpan = *all.LiveSpan } - o.LiveSpan = *all.LiveSpan + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_resource_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_resource_type.go index dcb09ffe0..572d2afd9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_resource_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_resource_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // NotebookResourceType Type of the Notebook resource. @@ -61,47 +62,3 @@ func (v NotebookResourceType) IsValid() bool { func (v NotebookResourceType) Ptr() *NotebookResourceType { return &v } - -// NullableNotebookResourceType handles when a null is used for NotebookResourceType. -type NullableNotebookResourceType struct { - value *NotebookResourceType - isSet bool -} - -// Get returns the associated value. -func (v NullableNotebookResourceType) Get() *NotebookResourceType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNotebookResourceType) Set(val *NotebookResourceType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNotebookResourceType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableNotebookResourceType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNotebookResourceType initializes the struct as if Set has been called. -func NewNullableNotebookResourceType(val *NotebookResourceType) *NullableNotebookResourceType { - return &NullableNotebookResourceType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNotebookResourceType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNotebookResourceType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_response.go index f7c2f732c..3ba846e68 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o NotebookResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *NotebookResponseData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *NotebookResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_response_data.go index 2ab8bb398..e5be9b9bb 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_response_data.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -133,19 +134,13 @@ func (o NotebookResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *NotebookResponseDataAttributes `json:"attributes"` Id *int64 `json:"id"` Type *NotebookResourceType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -162,27 +157,26 @@ func (o *NotebookResponseData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_response_data_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_response_data_attributes.go index c2dc54704..b699d57f2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_response_data_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_response_data_attributes.go @@ -5,10 +5,11 @@ package datadogV1 import ( - "encoding/json" "fmt" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -309,7 +310,6 @@ func (o NotebookResponseDataAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Author *NotebookAuthor `json:"author,omitempty"` Cells *[]NotebookCellResponse `json:"cells"` @@ -321,12 +321,7 @@ func (o *NotebookResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) Time *NotebookGlobalTime `json:"time"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Cells == nil { return fmt.Errorf("required field cells missing") @@ -343,39 +338,34 @@ func (o *NotebookResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Author != nil && all.Author.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Author = all.Author o.Cells = *all.Cells o.Created = all.Created if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Metadata = all.Metadata o.Modified = all.Modified o.Name = *all.Name - o.Status = all.Status + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } o.Time = *all.Time + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_split_by.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_split_by.go index 11cb38749..c6e10ed05 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_split_by.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_split_by.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o NotebookSplitBy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookSplitBy) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Keys *[]string `json:"keys"` Tags *[]string `json:"tags"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Keys == nil { return fmt.Errorf("required field keys missing") @@ -131,6 +126,7 @@ func (o *NotebookSplitBy) UnmarshalJSON(bytes []byte) (err error) { } o.Keys = *all.Keys o.Tags = *all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_status.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_status.go index 2f7a4ac70..5e8b37265 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_status.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_status.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // NotebookStatus Publication status of the notebook. For now, always "published". @@ -61,47 +62,3 @@ func (v NotebookStatus) IsValid() bool { func (v NotebookStatus) Ptr() *NotebookStatus { return &v } - -// NullableNotebookStatus handles when a null is used for NotebookStatus. -type NullableNotebookStatus struct { - value *NotebookStatus - isSet bool -} - -// Get returns the associated value. -func (v NullableNotebookStatus) Get() *NotebookStatus { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNotebookStatus) Set(val *NotebookStatus) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNotebookStatus) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableNotebookStatus) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNotebookStatus initializes the struct as if Set has been called. -func NewNullableNotebookStatus(val *NotebookStatus) *NullableNotebookStatus { - return &NullableNotebookStatus{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNotebookStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNotebookStatus) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_timeseries_cell_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_timeseries_cell_attributes.go index 8f5ce4d5c..fc8f209c5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_timeseries_cell_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_timeseries_cell_attributes.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -187,7 +188,6 @@ func (o NotebookTimeseriesCellAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookTimeseriesCellAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Definition *TimeseriesWidgetDefinition `json:"definition"` GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` @@ -195,12 +195,7 @@ func (o *NotebookTimeseriesCellAttributes) UnmarshalJSON(bytes []byte) (err erro Time NullableNotebookCellTime `json:"time,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Definition == nil { return fmt.Errorf("required field definition missing") @@ -211,35 +206,30 @@ func (o *NotebookTimeseriesCellAttributes) UnmarshalJSON(bytes []byte) (err erro } else { return err } - if v := all.GraphSize; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Definition.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Definition = *all.Definition - o.GraphSize = all.GraphSize + if all.GraphSize != nil && !all.GraphSize.IsValid() { + hasInvalidField = true + } else { + o.GraphSize = all.GraphSize + } if all.SplitBy != nil && all.SplitBy.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.SplitBy = all.SplitBy o.Time = all.Time + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_toplist_cell_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_toplist_cell_attributes.go index 96de9adbe..c025de520 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_toplist_cell_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_toplist_cell_attributes.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -187,7 +188,6 @@ func (o NotebookToplistCellAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookToplistCellAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Definition *ToplistWidgetDefinition `json:"definition"` GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` @@ -195,12 +195,7 @@ func (o *NotebookToplistCellAttributes) UnmarshalJSON(bytes []byte) (err error) Time NullableNotebookCellTime `json:"time,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Definition == nil { return fmt.Errorf("required field definition missing") @@ -211,35 +206,30 @@ func (o *NotebookToplistCellAttributes) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.GraphSize; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Definition.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Definition = *all.Definition - o.GraphSize = all.GraphSize + if all.GraphSize != nil && !all.GraphSize.IsValid() { + hasInvalidField = true + } else { + o.GraphSize = all.GraphSize + } if all.SplitBy != nil && all.SplitBy.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.SplitBy = all.SplitBy o.Time = all.Time + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_update_cell.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_update_cell.go index 80646e740..0d546a9e8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_update_cell.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_update_cell.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" ) // NotebookUpdateCell - Updating a notebook can either insert new cell(s) or update existing cell(s) by including the cell `id`. @@ -104,53 +104,3 @@ func (obj *NotebookUpdateCell) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableNotebookUpdateCell handles when a null is used for NotebookUpdateCell. -type NullableNotebookUpdateCell struct { - value *NotebookUpdateCell - isSet bool -} - -// Get returns the associated value. -func (v NullableNotebookUpdateCell) Get() *NotebookUpdateCell { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNotebookUpdateCell) Set(val *NotebookUpdateCell) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNotebookUpdateCell) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableNotebookUpdateCell) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNotebookUpdateCell initializes the struct as if Set has been called. -func NewNullableNotebookUpdateCell(val *NotebookUpdateCell) *NullableNotebookUpdateCell { - return &NullableNotebookUpdateCell{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNotebookUpdateCell) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNotebookUpdateCell) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_update_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_update_data.go index 29ae09ced..c10374951 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_update_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_update_data.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o NotebookUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *NotebookUpdateDataAttributes `json:"attributes"` Type *NotebookResourceType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -131,26 +126,25 @@ func (o *NotebookUpdateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_update_data_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_update_data_attributes.go index 885b1f935..99e073c62 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_update_data_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_update_data_attributes.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -201,7 +202,6 @@ func (o NotebookUpdateDataAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookUpdateDataAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Cells *[]NotebookUpdateCell `json:"cells"` Metadata *NotebookMetadata `json:"metadata,omitempty"` @@ -210,12 +210,7 @@ func (o *NotebookUpdateDataAttributes) UnmarshalJSON(bytes []byte) (err error) { Time *NotebookGlobalTime `json:"time"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Cells == nil { return fmt.Errorf("required field cells missing") @@ -232,29 +227,28 @@ func (o *NotebookUpdateDataAttributes) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Cells = *all.Cells if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Metadata = all.Metadata o.Name = *all.Name - o.Status = all.Status + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } o.Time = *all.Time + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_update_request.go index 7d0e1216c..56403b7e9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebook_update_request.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o NotebookUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *NotebookUpdateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *NotebookUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebooks_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebooks_response.go index 5452fce39..9a444ee0f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebooks_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebooks_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o NotebooksResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebooksResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []NotebooksResponseData `json:"data,omitempty"` Meta *NotebooksResponseMeta `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *NotebooksResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Data = all.Data if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebooks_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebooks_response_data.go index f77ad006a..2cb8a6fe2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebooks_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebooks_response_data.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -133,19 +134,13 @@ func (o NotebooksResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebooksResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *NotebooksResponseDataAttributes `json:"attributes"` Id *int64 `json:"id"` Type *NotebookResourceType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -162,27 +157,26 @@ func (o *NotebooksResponseData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebooks_response_data_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebooks_response_data_attributes.go index 901f9483e..7e1cc20da 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebooks_response_data_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebooks_response_data_attributes.go @@ -5,10 +5,11 @@ package datadogV1 import ( - "encoding/json" "fmt" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -321,7 +322,6 @@ func (o NotebooksResponseDataAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebooksResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Author *NotebookAuthor `json:"author,omitempty"` Cells []NotebookCellResponse `json:"cells,omitempty"` @@ -333,12 +333,7 @@ func (o *NotebooksResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error Time *NotebookGlobalTime `json:"time,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -349,39 +344,34 @@ func (o *NotebooksResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error } else { return err } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Author != nil && all.Author.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Author = all.Author o.Cells = all.Cells o.Created = all.Created if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Metadata = all.Metadata o.Modified = all.Modified o.Name = *all.Name - o.Status = all.Status + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } o.Time = all.Time + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebooks_response_meta.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebooks_response_meta.go index f73806ce3..0256ad6c2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebooks_response_meta.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebooks_response_meta.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o NotebooksResponseMeta) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebooksResponseMeta) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Page *NotebooksResponsePage `json:"page,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *NotebooksResponseMeta) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Page = all.Page + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebooks_response_page.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebooks_response_page.go index 42658783f..9eb358165 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebooks_response_page.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notebooks_response_page.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o NotebooksResponsePage) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebooksResponsePage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { TotalCount *int64 `json:"total_count,omitempty"` TotalFilteredCount *int64 `json:"total_filtered_count,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *NotebooksResponsePage) UnmarshalJSON(bytes []byte) (err error) { } o.TotalCount = all.TotalCount o.TotalFilteredCount = all.TotalFilteredCount + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notify_end_state.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notify_end_state.go index 8bea4ac16..32292907c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notify_end_state.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notify_end_state.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // NotifyEndState A notification end state. @@ -65,47 +66,3 @@ func (v NotifyEndState) IsValid() bool { func (v NotifyEndState) Ptr() *NotifyEndState { return &v } - -// NullableNotifyEndState handles when a null is used for NotifyEndState. -type NullableNotifyEndState struct { - value *NotifyEndState - isSet bool -} - -// Get returns the associated value. -func (v NullableNotifyEndState) Get() *NotifyEndState { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNotifyEndState) Set(val *NotifyEndState) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNotifyEndState) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableNotifyEndState) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNotifyEndState initializes the struct as if Set has been called. -func NewNullableNotifyEndState(val *NotifyEndState) *NullableNotifyEndState { - return &NullableNotifyEndState{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNotifyEndState) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNotifyEndState) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notify_end_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notify_end_type.go index 274deb591..11fe2b239 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notify_end_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_notify_end_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // NotifyEndType A notification end type. @@ -63,47 +64,3 @@ func (v NotifyEndType) IsValid() bool { func (v NotifyEndType) Ptr() *NotifyEndType { return &v } - -// NullableNotifyEndType handles when a null is used for NotifyEndType. -type NullableNotifyEndType struct { - value *NotifyEndType - isSet bool -} - -// Get returns the associated value. -func (v NullableNotifyEndType) Get() *NotifyEndType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNotifyEndType) Set(val *NotifyEndType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNotifyEndType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableNotifyEndType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNotifyEndType initializes the struct as if Set has been called. -func NewNullableNotifyEndType(val *NotifyEndType) *NullableNotifyEndType { - return &NullableNotifyEndType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNotifyEndType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNotifyEndType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_on_missing_data_option.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_on_missing_data_option.go index 2cb9d82ae..3244ded8c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_on_missing_data_option.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_on_missing_data_option.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // OnMissingDataOption Controls how groups or monitors are treated if an evaluation does not return any data points. @@ -71,47 +72,3 @@ func (v OnMissingDataOption) IsValid() bool { func (v OnMissingDataOption) Ptr() *OnMissingDataOption { return &v } - -// NullableOnMissingDataOption handles when a null is used for OnMissingDataOption. -type NullableOnMissingDataOption struct { - value *OnMissingDataOption - isSet bool -} - -// Get returns the associated value. -func (v NullableOnMissingDataOption) Get() *OnMissingDataOption { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableOnMissingDataOption) Set(val *OnMissingDataOption) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableOnMissingDataOption) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableOnMissingDataOption) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableOnMissingDataOption initializes the struct as if Set has been called. -func NewNullableOnMissingDataOption(val *OnMissingDataOption) *NullableOnMissingDataOption { - return &NullableOnMissingDataOption{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableOnMissingDataOption) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableOnMissingDataOption) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_org_downgraded_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_org_downgraded_response.go index 959e82f5b..aa0e92e89 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_org_downgraded_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_org_downgraded_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o OrgDowngradedResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OrgDowngradedResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Message *string `json:"message,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *OrgDowngradedResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Message = all.Message + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization.go index afec8416e..2c4de828e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -321,7 +321,6 @@ func (o Organization) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Organization) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Billing *OrganizationBilling `json:"billing,omitempty"` Created *string `json:"created,omitempty"` @@ -333,12 +332,7 @@ func (o *Organization) UnmarshalJSON(bytes []byte) (err error) { Trial *bool `json:"trial,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -346,12 +340,10 @@ func (o *Organization) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Billing != nil && all.Billing.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Billing = all.Billing o.Created = all.Created @@ -359,25 +351,22 @@ func (o *Organization) UnmarshalJSON(bytes []byte) (err error) { o.Name = all.Name o.PublicId = all.PublicId if all.Settings != nil && all.Settings.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Settings = all.Settings if all.Subscription != nil && all.Subscription.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Subscription = all.Subscription o.Trial = all.Trial + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_billing.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_billing.go index 173ae9b04..89b65689a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_billing.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_billing.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -84,17 +84,11 @@ func (o OrganizationBilling) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OrganizationBilling) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Type *string `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -103,6 +97,7 @@ func (o *OrganizationBilling) UnmarshalJSON(bytes []byte) (err error) { return err } o.Type = all.Type + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_create_body.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_create_body.go index 47689febe..aaeffa03e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_create_body.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_create_body.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -151,19 +152,13 @@ func (o OrganizationCreateBody) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OrganizationCreateBody) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Billing *OrganizationBilling `json:"billing,omitempty"` Name *string `json:"name"` Subscription *OrganizationSubscription `json:"subscription,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -174,26 +169,25 @@ func (o *OrganizationCreateBody) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Billing != nil && all.Billing.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Billing = all.Billing o.Name = *all.Name if all.Subscription != nil && all.Subscription.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Subscription = all.Subscription + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_create_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_create_response.go index 34ea09671..33327555a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_create_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_create_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -181,7 +181,6 @@ func (o OrganizationCreateResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OrganizationCreateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApiKey *ApiKey `json:"api_key,omitempty"` ApplicationKey *ApplicationKey `json:"application_key,omitempty"` @@ -189,12 +188,7 @@ func (o *OrganizationCreateResponse) UnmarshalJSON(bytes []byte) (err error) { User *User `json:"user,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -202,41 +196,32 @@ func (o *OrganizationCreateResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.ApiKey != nil && all.ApiKey.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ApiKey = all.ApiKey if all.ApplicationKey != nil && all.ApplicationKey.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ApplicationKey = all.ApplicationKey if all.Org != nil && all.Org.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Org = all.Org if all.User != nil && all.User.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.User = all.User + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_list_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_list_response.go index 1165ee832..8ded9480f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_list_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_list_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o OrganizationListResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OrganizationListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Orgs []Organization `json:"orgs,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *OrganizationListResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Orgs = all.Orgs + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_response.go index da9d66fea..266d1fa4d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o OrganizationResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OrganizationResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Org *Organization `json:"org,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *OrganizationResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Org != nil && all.Org.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Org = all.Org + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_settings.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_settings.go index 03e6c83a0..9a6a6bdc2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_settings.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_settings.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -18,7 +18,7 @@ type OrganizationSettings struct { // See the SAML documentation for more information about all SAML settings. Saml *OrganizationSettingsSaml `json:"saml,omitempty"` // The access role of the user. Options are **st** (standard user), **adm** (admin user), or **ro** (read-only user). - SamlAutocreateAccessRole *AccessRole `json:"saml_autocreate_access_role,omitempty"` + SamlAutocreateAccessRole NullableAccessRole `json:"saml_autocreate_access_role,omitempty"` // Has two properties, `enabled` (boolean) and `domains`, which is a list of domains without the @ symbol. SamlAutocreateUsersDomains *OrganizationSettingsSamlAutocreateUsersDomains `json:"saml_autocreate_users_domains,omitempty"` // Whether or not SAML can be enabled for this organization. @@ -44,8 +44,6 @@ type OrganizationSettings struct { // will change when the set of required properties is changed. func NewOrganizationSettings() *OrganizationSettings { this := OrganizationSettings{} - var samlAutocreateAccessRole AccessRole = ACCESSROLE_STANDARD - this.SamlAutocreateAccessRole = &samlAutocreateAccessRole return &this } @@ -54,8 +52,6 @@ func NewOrganizationSettings() *OrganizationSettings { // but it doesn't guarantee that properties required by API are set. func NewOrganizationSettingsWithDefaults() *OrganizationSettings { this := OrganizationSettings{} - var samlAutocreateAccessRole AccessRole = ACCESSROLE_STANDARD - this.SamlAutocreateAccessRole = &samlAutocreateAccessRole return &this } @@ -115,32 +111,43 @@ func (o *OrganizationSettings) SetSaml(v OrganizationSettingsSaml) { o.Saml = &v } -// GetSamlAutocreateAccessRole returns the SamlAutocreateAccessRole field value if set, zero value otherwise. +// GetSamlAutocreateAccessRole returns the SamlAutocreateAccessRole field value if set, zero value otherwise (both if not set or set to explicit null). func (o *OrganizationSettings) GetSamlAutocreateAccessRole() AccessRole { - if o == nil || o.SamlAutocreateAccessRole == nil { + if o == nil || o.SamlAutocreateAccessRole.Get() == nil { var ret AccessRole return ret } - return *o.SamlAutocreateAccessRole + return *o.SamlAutocreateAccessRole.Get() } // GetSamlAutocreateAccessRoleOk returns a tuple with the SamlAutocreateAccessRole field value if set, nil otherwise // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. func (o *OrganizationSettings) GetSamlAutocreateAccessRoleOk() (*AccessRole, bool) { - if o == nil || o.SamlAutocreateAccessRole == nil { + if o == nil { return nil, false } - return o.SamlAutocreateAccessRole, true + return o.SamlAutocreateAccessRole.Get(), o.SamlAutocreateAccessRole.IsSet() } // HasSamlAutocreateAccessRole returns a boolean if a field has been set. func (o *OrganizationSettings) HasSamlAutocreateAccessRole() bool { - return o != nil && o.SamlAutocreateAccessRole != nil + return o != nil && o.SamlAutocreateAccessRole.IsSet() } -// SetSamlAutocreateAccessRole gets a reference to the given AccessRole and assigns it to the SamlAutocreateAccessRole field. +// SetSamlAutocreateAccessRole gets a reference to the given NullableAccessRole and assigns it to the SamlAutocreateAccessRole field. func (o *OrganizationSettings) SetSamlAutocreateAccessRole(v AccessRole) { - o.SamlAutocreateAccessRole = &v + o.SamlAutocreateAccessRole.Set(&v) +} + +// SetSamlAutocreateAccessRoleNil sets the value for SamlAutocreateAccessRole to be an explicit nil. +func (o *OrganizationSettings) SetSamlAutocreateAccessRoleNil() { + o.SamlAutocreateAccessRole.Set(nil) +} + +// UnsetSamlAutocreateAccessRole ensures that no value is present for SamlAutocreateAccessRole, not even an explicit nil. +func (o *OrganizationSettings) UnsetSamlAutocreateAccessRole() { + o.SamlAutocreateAccessRole.Unset() } // GetSamlAutocreateUsersDomains returns the SamlAutocreateUsersDomains field value if set, zero value otherwise. @@ -351,8 +358,8 @@ func (o OrganizationSettings) MarshalJSON() ([]byte, error) { if o.Saml != nil { toSerialize["saml"] = o.Saml } - if o.SamlAutocreateAccessRole != nil { - toSerialize["saml_autocreate_access_role"] = o.SamlAutocreateAccessRole + if o.SamlAutocreateAccessRole.IsSet() { + toSerialize["saml_autocreate_access_role"] = o.SamlAutocreateAccessRole.Get() } if o.SamlAutocreateUsersDomains != nil { toSerialize["saml_autocreate_users_domains"] = o.SamlAutocreateUsersDomains @@ -384,11 +391,10 @@ func (o OrganizationSettings) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OrganizationSettings) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { PrivateWidgetShare *bool `json:"private_widget_share,omitempty"` Saml *OrganizationSettingsSaml `json:"saml,omitempty"` - SamlAutocreateAccessRole *AccessRole `json:"saml_autocreate_access_role,omitempty"` + SamlAutocreateAccessRole NullableAccessRole `json:"saml_autocreate_access_role,omitempty"` SamlAutocreateUsersDomains *OrganizationSettingsSamlAutocreateUsersDomains `json:"saml_autocreate_users_domains,omitempty"` SamlCanBeEnabled *bool `json:"saml_can_be_enabled,omitempty"` SamlIdpEndpoint *string `json:"saml_idp_endpoint,omitempty"` @@ -398,12 +404,7 @@ func (o *OrganizationSettings) UnmarshalJSON(bytes []byte) (err error) { SamlStrictMode *OrganizationSettingsSamlStrictMode `json:"saml_strict_mode,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -411,55 +412,42 @@ func (o *OrganizationSettings) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.SamlAutocreateAccessRole; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.PrivateWidgetShare = all.PrivateWidgetShare if all.Saml != nil && all.Saml.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Saml = all.Saml - o.SamlAutocreateAccessRole = all.SamlAutocreateAccessRole + if all.SamlAutocreateAccessRole.Get() != nil && !all.SamlAutocreateAccessRole.Get().IsValid() { + hasInvalidField = true + } else { + o.SamlAutocreateAccessRole = all.SamlAutocreateAccessRole + } if all.SamlAutocreateUsersDomains != nil && all.SamlAutocreateUsersDomains.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.SamlAutocreateUsersDomains = all.SamlAutocreateUsersDomains o.SamlCanBeEnabled = all.SamlCanBeEnabled o.SamlIdpEndpoint = all.SamlIdpEndpoint if all.SamlIdpInitiatedLogin != nil && all.SamlIdpInitiatedLogin.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.SamlIdpInitiatedLogin = all.SamlIdpInitiatedLogin o.SamlIdpMetadataUploaded = all.SamlIdpMetadataUploaded o.SamlLoginUrl = all.SamlLoginUrl if all.SamlStrictMode != nil && all.SamlStrictMode.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.SamlStrictMode = all.SamlStrictMode + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_settings_saml.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_settings_saml.go index d61d53869..20d76105d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_settings_saml.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_settings_saml.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -83,17 +83,11 @@ func (o OrganizationSettingsSaml) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OrganizationSettingsSaml) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Enabled *bool `json:"enabled,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -102,6 +96,7 @@ func (o *OrganizationSettingsSaml) UnmarshalJSON(bytes []byte) (err error) { return err } o.Enabled = all.Enabled + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_settings_saml_autocreate_users_domains.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_settings_saml_autocreate_users_domains.go index eaee19042..c041fe21c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_settings_saml_autocreate_users_domains.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_settings_saml_autocreate_users_domains.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o OrganizationSettingsSamlAutocreateUsersDomains) MarshalJSON() ([]byte, e // UnmarshalJSON deserializes the given payload. func (o *OrganizationSettingsSamlAutocreateUsersDomains) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Domains []string `json:"domains,omitempty"` Enabled *bool `json:"enabled,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *OrganizationSettingsSamlAutocreateUsersDomains) UnmarshalJSON(bytes []b } o.Domains = all.Domains o.Enabled = all.Enabled + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_settings_saml_idp_initiated_login.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_settings_saml_idp_initiated_login.go index b9f426ffa..5bdbfe1d4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_settings_saml_idp_initiated_login.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_settings_saml_idp_initiated_login.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -83,17 +83,11 @@ func (o OrganizationSettingsSamlIdpInitiatedLogin) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *OrganizationSettingsSamlIdpInitiatedLogin) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Enabled *bool `json:"enabled,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -102,6 +96,7 @@ func (o *OrganizationSettingsSamlIdpInitiatedLogin) UnmarshalJSON(bytes []byte) return err } o.Enabled = all.Enabled + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_settings_saml_strict_mode.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_settings_saml_strict_mode.go index cbdc1515e..d29846c0e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_settings_saml_strict_mode.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_settings_saml_strict_mode.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -83,17 +83,11 @@ func (o OrganizationSettingsSamlStrictMode) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OrganizationSettingsSamlStrictMode) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Enabled *bool `json:"enabled,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -102,6 +96,7 @@ func (o *OrganizationSettingsSamlStrictMode) UnmarshalJSON(bytes []byte) (err er return err } o.Enabled = all.Enabled + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_subscription.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_subscription.go index c294f39f2..f7cfddb6f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_subscription.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_organization_subscription.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -84,17 +84,11 @@ func (o OrganizationSubscription) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OrganizationSubscription) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Type *string `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -103,6 +97,7 @@ func (o *OrganizationSubscription) UnmarshalJSON(bytes []byte) (err error) { return err } o.Type = all.Type + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_pager_duty_service.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_pager_duty_service.go index b217a0de2..a02a5e8ef 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_pager_duty_service.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_pager_duty_service.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o PagerDutyService) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *PagerDutyService) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ServiceKey *string `json:"service_key"` ServiceName *string `json:"service_name"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.ServiceKey == nil { return fmt.Errorf("required field service_key missing") @@ -131,6 +126,7 @@ func (o *PagerDutyService) UnmarshalJSON(bytes []byte) (err error) { } o.ServiceKey = *all.ServiceKey o.ServiceName = *all.ServiceName + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_pager_duty_service_key.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_pager_duty_service_key.go index 7b5bc34af..d5eccd415 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_pager_duty_service_key.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_pager_duty_service_key.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o PagerDutyServiceKey) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *PagerDutyServiceKey) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ServiceKey *string `json:"service_key"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.ServiceKey == nil { return fmt.Errorf("required field service_key missing") @@ -99,6 +94,7 @@ func (o *PagerDutyServiceKey) UnmarshalJSON(bytes []byte) (err error) { return err } o.ServiceKey = *all.ServiceKey + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_pager_duty_service_name.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_pager_duty_service_name.go index 9454e7e26..6a6b3dc6a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_pager_duty_service_name.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_pager_duty_service_name.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o PagerDutyServiceName) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *PagerDutyServiceName) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ServiceName *string `json:"service_name"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.ServiceName == nil { return fmt.Errorf("required field service_name missing") @@ -99,6 +94,7 @@ func (o *PagerDutyServiceName) UnmarshalJSON(bytes []byte) (err error) { return err } o.ServiceName = *all.ServiceName + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_pagination.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_pagination.go index 389c00ed0..c89c45460 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_pagination.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_pagination.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o Pagination) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Pagination) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { TotalCount *int64 `json:"total_count,omitempty"` TotalFilteredCount *int64 `json:"total_filtered_count,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *Pagination) UnmarshalJSON(bytes []byte) (err error) { } o.TotalCount = all.TotalCount o.TotalFilteredCount = all.TotalFilteredCount + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_process_query_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_process_query_definition.go index efc2fba24..7a1b10eff 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_process_query_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_process_query_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -176,7 +177,6 @@ func (o ProcessQueryDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ProcessQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { FilterBy []string `json:"filter_by,omitempty"` Limit *int64 `json:"limit,omitempty"` @@ -184,12 +184,7 @@ func (o *ProcessQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { SearchBy *string `json:"search_by,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Metric == nil { return fmt.Errorf("required field metric missing") @@ -204,6 +199,7 @@ func (o *ProcessQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { o.Limit = all.Limit o.Metric = *all.Metric o.SearchBy = all.SearchBy + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_query_sort_order.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_query_sort_order.go index 8a65471c5..de691d2de 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_query_sort_order.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_query_sort_order.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // QuerySortOrder Direction of sort. @@ -63,47 +64,3 @@ func (v QuerySortOrder) IsValid() bool { func (v QuerySortOrder) Ptr() *QuerySortOrder { return &v } - -// NullableQuerySortOrder handles when a null is used for QuerySortOrder. -type NullableQuerySortOrder struct { - value *QuerySortOrder - isSet bool -} - -// Get returns the associated value. -func (v NullableQuerySortOrder) Get() *QuerySortOrder { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableQuerySortOrder) Set(val *QuerySortOrder) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableQuerySortOrder) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableQuerySortOrder) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableQuerySortOrder initializes the struct as if Set has been called. -func NewNullableQuerySortOrder(val *QuerySortOrder) *NullableQuerySortOrder { - return &NullableQuerySortOrder{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableQuerySortOrder) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableQuerySortOrder) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_query_value_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_query_value_widget_definition.go index 61d46f591..e486cc442 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_query_value_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_query_value_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -436,7 +437,6 @@ func (o QueryValueWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *QueryValueWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Autoscale *bool `json:"autoscale,omitempty"` CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` @@ -452,12 +452,7 @@ func (o *QueryValueWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { Type *QueryValueWidgetDefinitionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Requests == nil { return fmt.Errorf("required field requests missing") @@ -471,59 +466,46 @@ func (o *QueryValueWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.TextAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Autoscale = all.Autoscale o.CustomLinks = all.CustomLinks o.CustomUnit = all.CustomUnit o.Precision = all.Precision o.Requests = *all.Requests - o.TextAlign = all.TextAlign + if all.TextAlign != nil && !all.TextAlign.IsValid() { + hasInvalidField = true + } else { + o.TextAlign = all.TextAlign + } if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Time = all.Time if all.TimeseriesBackground != nil && all.TimeseriesBackground.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.TimeseriesBackground = all.TimeseriesBackground o.Title = all.Title - o.TitleAlign = all.TitleAlign + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } o.TitleSize = all.TitleSize - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_query_value_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_query_value_widget_definition_type.go index 77a4704eb..12cfa475c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_query_value_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_query_value_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // QueryValueWidgetDefinitionType Type of the query value widget. @@ -61,47 +62,3 @@ func (v QueryValueWidgetDefinitionType) IsValid() bool { func (v QueryValueWidgetDefinitionType) Ptr() *QueryValueWidgetDefinitionType { return &v } - -// NullableQueryValueWidgetDefinitionType handles when a null is used for QueryValueWidgetDefinitionType. -type NullableQueryValueWidgetDefinitionType struct { - value *QueryValueWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableQueryValueWidgetDefinitionType) Get() *QueryValueWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableQueryValueWidgetDefinitionType) Set(val *QueryValueWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableQueryValueWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableQueryValueWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableQueryValueWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableQueryValueWidgetDefinitionType(val *QueryValueWidgetDefinitionType) *NullableQueryValueWidgetDefinitionType { - return &NullableQueryValueWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableQueryValueWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableQueryValueWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_query_value_widget_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_query_value_widget_request.go index 59e1de15e..62445ac9b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_query_value_widget_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_query_value_widget_request.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -36,7 +36,7 @@ type QueryValueWidgetRequest struct { Q *string `json:"q,omitempty"` // List of queries that can be returned directly or used in formulas. Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - // Timeseries or Scalar response. + // Timeseries, scalar, or event list response. Event list response formats are supported by Geomap widgets. ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` // The log query. RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` @@ -544,7 +544,6 @@ func (o QueryValueWidgetRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *QueryValueWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregator *WidgetAggregator `json:"aggregator,omitempty"` ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` @@ -563,12 +562,7 @@ func (o *QueryValueWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -576,103 +570,66 @@ func (o *QueryValueWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Aggregator; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ResponseFormat; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregator = all.Aggregator + + hasInvalidField := false + if all.Aggregator != nil && !all.Aggregator.IsValid() { + hasInvalidField = true + } else { + o.Aggregator = all.Aggregator + } if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ApmQuery = all.ApmQuery if all.AuditQuery != nil && all.AuditQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.AuditQuery = all.AuditQuery o.ConditionalFormats = all.ConditionalFormats if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.EventQuery = all.EventQuery o.Formulas = all.Formulas if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LogQuery = all.LogQuery if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.NetworkQuery = all.NetworkQuery if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ProcessQuery = all.ProcessQuery if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ProfileMetricsQuery = all.ProfileMetricsQuery o.Q = all.Q o.Queries = all.Queries - o.ResponseFormat = all.ResponseFormat + if all.ResponseFormat != nil && !all.ResponseFormat.IsValid() { + hasInvalidField = true + } else { + o.ResponseFormat = all.ResponseFormat + } if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.RumQuery = all.RumQuery if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.SecurityQuery = all.SecurityQuery + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_reference_table_logs_lookup_processor.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_reference_table_logs_lookup_processor.go index ac5f3a313..2aadd7248 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_reference_table_logs_lookup_processor.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_reference_table_logs_lookup_processor.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -236,7 +237,6 @@ func (o ReferenceTableLogsLookupProcessor) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ReferenceTableLogsLookupProcessor) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IsEnabled *bool `json:"is_enabled,omitempty"` LookupEnrichmentTable *string `json:"lookup_enrichment_table"` @@ -246,12 +246,7 @@ func (o *ReferenceTableLogsLookupProcessor) UnmarshalJSON(bytes []byte) (err err Type *LogsLookupProcessorType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.LookupEnrichmentTable == nil { return fmt.Errorf("required field lookup_enrichment_table missing") @@ -271,23 +266,26 @@ func (o *ReferenceTableLogsLookupProcessor) UnmarshalJSON(bytes []byte) (err err } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.IsEnabled = all.IsEnabled o.LookupEnrichmentTable = *all.LookupEnrichmentTable o.Name = all.Name o.Source = *all.Source o.Target = *all.Target - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_response_meta_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_response_meta_attributes.go index 28d56dca5..1f2329c64 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_response_meta_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_response_meta_attributes.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o ResponseMetaAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ResponseMetaAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Page *Pagination `json:"page,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *ResponseMetaAttributes) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Page = all.Page + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_run_workflow_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_run_workflow_widget_definition.go index 304af0ea0..934702b17 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_run_workflow_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_run_workflow_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -304,7 +305,6 @@ func (o RunWorkflowWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RunWorkflowWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` Inputs []RunWorkflowWidgetInput `json:"inputs,omitempty"` @@ -316,12 +316,7 @@ func (o *RunWorkflowWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { WorkflowId *string `json:"workflow_id"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -335,40 +330,35 @@ func (o *RunWorkflowWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.CustomLinks = all.CustomLinks o.Inputs = all.Inputs if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Time = all.Time o.Title = all.Title - o.TitleAlign = all.TitleAlign + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } o.TitleSize = all.TitleSize - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } o.WorkflowId = *all.WorkflowId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_run_workflow_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_run_workflow_widget_definition_type.go index 087ee0044..2a006aaf8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_run_workflow_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_run_workflow_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // RunWorkflowWidgetDefinitionType Type of the run workflow widget. @@ -61,47 +62,3 @@ func (v RunWorkflowWidgetDefinitionType) IsValid() bool { func (v RunWorkflowWidgetDefinitionType) Ptr() *RunWorkflowWidgetDefinitionType { return &v } - -// NullableRunWorkflowWidgetDefinitionType handles when a null is used for RunWorkflowWidgetDefinitionType. -type NullableRunWorkflowWidgetDefinitionType struct { - value *RunWorkflowWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableRunWorkflowWidgetDefinitionType) Get() *RunWorkflowWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRunWorkflowWidgetDefinitionType) Set(val *RunWorkflowWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRunWorkflowWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableRunWorkflowWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRunWorkflowWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableRunWorkflowWidgetDefinitionType(val *RunWorkflowWidgetDefinitionType) *NullableRunWorkflowWidgetDefinitionType { - return &NullableRunWorkflowWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRunWorkflowWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRunWorkflowWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_run_workflow_widget_input.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_run_workflow_widget_input.go index 5d045f794..899d0182d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_run_workflow_widget_input.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_run_workflow_widget_input.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o RunWorkflowWidgetInput) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RunWorkflowWidgetInput) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Name *string `json:"name"` Value *string `json:"value"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -131,6 +126,7 @@ func (o *RunWorkflowWidgetInput) UnmarshalJSON(bytes []byte) (err error) { } o.Name = *all.Name o.Value = *all.Value + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatter_plot_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatter_plot_request.go index 65fb6d0f8..7d639b157 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatter_plot_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatter_plot_request.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -379,7 +379,6 @@ func (o ScatterPlotRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ScatterPlotRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregator *ScatterplotWidgetAggregator `json:"aggregator,omitempty"` ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` @@ -393,12 +392,7 @@ func (o *ScatterPlotRequest) UnmarshalJSON(bytes []byte) (err error) { SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -406,83 +400,54 @@ func (o *ScatterPlotRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Aggregator; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.Aggregator != nil && !all.Aggregator.IsValid() { + hasInvalidField = true + } else { + o.Aggregator = all.Aggregator } - o.Aggregator = all.Aggregator if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ApmQuery = all.ApmQuery if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.EventQuery = all.EventQuery if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LogQuery = all.LogQuery if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.NetworkQuery = all.NetworkQuery if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ProcessQuery = all.ProcessQuery if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ProfileMetricsQuery = all.ProfileMetricsQuery o.Q = all.Q if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.RumQuery = all.RumQuery if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.SecurityQuery = all.SecurityQuery + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatter_plot_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatter_plot_widget_definition.go index 2713fa437..9a0b22301 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatter_plot_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatter_plot_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -370,7 +371,6 @@ func (o ScatterPlotWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ScatterPlotWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ColorByGroups []string `json:"color_by_groups,omitempty"` CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` @@ -384,12 +384,7 @@ func (o *ScatterPlotWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { Yaxis *WidgetAxis `json:"yaxis,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Requests == nil { return fmt.Errorf("required field requests missing") @@ -403,63 +398,46 @@ func (o *ScatterPlotWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.ColorByGroups = all.ColorByGroups o.CustomLinks = all.CustomLinks if all.Requests.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Requests = *all.Requests if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Time = all.Time o.Title = all.Title - o.TitleAlign = all.TitleAlign + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } o.TitleSize = all.TitleSize - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } if all.Xaxis != nil && all.Xaxis.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Xaxis = all.Xaxis if all.Yaxis != nil && all.Yaxis.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Yaxis = all.Yaxis + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatter_plot_widget_definition_requests.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatter_plot_widget_definition_requests.go index f60d47f01..067911291 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatter_plot_widget_definition_requests.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatter_plot_widget_definition_requests.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o ScatterPlotWidgetDefinitionRequests) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ScatterPlotWidgetDefinitionRequests) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Table *ScatterplotTableRequest `json:"table,omitempty"` X *ScatterPlotRequest `json:"x,omitempty"` Y *ScatterPlotRequest `json:"y,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,33 +162,28 @@ func (o *ScatterPlotWidgetDefinitionRequests) UnmarshalJSON(bytes []byte) (err e } else { return err } + + hasInvalidField := false if all.Table != nil && all.Table.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Table = all.Table if all.X != nil && all.X.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.X = all.X if all.Y != nil && all.Y.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Y = all.Y + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatter_plot_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatter_plot_widget_definition_type.go index 651e6afbb..aaecb853d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatter_plot_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatter_plot_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ScatterPlotWidgetDefinitionType Type of the scatter plot widget. @@ -61,47 +62,3 @@ func (v ScatterPlotWidgetDefinitionType) IsValid() bool { func (v ScatterPlotWidgetDefinitionType) Ptr() *ScatterPlotWidgetDefinitionType { return &v } - -// NullableScatterPlotWidgetDefinitionType handles when a null is used for ScatterPlotWidgetDefinitionType. -type NullableScatterPlotWidgetDefinitionType struct { - value *ScatterPlotWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableScatterPlotWidgetDefinitionType) Get() *ScatterPlotWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableScatterPlotWidgetDefinitionType) Set(val *ScatterPlotWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableScatterPlotWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableScatterPlotWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableScatterPlotWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableScatterPlotWidgetDefinitionType(val *ScatterPlotWidgetDefinitionType) *NullableScatterPlotWidgetDefinitionType { - return &NullableScatterPlotWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableScatterPlotWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableScatterPlotWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatterplot_dimension.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatterplot_dimension.go index 339d573c6..7a05b448d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatterplot_dimension.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatterplot_dimension.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ScatterplotDimension Dimension of the Scatterplot. @@ -67,47 +68,3 @@ func (v ScatterplotDimension) IsValid() bool { func (v ScatterplotDimension) Ptr() *ScatterplotDimension { return &v } - -// NullableScatterplotDimension handles when a null is used for ScatterplotDimension. -type NullableScatterplotDimension struct { - value *ScatterplotDimension - isSet bool -} - -// Get returns the associated value. -func (v NullableScatterplotDimension) Get() *ScatterplotDimension { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableScatterplotDimension) Set(val *ScatterplotDimension) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableScatterplotDimension) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableScatterplotDimension) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableScatterplotDimension initializes the struct as if Set has been called. -func NewNullableScatterplotDimension(val *ScatterplotDimension) *NullableScatterplotDimension { - return &NullableScatterplotDimension{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableScatterplotDimension) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableScatterplotDimension) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatterplot_table_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatterplot_table_request.go index 77e3f4e81..9b6edf09d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatterplot_table_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatterplot_table_request.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -16,7 +16,7 @@ type ScatterplotTableRequest struct { Formulas []ScatterplotWidgetFormula `json:"formulas,omitempty"` // List of queries that can be returned directly or used in formulas. Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - // Timeseries or Scalar response. + // Timeseries, scalar, or event list response. Event list response formats are supported by Geomap widgets. ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` @@ -148,19 +148,13 @@ func (o ScatterplotTableRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ScatterplotTableRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Formulas []ScatterplotWidgetFormula `json:"formulas,omitempty"` Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,20 +162,23 @@ func (o *ScatterplotTableRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.ResponseFormat; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Formulas = all.Formulas o.Queries = all.Queries - o.ResponseFormat = all.ResponseFormat + if all.ResponseFormat != nil && !all.ResponseFormat.IsValid() { + hasInvalidField = true + } else { + o.ResponseFormat = all.ResponseFormat + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatterplot_widget_aggregator.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatterplot_widget_aggregator.go index bb849c01c..3ae824ae1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatterplot_widget_aggregator.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatterplot_widget_aggregator.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ScatterplotWidgetAggregator Aggregator used for the request. @@ -69,47 +70,3 @@ func (v ScatterplotWidgetAggregator) IsValid() bool { func (v ScatterplotWidgetAggregator) Ptr() *ScatterplotWidgetAggregator { return &v } - -// NullableScatterplotWidgetAggregator handles when a null is used for ScatterplotWidgetAggregator. -type NullableScatterplotWidgetAggregator struct { - value *ScatterplotWidgetAggregator - isSet bool -} - -// Get returns the associated value. -func (v NullableScatterplotWidgetAggregator) Get() *ScatterplotWidgetAggregator { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableScatterplotWidgetAggregator) Set(val *ScatterplotWidgetAggregator) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableScatterplotWidgetAggregator) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableScatterplotWidgetAggregator) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableScatterplotWidgetAggregator initializes the struct as if Set has been called. -func NewNullableScatterplotWidgetAggregator(val *ScatterplotWidgetAggregator) *NullableScatterplotWidgetAggregator { - return &NullableScatterplotWidgetAggregator{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableScatterplotWidgetAggregator) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableScatterplotWidgetAggregator) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatterplot_widget_formula.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatterplot_widget_formula.go index df205f81c..10f8c3e05 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatterplot_widget_formula.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_scatterplot_widget_formula.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -137,19 +138,13 @@ func (o ScatterplotWidgetFormula) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ScatterplotWidgetFormula) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Alias *string `json:"alias,omitempty"` Dimension *ScatterplotDimension `json:"dimension"` Formula *string `json:"formula"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Dimension == nil { return fmt.Errorf("required field dimension missing") @@ -163,20 +158,23 @@ func (o *ScatterplotWidgetFormula) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Dimension; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Alias = all.Alias - o.Dimension = *all.Dimension + if !all.Dimension.IsValid() { + hasInvalidField = true + } else { + o.Dimension = *all.Dimension + } o.Formula = *all.Formula + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_service_level_objective.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_service_level_objective.go index ee112561d..a722c1b8c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_service_level_objective.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_service_level_objective.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SearchServiceLevelObjective) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SearchServiceLevelObjective) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SearchServiceLevelObjectiveData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *SearchServiceLevelObjective) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_service_level_objective_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_service_level_objective_attributes.go index 8fc6e8d8f..2e20e6ac9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_service_level_objective_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_service_level_objective_attributes.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -646,7 +646,6 @@ func (o SearchServiceLevelObjectiveAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SearchServiceLevelObjectiveAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AllTags []string `json:"all_tags,omitempty"` CreatedAt *int64 `json:"created_at,omitempty"` @@ -666,12 +665,7 @@ func (o *SearchServiceLevelObjectiveAttributes) UnmarshalJSON(bytes []byte) (err Thresholds []SearchSLOThreshold `json:"thresholds,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -679,14 +673,8 @@ func (o *SearchServiceLevelObjectiveAttributes) UnmarshalJSON(bytes []byte) (err } else { return err } - if v := all.SloType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.AllTags = all.AllTags o.CreatedAt = all.CreatedAt o.Creator = all.Creator @@ -699,20 +687,25 @@ func (o *SearchServiceLevelObjectiveAttributes) UnmarshalJSON(bytes []byte) (err o.OverallStatus = all.OverallStatus o.Query = all.Query o.ServiceTags = all.ServiceTags - o.SloType = all.SloType + if all.SloType != nil && !all.SloType.IsValid() { + hasInvalidField = true + } else { + o.SloType = all.SloType + } if all.Status != nil && all.Status.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Status = all.Status o.TeamTags = all.TeamTags o.Thresholds = all.Thresholds + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_service_level_objective_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_service_level_objective_data.go index b4578e1d7..d969318ec 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_service_level_objective_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_service_level_objective_data.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -151,19 +151,13 @@ func (o SearchServiceLevelObjectiveData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SearchServiceLevelObjectiveData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SearchServiceLevelObjectiveAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *string `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,19 +165,22 @@ func (o *SearchServiceLevelObjectiveData) UnmarshalJSON(bytes []byte) (err error } else { return err } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id o.Type = all.Type + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_query.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_query.go index 39059a2f7..1ebfafe46 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_query.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_query.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -162,19 +162,13 @@ func (o SearchSLOQuery) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SearchSLOQuery) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Denominator *string `json:"denominator,omitempty"` Metrics datadog.NullableList[string] `json:"metrics,omitempty"` Numerator *string `json:"numerator,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -185,6 +179,7 @@ func (o *SearchSLOQuery) UnmarshalJSON(bytes []byte) (err error) { o.Denominator = all.Denominator o.Metrics = all.Metrics o.Numerator = all.Numerator + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response.go index 8c8a1e002..e9187cd34 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o SearchSLOResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SearchSLOResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SearchSLOResponseData `json:"data,omitempty"` Links *SearchSLOResponseLinks `json:"links,omitempty"` Meta *SearchSLOResponseMeta `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,33 +162,28 @@ func (o *SearchSLOResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Links = all.Links if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_data.go index f32e14b21..f2dc35a42 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_data.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SearchSLOResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SearchSLOResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SearchSLOResponseDataAttributes `json:"attributes,omitempty"` Type *string `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *SearchSLOResponseData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Type = all.Type + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_data_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_data_attributes.go index 657bccae1..a4612b386 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_data_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_data_attributes.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SearchSLOResponseDataAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SearchSLOResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Facets *SearchSLOResponseDataAttributesFacets `json:"facets,omitempty"` Slos []SearchServiceLevelObjective `json:"slos,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *SearchSLOResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error } else { return err } + + hasInvalidField := false if all.Facets != nil && all.Facets.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Facets = all.Facets o.Slos = all.Slos + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_data_attributes_facets.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_data_attributes_facets.go index dbb1f8ab0..b825b5817 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_data_attributes_facets.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_data_attributes_facets.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -313,7 +313,6 @@ func (o SearchSLOResponseDataAttributesFacets) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SearchSLOResponseDataAttributesFacets) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AllTags []SearchSLOResponseDataAttributesFacetsObjectString `json:"all_tags,omitempty"` CreatorName []SearchSLOResponseDataAttributesFacetsObjectString `json:"creator_name,omitempty"` @@ -325,12 +324,7 @@ func (o *SearchSLOResponseDataAttributesFacets) UnmarshalJSON(bytes []byte) (err Timeframe []SearchSLOResponseDataAttributesFacetsObjectString `json:"timeframe,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -346,6 +340,7 @@ func (o *SearchSLOResponseDataAttributesFacets) UnmarshalJSON(bytes []byte) (err o.Target = all.Target o.TeamTags = all.TeamTags o.Timeframe = all.Timeframe + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_data_attributes_facets_object_int.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_data_attributes_facets_object_int.go index 48340feda..a4b29945f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_data_attributes_facets_object_int.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_data_attributes_facets_object_int.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SearchSLOResponseDataAttributesFacetsObjectInt) MarshalJSON() ([]byte, e // UnmarshalJSON deserializes the given payload. func (o *SearchSLOResponseDataAttributesFacetsObjectInt) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Count *int64 `json:"count,omitempty"` Name *float64 `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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *SearchSLOResponseDataAttributesFacetsObjectInt) UnmarshalJSON(bytes []b } o.Count = all.Count o.Name = all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_data_attributes_facets_object_string.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_data_attributes_facets_object_string.go index 14fc57cab..08d934a2f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_data_attributes_facets_object_string.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_data_attributes_facets_object_string.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SearchSLOResponseDataAttributesFacetsObjectString) MarshalJSON() ([]byte // UnmarshalJSON deserializes the given payload. func (o *SearchSLOResponseDataAttributesFacetsObjectString) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Count *int64 `json:"count,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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *SearchSLOResponseDataAttributesFacetsObjectString) UnmarshalJSON(bytes } o.Count = all.Count o.Name = all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_links.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_links.go index 21e301b56..f3350597b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_links.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_links.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -236,7 +236,6 @@ func (o SearchSLOResponseLinks) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SearchSLOResponseLinks) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { First *string `json:"first,omitempty"` Last datadog.NullableString `json:"last,omitempty"` @@ -245,12 +244,7 @@ func (o *SearchSLOResponseLinks) UnmarshalJSON(bytes []byte) (err error) { Self *string `json:"self,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -263,6 +257,7 @@ func (o *SearchSLOResponseLinks) UnmarshalJSON(bytes []byte) (err error) { o.Next = all.Next o.Prev = all.Prev o.Self = all.Self + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_meta.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_meta.go index 3dca03ea6..0838c0e63 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_meta.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_meta.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SearchSLOResponseMeta) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SearchSLOResponseMeta) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Pagination *SearchSLOResponseMetaPage `json:"pagination,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *SearchSLOResponseMeta) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Pagination != nil && all.Pagination.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Pagination = all.Pagination + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_meta_page.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_meta_page.go index 346cfbc80..6b4a8ae49 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_meta_page.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_response_meta_page.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -313,7 +313,6 @@ func (o SearchSLOResponseMetaPage) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SearchSLOResponseMetaPage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { FirstNumber *int64 `json:"first_number,omitempty"` LastNumber *int64 `json:"last_number,omitempty"` @@ -325,12 +324,7 @@ func (o *SearchSLOResponseMetaPage) UnmarshalJSON(bytes []byte) (err error) { Type *string `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -346,6 +340,7 @@ func (o *SearchSLOResponseMetaPage) UnmarshalJSON(bytes []byte) (err error) { o.Size = all.Size o.Total = all.Total o.Type = all.Type + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_threshold.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_threshold.go index 501c64f4f..4154ac20d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_threshold.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_threshold.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -234,7 +235,6 @@ func (o SearchSLOThreshold) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SearchSLOThreshold) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Target *float64 `json:"target"` TargetDisplay *string `json:"target_display,omitempty"` @@ -243,12 +243,7 @@ func (o *SearchSLOThreshold) UnmarshalJSON(bytes []byte) (err error) { WarningDisplay datadog.NullableString `json:"warning_display,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Target == nil { return fmt.Errorf("required field target missing") @@ -262,22 +257,25 @@ func (o *SearchSLOThreshold) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Timeframe; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Target = *all.Target o.TargetDisplay = all.TargetDisplay - o.Timeframe = *all.Timeframe + if !all.Timeframe.IsValid() { + hasInvalidField = true + } else { + o.Timeframe = *all.Timeframe + } o.Warning = all.Warning o.WarningDisplay = all.WarningDisplay + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_timeframe.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_timeframe.go index 5fcbfab69..89095afaa 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_timeframe.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_search_slo_timeframe.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SearchSLOTimeframe The SLO time window options. @@ -65,47 +66,3 @@ func (v SearchSLOTimeframe) IsValid() bool { func (v SearchSLOTimeframe) Ptr() *SearchSLOTimeframe { return &v } - -// NullableSearchSLOTimeframe handles when a null is used for SearchSLOTimeframe. -type NullableSearchSLOTimeframe struct { - value *SearchSLOTimeframe - isSet bool -} - -// Get returns the associated value. -func (v NullableSearchSLOTimeframe) Get() *SearchSLOTimeframe { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSearchSLOTimeframe) Set(val *SearchSLOTimeframe) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSearchSLOTimeframe) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSearchSLOTimeframe) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSearchSLOTimeframe initializes the struct as if Set has been called. -func NewNullableSearchSLOTimeframe(val *SearchSLOTimeframe) *NullableSearchSLOTimeframe { - return &NullableSearchSLOTimeframe{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSearchSLOTimeframe) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSearchSLOTimeframe) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_selectable_template_variable_items.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_selectable_template_variable_items.go index 391e07f51..5384dfcd1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_selectable_template_variable_items.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_selectable_template_variable_items.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -192,7 +192,6 @@ func (o SelectableTemplateVariableItems) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SelectableTemplateVariableItems) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DefaultValue *string `json:"default_value,omitempty"` Name *string `json:"name,omitempty"` @@ -200,12 +199,7 @@ func (o *SelectableTemplateVariableItems) UnmarshalJSON(bytes []byte) (err error VisibleTags datadog.NullableList[string] `json:"visible_tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -217,6 +211,7 @@ func (o *SelectableTemplateVariableItems) UnmarshalJSON(bytes []byte) (err error o.Name = all.Name o.Prefix = all.Prefix o.VisibleTags = all.VisibleTags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_series.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_series.go index a3e274cfc..f897b9816 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_series.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_series.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -254,7 +255,6 @@ func (o Series) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Series) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Host *string `json:"host,omitempty"` Interval datadog.NullableInt64 `json:"interval,omitempty"` @@ -264,12 +264,7 @@ func (o *Series) UnmarshalJSON(bytes []byte) (err error) { Type *string `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Metric == nil { return fmt.Errorf("required field metric missing") @@ -289,6 +284,7 @@ func (o *Series) UnmarshalJSON(bytes []byte) (err error) { o.Points = *all.Points o.Tags = all.Tags o.Type = all.Type + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_check.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_check.go index e1b4d2d40..9b0ce4d65 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_check.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_check.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -224,7 +225,6 @@ func (o ServiceCheck) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceCheck) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Check *string `json:"check"` HostName *string `json:"host_name"` @@ -234,12 +234,7 @@ func (o *ServiceCheck) UnmarshalJSON(bytes []byte) (err error) { Timestamp *int64 `json:"timestamp,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Check == nil { return fmt.Errorf("required field check missing") @@ -259,23 +254,26 @@ func (o *ServiceCheck) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Status; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Check = *all.Check o.HostName = *all.HostName o.Message = all.Message - o.Status = *all.Status + if !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = *all.Status + } o.Tags = *all.Tags o.Timestamp = all.Timestamp + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_check_status.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_check_status.go index 21696df4f..d9cf35409 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_check_status.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_check_status.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ServiceCheckStatus The status of a service check. Set to `0` for OK, `1` for warning, `2` for critical, and `3` for unknown. @@ -67,47 +68,3 @@ func (v ServiceCheckStatus) IsValid() bool { func (v ServiceCheckStatus) Ptr() *ServiceCheckStatus { return &v } - -// NullableServiceCheckStatus handles when a null is used for ServiceCheckStatus. -type NullableServiceCheckStatus struct { - value *ServiceCheckStatus - isSet bool -} - -// Get returns the associated value. -func (v NullableServiceCheckStatus) Get() *ServiceCheckStatus { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableServiceCheckStatus) Set(val *ServiceCheckStatus) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableServiceCheckStatus) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableServiceCheckStatus) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableServiceCheckStatus initializes the struct as if Set has been called. -func NewNullableServiceCheckStatus(val *ServiceCheckStatus) *NullableServiceCheckStatus { - return &NullableServiceCheckStatus{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableServiceCheckStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableServiceCheckStatus) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_level_objective.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_level_objective.go index b03c0c0bc..3beccd072 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_level_objective.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_level_objective.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -600,7 +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{}{} all := struct { CreatedAt *int64 `json:"created_at,omitempty"` Creator *Creator `json:"creator,omitempty"` @@ -620,12 +620,7 @@ func (o *ServiceLevelObjective) UnmarshalJSON(bytes []byte) (err error) { WarningThreshold *float64 `json:"warning_threshold,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -642,29 +637,11 @@ func (o *ServiceLevelObjective) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Timeframe; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.CreatedAt = all.CreatedAt if all.Creator != nil && all.Creator.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Creator = all.Creator o.Description = all.Description @@ -675,22 +652,31 @@ func (o *ServiceLevelObjective) UnmarshalJSON(bytes []byte) (err error) { o.MonitorTags = all.MonitorTags o.Name = *all.Name if all.Query != nil && all.Query.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Query = all.Query o.Tags = all.Tags o.TargetThreshold = all.TargetThreshold o.Thresholds = *all.Thresholds - o.Timeframe = all.Timeframe - o.Type = *all.Type + if all.Timeframe != nil && !all.Timeframe.IsValid() { + hasInvalidField = true + } else { + o.Timeframe = all.Timeframe + } + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } o.WarningThreshold = all.WarningThreshold + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_level_objective_query.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_level_objective_query.go index cc8284ebd..f1cfad58e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_level_objective_query.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_level_objective_query.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o ServiceLevelObjectiveQuery) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceLevelObjectiveQuery) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Denominator *string `json:"denominator"` Numerator *string `json:"numerator"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Denominator == nil { return fmt.Errorf("required field denominator missing") @@ -133,6 +128,7 @@ func (o *ServiceLevelObjectiveQuery) UnmarshalJSON(bytes []byte) (err error) { } o.Denominator = *all.Denominator o.Numerator = *all.Numerator + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_level_objective_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_level_objective_request.go index 940e538ab..80c8e7ff1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_level_objective_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_level_objective_request.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -424,7 +425,6 @@ func (o ServiceLevelObjectiveRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceLevelObjectiveRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Description datadog.NullableString `json:"description,omitempty"` Groups []string `json:"groups,omitempty"` @@ -439,12 +439,7 @@ func (o *ServiceLevelObjectiveRequest) UnmarshalJSON(bytes []byte) (err error) { WarningThreshold *float64 `json:"warning_threshold,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -461,43 +456,38 @@ func (o *ServiceLevelObjectiveRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Timeframe; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Description = all.Description o.Groups = all.Groups o.MonitorIds = all.MonitorIds o.Name = *all.Name if all.Query != nil && all.Query.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Query = all.Query o.Tags = all.Tags o.TargetThreshold = all.TargetThreshold o.Thresholds = *all.Thresholds - o.Timeframe = all.Timeframe - o.Type = *all.Type + if all.Timeframe != nil && !all.Timeframe.IsValid() { + hasInvalidField = true + } else { + o.Timeframe = all.Timeframe + } + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } o.WarningThreshold = all.WarningThreshold + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_map_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_map_widget_definition.go index 1c50116ab..266d92003 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_map_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_map_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -265,7 +266,6 @@ func (o ServiceMapWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` Filters *[]string `json:"filters"` @@ -276,12 +276,7 @@ func (o *ServiceMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { Type *ServiceMapWidgetDefinitionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Filters == nil { return fmt.Errorf("required field filters missing") @@ -298,32 +293,31 @@ func (o *ServiceMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.CustomLinks = all.CustomLinks o.Filters = *all.Filters o.Service = *all.Service o.Title = all.Title - o.TitleAlign = all.TitleAlign + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } o.TitleSize = all.TitleSize - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_map_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_map_widget_definition_type.go index 0c35f55f0..e2bb590fa 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_map_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_map_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ServiceMapWidgetDefinitionType Type of the service map widget. @@ -61,47 +62,3 @@ func (v ServiceMapWidgetDefinitionType) IsValid() bool { func (v ServiceMapWidgetDefinitionType) Ptr() *ServiceMapWidgetDefinitionType { return &v } - -// NullableServiceMapWidgetDefinitionType handles when a null is used for ServiceMapWidgetDefinitionType. -type NullableServiceMapWidgetDefinitionType struct { - value *ServiceMapWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableServiceMapWidgetDefinitionType) Get() *ServiceMapWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableServiceMapWidgetDefinitionType) Set(val *ServiceMapWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableServiceMapWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableServiceMapWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableServiceMapWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableServiceMapWidgetDefinitionType(val *ServiceMapWidgetDefinitionType) *NullableServiceMapWidgetDefinitionType { - return &NullableServiceMapWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableServiceMapWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableServiceMapWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_summary_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_summary_widget_definition.go index 43170889b..d28e2d937 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_summary_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_summary_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -556,7 +557,6 @@ func (o ServiceSummaryWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceSummaryWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DisplayFormat *WidgetServiceSummaryDisplayFormat `json:"display_format,omitempty"` Env *string `json:"env"` @@ -576,12 +576,7 @@ func (o *ServiceSummaryWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) Type *ServiceSummaryWidgetDefinitionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Env == nil { return fmt.Errorf("required field env missing") @@ -601,39 +596,13 @@ func (o *ServiceSummaryWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.DisplayFormat; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.SizeFormat; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.DisplayFormat = all.DisplayFormat + + hasInvalidField := false + if all.DisplayFormat != nil && !all.DisplayFormat.IsValid() { + hasInvalidField = true + } else { + o.DisplayFormat = all.DisplayFormat + } o.Env = *all.Env o.Service = *all.Service o.ShowBreakdown = all.ShowBreakdown @@ -642,23 +611,36 @@ func (o *ServiceSummaryWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) o.ShowHits = all.ShowHits o.ShowLatency = all.ShowLatency o.ShowResourceList = all.ShowResourceList - o.SizeFormat = all.SizeFormat + if all.SizeFormat != nil && !all.SizeFormat.IsValid() { + hasInvalidField = true + } else { + o.SizeFormat = all.SizeFormat + } o.SpanName = *all.SpanName if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Time = all.Time o.Title = all.Title - o.TitleAlign = all.TitleAlign + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } o.TitleSize = all.TitleSize - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_summary_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_summary_widget_definition_type.go index 133f9eb44..c01db9755 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_summary_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_service_summary_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ServiceSummaryWidgetDefinitionType Type of the service summary widget. @@ -61,47 +62,3 @@ func (v ServiceSummaryWidgetDefinitionType) IsValid() bool { func (v ServiceSummaryWidgetDefinitionType) Ptr() *ServiceSummaryWidgetDefinitionType { return &v } - -// NullableServiceSummaryWidgetDefinitionType handles when a null is used for ServiceSummaryWidgetDefinitionType. -type NullableServiceSummaryWidgetDefinitionType struct { - value *ServiceSummaryWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableServiceSummaryWidgetDefinitionType) Get() *ServiceSummaryWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableServiceSummaryWidgetDefinitionType) Set(val *ServiceSummaryWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableServiceSummaryWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableServiceSummaryWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableServiceSummaryWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableServiceSummaryWidgetDefinitionType(val *ServiceSummaryWidgetDefinitionType) *NullableServiceSummaryWidgetDefinitionType { - return &NullableServiceSummaryWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableServiceSummaryWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableServiceSummaryWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard.go index 7d0917ec4..132d46e84 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard.go @@ -5,10 +5,11 @@ package datadogV1 import ( - "encoding/json" "fmt" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -440,7 +441,6 @@ func (o SharedDashboard) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SharedDashboard) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Author *SharedDashboardAuthor `json:"author,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` @@ -455,12 +455,7 @@ func (o *SharedDashboard) UnmarshalJSON(bytes []byte) (err error) { Token *string `json:"token,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.DashboardId == nil { return fmt.Errorf("required field dashboard_id missing") @@ -474,50 +469,41 @@ func (o *SharedDashboard) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.DashboardType; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ShareType; v.Get() != nil && !v.Get().IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Author != nil && all.Author.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Author = all.Author o.CreatedAt = all.CreatedAt o.DashboardId = *all.DashboardId - o.DashboardType = *all.DashboardType + if !all.DashboardType.IsValid() { + hasInvalidField = true + } else { + o.DashboardType = *all.DashboardType + } if all.GlobalTime != nil && all.GlobalTime.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.GlobalTime = all.GlobalTime o.GlobalTimeSelectableEnabled = all.GlobalTimeSelectableEnabled o.PublicUrl = all.PublicUrl o.SelectableTemplateVars = all.SelectableTemplateVars o.ShareList = all.ShareList - o.ShareType = all.ShareType + if all.ShareType.Get() != nil && !all.ShareType.Get().IsValid() { + hasInvalidField = true + } else { + o.ShareType = all.ShareType + } o.Token = all.Token + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_author.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_author.go index 0ba50a1a2..a631aec09 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_author.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_author.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -126,18 +126,12 @@ func (o SharedDashboardAuthor) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SharedDashboardAuthor) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Handle *string `json:"handle,omitempty"` Name datadog.NullableString `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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -147,6 +141,7 @@ func (o *SharedDashboardAuthor) UnmarshalJSON(bytes []byte) (err error) { } o.Handle = all.Handle o.Name = all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_invites.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_invites.go index 4ddd1ad3f..f57119270 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_invites.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_invites.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o SharedDashboardInvites) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SharedDashboardInvites) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SharedDashboardInvitesData `json:"data"` Meta *SharedDashboardInvitesMeta `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -132,18 +127,21 @@ func (o *SharedDashboardInvites) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Data = *all.Data if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_invites_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_invites_data.go index 56cebbb00..29f7a48a4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_invites_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_invites_data.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" ) // SharedDashboardInvitesData - An object or list of objects containing the information for an invitation to a shared dashboard. @@ -103,53 +103,3 @@ func (obj *SharedDashboardInvitesData) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableSharedDashboardInvitesData handles when a null is used for SharedDashboardInvitesData. -type NullableSharedDashboardInvitesData struct { - value *SharedDashboardInvitesData - isSet bool -} - -// Get returns the associated value. -func (v NullableSharedDashboardInvitesData) Get() *SharedDashboardInvitesData { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSharedDashboardInvitesData) Set(val *SharedDashboardInvitesData) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSharedDashboardInvitesData) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableSharedDashboardInvitesData) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSharedDashboardInvitesData initializes the struct as if Set has been called. -func NewNullableSharedDashboardInvitesData(val *SharedDashboardInvitesData) *NullableSharedDashboardInvitesData { - return &NullableSharedDashboardInvitesData{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSharedDashboardInvitesData) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSharedDashboardInvitesData) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_invites_data_object.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_invites_data_object.go index 08b6d020e..d148cca99 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_invites_data_object.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_invites_data_object.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o SharedDashboardInvitesDataObject) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SharedDashboardInvitesDataObject) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SharedDashboardInvitesDataObjectAttributes `json:"attributes"` Type *DashboardInviteType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -129,26 +124,25 @@ func (o *SharedDashboardInvitesDataObject) UnmarshalJSON(bytes []byte) (err erro } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_invites_data_object_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_invites_data_object_attributes.go index ab7817333..902aaa9b9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_invites_data_object_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_invites_data_object_attributes.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -267,7 +268,6 @@ func (o SharedDashboardInvitesDataObjectAttributes) MarshalJSON() ([]byte, error // UnmarshalJSON deserializes the given payload. func (o *SharedDashboardInvitesDataObjectAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CreatedAt *time.Time `json:"created_at,omitempty"` Email *string `json:"email,omitempty"` @@ -277,12 +277,7 @@ func (o *SharedDashboardInvitesDataObjectAttributes) UnmarshalJSON(bytes []byte) ShareToken *string `json:"share_token,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -296,6 +291,7 @@ func (o *SharedDashboardInvitesDataObjectAttributes) UnmarshalJSON(bytes []byte) o.InvitationExpiry = all.InvitationExpiry o.SessionExpiry = all.SessionExpiry o.ShareToken = all.ShareToken + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_invites_meta.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_invites_meta.go index 62edebe6b..e46ba804a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_invites_meta.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_invites_meta.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SharedDashboardInvitesMeta) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SharedDashboardInvitesMeta) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Page *SharedDashboardInvitesMetaPage `json:"page,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *SharedDashboardInvitesMeta) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Page = all.Page + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_invites_meta_page.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_invites_meta_page.go index f1aaa7c09..be5024834 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_invites_meta_page.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_invites_meta_page.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SharedDashboardInvitesMetaPage) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SharedDashboardInvitesMetaPage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { TotalCount *int64 `json:"total_count,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *SharedDashboardInvitesMetaPage) UnmarshalJSON(bytes []byte) (err error) return err } o.TotalCount = all.TotalCount + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_update_request.go index 1cfbbad4b..85747a2b2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_update_request.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -245,7 +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{}{} all := struct { GlobalTime NullableSharedDashboardUpdateRequestGlobalTime `json:"global_time"` GlobalTimeSelectableEnabled datadog.NullableBool `json:"global_time_selectable_enabled,omitempty"` @@ -254,12 +254,7 @@ func (o *SharedDashboardUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { ShareType NullableDashboardShareType `json:"share_type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if !all.GlobalTime.IsSet() { return fmt.Errorf("required field global_time missing") @@ -270,22 +265,25 @@ func (o *SharedDashboardUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.ShareType; v.Get() != nil && !v.Get().IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.GlobalTime = all.GlobalTime o.GlobalTimeSelectableEnabled = all.GlobalTimeSelectableEnabled o.SelectableTemplateVars = all.SelectableTemplateVars o.ShareList = all.ShareList - o.ShareType = all.ShareType + if all.ShareType.Get() != nil && !all.ShareType.Get().IsValid() { + hasInvalidField = true + } else { + o.ShareType = all.ShareType + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_update_request_global_time.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_update_request_global_time.go index 9036b8201..4cc5fa6c8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_update_request_global_time.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_shared_dashboard_update_request_global_time.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SharedDashboardUpdateRequestGlobalTime) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SharedDashboardUpdateRequestGlobalTime) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { LiveSpan *DashboardGlobalTimeLiveSpan `json:"live_span,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,19 +94,22 @@ func (o *SharedDashboardUpdateRequestGlobalTime) UnmarshalJSON(bytes []byte) (er } else { return err } - if v := all.LiveSpan; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.LiveSpan != nil && !all.LiveSpan.IsValid() { + hasInvalidField = true + } else { + o.LiveSpan = all.LiveSpan } - o.LiveSpan = all.LiveSpan + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_signal_archive_reason.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_signal_archive_reason.go index 070d6f27d..d4c04e3bf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_signal_archive_reason.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_signal_archive_reason.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SignalArchiveReason Reason why a signal has been archived. @@ -69,47 +70,3 @@ func (v SignalArchiveReason) IsValid() bool { func (v SignalArchiveReason) Ptr() *SignalArchiveReason { return &v } - -// NullableSignalArchiveReason handles when a null is used for SignalArchiveReason. -type NullableSignalArchiveReason struct { - value *SignalArchiveReason - isSet bool -} - -// Get returns the associated value. -func (v NullableSignalArchiveReason) Get() *SignalArchiveReason { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSignalArchiveReason) Set(val *SignalArchiveReason) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSignalArchiveReason) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSignalArchiveReason) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSignalArchiveReason initializes the struct as if Set has been called. -func NewNullableSignalArchiveReason(val *SignalArchiveReason) *NullableSignalArchiveReason { - return &NullableSignalArchiveReason{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSignalArchiveReason) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSignalArchiveReason) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_signal_assignee_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_signal_assignee_update_request.go index 9a9cd871a..7ff4a7955 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_signal_assignee_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_signal_assignee_update_request.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o SignalAssigneeUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SignalAssigneeUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Assignee *string `json:"assignee"` Version *int64 `json:"version,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Assignee == nil { return fmt.Errorf("required field assignee missing") @@ -134,6 +129,7 @@ func (o *SignalAssigneeUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.Assignee = *all.Assignee o.Version = all.Version + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_signal_state_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_signal_state_update_request.go index 11907896a..25ffcf8c2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_signal_state_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_signal_state_update_request.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -176,7 +177,6 @@ func (o SignalStateUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SignalStateUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ArchiveComment *string `json:"archiveComment,omitempty"` ArchiveReason *SignalArchiveReason `json:"archiveReason,omitempty"` @@ -184,12 +184,7 @@ func (o *SignalStateUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { Version *int64 `json:"version,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.State == nil { return fmt.Errorf("required field state missing") @@ -200,29 +195,28 @@ func (o *SignalStateUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.ArchiveReason; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.State; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.ArchiveComment = all.ArchiveComment - o.ArchiveReason = all.ArchiveReason - o.State = *all.State + if all.ArchiveReason != nil && !all.ArchiveReason.IsValid() { + hasInvalidField = true + } else { + o.ArchiveReason = all.ArchiveReason + } + if !all.State.IsValid() { + hasInvalidField = true + } else { + o.State = *all.State + } o.Version = all.Version + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_signal_triage_state.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_signal_triage_state.go index e53f7c7aa..99e75597e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_signal_triage_state.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_signal_triage_state.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SignalTriageState The new triage state of the signal. @@ -65,47 +66,3 @@ func (v SignalTriageState) IsValid() bool { func (v SignalTriageState) Ptr() *SignalTriageState { return &v } - -// NullableSignalTriageState handles when a null is used for SignalTriageState. -type NullableSignalTriageState struct { - value *SignalTriageState - isSet bool -} - -// Get returns the associated value. -func (v NullableSignalTriageState) Get() *SignalTriageState { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSignalTriageState) Set(val *SignalTriageState) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSignalTriageState) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSignalTriageState) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSignalTriageState initializes the struct as if Set has been called. -func NewNullableSignalTriageState(val *SignalTriageState) *NullableSignalTriageState { - return &NullableSignalTriageState{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSignalTriageState) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSignalTriageState) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slack_integration_channel.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slack_integration_channel.go index b753f6c09..9d787bc0a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slack_integration_channel.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slack_integration_channel.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SlackIntegrationChannel) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SlackIntegrationChannel) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Display *SlackIntegrationChannelDisplay `json:"display,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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *SlackIntegrationChannel) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Display != nil && all.Display.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Display = all.Display o.Name = all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slack_integration_channel_display.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slack_integration_channel_display.go index 7ef7af6cd..a3e97942f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slack_integration_channel_display.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slack_integration_channel_display.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -197,7 +197,6 @@ func (o SlackIntegrationChannelDisplay) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SlackIntegrationChannelDisplay) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Message *bool `json:"message,omitempty"` Notified *bool `json:"notified,omitempty"` @@ -205,12 +204,7 @@ func (o *SlackIntegrationChannelDisplay) UnmarshalJSON(bytes []byte) (err error) Tags *bool `json:"tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -222,6 +216,7 @@ func (o *SlackIntegrationChannelDisplay) UnmarshalJSON(bytes []byte) (err error) o.Notified = all.Notified o.Snapshot = all.Snapshot o.Tags = all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_bulk_delete_error.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_bulk_delete_error.go index b52b32a88..984e914f2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_bulk_delete_error.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_bulk_delete_error.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -133,19 +134,13 @@ func (o SLOBulkDeleteError) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOBulkDeleteError) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id"` Message *string `json:"message"` Timeframe *SLOErrorTimeframe `json:"timeframe"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -162,20 +157,23 @@ func (o *SLOBulkDeleteError) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Timeframe; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Id = *all.Id o.Message = *all.Message - o.Timeframe = *all.Timeframe + if !all.Timeframe.IsValid() { + hasInvalidField = true + } else { + o.Timeframe = *all.Timeframe + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_bulk_delete_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_bulk_delete_response.go index 2948a57f3..cbbd67308 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_bulk_delete_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_bulk_delete_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -120,18 +120,12 @@ func (o SLOBulkDeleteResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOBulkDeleteResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SLOBulkDeleteResponseData `json:"data,omitempty"` Errors []SLOBulkDeleteError `json:"errors,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -139,18 +133,21 @@ func (o *SLOBulkDeleteResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data o.Errors = all.Errors + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_bulk_delete_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_bulk_delete_response_data.go index a542778f5..5b208031c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_bulk_delete_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_bulk_delete_response_data.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -118,18 +118,12 @@ func (o SLOBulkDeleteResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOBulkDeleteResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Deleted []string `json:"deleted,omitempty"` Updated []string `json:"updated,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -139,6 +133,7 @@ func (o *SLOBulkDeleteResponseData) UnmarshalJSON(bytes []byte) (err error) { } o.Deleted = all.Deleted o.Updated = all.Updated + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction.go index e1d0b2b52..fb6918638 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o SLOCorrection) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOCorrection) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SLOCorrectionResponseAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *SLOCorrectionType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *SLOCorrection) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_category.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_category.go index da3cf4da6..21648fc5a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_category.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_category.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SLOCorrectionCategory Category the SLO correction belongs to. @@ -67,47 +68,3 @@ func (v SLOCorrectionCategory) IsValid() bool { func (v SLOCorrectionCategory) Ptr() *SLOCorrectionCategory { return &v } - -// NullableSLOCorrectionCategory handles when a null is used for SLOCorrectionCategory. -type NullableSLOCorrectionCategory struct { - value *SLOCorrectionCategory - isSet bool -} - -// Get returns the associated value. -func (v NullableSLOCorrectionCategory) Get() *SLOCorrectionCategory { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSLOCorrectionCategory) Set(val *SLOCorrectionCategory) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSLOCorrectionCategory) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSLOCorrectionCategory) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSLOCorrectionCategory initializes the struct as if Set has been called. -func NewNullableSLOCorrectionCategory(val *SLOCorrectionCategory) *NullableSLOCorrectionCategory { - return &NullableSLOCorrectionCategory{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSLOCorrectionCategory) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSLOCorrectionCategory) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_create_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_create_data.go index 4ec92acb1..abc3f1466 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_create_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_create_data.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -112,18 +113,12 @@ func (o SLOCorrectionCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOCorrectionCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SLOCorrectionCreateRequestAttributes `json:"attributes,omitempty"` Type *SLOCorrectionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -134,26 +129,25 @@ func (o *SLOCorrectionCreateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_create_request.go index 6bc9b931f..117396a4b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_create_request.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SLOCorrectionCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOCorrectionCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SLOCorrectionCreateData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *SLOCorrectionCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_create_request_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_create_request_attributes.go index 2ce9d5a95..e24d53ba7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_create_request_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_create_request_attributes.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -297,7 +298,6 @@ func (o SLOCorrectionCreateRequestAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOCorrectionCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Category *SLOCorrectionCategory `json:"category"` Description *string `json:"description,omitempty"` @@ -309,12 +309,7 @@ func (o *SLOCorrectionCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err Timezone *string `json:"timezone,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Category == nil { return fmt.Errorf("required field category missing") @@ -331,15 +326,13 @@ func (o *SLOCorrectionCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err } else { return err } - if v := all.Category; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if !all.Category.IsValid() { + hasInvalidField = true + } else { + o.Category = *all.Category } - o.Category = *all.Category o.Description = all.Description o.Duration = all.Duration o.End = all.End @@ -347,9 +340,14 @@ func (o *SLOCorrectionCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err o.SloId = *all.SloId o.Start = *all.Start o.Timezone = all.Timezone + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_list_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_list_response.go index bcc2abe6c..faf720fdc 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_list_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_list_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SLOCorrectionListResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOCorrectionListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []SLOCorrection `json:"data,omitempty"` Meta *ResponseMetaAttributes `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *SLOCorrectionListResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Data = all.Data if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_response.go index 638476d25..2d19b51fd 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SLOCorrectionResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOCorrectionResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SLOCorrection `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *SLOCorrectionResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_response_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_response_attributes.go index bb6b2b8ac..bf915780b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_response_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_response_attributes.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -512,7 +512,6 @@ func (o SLOCorrectionResponseAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOCorrectionResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Category *SLOCorrectionCategory `json:"category,omitempty"` CreatedAt datadog.NullableInt64 `json:"created_at,omitempty"` @@ -528,12 +527,7 @@ func (o *SLOCorrectionResponseAttributes) UnmarshalJSON(bytes []byte) (err error Timezone *string `json:"timezone,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -541,22 +535,16 @@ func (o *SLOCorrectionResponseAttributes) UnmarshalJSON(bytes []byte) (err error } else { return err } - if v := all.Category; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.Category != nil && !all.Category.IsValid() { + hasInvalidField = true + } else { + o.Category = all.Category } - o.Category = all.Category o.CreatedAt = all.CreatedAt if all.Creator != nil && all.Creator.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Creator = all.Creator o.Description = all.Description @@ -568,9 +556,14 @@ func (o *SLOCorrectionResponseAttributes) UnmarshalJSON(bytes []byte) (err error o.SloId = all.SloId o.Start = all.Start o.Timezone = all.Timezone + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_response_attributes_modifier.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_response_attributes_modifier.go index 5647923c4..5414af980 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_response_attributes_modifier.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_response_attributes_modifier.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o SLOCorrectionResponseAttributesModifier) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOCorrectionResponseAttributesModifier) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Email *string `json:"email,omitempty"` Handle *string `json:"handle,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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *SLOCorrectionResponseAttributesModifier) UnmarshalJSON(bytes []byte) (e o.Email = all.Email o.Handle = all.Handle o.Name = all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_type.go index 3d8a9580a..8c15f2f03 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SLOCorrectionType SLO correction resource type. @@ -61,47 +62,3 @@ func (v SLOCorrectionType) IsValid() bool { func (v SLOCorrectionType) Ptr() *SLOCorrectionType { return &v } - -// NullableSLOCorrectionType handles when a null is used for SLOCorrectionType. -type NullableSLOCorrectionType struct { - value *SLOCorrectionType - isSet bool -} - -// Get returns the associated value. -func (v NullableSLOCorrectionType) Get() *SLOCorrectionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSLOCorrectionType) Set(val *SLOCorrectionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSLOCorrectionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSLOCorrectionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSLOCorrectionType initializes the struct as if Set has been called. -func NewNullableSLOCorrectionType(val *SLOCorrectionType) *NullableSLOCorrectionType { - return &NullableSLOCorrectionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSLOCorrectionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSLOCorrectionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_update_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_update_data.go index 6f73ac354..6da17eb3b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_update_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_update_data.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -119,18 +119,12 @@ func (o SLOCorrectionUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOCorrectionUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SLOCorrectionUpdateRequestAttributes `json:"attributes,omitempty"` Type *SLOCorrectionType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -138,26 +132,25 @@ func (o *SLOCorrectionUpdateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_update_request.go index 88e69f60c..91c9bf794 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_update_request.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SLOCorrectionUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOCorrectionUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SLOCorrectionUpdateData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *SLOCorrectionUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_update_request_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_update_request_attributes.go index 30a48f9ed..f90069dbc 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_update_request_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_correction_update_request_attributes.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -281,7 +281,6 @@ func (o SLOCorrectionUpdateRequestAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOCorrectionUpdateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Category *SLOCorrectionCategory `json:"category,omitempty"` Description *string `json:"description,omitempty"` @@ -292,12 +291,7 @@ func (o *SLOCorrectionUpdateRequestAttributes) UnmarshalJSON(bytes []byte) (err Timezone *string `json:"timezone,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -305,24 +299,27 @@ func (o *SLOCorrectionUpdateRequestAttributes) UnmarshalJSON(bytes []byte) (err } else { return err } - if v := all.Category; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.Category != nil && !all.Category.IsValid() { + hasInvalidField = true + } else { + 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.Start = all.Start o.Timezone = all.Timezone + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_creator.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_creator.go index 732ddf448..cddc83724 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_creator.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_creator.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -159,19 +159,13 @@ func (o SLOCreator) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOCreator) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Email *string `json:"email,omitempty"` Id *int64 `json:"id,omitempty"` Name datadog.NullableString `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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -182,6 +176,7 @@ func (o *SLOCreator) UnmarshalJSON(bytes []byte) (err error) { o.Email = all.Email o.Id = all.Id o.Name = all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_delete_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_delete_response.go index 4ccf7173d..28e240e6f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_delete_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_delete_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SLODeleteResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLODeleteResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []string `json:"data,omitempty"` Errors map[string]string `json:"errors,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *SLODeleteResponse) UnmarshalJSON(bytes []byte) (err error) { } o.Data = all.Data o.Errors = all.Errors + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_error_timeframe.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_error_timeframe.go index 79c95a8a4..719ad2c65 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_error_timeframe.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_error_timeframe.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SLOErrorTimeframe The timeframe of the threshold associated with this error @@ -68,47 +69,3 @@ func (v SLOErrorTimeframe) IsValid() bool { func (v SLOErrorTimeframe) Ptr() *SLOErrorTimeframe { return &v } - -// NullableSLOErrorTimeframe handles when a null is used for SLOErrorTimeframe. -type NullableSLOErrorTimeframe struct { - value *SLOErrorTimeframe - isSet bool -} - -// Get returns the associated value. -func (v NullableSLOErrorTimeframe) Get() *SLOErrorTimeframe { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSLOErrorTimeframe) Set(val *SLOErrorTimeframe) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSLOErrorTimeframe) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSLOErrorTimeframe) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSLOErrorTimeframe initializes the struct as if Set has been called. -func NewNullableSLOErrorTimeframe(val *SLOErrorTimeframe) *NullableSLOErrorTimeframe { - return &NullableSLOErrorTimeframe{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSLOErrorTimeframe) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSLOErrorTimeframe) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_metrics.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_metrics.go index d720928c5..aebe91a28 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_metrics.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_metrics.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -276,7 +277,6 @@ func (o SLOHistoryMetrics) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOHistoryMetrics) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Denominator *SLOHistoryMetricsSeries `json:"denominator"` Interval *int64 `json:"interval"` @@ -288,12 +288,7 @@ func (o *SLOHistoryMetrics) UnmarshalJSON(bytes []byte) (err error) { Times *[]float64 `json:"times"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Denominator == nil { return fmt.Errorf("required field denominator missing") @@ -322,31 +317,30 @@ func (o *SLOHistoryMetrics) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Denominator.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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 } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_metrics_series.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_metrics_series.go index 8a554974e..2bd7a4213 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_metrics_series.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_metrics_series.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -165,7 +166,6 @@ func (o SLOHistoryMetricsSeries) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOHistoryMetricsSeries) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Count *int64 `json:"count"` Metadata *SLOHistoryMetricsSeriesMetadata `json:"metadata,omitempty"` @@ -173,12 +173,7 @@ func (o *SLOHistoryMetricsSeries) UnmarshalJSON(bytes []byte) (err error) { Values *[]float64 `json:"values"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Count == nil { return fmt.Errorf("required field count missing") @@ -195,20 +190,23 @@ func (o *SLOHistoryMetricsSeries) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Count = *all.Count if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Metadata = all.Metadata o.Sum = *all.Sum o.Values = *all.Values + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_metrics_series_metadata.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_metrics_series_metadata.go index 2a349ddbe..70580c75d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_metrics_series_metadata.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_metrics_series_metadata.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -250,7 +250,6 @@ func (o SLOHistoryMetricsSeriesMetadata) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOHistoryMetricsSeriesMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggr *string `json:"aggr,omitempty"` Expression *string `json:"expression,omitempty"` @@ -260,12 +259,7 @@ func (o *SLOHistoryMetricsSeriesMetadata) UnmarshalJSON(bytes []byte) (err error Unit []SLOHistoryMetricsSeriesMetadataUnit `json:"unit,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -279,6 +273,7 @@ func (o *SLOHistoryMetricsSeriesMetadata) UnmarshalJSON(bytes []byte) (err error o.QueryIndex = all.QueryIndex o.Scope = all.Scope o.Unit = all.Unit + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_metrics_series_metadata_unit.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_metrics_series_metadata_unit.go index 8cd99c8f8..653bdba8b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_metrics_series_metadata_unit.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_metrics_series_metadata_unit.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -269,7 +269,6 @@ func (o SLOHistoryMetricsSeriesMetadataUnit) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOHistoryMetricsSeriesMetadataUnit) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Family *string `json:"family,omitempty"` Id *int64 `json:"id,omitempty"` @@ -279,12 +278,7 @@ func (o *SLOHistoryMetricsSeriesMetadataUnit) UnmarshalJSON(bytes []byte) (err e ShortName datadog.NullableString `json:"short_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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -298,6 +292,7 @@ func (o *SLOHistoryMetricsSeriesMetadataUnit) UnmarshalJSON(bytes []byte) (err e o.Plural = all.Plural o.ScaleFactor = all.ScaleFactor o.ShortName = all.ShortName + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_monitor.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_monitor.go index 14afa1419..e85293066 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_monitor.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_monitor.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -466,7 +466,6 @@ func (o SLOHistoryMonitor) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOHistoryMonitor) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ErrorBudgetRemaining map[string]float64 `json:"error_budget_remaining,omitempty"` Errors []SLOHistoryResponseErrorWithType `json:"errors,omitempty"` @@ -482,12 +481,7 @@ func (o *SLOHistoryMonitor) UnmarshalJSON(bytes []byte) (err error) { Uptime *float64 `json:"uptime,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -507,6 +501,7 @@ func (o *SLOHistoryMonitor) UnmarshalJSON(bytes []byte) (err error) { o.SliValue = all.SliValue o.SpanPrecision = all.SpanPrecision o.Uptime = all.Uptime + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_response.go index b2b1c10d5..aa4f7409f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -116,18 +116,12 @@ func (o SLOHistoryResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOHistoryResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SLOHistoryResponseData `json:"data,omitempty"` Errors []SLOHistoryResponseError `json:"errors,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -135,18 +129,21 @@ func (o *SLOHistoryResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data o.Errors = all.Errors + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_response_data.go index 6d19b995f..46d35eb1d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_response_data.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -390,7 +390,6 @@ func (o SLOHistoryResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOHistoryResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { FromTs *int64 `json:"from_ts,omitempty"` GroupBy []string `json:"group_by,omitempty"` @@ -404,12 +403,7 @@ func (o *SLOHistoryResponseData) UnmarshalJSON(bytes []byte) (err error) { TypeId *SLOTypeNumeric `json:"type_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -417,49 +411,40 @@ func (o *SLOHistoryResponseData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TypeId; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.FromTs = all.FromTs o.GroupBy = all.GroupBy o.Groups = all.Groups o.Monitors = all.Monitors if all.Overall != nil && all.Overall.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Overall = all.Overall if all.Series != nil && all.Series.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Series = all.Series o.Thresholds = all.Thresholds o.ToTs = all.ToTs - o.Type = all.Type - o.TypeId = all.TypeId + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if all.TypeId != nil && !all.TypeId.IsValid() { + hasInvalidField = true + } else { + o.TypeId = all.TypeId + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_response_error.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_response_error.go index 989560b57..9cf47cd99 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_response_error.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_response_error.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SLOHistoryResponseError) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOHistoryResponseError) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Error *string `json:"error,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *SLOHistoryResponseError) UnmarshalJSON(bytes []byte) (err error) { return err } o.Error = all.Error + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_response_error_with_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_response_error_with_type.go index ed43327ca..c1a9dfc9c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_response_error_with_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_response_error_with_type.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o SLOHistoryResponseErrorWithType) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOHistoryResponseErrorWithType) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ErrorMessage *string `json:"error_message"` ErrorType *string `json:"error_type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.ErrorMessage == nil { return fmt.Errorf("required field error_message missing") @@ -131,6 +126,7 @@ func (o *SLOHistoryResponseErrorWithType) UnmarshalJSON(bytes []byte) (err error } o.ErrorMessage = *all.ErrorMessage o.ErrorType = *all.ErrorType + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_sli_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_sli_data.go index 1528a9344..8dd9d07dc 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_sli_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_history_sli_data.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -473,7 +473,6 @@ func (o SLOHistorySLIData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOHistorySLIData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ErrorBudgetRemaining map[string]float64 `json:"error_budget_remaining,omitempty"` Errors []SLOHistoryResponseErrorWithType `json:"errors,omitempty"` @@ -489,12 +488,7 @@ func (o *SLOHistorySLIData) UnmarshalJSON(bytes []byte) (err error) { Uptime datadog.NullableFloat64 `json:"uptime,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -514,6 +508,7 @@ func (o *SLOHistorySLIData) UnmarshalJSON(bytes []byte) (err error) { o.SliValue = all.SliValue o.SpanPrecision = all.SpanPrecision o.Uptime = all.Uptime + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_response.go index 2b095b3db..92abd4c19 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -149,19 +149,13 @@ func (o SLOListResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []ServiceLevelObjective `json:"data,omitempty"` Errors []string `json:"errors,omitempty"` Metadata *SLOListResponseMetadata `json:"metadata,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -169,19 +163,22 @@ func (o *SLOListResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Data = all.Data o.Errors = all.Errors if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Metadata = all.Metadata + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_response_metadata.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_response_metadata.go index cb65b067e..9b9394aa8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_response_metadata.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_response_metadata.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SLOListResponseMetadata) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOListResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Page *SLOListResponseMetadataPage `json:"page,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *SLOListResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Page = all.Page + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_response_metadata_page.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_response_metadata_page.go index 7016a266c..35e62b5d1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_response_metadata_page.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_response_metadata_page.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SLOListResponseMetadataPage) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOListResponseMetadataPage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { TotalCount *int64 `json:"total_count,omitempty"` TotalFilteredCount *int64 `json:"total_filtered_count,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *SLOListResponseMetadataPage) UnmarshalJSON(bytes []byte) (err error) { } o.TotalCount = all.TotalCount o.TotalFilteredCount = all.TotalFilteredCount + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_widget_definition.go index 7edae8e6a..213dde0c6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -205,7 +206,6 @@ func (o SLOListWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOListWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Requests *[]SLOListWidgetRequest `json:"requests"` Title *string `json:"title,omitempty"` @@ -214,12 +214,7 @@ func (o *SLOListWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { Type *SLOListWidgetDefinitionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Requests == nil { return fmt.Errorf("required field requests missing") @@ -233,30 +228,29 @@ func (o *SLOListWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Requests = *all.Requests o.Title = all.Title - o.TitleAlign = all.TitleAlign + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } o.TitleSize = all.TitleSize - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_widget_definition_type.go index 8e337c000..feab27b58 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SLOListWidgetDefinitionType Type of the SLO List widget. @@ -61,47 +62,3 @@ func (v SLOListWidgetDefinitionType) IsValid() bool { func (v SLOListWidgetDefinitionType) Ptr() *SLOListWidgetDefinitionType { return &v } - -// NullableSLOListWidgetDefinitionType handles when a null is used for SLOListWidgetDefinitionType. -type NullableSLOListWidgetDefinitionType struct { - value *SLOListWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableSLOListWidgetDefinitionType) Get() *SLOListWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSLOListWidgetDefinitionType) Set(val *SLOListWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSLOListWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSLOListWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSLOListWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableSLOListWidgetDefinitionType(val *SLOListWidgetDefinitionType) *NullableSLOListWidgetDefinitionType { - return &NullableSLOListWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSLOListWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSLOListWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_widget_query.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_widget_query.go index 3e5d773ec..3111ef1c9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_widget_query.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_widget_query.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -147,19 +148,13 @@ func (o SLOListWidgetQuery) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOListWidgetQuery) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Limit *int64 `json:"limit,omitempty"` QueryString *string `json:"query_string"` Sort []WidgetFieldSort `json:"sort,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.QueryString == nil { return fmt.Errorf("required field query_string missing") @@ -173,6 +168,7 @@ func (o *SLOListWidgetQuery) UnmarshalJSON(bytes []byte) (err error) { o.Limit = all.Limit o.QueryString = *all.QueryString o.Sort = all.Sort + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_widget_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_widget_request.go index 9defd4501..4dae9687f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_widget_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_widget_request.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o SLOListWidgetRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOListWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Query *SLOListWidgetQuery `json:"query"` RequestType *SLOListWidgetRequestType `json:"request_type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Query == nil { return fmt.Errorf("required field query missing") @@ -129,26 +124,25 @@ func (o *SLOListWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.RequestType; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Query.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Query = *all.Query - o.RequestType = *all.RequestType + if !all.RequestType.IsValid() { + hasInvalidField = true + } else { + o.RequestType = *all.RequestType + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_widget_request_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_widget_request_type.go index 4a93ebf40..a1fbde102 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_widget_request_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_list_widget_request_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SLOListWidgetRequestType Widget request type. @@ -61,47 +62,3 @@ func (v SLOListWidgetRequestType) IsValid() bool { func (v SLOListWidgetRequestType) Ptr() *SLOListWidgetRequestType { return &v } - -// NullableSLOListWidgetRequestType handles when a null is used for SLOListWidgetRequestType. -type NullableSLOListWidgetRequestType struct { - value *SLOListWidgetRequestType - isSet bool -} - -// Get returns the associated value. -func (v NullableSLOListWidgetRequestType) Get() *SLOListWidgetRequestType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSLOListWidgetRequestType) Set(val *SLOListWidgetRequestType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSLOListWidgetRequestType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSLOListWidgetRequestType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSLOListWidgetRequestType initializes the struct as if Set has been called. -func NewNullableSLOListWidgetRequestType(val *SLOListWidgetRequestType) *NullableSLOListWidgetRequestType { - return &NullableSLOListWidgetRequestType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSLOListWidgetRequestType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSLOListWidgetRequestType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_overall_statuses.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_overall_statuses.go index 1f92c3b87..b426bde3d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_overall_statuses.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_overall_statuses.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -402,7 +402,6 @@ func (o SLOOverallStatuses) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOOverallStatuses) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Error datadog.NullableString `json:"error,omitempty"` ErrorBudgetRemaining datadog.NullableFloat64 `json:"error_budget_remaining,omitempty"` @@ -415,12 +414,7 @@ func (o *SLOOverallStatuses) UnmarshalJSON(bytes []byte) (err error) { Timeframe *SLOTimeframe `json:"timeframe,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -428,34 +422,33 @@ func (o *SLOOverallStatuses) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.State; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Timeframe; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Error = all.Error o.ErrorBudgetRemaining = all.ErrorBudgetRemaining o.IndexedAt = all.IndexedAt o.RawErrorBudgetRemaining = all.RawErrorBudgetRemaining o.SpanPrecision = all.SpanPrecision - o.State = all.State + if all.State != nil && !all.State.IsValid() { + hasInvalidField = true + } else { + o.State = all.State + } o.Status = all.Status o.Target = all.Target - o.Timeframe = all.Timeframe + if all.Timeframe != nil && !all.Timeframe.IsValid() { + hasInvalidField = true + } else { + o.Timeframe = all.Timeframe + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_raw_error_budget_remaining.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_raw_error_budget_remaining.go index 6b68b8b12..3eba7358b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_raw_error_budget_remaining.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_raw_error_budget_remaining.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SLORawErrorBudgetRemaining) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLORawErrorBudgetRemaining) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Unit *string `json:"unit,omitempty"` Value *float64 `json:"value,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *SLORawErrorBudgetRemaining) UnmarshalJSON(bytes []byte) (err error) { } o.Unit = all.Unit o.Value = all.Value + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_response.go index 18fddc880..465be5a72 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -117,18 +117,12 @@ func (o SLOResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SLOResponseData `json:"data,omitempty"` Errors []string `json:"errors,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,18 +130,21 @@ func (o *SLOResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data o.Errors = all.Errors + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_response_data.go index 0104b2e8f..bf0ec9af8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_response_data.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -650,7 +650,6 @@ func (o SLOResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ConfiguredAlertIds []int64 `json:"configured_alert_ids,omitempty"` CreatedAt *int64 `json:"created_at,omitempty"` @@ -671,12 +670,7 @@ func (o *SLOResponseData) UnmarshalJSON(bytes []byte) (err error) { WarningThreshold *float64 `json:"warning_threshold,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -684,30 +678,12 @@ func (o *SLOResponseData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Timeframe; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.ConfiguredAlertIds = all.ConfiguredAlertIds o.CreatedAt = all.CreatedAt if all.Creator != nil && all.Creator.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Creator = all.Creator o.Description = all.Description @@ -718,22 +694,31 @@ func (o *SLOResponseData) UnmarshalJSON(bytes []byte) (err error) { o.MonitorTags = all.MonitorTags o.Name = all.Name if all.Query != nil && all.Query.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Query = all.Query o.Tags = all.Tags o.TargetThreshold = all.TargetThreshold o.Thresholds = all.Thresholds - o.Timeframe = all.Timeframe - o.Type = all.Type + if all.Timeframe != nil && !all.Timeframe.IsValid() { + hasInvalidField = true + } else { + o.Timeframe = all.Timeframe + } + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } o.WarningThreshold = all.WarningThreshold + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_state.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_state.go index adec3a299..656c69383 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_state.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_state.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SLOState State of the SLO. @@ -67,47 +68,3 @@ func (v SLOState) IsValid() bool { func (v SLOState) Ptr() *SLOState { return &v } - -// NullableSLOState handles when a null is used for SLOState. -type NullableSLOState struct { - value *SLOState - isSet bool -} - -// Get returns the associated value. -func (v NullableSLOState) Get() *SLOState { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSLOState) Set(val *SLOState) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSLOState) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSLOState) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSLOState initializes the struct as if Set has been called. -func NewNullableSLOState(val *SLOState) *NullableSLOState { - return &NullableSLOState{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSLOState) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSLOState) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_status.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_status.go index b63cb9037..2387025a1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_status.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_status.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -336,7 +336,6 @@ func (o SLOStatus) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOStatus) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CalculationError datadog.NullableString `json:"calculation_error,omitempty"` ErrorBudgetRemaining datadog.NullableFloat64 `json:"error_budget_remaining,omitempty"` @@ -347,12 +346,7 @@ func (o *SLOStatus) UnmarshalJSON(bytes []byte) (err error) { State *SLOState `json:"state,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -360,24 +354,27 @@ func (o *SLOStatus) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.State; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.CalculationError = all.CalculationError o.ErrorBudgetRemaining = all.ErrorBudgetRemaining o.IndexedAt = all.IndexedAt o.RawErrorBudgetRemaining = all.RawErrorBudgetRemaining o.Sli = all.Sli o.SpanPrecision = all.SpanPrecision - o.State = all.State + if all.State != nil && !all.State.IsValid() { + hasInvalidField = true + } else { + o.State = all.State + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_threshold.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_threshold.go index 92af86393..91775a62d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_threshold.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_threshold.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -212,7 +213,6 @@ func (o SLOThreshold) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOThreshold) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Target *float64 `json:"target"` TargetDisplay *string `json:"target_display,omitempty"` @@ -221,12 +221,7 @@ func (o *SLOThreshold) UnmarshalJSON(bytes []byte) (err error) { WarningDisplay *string `json:"warning_display,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Target == nil { return fmt.Errorf("required field target missing") @@ -240,22 +235,25 @@ func (o *SLOThreshold) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Timeframe; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Target = *all.Target o.TargetDisplay = all.TargetDisplay - o.Timeframe = *all.Timeframe + if !all.Timeframe.IsValid() { + hasInvalidField = true + } else { + o.Timeframe = *all.Timeframe + } o.Warning = all.Warning o.WarningDisplay = all.WarningDisplay + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_timeframe.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_timeframe.go index 23b337f69..60277d67f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_timeframe.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_timeframe.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SLOTimeframe The SLO time window options. @@ -67,47 +68,3 @@ func (v SLOTimeframe) IsValid() bool { func (v SLOTimeframe) Ptr() *SLOTimeframe { return &v } - -// NullableSLOTimeframe handles when a null is used for SLOTimeframe. -type NullableSLOTimeframe struct { - value *SLOTimeframe - isSet bool -} - -// Get returns the associated value. -func (v NullableSLOTimeframe) Get() *SLOTimeframe { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSLOTimeframe) Set(val *SLOTimeframe) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSLOTimeframe) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSLOTimeframe) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSLOTimeframe initializes the struct as if Set has been called. -func NewNullableSLOTimeframe(val *SLOTimeframe) *NullableSLOTimeframe { - return &NullableSLOTimeframe{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSLOTimeframe) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSLOTimeframe) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_type.go index 4e77081c6..48e851a38 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SLOType The type of the service level objective. @@ -63,47 +64,3 @@ func (v SLOType) IsValid() bool { func (v SLOType) Ptr() *SLOType { return &v } - -// NullableSLOType handles when a null is used for SLOType. -type NullableSLOType struct { - value *SLOType - isSet bool -} - -// Get returns the associated value. -func (v NullableSLOType) Get() *SLOType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSLOType) Set(val *SLOType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSLOType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSLOType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSLOType initializes the struct as if Set has been called. -func NewNullableSLOType(val *SLOType) *NullableSLOType { - return &NullableSLOType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSLOType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSLOType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_type_numeric.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_type_numeric.go index 77c22b779..eda0c8067 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_type_numeric.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_type_numeric.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SLOTypeNumeric A numeric representation of the type of the service level objective (`0` for @@ -65,47 +66,3 @@ func (v SLOTypeNumeric) IsValid() bool { func (v SLOTypeNumeric) Ptr() *SLOTypeNumeric { return &v } - -// NullableSLOTypeNumeric handles when a null is used for SLOTypeNumeric. -type NullableSLOTypeNumeric struct { - value *SLOTypeNumeric - isSet bool -} - -// Get returns the associated value. -func (v NullableSLOTypeNumeric) Get() *SLOTypeNumeric { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSLOTypeNumeric) Set(val *SLOTypeNumeric) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSLOTypeNumeric) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSLOTypeNumeric) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSLOTypeNumeric initializes the struct as if Set has been called. -func NewNullableSLOTypeNumeric(val *SLOTypeNumeric) *NullableSLOTypeNumeric { - return &NullableSLOTypeNumeric{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSLOTypeNumeric) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSLOTypeNumeric) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_widget_definition.go index 0adbce34b..3f9ed3dfd 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -405,7 +406,6 @@ func (o SLOWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AdditionalQueryFilters *string `json:"additional_query_filters,omitempty"` GlobalTimeTarget *string `json:"global_time_target,omitempty"` @@ -420,12 +420,7 @@ func (o *SLOWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { ViewType *string `json:"view_type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -439,44 +434,39 @@ func (o *SLOWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ViewMode; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.AdditionalQueryFilters = all.AdditionalQueryFilters o.GlobalTimeTarget = all.GlobalTimeTarget o.ShowErrorBudget = all.ShowErrorBudget o.SloId = all.SloId o.TimeWindows = all.TimeWindows o.Title = all.Title - o.TitleAlign = all.TitleAlign + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } o.TitleSize = all.TitleSize - o.Type = *all.Type - o.ViewMode = all.ViewMode + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if all.ViewMode != nil && !all.ViewMode.IsValid() { + hasInvalidField = true + } else { + o.ViewMode = all.ViewMode + } o.ViewType = *all.ViewType + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_widget_definition_type.go index c4d33131a..6ec3e24db 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_slo_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SLOWidgetDefinitionType Type of the SLO widget. @@ -61,47 +62,3 @@ func (v SLOWidgetDefinitionType) IsValid() bool { func (v SLOWidgetDefinitionType) Ptr() *SLOWidgetDefinitionType { return &v } - -// NullableSLOWidgetDefinitionType handles when a null is used for SLOWidgetDefinitionType. -type NullableSLOWidgetDefinitionType struct { - value *SLOWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableSLOWidgetDefinitionType) Get() *SLOWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSLOWidgetDefinitionType) Set(val *SLOWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSLOWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSLOWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSLOWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableSLOWidgetDefinitionType(val *SLOWidgetDefinitionType) *NullableSLOWidgetDefinitionType { - return &NullableSLOWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSLOWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSLOWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_successful_signal_update_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_successful_signal_update_response.go index c413694cf..10867cc63 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_successful_signal_update_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_successful_signal_update_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SuccessfulSignalUpdateResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SuccessfulSignalUpdateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Status *string `json:"status,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *SuccessfulSignalUpdateResponse) UnmarshalJSON(bytes []byte) (err error) return err } o.Status = all.Status + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_definition.go index 9334fd449..8d8eb38e4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -337,7 +338,6 @@ func (o SunburstWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SunburstWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` HideTotal *bool `json:"hide_total,omitempty"` @@ -350,12 +350,7 @@ func (o *SunburstWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { Type *SunburstWidgetDefinitionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Requests == nil { return fmt.Errorf("required field requests missing") @@ -369,41 +364,36 @@ func (o *SunburstWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.CustomLinks = all.CustomLinks o.HideTotal = all.HideTotal o.Legend = all.Legend o.Requests = *all.Requests if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Time = all.Time o.Title = all.Title - o.TitleAlign = all.TitleAlign + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } o.TitleSize = all.TitleSize - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_definition_type.go index 24b92ad11..881a9b3f8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SunburstWidgetDefinitionType Type of the Sunburst widget. @@ -61,47 +62,3 @@ func (v SunburstWidgetDefinitionType) IsValid() bool { func (v SunburstWidgetDefinitionType) Ptr() *SunburstWidgetDefinitionType { return &v } - -// NullableSunburstWidgetDefinitionType handles when a null is used for SunburstWidgetDefinitionType. -type NullableSunburstWidgetDefinitionType struct { - value *SunburstWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableSunburstWidgetDefinitionType) Get() *SunburstWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSunburstWidgetDefinitionType) Set(val *SunburstWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSunburstWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSunburstWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSunburstWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableSunburstWidgetDefinitionType(val *SunburstWidgetDefinitionType) *NullableSunburstWidgetDefinitionType { - return &NullableSunburstWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSunburstWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSunburstWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_legend.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_legend.go index 8610470e6..05cea08e5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_legend.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_legend.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" ) // SunburstWidgetLegend - Configuration of the legend. @@ -103,53 +103,3 @@ func (obj *SunburstWidgetLegend) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableSunburstWidgetLegend handles when a null is used for SunburstWidgetLegend. -type NullableSunburstWidgetLegend struct { - value *SunburstWidgetLegend - isSet bool -} - -// Get returns the associated value. -func (v NullableSunburstWidgetLegend) Get() *SunburstWidgetLegend { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSunburstWidgetLegend) Set(val *SunburstWidgetLegend) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSunburstWidgetLegend) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableSunburstWidgetLegend) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSunburstWidgetLegend initializes the struct as if Set has been called. -func NewNullableSunburstWidgetLegend(val *SunburstWidgetLegend) *NullableSunburstWidgetLegend { - return &NullableSunburstWidgetLegend{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSunburstWidgetLegend) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSunburstWidgetLegend) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_legend_inline_automatic.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_legend_inline_automatic.go index 43372e27a..aec6290d9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_legend_inline_automatic.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_legend_inline_automatic.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -143,19 +144,13 @@ func (o SunburstWidgetLegendInlineAutomatic) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SunburstWidgetLegendInlineAutomatic) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { HidePercent *bool `json:"hide_percent,omitempty"` HideValue *bool `json:"hide_value,omitempty"` Type *SunburstWidgetLegendInlineAutomaticType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -166,20 +161,23 @@ func (o *SunburstWidgetLegendInlineAutomatic) UnmarshalJSON(bytes []byte) (err e } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.HidePercent = all.HidePercent o.HideValue = all.HideValue - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_legend_inline_automatic_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_legend_inline_automatic_type.go index fa876cf1f..fc1c3cbca 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_legend_inline_automatic_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_legend_inline_automatic_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SunburstWidgetLegendInlineAutomaticType Whether to show the legend inline or let it be automatically generated. @@ -63,47 +64,3 @@ func (v SunburstWidgetLegendInlineAutomaticType) IsValid() bool { func (v SunburstWidgetLegendInlineAutomaticType) Ptr() *SunburstWidgetLegendInlineAutomaticType { return &v } - -// NullableSunburstWidgetLegendInlineAutomaticType handles when a null is used for SunburstWidgetLegendInlineAutomaticType. -type NullableSunburstWidgetLegendInlineAutomaticType struct { - value *SunburstWidgetLegendInlineAutomaticType - isSet bool -} - -// Get returns the associated value. -func (v NullableSunburstWidgetLegendInlineAutomaticType) Get() *SunburstWidgetLegendInlineAutomaticType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSunburstWidgetLegendInlineAutomaticType) Set(val *SunburstWidgetLegendInlineAutomaticType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSunburstWidgetLegendInlineAutomaticType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSunburstWidgetLegendInlineAutomaticType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSunburstWidgetLegendInlineAutomaticType initializes the struct as if Set has been called. -func NewNullableSunburstWidgetLegendInlineAutomaticType(val *SunburstWidgetLegendInlineAutomaticType) *NullableSunburstWidgetLegendInlineAutomaticType { - return &NullableSunburstWidgetLegendInlineAutomaticType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSunburstWidgetLegendInlineAutomaticType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSunburstWidgetLegendInlineAutomaticType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_legend_table.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_legend_table.go index 0d499c52c..5b9c55ee2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_legend_table.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_legend_table.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o SunburstWidgetLegendTable) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SunburstWidgetLegendTable) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Type *SunburstWidgetLegendTableType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -98,18 +93,21 @@ func (o *SunburstWidgetLegendTable) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type } - o.Type = *all.Type + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_legend_table_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_legend_table_type.go index 0bbe7f102..2f9136d3c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_legend_table_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_legend_table_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SunburstWidgetLegendTableType Whether or not to show a table legend. @@ -63,47 +64,3 @@ func (v SunburstWidgetLegendTableType) IsValid() bool { func (v SunburstWidgetLegendTableType) Ptr() *SunburstWidgetLegendTableType { return &v } - -// NullableSunburstWidgetLegendTableType handles when a null is used for SunburstWidgetLegendTableType. -type NullableSunburstWidgetLegendTableType struct { - value *SunburstWidgetLegendTableType - isSet bool -} - -// Get returns the associated value. -func (v NullableSunburstWidgetLegendTableType) Get() *SunburstWidgetLegendTableType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSunburstWidgetLegendTableType) Set(val *SunburstWidgetLegendTableType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSunburstWidgetLegendTableType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSunburstWidgetLegendTableType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSunburstWidgetLegendTableType initializes the struct as if Set has been called. -func NewNullableSunburstWidgetLegendTableType(val *SunburstWidgetLegendTableType) *NullableSunburstWidgetLegendTableType { - return &NullableSunburstWidgetLegendTableType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSunburstWidgetLegendTableType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSunburstWidgetLegendTableType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_request.go index c20f9bb36..a24237fce 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_sunburst_widget_request.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -32,7 +32,7 @@ type SunburstWidgetRequest struct { Q *string `json:"q,omitempty"` // List of queries that can be returned directly or used in formulas. Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - // Timeseries or Scalar response. + // Timeseries, scalar, or event list response. Event list response formats are supported by Geomap widgets. ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` // The log query. RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` @@ -478,7 +478,6 @@ func (o SunburstWidgetRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SunburstWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` AuditQuery *LogQueryDefinition `json:"audit_query,omitempty"` @@ -495,12 +494,7 @@ func (o *SunburstWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -508,93 +502,60 @@ func (o *SunburstWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.ResponseFormat; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ApmQuery = all.ApmQuery if all.AuditQuery != nil && all.AuditQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.AuditQuery = all.AuditQuery if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.EventQuery = all.EventQuery o.Formulas = all.Formulas if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LogQuery = all.LogQuery if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.NetworkQuery = all.NetworkQuery if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ProcessQuery = all.ProcessQuery if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ProfileMetricsQuery = all.ProfileMetricsQuery o.Q = all.Q o.Queries = all.Queries - o.ResponseFormat = all.ResponseFormat + if all.ResponseFormat != nil && !all.ResponseFormat.IsValid() { + hasInvalidField = true + } else { + o.ResponseFormat = all.ResponseFormat + } if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.RumQuery = all.RumQuery if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.SecurityQuery = all.SecurityQuery + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_step.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_step.go index 225d93e50..1cc67c4c5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_step.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_step.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -291,7 +292,6 @@ func (o SyntheticsAPIStep) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsAPIStep) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AllowFailure *bool `json:"allowFailure,omitempty"` Assertions *[]SyntheticsAssertion `json:"assertions"` @@ -303,12 +303,7 @@ func (o *SyntheticsAPIStep) UnmarshalJSON(bytes []byte) (err error) { Subtype *SyntheticsAPIStepSubtype `json:"subtype"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Assertions == nil { return fmt.Errorf("required field assertions missing") @@ -328,39 +323,34 @@ func (o *SyntheticsAPIStep) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Subtype; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.AllowFailure = all.AllowFailure o.Assertions = *all.Assertions o.ExtractedValues = all.ExtractedValues o.IsCritical = all.IsCritical o.Name = *all.Name if all.Request.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Request = *all.Request if all.Retry != nil && all.Retry.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Retry = all.Retry - o.Subtype = *all.Subtype + if !all.Subtype.IsValid() { + hasInvalidField = true + } else { + o.Subtype = *all.Subtype + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_step_subtype.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_step_subtype.go index 05bbb640f..4e0fd694b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_step_subtype.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_step_subtype.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsAPIStepSubtype The subtype of the Synthetic multistep API test step, currently only supporting `http`. @@ -61,47 +62,3 @@ func (v SyntheticsAPIStepSubtype) IsValid() bool { func (v SyntheticsAPIStepSubtype) Ptr() *SyntheticsAPIStepSubtype { return &v } - -// NullableSyntheticsAPIStepSubtype handles when a null is used for SyntheticsAPIStepSubtype. -type NullableSyntheticsAPIStepSubtype struct { - value *SyntheticsAPIStepSubtype - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsAPIStepSubtype) Get() *SyntheticsAPIStepSubtype { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsAPIStepSubtype) Set(val *SyntheticsAPIStepSubtype) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsAPIStepSubtype) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsAPIStepSubtype) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsAPIStepSubtype initializes the struct as if Set has been called. -func NewNullableSyntheticsAPIStepSubtype(val *SyntheticsAPIStepSubtype) *NullableSyntheticsAPIStepSubtype { - return &NullableSyntheticsAPIStepSubtype{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsAPIStepSubtype) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsAPIStepSubtype) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_.go index 4993f95f2..e66d67b67 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -381,7 +382,6 @@ func (o SyntheticsAPITest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsAPITest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Config *SyntheticsAPITestConfig `json:"config"` Locations *[]string `json:"locations"` @@ -396,12 +396,7 @@ func (o *SyntheticsAPITest) UnmarshalJSON(bytes []byte) (err error) { Type *SyntheticsAPITestType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Config == nil { return fmt.Errorf("required field config missing") @@ -427,36 +422,10 @@ func (o *SyntheticsAPITest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Subtype; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Config.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Config = *all.Config o.Locations = *all.Locations @@ -464,21 +433,34 @@ func (o *SyntheticsAPITest) UnmarshalJSON(bytes []byte) (err error) { o.MonitorId = all.MonitorId o.Name = *all.Name if all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Options = *all.Options o.PublicId = all.PublicId - o.Status = all.Status - o.Subtype = all.Subtype + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } + if all.Subtype != nil && !all.Subtype.IsValid() { + hasInvalidField = true + } else { + o.Subtype = all.Subtype + } o.Tags = all.Tags - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_config.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_config.go index 78772b111..79310e343 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_config.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_config.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -181,7 +181,6 @@ func (o SyntheticsAPITestConfig) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsAPITestConfig) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Assertions []SyntheticsAssertion `json:"assertions,omitempty"` ConfigVariables []SyntheticsConfigVariable `json:"configVariables,omitempty"` @@ -189,12 +188,7 @@ func (o *SyntheticsAPITestConfig) UnmarshalJSON(bytes []byte) (err error) { Steps []SyntheticsAPIStep `json:"steps,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -202,20 +196,23 @@ func (o *SyntheticsAPITestConfig) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Assertions = all.Assertions o.ConfigVariables = all.ConfigVariables if all.Request != nil && all.Request.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Request = all.Request o.Steps = all.Steps + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_failure_code.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_failure_code.go index 54407b4c5..1d9c2ed91 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_failure_code.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_failure_code.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsApiTestFailureCode Error code that can be returned by a Synthetic test. @@ -111,47 +112,3 @@ func (v SyntheticsApiTestFailureCode) IsValid() bool { func (v SyntheticsApiTestFailureCode) Ptr() *SyntheticsApiTestFailureCode { return &v } - -// NullableSyntheticsApiTestFailureCode handles when a null is used for SyntheticsApiTestFailureCode. -type NullableSyntheticsApiTestFailureCode struct { - value *SyntheticsApiTestFailureCode - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsApiTestFailureCode) Get() *SyntheticsApiTestFailureCode { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsApiTestFailureCode) Set(val *SyntheticsApiTestFailureCode) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsApiTestFailureCode) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsApiTestFailureCode) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsApiTestFailureCode initializes the struct as if Set has been called. -func NewNullableSyntheticsApiTestFailureCode(val *SyntheticsApiTestFailureCode) *NullableSyntheticsApiTestFailureCode { - return &NullableSyntheticsApiTestFailureCode{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsApiTestFailureCode) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsApiTestFailureCode) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_result_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_result_data.go index fa4c97a66..48ccf898c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_result_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_result_data.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -347,7 +347,6 @@ func (o SyntheticsAPITestResultData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsAPITestResultData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Cert *SyntheticsSSLCertificate `json:"cert,omitempty"` EventType *SyntheticsTestProcessStatus `json:"eventType,omitempty"` @@ -360,12 +359,7 @@ func (o *SyntheticsAPITestResultData) UnmarshalJSON(bytes []byte) (err error) { Timings *SyntheticsTiming `json:"timings,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -373,29 +367,19 @@ func (o *SyntheticsAPITestResultData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.EventType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Cert != nil && all.Cert.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Cert = all.Cert - o.EventType = all.EventType + if all.EventType != nil && !all.EventType.IsValid() { + hasInvalidField = true + } else { + o.EventType = all.EventType + } if all.Failure != nil && all.Failure.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Failure = all.Failure o.HttpStatusCode = all.HttpStatusCode @@ -404,16 +388,17 @@ func (o *SyntheticsAPITestResultData) UnmarshalJSON(bytes []byte) (err error) { o.ResponseHeaders = all.ResponseHeaders o.ResponseSize = all.ResponseSize if all.Timings != nil && all.Timings.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Timings = all.Timings + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_result_failure.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_result_failure.go index ca0c1ebd3..b470bb1e8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_result_failure.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_result_failure.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SyntheticsApiTestResultFailure) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsApiTestResultFailure) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Code *SyntheticsApiTestFailureCode `json:"code,omitempty"` Message *string `json:"message,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,19 +128,22 @@ func (o *SyntheticsApiTestResultFailure) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.Code; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.Code != nil && !all.Code.IsValid() { + hasInvalidField = true + } else { + o.Code = all.Code } - o.Code = all.Code o.Message = all.Message + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_result_full.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_result_full.go index 036fada7c..46d00c8bf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_result_full.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_result_full.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -283,7 +283,6 @@ func (o SyntheticsAPITestResultFull) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsAPITestResultFull) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Check *SyntheticsAPITestResultFullCheck `json:"check,omitempty"` CheckTime *float64 `json:"check_time,omitempty"` @@ -294,12 +293,7 @@ func (o *SyntheticsAPITestResultFull) UnmarshalJSON(bytes []byte) (err error) { Status *SyntheticsTestMonitorStatus `json:"status,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -307,38 +301,33 @@ func (o *SyntheticsAPITestResultFull) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Check != nil && all.Check.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Check = all.Check o.CheckTime = all.CheckTime o.CheckVersion = all.CheckVersion o.ProbeDc = all.ProbeDc if all.Result != nil && all.Result.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Result = all.Result o.ResultId = all.ResultId - o.Status = all.Status + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_result_full_check.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_result_full_check.go index f71e695c1..7e293adea 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_result_full_check.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_result_full_check.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o SyntheticsAPITestResultFullCheck) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsAPITestResultFullCheck) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Config *SyntheticsTestConfig `json:"config"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Config == nil { return fmt.Errorf("required field config missing") @@ -98,17 +93,20 @@ func (o *SyntheticsAPITestResultFullCheck) UnmarshalJSON(bytes []byte) (err erro } else { return err } + + hasInvalidField := false if all.Config.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Config = *all.Config + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_result_short.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_result_short.go index 6e8282a7e..0eadf719e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_result_short.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_result_short.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -217,7 +217,6 @@ func (o SyntheticsAPITestResultShort) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsAPITestResultShort) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CheckTime *float64 `json:"check_time,omitempty"` ProbeDc *string `json:"probe_dc,omitempty"` @@ -226,12 +225,7 @@ func (o *SyntheticsAPITestResultShort) UnmarshalJSON(bytes []byte) (err error) { Status *SyntheticsTestMonitorStatus `json:"status,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -239,29 +233,28 @@ func (o *SyntheticsAPITestResultShort) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.CheckTime = all.CheckTime o.ProbeDc = all.ProbeDc if all.Result != nil && all.Result.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Result = all.Result o.ResultId = all.ResultId - o.Status = all.Status + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_result_short_result.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_result_short_result.go index 4fd4ed47b..ceea03656 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_result_short_result.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_result_short_result.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -116,18 +116,12 @@ func (o SyntheticsAPITestResultShortResult) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsAPITestResultShortResult) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Passed *bool `json:"passed,omitempty"` Timings *SyntheticsTiming `json:"timings,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -135,18 +129,21 @@ func (o *SyntheticsAPITestResultShortResult) UnmarshalJSON(bytes []byte) (err er } else { return err } + + hasInvalidField := false o.Passed = all.Passed if all.Timings != nil && all.Timings.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Timings = all.Timings + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_type.go index 47135f3b9..4eec30788 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_api_test_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsAPITestType Type of the Synthetic test, `api`. @@ -61,47 +62,3 @@ func (v SyntheticsAPITestType) IsValid() bool { func (v SyntheticsAPITestType) Ptr() *SyntheticsAPITestType { return &v } - -// NullableSyntheticsAPITestType handles when a null is used for SyntheticsAPITestType. -type NullableSyntheticsAPITestType struct { - value *SyntheticsAPITestType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsAPITestType) Get() *SyntheticsAPITestType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsAPITestType) Set(val *SyntheticsAPITestType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsAPITestType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsAPITestType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsAPITestType initializes the struct as if Set has been called. -func NewNullableSyntheticsAPITestType(val *SyntheticsAPITestType) *NullableSyntheticsAPITestType { - return &NullableSyntheticsAPITestType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsAPITestType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsAPITestType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion.go index 8fa59f82b..6161e1a7a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" ) // SyntheticsAssertion - Object describing the assertions type, their associated operator, @@ -136,53 +136,3 @@ func (obj *SyntheticsAssertion) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableSyntheticsAssertion handles when a null is used for SyntheticsAssertion. -type NullableSyntheticsAssertion struct { - value *SyntheticsAssertion - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsAssertion) Get() *SyntheticsAssertion { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsAssertion) Set(val *SyntheticsAssertion) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsAssertion) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableSyntheticsAssertion) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsAssertion initializes the struct as if Set has been called. -func NewNullableSyntheticsAssertion(val *SyntheticsAssertion) *NullableSyntheticsAssertion { - return &NullableSyntheticsAssertion{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsAssertion) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsAssertion) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_json_path_operator.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_json_path_operator.go index e501cfcd8..9870f2165 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_json_path_operator.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_json_path_operator.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsAssertionJSONPathOperator Assertion operator to apply. @@ -61,47 +62,3 @@ func (v SyntheticsAssertionJSONPathOperator) IsValid() bool { func (v SyntheticsAssertionJSONPathOperator) Ptr() *SyntheticsAssertionJSONPathOperator { return &v } - -// NullableSyntheticsAssertionJSONPathOperator handles when a null is used for SyntheticsAssertionJSONPathOperator. -type NullableSyntheticsAssertionJSONPathOperator struct { - value *SyntheticsAssertionJSONPathOperator - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsAssertionJSONPathOperator) Get() *SyntheticsAssertionJSONPathOperator { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsAssertionJSONPathOperator) Set(val *SyntheticsAssertionJSONPathOperator) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsAssertionJSONPathOperator) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsAssertionJSONPathOperator) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsAssertionJSONPathOperator initializes the struct as if Set has been called. -func NewNullableSyntheticsAssertionJSONPathOperator(val *SyntheticsAssertionJSONPathOperator) *NullableSyntheticsAssertionJSONPathOperator { - return &NullableSyntheticsAssertionJSONPathOperator{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsAssertionJSONPathOperator) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsAssertionJSONPathOperator) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_json_path_target.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_json_path_target.go index 77af422fc..a596284d8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_json_path_target.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_json_path_target.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -170,7 +171,6 @@ func (o SyntheticsAssertionJSONPathTarget) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsAssertionJSONPathTarget) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Operator *SyntheticsAssertionJSONPathOperator `json:"operator"` Property *string `json:"property,omitempty"` @@ -178,12 +178,7 @@ func (o *SyntheticsAssertionJSONPathTarget) UnmarshalJSON(bytes []byte) (err err Type *SyntheticsAssertionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Operator == nil { return fmt.Errorf("required field operator missing") @@ -197,36 +192,31 @@ func (o *SyntheticsAssertionJSONPathTarget) UnmarshalJSON(bytes []byte) (err err } else { return err } - if v := all.Operator; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Operator = *all.Operator + + hasInvalidField := false + if !all.Operator.IsValid() { + hasInvalidField = true + } else { + o.Operator = *all.Operator + } o.Property = all.Property if all.Target != nil && all.Target.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Target = all.Target - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_json_path_target_target.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_json_path_target_target.go index c79f6c0c0..7653a6a39 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_json_path_target_target.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_json_path_target_target.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o SyntheticsAssertionJSONPathTargetTarget) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsAssertionJSONPathTargetTarget) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { JsonPath *string `json:"jsonPath,omitempty"` Operator *string `json:"operator,omitempty"` TargetValue interface{} `json:"targetValue,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *SyntheticsAssertionJSONPathTargetTarget) UnmarshalJSON(bytes []byte) (e o.JsonPath = all.JsonPath o.Operator = all.Operator o.TargetValue = all.TargetValue + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_operator.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_operator.go index 366cb50f9..e8b8742f8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_operator.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_operator.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsAssertionOperator Assertion operator to apply. @@ -89,47 +90,3 @@ func (v SyntheticsAssertionOperator) IsValid() bool { func (v SyntheticsAssertionOperator) Ptr() *SyntheticsAssertionOperator { return &v } - -// NullableSyntheticsAssertionOperator handles when a null is used for SyntheticsAssertionOperator. -type NullableSyntheticsAssertionOperator struct { - value *SyntheticsAssertionOperator - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsAssertionOperator) Get() *SyntheticsAssertionOperator { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsAssertionOperator) Set(val *SyntheticsAssertionOperator) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsAssertionOperator) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsAssertionOperator) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsAssertionOperator initializes the struct as if Set has been called. -func NewNullableSyntheticsAssertionOperator(val *SyntheticsAssertionOperator) *NullableSyntheticsAssertionOperator { - return &NullableSyntheticsAssertionOperator{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsAssertionOperator) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsAssertionOperator) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_target.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_target.go index c5186c8fc..1eeed5d32 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_target.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_target.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -164,7 +165,6 @@ func (o SyntheticsAssertionTarget) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsAssertionTarget) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Operator *SyntheticsAssertionOperator `json:"operator"` Property *string `json:"property,omitempty"` @@ -172,12 +172,7 @@ func (o *SyntheticsAssertionTarget) UnmarshalJSON(bytes []byte) (err error) { Type *SyntheticsAssertionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Operator == nil { return fmt.Errorf("required field operator missing") @@ -194,29 +189,28 @@ func (o *SyntheticsAssertionTarget) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Operator; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Operator = *all.Operator + + hasInvalidField := false + if !all.Operator.IsValid() { + hasInvalidField = true + } else { + o.Operator = *all.Operator + } o.Property = all.Property o.Target = *all.Target - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_type.go index a5717333c..fadf9d250 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsAssertionType Type of the assertion. @@ -97,47 +98,3 @@ func (v SyntheticsAssertionType) IsValid() bool { func (v SyntheticsAssertionType) Ptr() *SyntheticsAssertionType { return &v } - -// NullableSyntheticsAssertionType handles when a null is used for SyntheticsAssertionType. -type NullableSyntheticsAssertionType struct { - value *SyntheticsAssertionType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsAssertionType) Get() *SyntheticsAssertionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsAssertionType) Set(val *SyntheticsAssertionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsAssertionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsAssertionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsAssertionType initializes the struct as if Set has been called. -func NewNullableSyntheticsAssertionType(val *SyntheticsAssertionType) *NullableSyntheticsAssertionType { - return &NullableSyntheticsAssertionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsAssertionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsAssertionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_x_path_operator.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_x_path_operator.go index 10bbaa42d..e1498554c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_x_path_operator.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_x_path_operator.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsAssertionXPathOperator Assertion operator to apply. @@ -61,47 +62,3 @@ func (v SyntheticsAssertionXPathOperator) IsValid() bool { func (v SyntheticsAssertionXPathOperator) Ptr() *SyntheticsAssertionXPathOperator { return &v } - -// NullableSyntheticsAssertionXPathOperator handles when a null is used for SyntheticsAssertionXPathOperator. -type NullableSyntheticsAssertionXPathOperator struct { - value *SyntheticsAssertionXPathOperator - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsAssertionXPathOperator) Get() *SyntheticsAssertionXPathOperator { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsAssertionXPathOperator) Set(val *SyntheticsAssertionXPathOperator) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsAssertionXPathOperator) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsAssertionXPathOperator) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsAssertionXPathOperator initializes the struct as if Set has been called. -func NewNullableSyntheticsAssertionXPathOperator(val *SyntheticsAssertionXPathOperator) *NullableSyntheticsAssertionXPathOperator { - return &NullableSyntheticsAssertionXPathOperator{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsAssertionXPathOperator) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsAssertionXPathOperator) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_x_path_target.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_x_path_target.go index fdc50aa28..8a548bef6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_x_path_target.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_x_path_target.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -170,7 +171,6 @@ func (o SyntheticsAssertionXPathTarget) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsAssertionXPathTarget) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Operator *SyntheticsAssertionXPathOperator `json:"operator"` Property *string `json:"property,omitempty"` @@ -178,12 +178,7 @@ func (o *SyntheticsAssertionXPathTarget) UnmarshalJSON(bytes []byte) (err error) Type *SyntheticsAssertionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Operator == nil { return fmt.Errorf("required field operator missing") @@ -197,36 +192,31 @@ func (o *SyntheticsAssertionXPathTarget) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.Operator; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Operator = *all.Operator + + hasInvalidField := false + if !all.Operator.IsValid() { + hasInvalidField = true + } else { + o.Operator = *all.Operator + } o.Property = all.Property if all.Target != nil && all.Target.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Target = all.Target - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_x_path_target_target.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_x_path_target_target.go index de05855ea..5469034ac 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_x_path_target_target.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_assertion_x_path_target_target.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o SyntheticsAssertionXPathTargetTarget) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsAssertionXPathTargetTarget) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Operator *string `json:"operator,omitempty"` TargetValue interface{} `json:"targetValue,omitempty"` XPath *string `json:"xPath,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *SyntheticsAssertionXPathTargetTarget) UnmarshalJSON(bytes []byte) (err o.Operator = all.Operator o.TargetValue = all.TargetValue o.XPath = all.XPath + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth.go index 3172e9729..0ff50dd21 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" ) // SyntheticsBasicAuth - Object to handle basic authentication when performing the test. @@ -231,53 +231,3 @@ func (obj *SyntheticsBasicAuth) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableSyntheticsBasicAuth handles when a null is used for SyntheticsBasicAuth. -type NullableSyntheticsBasicAuth struct { - value *SyntheticsBasicAuth - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsBasicAuth) Get() *SyntheticsBasicAuth { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsBasicAuth) Set(val *SyntheticsBasicAuth) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsBasicAuth) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableSyntheticsBasicAuth) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsBasicAuth initializes the struct as if Set has been called. -func NewNullableSyntheticsBasicAuth(val *SyntheticsBasicAuth) *NullableSyntheticsBasicAuth { - return &NullableSyntheticsBasicAuth{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsBasicAuth) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsBasicAuth) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_digest.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_digest.go index ec25aa4a0..af5a38bd4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_digest.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_digest.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -141,19 +142,13 @@ func (o SyntheticsBasicAuthDigest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBasicAuthDigest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Password *string `json:"password"` Type *SyntheticsBasicAuthDigestType `json:"type,omitempty"` Username *string `json:"username"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Password == nil { return fmt.Errorf("required field password missing") @@ -167,20 +162,23 @@ func (o *SyntheticsBasicAuthDigest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Password = *all.Password - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } o.Username = *all.Username + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_digest_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_digest_type.go index 53f6a59df..1fdb8fd28 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_digest_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_digest_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsBasicAuthDigestType The type of basic authentication to use when performing the test. @@ -61,47 +62,3 @@ func (v SyntheticsBasicAuthDigestType) IsValid() bool { func (v SyntheticsBasicAuthDigestType) Ptr() *SyntheticsBasicAuthDigestType { return &v } - -// NullableSyntheticsBasicAuthDigestType handles when a null is used for SyntheticsBasicAuthDigestType. -type NullableSyntheticsBasicAuthDigestType struct { - value *SyntheticsBasicAuthDigestType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsBasicAuthDigestType) Get() *SyntheticsBasicAuthDigestType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsBasicAuthDigestType) Set(val *SyntheticsBasicAuthDigestType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsBasicAuthDigestType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsBasicAuthDigestType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsBasicAuthDigestType initializes the struct as if Set has been called. -func NewNullableSyntheticsBasicAuthDigestType(val *SyntheticsBasicAuthDigestType) *NullableSyntheticsBasicAuthDigestType { - return &NullableSyntheticsBasicAuthDigestType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsBasicAuthDigestType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsBasicAuthDigestType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_ntlm.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_ntlm.go index 950aaf423..8a9dd8b74 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_ntlm.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_ntlm.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -211,7 +212,6 @@ func (o SyntheticsBasicAuthNTLM) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBasicAuthNTLM) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Domain *string `json:"domain,omitempty"` Password *string `json:"password,omitempty"` @@ -220,12 +220,7 @@ func (o *SyntheticsBasicAuthNTLM) UnmarshalJSON(bytes []byte) (err error) { Workstation *string `json:"workstation,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -236,22 +231,25 @@ func (o *SyntheticsBasicAuthNTLM) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Domain = all.Domain o.Password = all.Password - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } o.Username = all.Username o.Workstation = all.Workstation + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_ntlm_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_ntlm_type.go index ada3e3c71..e7d1ca8a3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_ntlm_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_ntlm_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsBasicAuthNTLMType The type of authentication to use when performing the test. @@ -61,47 +62,3 @@ func (v SyntheticsBasicAuthNTLMType) IsValid() bool { func (v SyntheticsBasicAuthNTLMType) Ptr() *SyntheticsBasicAuthNTLMType { return &v } - -// NullableSyntheticsBasicAuthNTLMType handles when a null is used for SyntheticsBasicAuthNTLMType. -type NullableSyntheticsBasicAuthNTLMType struct { - value *SyntheticsBasicAuthNTLMType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsBasicAuthNTLMType) Get() *SyntheticsBasicAuthNTLMType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsBasicAuthNTLMType) Set(val *SyntheticsBasicAuthNTLMType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsBasicAuthNTLMType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsBasicAuthNTLMType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsBasicAuthNTLMType initializes the struct as if Set has been called. -func NewNullableSyntheticsBasicAuthNTLMType(val *SyntheticsBasicAuthNTLMType) *NullableSyntheticsBasicAuthNTLMType { - return &NullableSyntheticsBasicAuthNTLMType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsBasicAuthNTLMType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsBasicAuthNTLMType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_oauth_client.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_oauth_client.go index cd0ce140a..19430ca09 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_oauth_client.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_oauth_client.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -294,7 +295,6 @@ func (o SyntheticsBasicAuthOauthClient) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBasicAuthOauthClient) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AccessTokenUrl *string `json:"accessTokenUrl"` Audience *string `json:"audience,omitempty"` @@ -306,12 +306,7 @@ func (o *SyntheticsBasicAuthOauthClient) UnmarshalJSON(bytes []byte) (err error) Type *SyntheticsBasicAuthOauthClientType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.AccessTokenUrl == nil { return fmt.Errorf("required field accessTokenUrl missing") @@ -331,33 +326,32 @@ func (o *SyntheticsBasicAuthOauthClient) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.TokenApiAuthentication; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.AccessTokenUrl = *all.AccessTokenUrl o.Audience = all.Audience o.ClientId = *all.ClientId o.ClientSecret = *all.ClientSecret o.Resource = all.Resource o.Scope = all.Scope - o.TokenApiAuthentication = *all.TokenApiAuthentication - o.Type = all.Type + if !all.TokenApiAuthentication.IsValid() { + hasInvalidField = true + } else { + o.TokenApiAuthentication = *all.TokenApiAuthentication + } + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_oauth_client_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_oauth_client_type.go index 12af130bc..4dc9da01e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_oauth_client_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_oauth_client_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsBasicAuthOauthClientType The type of basic authentication to use when performing the test. @@ -61,47 +62,3 @@ func (v SyntheticsBasicAuthOauthClientType) IsValid() bool { func (v SyntheticsBasicAuthOauthClientType) Ptr() *SyntheticsBasicAuthOauthClientType { return &v } - -// NullableSyntheticsBasicAuthOauthClientType handles when a null is used for SyntheticsBasicAuthOauthClientType. -type NullableSyntheticsBasicAuthOauthClientType struct { - value *SyntheticsBasicAuthOauthClientType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsBasicAuthOauthClientType) Get() *SyntheticsBasicAuthOauthClientType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsBasicAuthOauthClientType) Set(val *SyntheticsBasicAuthOauthClientType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsBasicAuthOauthClientType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsBasicAuthOauthClientType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsBasicAuthOauthClientType initializes the struct as if Set has been called. -func NewNullableSyntheticsBasicAuthOauthClientType(val *SyntheticsBasicAuthOauthClientType) *NullableSyntheticsBasicAuthOauthClientType { - return &NullableSyntheticsBasicAuthOauthClientType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsBasicAuthOauthClientType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsBasicAuthOauthClientType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_oauth_rop.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_oauth_rop.go index 6b9ad9a40..e7d856cc9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_oauth_rop.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_oauth_rop.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -360,7 +361,6 @@ func (o SyntheticsBasicAuthOauthROP) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBasicAuthOauthROP) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AccessTokenUrl *string `json:"accessTokenUrl"` Audience *string `json:"audience,omitempty"` @@ -374,12 +374,7 @@ func (o *SyntheticsBasicAuthOauthROP) UnmarshalJSON(bytes []byte) (err error) { Username *string `json:"username"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.AccessTokenUrl == nil { return fmt.Errorf("required field accessTokenUrl missing") @@ -399,22 +394,8 @@ func (o *SyntheticsBasicAuthOauthROP) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.TokenApiAuthentication; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.AccessTokenUrl = *all.AccessTokenUrl o.Audience = all.Audience o.ClientId = all.ClientId @@ -422,12 +403,25 @@ func (o *SyntheticsBasicAuthOauthROP) UnmarshalJSON(bytes []byte) (err error) { o.Password = *all.Password o.Resource = all.Resource o.Scope = all.Scope - o.TokenApiAuthentication = *all.TokenApiAuthentication - o.Type = all.Type + if !all.TokenApiAuthentication.IsValid() { + hasInvalidField = true + } else { + o.TokenApiAuthentication = *all.TokenApiAuthentication + } + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } o.Username = *all.Username + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_oauth_rop_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_oauth_rop_type.go index 978ec3edb..444ce18e7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_oauth_rop_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_oauth_rop_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsBasicAuthOauthROPType The type of basic authentication to use when performing the test. @@ -61,47 +62,3 @@ func (v SyntheticsBasicAuthOauthROPType) IsValid() bool { func (v SyntheticsBasicAuthOauthROPType) Ptr() *SyntheticsBasicAuthOauthROPType { return &v } - -// NullableSyntheticsBasicAuthOauthROPType handles when a null is used for SyntheticsBasicAuthOauthROPType. -type NullableSyntheticsBasicAuthOauthROPType struct { - value *SyntheticsBasicAuthOauthROPType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsBasicAuthOauthROPType) Get() *SyntheticsBasicAuthOauthROPType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsBasicAuthOauthROPType) Set(val *SyntheticsBasicAuthOauthROPType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsBasicAuthOauthROPType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsBasicAuthOauthROPType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsBasicAuthOauthROPType initializes the struct as if Set has been called. -func NewNullableSyntheticsBasicAuthOauthROPType(val *SyntheticsBasicAuthOauthROPType) *NullableSyntheticsBasicAuthOauthROPType { - return &NullableSyntheticsBasicAuthOauthROPType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsBasicAuthOauthROPType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsBasicAuthOauthROPType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_oauth_token_api_authentication.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_oauth_token_api_authentication.go index 1edc9ee9b..5fca62847 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_oauth_token_api_authentication.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_oauth_token_api_authentication.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsBasicAuthOauthTokenApiAuthentication Type of token to use when performing the authentication. @@ -63,47 +64,3 @@ func (v SyntheticsBasicAuthOauthTokenApiAuthentication) IsValid() bool { func (v SyntheticsBasicAuthOauthTokenApiAuthentication) Ptr() *SyntheticsBasicAuthOauthTokenApiAuthentication { return &v } - -// NullableSyntheticsBasicAuthOauthTokenApiAuthentication handles when a null is used for SyntheticsBasicAuthOauthTokenApiAuthentication. -type NullableSyntheticsBasicAuthOauthTokenApiAuthentication struct { - value *SyntheticsBasicAuthOauthTokenApiAuthentication - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsBasicAuthOauthTokenApiAuthentication) Get() *SyntheticsBasicAuthOauthTokenApiAuthentication { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsBasicAuthOauthTokenApiAuthentication) Set(val *SyntheticsBasicAuthOauthTokenApiAuthentication) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsBasicAuthOauthTokenApiAuthentication) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsBasicAuthOauthTokenApiAuthentication) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsBasicAuthOauthTokenApiAuthentication initializes the struct as if Set has been called. -func NewNullableSyntheticsBasicAuthOauthTokenApiAuthentication(val *SyntheticsBasicAuthOauthTokenApiAuthentication) *NullableSyntheticsBasicAuthOauthTokenApiAuthentication { - return &NullableSyntheticsBasicAuthOauthTokenApiAuthentication{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsBasicAuthOauthTokenApiAuthentication) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsBasicAuthOauthTokenApiAuthentication) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_sigv4.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_sigv4.go index c16af5bda..f93b7d9c2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_sigv4.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_sigv4.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -232,7 +233,6 @@ func (o SyntheticsBasicAuthSigv4) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBasicAuthSigv4) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AccessKey *string `json:"accessKey"` Region *string `json:"region,omitempty"` @@ -242,12 +242,7 @@ func (o *SyntheticsBasicAuthSigv4) UnmarshalJSON(bytes []byte) (err error) { Type *SyntheticsBasicAuthSigv4Type `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.AccessKey == nil { return fmt.Errorf("required field accessKey missing") @@ -264,23 +259,26 @@ func (o *SyntheticsBasicAuthSigv4) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.AccessKey = *all.AccessKey o.Region = all.Region o.SecretKey = *all.SecretKey o.ServiceName = all.ServiceName o.SessionToken = all.SessionToken - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_sigv4_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_sigv4_type.go index 7dee7ed3c..2665c11be 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_sigv4_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_sigv4_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsBasicAuthSigv4Type The type of authentication to use when performing the test. @@ -61,47 +62,3 @@ func (v SyntheticsBasicAuthSigv4Type) IsValid() bool { func (v SyntheticsBasicAuthSigv4Type) Ptr() *SyntheticsBasicAuthSigv4Type { return &v } - -// NullableSyntheticsBasicAuthSigv4Type handles when a null is used for SyntheticsBasicAuthSigv4Type. -type NullableSyntheticsBasicAuthSigv4Type struct { - value *SyntheticsBasicAuthSigv4Type - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsBasicAuthSigv4Type) Get() *SyntheticsBasicAuthSigv4Type { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsBasicAuthSigv4Type) Set(val *SyntheticsBasicAuthSigv4Type) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsBasicAuthSigv4Type) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsBasicAuthSigv4Type) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsBasicAuthSigv4Type initializes the struct as if Set has been called. -func NewNullableSyntheticsBasicAuthSigv4Type(val *SyntheticsBasicAuthSigv4Type) *NullableSyntheticsBasicAuthSigv4Type { - return &NullableSyntheticsBasicAuthSigv4Type{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsBasicAuthSigv4Type) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsBasicAuthSigv4Type) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_web.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_web.go index 0e253af81..c1df3cebf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_web.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_web.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -141,19 +142,13 @@ func (o SyntheticsBasicAuthWeb) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBasicAuthWeb) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Password *string `json:"password"` Type *SyntheticsBasicAuthWebType `json:"type,omitempty"` Username *string `json:"username"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Password == nil { return fmt.Errorf("required field password missing") @@ -167,20 +162,23 @@ func (o *SyntheticsBasicAuthWeb) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Password = *all.Password - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } o.Username = *all.Username + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_web_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_web_type.go index ab94389e4..2834fe92d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_web_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_basic_auth_web_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsBasicAuthWebType The type of basic authentication to use when performing the test. @@ -61,47 +62,3 @@ func (v SyntheticsBasicAuthWebType) IsValid() bool { func (v SyntheticsBasicAuthWebType) Ptr() *SyntheticsBasicAuthWebType { return &v } - -// NullableSyntheticsBasicAuthWebType handles when a null is used for SyntheticsBasicAuthWebType. -type NullableSyntheticsBasicAuthWebType struct { - value *SyntheticsBasicAuthWebType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsBasicAuthWebType) Get() *SyntheticsBasicAuthWebType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsBasicAuthWebType) Set(val *SyntheticsBasicAuthWebType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsBasicAuthWebType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsBasicAuthWebType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsBasicAuthWebType initializes the struct as if Set has been called. -func NewNullableSyntheticsBasicAuthWebType(val *SyntheticsBasicAuthWebType) *NullableSyntheticsBasicAuthWebType { - return &NullableSyntheticsBasicAuthWebType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsBasicAuthWebType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsBasicAuthWebType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_batch_details.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_batch_details.go index 9a16efccc..7dcb9f84e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_batch_details.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_batch_details.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SyntheticsBatchDetails) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBatchDetails) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SyntheticsBatchDetailsData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *SyntheticsBatchDetails) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_batch_details_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_batch_details_data.go index e98874db1..8788f1f16 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_batch_details_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_batch_details_data.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o SyntheticsBatchDetailsData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBatchDetailsData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Metadata *SyntheticsCIBatchMetadata `json:"metadata,omitempty"` Results []SyntheticsBatchResult `json:"results,omitempty"` Status *SyntheticsStatus `json:"status,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,27 +162,26 @@ func (o *SyntheticsBatchDetailsData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Metadata = all.Metadata o.Results = all.Results - o.Status = all.Status + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_batch_result.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_batch_result.go index 0439d18ef..5c4477c97 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_batch_result.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_batch_result.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -379,7 +379,6 @@ func (o SyntheticsBatchResult) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBatchResult) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Device *SyntheticsDeviceID `json:"device,omitempty"` Duration *float64 `json:"duration,omitempty"` @@ -393,12 +392,7 @@ func (o *SyntheticsBatchResult) UnmarshalJSON(bytes []byte) (err error) { TestType *SyntheticsTestDetailsType `json:"test_type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -406,51 +400,42 @@ func (o *SyntheticsBatchResult) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Device; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ExecutionRule; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TestType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Device = all.Device + + hasInvalidField := false + if all.Device != nil && !all.Device.IsValid() { + hasInvalidField = true + } else { + o.Device = all.Device + } o.Duration = all.Duration - o.ExecutionRule = all.ExecutionRule + if all.ExecutionRule != nil && !all.ExecutionRule.IsValid() { + hasInvalidField = true + } else { + o.ExecutionRule = all.ExecutionRule + } o.Location = all.Location o.ResultId = all.ResultId o.Retries = all.Retries - o.Status = all.Status + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } o.TestName = all.TestName o.TestPublicId = all.TestPublicId - o.TestType = all.TestType + if all.TestType != nil && !all.TestType.IsValid() { + hasInvalidField = true + } else { + o.TestType = all.TestType + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_error.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_error.go index 43936a270..7793a77f7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_error.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_error.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -164,7 +165,6 @@ func (o SyntheticsBrowserError) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBrowserError) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Description *string `json:"description"` Name *string `json:"name"` @@ -172,12 +172,7 @@ func (o *SyntheticsBrowserError) UnmarshalJSON(bytes []byte) (err error) { Type *SyntheticsBrowserErrorType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Description == nil { return fmt.Errorf("required field description missing") @@ -194,21 +189,24 @@ func (o *SyntheticsBrowserError) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Description = *all.Description o.Name = *all.Name o.Status = all.Status - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_error_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_error_type.go index f593e2ee6..16df22dc8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_error_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_error_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsBrowserErrorType Error type returned by a browser test. @@ -63,47 +64,3 @@ func (v SyntheticsBrowserErrorType) IsValid() bool { func (v SyntheticsBrowserErrorType) Ptr() *SyntheticsBrowserErrorType { return &v } - -// NullableSyntheticsBrowserErrorType handles when a null is used for SyntheticsBrowserErrorType. -type NullableSyntheticsBrowserErrorType struct { - value *SyntheticsBrowserErrorType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsBrowserErrorType) Get() *SyntheticsBrowserErrorType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsBrowserErrorType) Set(val *SyntheticsBrowserErrorType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsBrowserErrorType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsBrowserErrorType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsBrowserErrorType initializes the struct as if Set has been called. -func NewNullableSyntheticsBrowserErrorType(val *SyntheticsBrowserErrorType) *NullableSyntheticsBrowserErrorType { - return &NullableSyntheticsBrowserErrorType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsBrowserErrorType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsBrowserErrorType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_.go index 56038290d..c4ac73d01 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -380,7 +381,6 @@ func (o SyntheticsBrowserTest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBrowserTest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Config *SyntheticsBrowserTestConfig `json:"config"` Locations *[]string `json:"locations"` @@ -395,12 +395,7 @@ func (o *SyntheticsBrowserTest) UnmarshalJSON(bytes []byte) (err error) { Type *SyntheticsBrowserTestType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Config == nil { return fmt.Errorf("required field config missing") @@ -426,28 +421,10 @@ func (o *SyntheticsBrowserTest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Config.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Config = *all.Config o.Locations = *all.Locations @@ -455,21 +432,30 @@ func (o *SyntheticsBrowserTest) UnmarshalJSON(bytes []byte) (err error) { o.MonitorId = all.MonitorId o.Name = *all.Name if all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Options = *all.Options o.PublicId = all.PublicId - o.Status = all.Status + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } o.Steps = all.Steps o.Tags = all.Tags - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_config.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_config.go index 2b7cffa8d..244daeab9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_config.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_config.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -203,7 +204,6 @@ func (o SyntheticsBrowserTestConfig) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBrowserTestConfig) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Assertions *[]SyntheticsAssertion `json:"assertions"` ConfigVariables []SyntheticsConfigVariable `json:"configVariables,omitempty"` @@ -212,12 +212,7 @@ func (o *SyntheticsBrowserTestConfig) UnmarshalJSON(bytes []byte) (err error) { Variables []SyntheticsBrowserVariable `json:"variables,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Assertions == nil { return fmt.Errorf("required field assertions missing") @@ -231,21 +226,24 @@ func (o *SyntheticsBrowserTestConfig) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Assertions = *all.Assertions o.ConfigVariables = all.ConfigVariables if all.Request.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Request = *all.Request o.SetCookie = all.SetCookie o.Variables = all.Variables + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_failure_code.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_failure_code.go index d0f7ce1c8..6a7c39256 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_failure_code.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_failure_code.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsBrowserTestFailureCode Error code that can be returned by a Synthetic test. @@ -125,47 +126,3 @@ func (v SyntheticsBrowserTestFailureCode) IsValid() bool { func (v SyntheticsBrowserTestFailureCode) Ptr() *SyntheticsBrowserTestFailureCode { return &v } - -// NullableSyntheticsBrowserTestFailureCode handles when a null is used for SyntheticsBrowserTestFailureCode. -type NullableSyntheticsBrowserTestFailureCode struct { - value *SyntheticsBrowserTestFailureCode - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsBrowserTestFailureCode) Get() *SyntheticsBrowserTestFailureCode { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsBrowserTestFailureCode) Set(val *SyntheticsBrowserTestFailureCode) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsBrowserTestFailureCode) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsBrowserTestFailureCode) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsBrowserTestFailureCode initializes the struct as if Set has been called. -func NewNullableSyntheticsBrowserTestFailureCode(val *SyntheticsBrowserTestFailureCode) *NullableSyntheticsBrowserTestFailureCode { - return &NullableSyntheticsBrowserTestFailureCode{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsBrowserTestFailureCode) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsBrowserTestFailureCode) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_result_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_result_data.go index 803682fe5..c1b3f086e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_result_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_result_data.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -446,7 +446,6 @@ func (o SyntheticsBrowserTestResultData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBrowserTestResultData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { BrowserType *string `json:"browserType,omitempty"` BrowserVersion *string `json:"browserVersion,omitempty"` @@ -462,12 +461,7 @@ func (o *SyntheticsBrowserTestResultData) UnmarshalJSON(bytes []byte) (err error TimeToInteractive *float64 `json:"timeToInteractive,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -475,24 +469,18 @@ func (o *SyntheticsBrowserTestResultData) UnmarshalJSON(bytes []byte) (err error } else { return err } + + hasInvalidField := false o.BrowserType = all.BrowserType o.BrowserVersion = all.BrowserVersion if all.Device != nil && all.Device.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Device = all.Device o.Duration = all.Duration o.Error = all.Error if all.Failure != nil && all.Failure.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Failure = all.Failure o.Passed = all.Passed @@ -501,9 +489,14 @@ func (o *SyntheticsBrowserTestResultData) UnmarshalJSON(bytes []byte) (err error o.StepDetails = all.StepDetails o.ThumbnailsBucketKey = all.ThumbnailsBucketKey o.TimeToInteractive = all.TimeToInteractive + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_result_failure.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_result_failure.go index ed1030525..2e5e6e435 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_result_failure.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_result_failure.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SyntheticsBrowserTestResultFailure) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBrowserTestResultFailure) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Code *SyntheticsBrowserTestFailureCode `json:"code,omitempty"` Message *string `json:"message,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,19 +128,22 @@ func (o *SyntheticsBrowserTestResultFailure) UnmarshalJSON(bytes []byte) (err er } else { return err } - if v := all.Code; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.Code != nil && !all.Code.IsValid() { + hasInvalidField = true + } else { + o.Code = all.Code } - o.Code = all.Code o.Message = all.Message + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_result_full.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_result_full.go index 036e2cac7..54a78405f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_result_full.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_result_full.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -283,7 +283,6 @@ func (o SyntheticsBrowserTestResultFull) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBrowserTestResultFull) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Check *SyntheticsBrowserTestResultFullCheck `json:"check,omitempty"` CheckTime *float64 `json:"check_time,omitempty"` @@ -294,12 +293,7 @@ func (o *SyntheticsBrowserTestResultFull) UnmarshalJSON(bytes []byte) (err error Status *SyntheticsTestMonitorStatus `json:"status,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -307,38 +301,33 @@ func (o *SyntheticsBrowserTestResultFull) UnmarshalJSON(bytes []byte) (err error } else { return err } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Check != nil && all.Check.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Check = all.Check o.CheckTime = all.CheckTime o.CheckVersion = all.CheckVersion o.ProbeDc = all.ProbeDc if all.Result != nil && all.Result.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Result = all.Result o.ResultId = all.ResultId - o.Status = all.Status + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_result_full_check.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_result_full_check.go index 0b3da84a7..be48997c7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_result_full_check.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_result_full_check.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o SyntheticsBrowserTestResultFullCheck) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBrowserTestResultFullCheck) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Config *SyntheticsTestConfig `json:"config"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Config == nil { return fmt.Errorf("required field config missing") @@ -98,17 +93,20 @@ func (o *SyntheticsBrowserTestResultFullCheck) UnmarshalJSON(bytes []byte) (err } else { return err } + + hasInvalidField := false if all.Config.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Config = *all.Config + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_result_short.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_result_short.go index 65d69bcf3..de794760d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_result_short.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_result_short.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -217,7 +217,6 @@ func (o SyntheticsBrowserTestResultShort) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBrowserTestResultShort) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CheckTime *float64 `json:"check_time,omitempty"` ProbeDc *string `json:"probe_dc,omitempty"` @@ -226,12 +225,7 @@ func (o *SyntheticsBrowserTestResultShort) UnmarshalJSON(bytes []byte) (err erro Status *SyntheticsTestMonitorStatus `json:"status,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -239,29 +233,28 @@ func (o *SyntheticsBrowserTestResultShort) UnmarshalJSON(bytes []byte) (err erro } else { return err } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.CheckTime = all.CheckTime o.ProbeDc = all.ProbeDc if all.Result != nil && all.Result.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Result = all.Result o.ResultId = all.ResultId - o.Status = all.Status + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_result_short_result.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_result_short_result.go index 672757482..80dcdf81a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_result_short_result.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_result_short_result.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -214,7 +214,6 @@ func (o SyntheticsBrowserTestResultShortResult) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBrowserTestResultShortResult) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Device *SyntheticsDevice `json:"device,omitempty"` Duration *float64 `json:"duration,omitempty"` @@ -223,12 +222,7 @@ func (o *SyntheticsBrowserTestResultShortResult) UnmarshalJSON(bytes []byte) (er StepCountTotal *int64 `json:"stepCountTotal,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -236,21 +230,24 @@ func (o *SyntheticsBrowserTestResultShortResult) UnmarshalJSON(bytes []byte) (er } else { return err } + + hasInvalidField := false if all.Device != nil && all.Device.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Device = all.Device o.Duration = all.Duration o.ErrorCount = all.ErrorCount o.StepCountCompleted = all.StepCountCompleted o.StepCountTotal = all.StepCountTotal + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_rum_settings.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_rum_settings.go index 5ec7d781f..86ada6d3e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_rum_settings.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_rum_settings.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -153,19 +154,13 @@ func (o SyntheticsBrowserTestRumSettings) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBrowserTestRumSettings) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApplicationId *string `json:"applicationId,omitempty"` ClientTokenId *int64 `json:"clientTokenId,omitempty"` IsEnabled *bool `json:"isEnabled"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.IsEnabled == nil { return fmt.Errorf("required field isEnabled missing") @@ -179,6 +174,7 @@ func (o *SyntheticsBrowserTestRumSettings) UnmarshalJSON(bytes []byte) (err erro o.ApplicationId = all.ApplicationId o.ClientTokenId = all.ClientTokenId o.IsEnabled = *all.IsEnabled + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_type.go index dda419119..8724a5ea8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_test_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsBrowserTestType Type of the Synthetic test, `browser`. @@ -61,47 +62,3 @@ func (v SyntheticsBrowserTestType) IsValid() bool { func (v SyntheticsBrowserTestType) Ptr() *SyntheticsBrowserTestType { return &v } - -// NullableSyntheticsBrowserTestType handles when a null is used for SyntheticsBrowserTestType. -type NullableSyntheticsBrowserTestType struct { - value *SyntheticsBrowserTestType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsBrowserTestType) Get() *SyntheticsBrowserTestType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsBrowserTestType) Set(val *SyntheticsBrowserTestType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsBrowserTestType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsBrowserTestType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsBrowserTestType initializes the struct as if Set has been called. -func NewNullableSyntheticsBrowserTestType(val *SyntheticsBrowserTestType) *NullableSyntheticsBrowserTestType { - return &NullableSyntheticsBrowserTestType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsBrowserTestType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsBrowserTestType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_variable.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_variable.go index c22f0a9a1..a1b67b68b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_variable.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_variable.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -237,7 +238,6 @@ func (o SyntheticsBrowserVariable) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBrowserVariable) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Example *string `json:"example,omitempty"` Id *string `json:"id,omitempty"` @@ -247,12 +247,7 @@ func (o *SyntheticsBrowserVariable) UnmarshalJSON(bytes []byte) (err error) { Type *SyntheticsBrowserVariableType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -266,23 +261,26 @@ func (o *SyntheticsBrowserVariable) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Example = all.Example o.Id = all.Id o.Name = *all.Name o.Pattern = all.Pattern o.Secure = all.Secure - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_variable_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_variable_type.go index 0a8ee65ad..c1b054465 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_variable_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_browser_variable_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsBrowserVariableType Type of browser test variable. @@ -69,47 +70,3 @@ func (v SyntheticsBrowserVariableType) IsValid() bool { func (v SyntheticsBrowserVariableType) Ptr() *SyntheticsBrowserVariableType { return &v } - -// NullableSyntheticsBrowserVariableType handles when a null is used for SyntheticsBrowserVariableType. -type NullableSyntheticsBrowserVariableType struct { - value *SyntheticsBrowserVariableType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsBrowserVariableType) Get() *SyntheticsBrowserVariableType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsBrowserVariableType) Set(val *SyntheticsBrowserVariableType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsBrowserVariableType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsBrowserVariableType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsBrowserVariableType initializes the struct as if Set has been called. -func NewNullableSyntheticsBrowserVariableType(val *SyntheticsBrowserVariableType) *NullableSyntheticsBrowserVariableType { - return &NullableSyntheticsBrowserVariableType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsBrowserVariableType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsBrowserVariableType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_check_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_check_type.go index 66ed21297..42ee9a3a0 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_check_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_check_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsCheckType Type of assertion to apply in an API test. @@ -87,47 +88,3 @@ func (v SyntheticsCheckType) IsValid() bool { func (v SyntheticsCheckType) Ptr() *SyntheticsCheckType { return &v } - -// NullableSyntheticsCheckType handles when a null is used for SyntheticsCheckType. -type NullableSyntheticsCheckType struct { - value *SyntheticsCheckType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsCheckType) Get() *SyntheticsCheckType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsCheckType) Set(val *SyntheticsCheckType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsCheckType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsCheckType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsCheckType initializes the struct as if Set has been called. -func NewNullableSyntheticsCheckType(val *SyntheticsCheckType) *NullableSyntheticsCheckType { - return &NullableSyntheticsCheckType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsCheckType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsCheckType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_batch_metadata.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_batch_metadata.go index 855d3b1ff..3cc14dbf3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_batch_metadata.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_batch_metadata.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SyntheticsCIBatchMetadata) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsCIBatchMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Ci *SyntheticsCIBatchMetadataCI `json:"ci,omitempty"` Git *SyntheticsCIBatchMetadataGit `json:"git,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,25 +128,24 @@ func (o *SyntheticsCIBatchMetadata) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Ci != nil && all.Ci.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Ci = all.Ci if all.Git != nil && all.Git.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Git = all.Git + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_batch_metadata_ci.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_batch_metadata_ci.go index e2f7670fb..daf3f4dbc 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_batch_metadata_ci.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_batch_metadata_ci.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SyntheticsCIBatchMetadataCI) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsCIBatchMetadataCI) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Pipeline *SyntheticsCIBatchMetadataPipeline `json:"pipeline,omitempty"` Provider *SyntheticsCIBatchMetadataProvider `json:"provider,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,25 +128,24 @@ func (o *SyntheticsCIBatchMetadataCI) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Pipeline != nil && all.Pipeline.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Pipeline = all.Pipeline if all.Provider != nil && all.Provider.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Provider = all.Provider + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_batch_metadata_git.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_batch_metadata_git.go index 29e2ffae8..a37f2f8c9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_batch_metadata_git.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_batch_metadata_git.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SyntheticsCIBatchMetadataGit) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsCIBatchMetadataGit) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Branch *string `json:"branch,omitempty"` CommitSha *string `json:"commitSha,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *SyntheticsCIBatchMetadataGit) UnmarshalJSON(bytes []byte) (err error) { } o.Branch = all.Branch o.CommitSha = all.CommitSha + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_batch_metadata_pipeline.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_batch_metadata_pipeline.go index cae8c34c0..522aa4683 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_batch_metadata_pipeline.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_batch_metadata_pipeline.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SyntheticsCIBatchMetadataPipeline) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsCIBatchMetadataPipeline) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Url *string `json:"url,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *SyntheticsCIBatchMetadataPipeline) UnmarshalJSON(bytes []byte) (err err return err } o.Url = all.Url + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_batch_metadata_provider.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_batch_metadata_provider.go index aaecec06e..7f155fa87 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_batch_metadata_provider.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_batch_metadata_provider.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SyntheticsCIBatchMetadataProvider) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsCIBatchMetadataProvider) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { 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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *SyntheticsCIBatchMetadataProvider) UnmarshalJSON(bytes []byte) (err err return err } o.Name = all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_test_.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_test_.go index d3afb9ae7..974e48f16 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_test_.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_test_.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -506,7 +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{}{} all := struct { AllowInsecureCertificates *bool `json:"allowInsecureCertificates,omitempty"` BasicAuth *SyntheticsBasicAuth `json:"basicAuth,omitempty"` @@ -524,12 +524,7 @@ func (o *SyntheticsCITest) UnmarshalJSON(bytes []byte) (err error) { Variables map[string]string `json:"variables,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.PublicId == nil { return fmt.Errorf("required field public_id missing") @@ -540,6 +535,8 @@ func (o *SyntheticsCITest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.AllowInsecureCertificates = all.AllowInsecureCertificates o.BasicAuth = all.BasicAuth o.Body = all.Body @@ -550,27 +547,24 @@ func (o *SyntheticsCITest) UnmarshalJSON(bytes []byte) (err error) { o.Headers = all.Headers o.Locations = all.Locations if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Metadata = all.Metadata o.PublicId = *all.PublicId if all.Retry != nil && all.Retry.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Retry = all.Retry o.StartUrl = all.StartUrl o.Variables = all.Variables + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_test_body.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_test_body.go index 490fa7f34..77cd1dec3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_test_body.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ci_test_body.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SyntheticsCITestBody) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsCITestBody) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Tests []SyntheticsCITest `json:"tests,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *SyntheticsCITestBody) UnmarshalJSON(bytes []byte) (err error) { return err } o.Tests = all.Tests + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_config_variable.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_config_variable.go index d3a78077c..35041de4c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_config_variable.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_config_variable.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -236,7 +237,6 @@ func (o SyntheticsConfigVariable) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsConfigVariable) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Example *string `json:"example,omitempty"` Id *string `json:"id,omitempty"` @@ -246,12 +246,7 @@ func (o *SyntheticsConfigVariable) UnmarshalJSON(bytes []byte) (err error) { Type *SyntheticsConfigVariableType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -265,23 +260,26 @@ func (o *SyntheticsConfigVariable) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Example = all.Example o.Id = all.Id o.Name = *all.Name o.Pattern = all.Pattern o.Secure = all.Secure - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_config_variable_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_config_variable_type.go index ef4e578c2..f481d5632 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_config_variable_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_config_variable_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsConfigVariableType Type of the configuration variable. @@ -63,47 +64,3 @@ func (v SyntheticsConfigVariableType) IsValid() bool { func (v SyntheticsConfigVariableType) Ptr() *SyntheticsConfigVariableType { return &v } - -// NullableSyntheticsConfigVariableType handles when a null is used for SyntheticsConfigVariableType. -type NullableSyntheticsConfigVariableType struct { - value *SyntheticsConfigVariableType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsConfigVariableType) Get() *SyntheticsConfigVariableType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsConfigVariableType) Set(val *SyntheticsConfigVariableType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsConfigVariableType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsConfigVariableType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsConfigVariableType initializes the struct as if Set has been called. -func NewNullableSyntheticsConfigVariableType(val *SyntheticsConfigVariableType) *NullableSyntheticsConfigVariableType { - return &NullableSyntheticsConfigVariableType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsConfigVariableType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsConfigVariableType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_core_web_vitals.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_core_web_vitals.go index de7e26783..de48739f9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_core_web_vitals.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_core_web_vitals.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o SyntheticsCoreWebVitals) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsCoreWebVitals) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Cls *float64 `json:"cls,omitempty"` Lcp *float64 `json:"lcp,omitempty"` Url *string `json:"url,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *SyntheticsCoreWebVitals) UnmarshalJSON(bytes []byte) (err error) { o.Cls = all.Cls o.Lcp = all.Lcp o.Url = all.Url + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_delete_tests_payload.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_delete_tests_payload.go index b5fc2f27b..110990ac5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_delete_tests_payload.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_delete_tests_payload.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -83,17 +83,11 @@ func (o SyntheticsDeleteTestsPayload) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsDeleteTestsPayload) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { PublicIds []string `json:"public_ids,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -102,6 +96,7 @@ func (o *SyntheticsDeleteTestsPayload) UnmarshalJSON(bytes []byte) (err error) { return err } o.PublicIds = all.PublicIds + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_delete_tests_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_delete_tests_response.go index 852cab428..38bbe1a92 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_delete_tests_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_delete_tests_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -83,17 +83,11 @@ func (o SyntheticsDeleteTestsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsDeleteTestsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DeletedTests []SyntheticsDeletedTest `json:"deleted_tests,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -102,6 +96,7 @@ func (o *SyntheticsDeleteTestsResponse) UnmarshalJSON(bytes []byte) (err error) return err } o.DeletedTests = all.DeletedTests + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_deleted_test_.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_deleted_test_.go index 8ec7c768c..3c13231a8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_deleted_test_.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_deleted_test_.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -121,18 +122,12 @@ func (o SyntheticsDeletedTest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsDeletedTest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DeletedAt *time.Time `json:"deleted_at,omitempty"` PublicId *string `json:"public_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -142,6 +137,7 @@ func (o *SyntheticsDeletedTest) UnmarshalJSON(bytes []byte) (err error) { } o.DeletedAt = all.DeletedAt o.PublicId = all.PublicId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_device.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_device.go index 08573ce91..7eb0720de 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_device.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_device.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -191,7 +192,6 @@ func (o SyntheticsDevice) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsDevice) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Height *int64 `json:"height"` Id *SyntheticsDeviceID `json:"id"` @@ -200,12 +200,7 @@ func (o *SyntheticsDevice) UnmarshalJSON(bytes []byte) (err error) { Width *int64 `json:"width"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Height == nil { return fmt.Errorf("required field height missing") @@ -225,22 +220,25 @@ func (o *SyntheticsDevice) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Id; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Height = *all.Height - o.Id = *all.Id + if !all.Id.IsValid() { + hasInvalidField = true + } else { + o.Id = *all.Id + } o.IsMobile = all.IsMobile o.Name = *all.Name o.Width = *all.Width + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_device_id.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_device_id.go index 938b0a44f..2c28e4d77 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_device_id.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_device_id.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsDeviceID The device ID. @@ -83,47 +84,3 @@ func (v SyntheticsDeviceID) IsValid() bool { func (v SyntheticsDeviceID) Ptr() *SyntheticsDeviceID { return &v } - -// NullableSyntheticsDeviceID handles when a null is used for SyntheticsDeviceID. -type NullableSyntheticsDeviceID struct { - value *SyntheticsDeviceID - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsDeviceID) Get() *SyntheticsDeviceID { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsDeviceID) Set(val *SyntheticsDeviceID) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsDeviceID) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsDeviceID) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsDeviceID initializes the struct as if Set has been called. -func NewNullableSyntheticsDeviceID(val *SyntheticsDeviceID) *NullableSyntheticsDeviceID { - return &NullableSyntheticsDeviceID{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsDeviceID) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsDeviceID) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_get_api_test_latest_results_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_get_api_test_latest_results_response.go index 00eef5d50..31fc22080 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_get_api_test_latest_results_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_get_api_test_latest_results_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SyntheticsGetAPITestLatestResultsResponse) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *SyntheticsGetAPITestLatestResultsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { LastTimestampFetched *int64 `json:"last_timestamp_fetched,omitempty"` Results []SyntheticsAPITestResultShort `json:"results,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *SyntheticsGetAPITestLatestResultsResponse) UnmarshalJSON(bytes []byte) } o.LastTimestampFetched = all.LastTimestampFetched o.Results = all.Results + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_get_browser_test_latest_results_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_get_browser_test_latest_results_response.go index 4d6c3ed44..096f3159d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_get_browser_test_latest_results_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_get_browser_test_latest_results_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SyntheticsGetBrowserTestLatestResultsResponse) MarshalJSON() ([]byte, er // UnmarshalJSON deserializes the given payload. func (o *SyntheticsGetBrowserTestLatestResultsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { LastTimestampFetched *int64 `json:"last_timestamp_fetched,omitempty"` Results []SyntheticsBrowserTestResultShort `json:"results,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *SyntheticsGetBrowserTestLatestResultsResponse) UnmarshalJSON(bytes []by } o.LastTimestampFetched = all.LastTimestampFetched o.Results = all.Results + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable.go index 98721fa0e..4b78a383b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -290,7 +291,6 @@ func (o SyntheticsGlobalVariable) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsGlobalVariable) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SyntheticsGlobalVariableAttributes `json:"attributes,omitempty"` Description *string `json:"description"` @@ -302,12 +302,7 @@ func (o *SyntheticsGlobalVariable) UnmarshalJSON(bytes []byte) (err error) { Value *SyntheticsGlobalVariableValue `json:"value"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Description == nil { return fmt.Errorf("required field description missing") @@ -327,38 +322,33 @@ func (o *SyntheticsGlobalVariable) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Description = *all.Description o.Id = all.Id o.Name = *all.Name if all.ParseTestOptions != nil && all.ParseTestOptions.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ParseTestOptions = all.ParseTestOptions o.ParseTestPublicId = all.ParseTestPublicId o.Tags = *all.Tags if all.Value.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Value = *all.Value + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_attributes.go index 2796d9aaa..3c5eeb4f2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_attributes.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SyntheticsGlobalVariableAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsGlobalVariableAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { RestrictedRoles []string `json:"restricted_roles,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *SyntheticsGlobalVariableAttributes) UnmarshalJSON(bytes []byte) (err er return err } o.RestrictedRoles = all.RestrictedRoles + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_options.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_options.go index f4565cb1f..098fc8c4e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_options.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_options.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SyntheticsGlobalVariableOptions) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsGlobalVariableOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { TotpParameters *SyntheticsGlobalVariableTOTPParameters `json:"totp_parameters,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *SyntheticsGlobalVariableOptions) UnmarshalJSON(bytes []byte) (err error } else { return err } + + hasInvalidField := false if all.TotpParameters != nil && all.TotpParameters.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.TotpParameters = all.TotpParameters + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_parse_test_options.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_parse_test_options.go index 1c9395762..85d6ff915 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_parse_test_options.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_parse_test_options.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -176,7 +177,6 @@ func (o SyntheticsGlobalVariableParseTestOptions) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *SyntheticsGlobalVariableParseTestOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Field *string `json:"field,omitempty"` LocalVariableName *string `json:"localVariableName,omitempty"` @@ -184,12 +184,7 @@ func (o *SyntheticsGlobalVariableParseTestOptions) UnmarshalJSON(bytes []byte) ( Type *SyntheticsGlobalVariableParseTestOptionsType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -200,28 +195,27 @@ func (o *SyntheticsGlobalVariableParseTestOptions) UnmarshalJSON(bytes []byte) ( } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Field = all.Field o.LocalVariableName = all.LocalVariableName if all.Parser != nil && all.Parser.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Parser = all.Parser - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_parse_test_options_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_parse_test_options_type.go index 5d1f0973d..03dd9f03b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_parse_test_options_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_parse_test_options_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsGlobalVariableParseTestOptionsType Property of the Synthetic Test Response to use for a Synthetic global variable. @@ -65,47 +66,3 @@ func (v SyntheticsGlobalVariableParseTestOptionsType) IsValid() bool { func (v SyntheticsGlobalVariableParseTestOptionsType) Ptr() *SyntheticsGlobalVariableParseTestOptionsType { return &v } - -// NullableSyntheticsGlobalVariableParseTestOptionsType handles when a null is used for SyntheticsGlobalVariableParseTestOptionsType. -type NullableSyntheticsGlobalVariableParseTestOptionsType struct { - value *SyntheticsGlobalVariableParseTestOptionsType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsGlobalVariableParseTestOptionsType) Get() *SyntheticsGlobalVariableParseTestOptionsType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsGlobalVariableParseTestOptionsType) Set(val *SyntheticsGlobalVariableParseTestOptionsType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsGlobalVariableParseTestOptionsType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsGlobalVariableParseTestOptionsType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsGlobalVariableParseTestOptionsType initializes the struct as if Set has been called. -func NewNullableSyntheticsGlobalVariableParseTestOptionsType(val *SyntheticsGlobalVariableParseTestOptionsType) *NullableSyntheticsGlobalVariableParseTestOptionsType { - return &NullableSyntheticsGlobalVariableParseTestOptionsType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsGlobalVariableParseTestOptionsType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsGlobalVariableParseTestOptionsType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_parser_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_parser_type.go index 0d800656c..21d121ea5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_parser_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_parser_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsGlobalVariableParserType Type of parser for a Synthetic global variable from a synthetics test. @@ -67,47 +68,3 @@ func (v SyntheticsGlobalVariableParserType) IsValid() bool { func (v SyntheticsGlobalVariableParserType) Ptr() *SyntheticsGlobalVariableParserType { return &v } - -// NullableSyntheticsGlobalVariableParserType handles when a null is used for SyntheticsGlobalVariableParserType. -type NullableSyntheticsGlobalVariableParserType struct { - value *SyntheticsGlobalVariableParserType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsGlobalVariableParserType) Get() *SyntheticsGlobalVariableParserType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsGlobalVariableParserType) Set(val *SyntheticsGlobalVariableParserType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsGlobalVariableParserType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsGlobalVariableParserType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsGlobalVariableParserType initializes the struct as if Set has been called. -func NewNullableSyntheticsGlobalVariableParserType(val *SyntheticsGlobalVariableParserType) *NullableSyntheticsGlobalVariableParserType { - return &NullableSyntheticsGlobalVariableParserType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsGlobalVariableParserType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsGlobalVariableParserType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_totp_parameters.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_totp_parameters.go index 74dbbe921..0dfa84233 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_totp_parameters.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_totp_parameters.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SyntheticsGlobalVariableTOTPParameters) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsGlobalVariableTOTPParameters) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Digits *int32 `json:"digits,omitempty"` RefreshInterval *int32 `json:"refresh_interval,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *SyntheticsGlobalVariableTOTPParameters) UnmarshalJSON(bytes []byte) (er } o.Digits = all.Digits o.RefreshInterval = all.RefreshInterval + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_value.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_value.go index 3803f1740..5ff05eca3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_value.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_global_variable_value.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -149,19 +149,13 @@ func (o SyntheticsGlobalVariableValue) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsGlobalVariableValue) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Options *SyntheticsGlobalVariableOptions `json:"options,omitempty"` Secure *bool `json:"secure,omitempty"` Value *string `json:"value,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -169,19 +163,22 @@ func (o *SyntheticsGlobalVariableValue) UnmarshalJSON(bytes []byte) (err error) } else { return err } + + hasInvalidField := false if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Options = all.Options o.Secure = all.Secure o.Value = all.Value + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_list_global_variables_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_list_global_variables_response.go index cc76bfd6e..9d958f945 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_list_global_variables_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_list_global_variables_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SyntheticsListGlobalVariablesResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsListGlobalVariablesResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Variables []SyntheticsGlobalVariable `json:"variables,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *SyntheticsListGlobalVariablesResponse) UnmarshalJSON(bytes []byte) (err return err } o.Variables = all.Variables + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_list_tests_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_list_tests_response.go index 81335cff6..edd2163b6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_list_tests_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_list_tests_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SyntheticsListTestsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsListTestsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Tests []SyntheticsTestDetails `json:"tests,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *SyntheticsListTestsResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Tests = all.Tests + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_location.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_location.go index 2e5900cd2..698d36787 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_location.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_location.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -116,18 +116,12 @@ func (o SyntheticsLocation) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsLocation) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id,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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -137,6 +131,7 @@ func (o *SyntheticsLocation) UnmarshalJSON(bytes []byte) (err error) { } o.Id = all.Id o.Name = all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_locations.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_locations.go index 5a32c758e..13a09f6f8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_locations.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_locations.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SyntheticsLocations) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsLocations) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Locations []SyntheticsLocation `json:"locations,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *SyntheticsLocations) UnmarshalJSON(bytes []byte) (err error) { return err } o.Locations = all.Locations + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_parsing_options.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_parsing_options.go index 98a84bc2c..d1b0682c4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_parsing_options.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_parsing_options.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -214,7 +214,6 @@ func (o SyntheticsParsingOptions) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsParsingOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Field *string `json:"field,omitempty"` Name *string `json:"name,omitempty"` @@ -223,12 +222,7 @@ func (o *SyntheticsParsingOptions) UnmarshalJSON(bytes []byte) (err error) { Type *SyntheticsGlobalVariableParseTestOptionsType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -236,29 +230,28 @@ func (o *SyntheticsParsingOptions) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Field = all.Field o.Name = all.Name if all.Parser != nil && all.Parser.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Parser = all.Parser o.Secure = all.Secure - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_playing_tab.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_playing_tab.go index 2a3072b93..3eee52c61 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_playing_tab.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_playing_tab.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsPlayingTab Navigate between different tabs for your browser test. @@ -69,47 +70,3 @@ func (v SyntheticsPlayingTab) IsValid() bool { func (v SyntheticsPlayingTab) Ptr() *SyntheticsPlayingTab { return &v } - -// NullableSyntheticsPlayingTab handles when a null is used for SyntheticsPlayingTab. -type NullableSyntheticsPlayingTab struct { - value *SyntheticsPlayingTab - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsPlayingTab) Get() *SyntheticsPlayingTab { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsPlayingTab) Set(val *SyntheticsPlayingTab) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsPlayingTab) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsPlayingTab) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsPlayingTab initializes the struct as if Set has been called. -func NewNullableSyntheticsPlayingTab(val *SyntheticsPlayingTab) *NullableSyntheticsPlayingTab { - return &NullableSyntheticsPlayingTab{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsPlayingTab) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsPlayingTab) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location.go index c5d533c96..a06ed7dde 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -230,7 +231,6 @@ func (o SyntheticsPrivateLocation) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsPrivateLocation) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Description *string `json:"description"` Id *string `json:"id,omitempty"` @@ -240,12 +240,7 @@ func (o *SyntheticsPrivateLocation) UnmarshalJSON(bytes []byte) (err error) { Tags *[]string `json:"tags"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Description == nil { return fmt.Errorf("required field description missing") @@ -262,29 +257,28 @@ func (o *SyntheticsPrivateLocation) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Description = *all.Description o.Id = all.Id if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Metadata = all.Metadata o.Name = *all.Name if all.Secrets != nil && all.Secrets.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Secrets = all.Secrets o.Tags = *all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location_creation_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location_creation_response.go index b225ae55d..72aadf480 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location_creation_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location_creation_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o SyntheticsPrivateLocationCreationResponse) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *SyntheticsPrivateLocationCreationResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Config interface{} `json:"config,omitempty"` PrivateLocation *SyntheticsPrivateLocation `json:"private_location,omitempty"` ResultEncryption *SyntheticsPrivateLocationCreationResponseResultEncryption `json:"result_encryption,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,26 +162,25 @@ func (o *SyntheticsPrivateLocationCreationResponse) UnmarshalJSON(bytes []byte) } else { return err } + + hasInvalidField := false o.Config = all.Config if all.PrivateLocation != nil && all.PrivateLocation.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.PrivateLocation = all.PrivateLocation if all.ResultEncryption != nil && all.ResultEncryption.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ResultEncryption = all.ResultEncryption + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location_creation_response_result_encryption.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location_creation_response_result_encryption.go index 6abbf15c2..cf57c0c13 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location_creation_response_result_encryption.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location_creation_response_result_encryption.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SyntheticsPrivateLocationCreationResponseResultEncryption) MarshalJSON() // UnmarshalJSON deserializes the given payload. func (o *SyntheticsPrivateLocationCreationResponseResultEncryption) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id,omitempty"` Key *string `json:"key,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *SyntheticsPrivateLocationCreationResponseResultEncryption) UnmarshalJSO } o.Id = all.Id o.Key = all.Key + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location_metadata.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location_metadata.go index e8501121d..3fbae4459 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location_metadata.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location_metadata.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SyntheticsPrivateLocationMetadata) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsPrivateLocationMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { RestrictedRoles []string `json:"restricted_roles,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *SyntheticsPrivateLocationMetadata) UnmarshalJSON(bytes []byte) (err err return err } o.RestrictedRoles = all.RestrictedRoles + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location_secrets.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location_secrets.go index f8b601302..6c663cc85 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location_secrets.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location_secrets.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SyntheticsPrivateLocationSecrets) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsPrivateLocationSecrets) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Authentication *SyntheticsPrivateLocationSecretsAuthentication `json:"authentication,omitempty"` ConfigDecryption *SyntheticsPrivateLocationSecretsConfigDecryption `json:"config_decryption,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,25 +128,24 @@ func (o *SyntheticsPrivateLocationSecrets) UnmarshalJSON(bytes []byte) (err erro } else { return err } + + hasInvalidField := false if all.Authentication != nil && all.Authentication.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Authentication = all.Authentication if all.ConfigDecryption != nil && all.ConfigDecryption.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ConfigDecryption = all.ConfigDecryption + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location_secrets_authentication.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location_secrets_authentication.go index f3aac72ab..355229bc0 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location_secrets_authentication.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location_secrets_authentication.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SyntheticsPrivateLocationSecretsAuthentication) MarshalJSON() ([]byte, e // UnmarshalJSON deserializes the given payload. func (o *SyntheticsPrivateLocationSecretsAuthentication) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id,omitempty"` Key *string `json:"key,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *SyntheticsPrivateLocationSecretsAuthentication) UnmarshalJSON(bytes []b } o.Id = all.Id o.Key = all.Key + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location_secrets_config_decryption.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location_secrets_config_decryption.go index 27c933f98..148465046 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location_secrets_config_decryption.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_private_location_secrets_config_decryption.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SyntheticsPrivateLocationSecretsConfigDecryption) MarshalJSON() ([]byte, // UnmarshalJSON deserializes the given payload. func (o *SyntheticsPrivateLocationSecretsConfigDecryption) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Key *string `json:"key,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *SyntheticsPrivateLocationSecretsConfigDecryption) UnmarshalJSON(bytes [ return err } o.Key = all.Key + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ssl_certificate.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ssl_certificate.go index cf87d7013..057d84d3b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ssl_certificate.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ssl_certificate.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -454,7 +455,6 @@ func (o SyntheticsSSLCertificate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsSSLCertificate) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Cipher *string `json:"cipher,omitempty"` Exponent *float64 `json:"exponent,omitempty"` @@ -470,12 +470,7 @@ func (o *SyntheticsSSLCertificate) UnmarshalJSON(bytes []byte) (err error) { ValidTo *time.Time `json:"validTo,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -483,35 +478,34 @@ func (o *SyntheticsSSLCertificate) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Cipher = all.Cipher o.Exponent = all.Exponent o.ExtKeyUsage = all.ExtKeyUsage o.Fingerprint = all.Fingerprint o.Fingerprint256 = all.Fingerprint256 if all.Issuer != nil && all.Issuer.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Issuer = all.Issuer o.Modulus = all.Modulus o.Protocol = all.Protocol o.SerialNumber = all.SerialNumber if all.Subject != nil && all.Subject.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Subject = all.Subject o.ValidFrom = all.ValidFrom o.ValidTo = all.ValidTo + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ssl_certificate_issuer.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ssl_certificate_issuer.go index c1715d528..fc1c8df26 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ssl_certificate_issuer.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ssl_certificate_issuer.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -247,7 +247,6 @@ func (o SyntheticsSSLCertificateIssuer) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsSSLCertificateIssuer) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { C *string `json:"C,omitempty"` Cn *string `json:"CN,omitempty"` @@ -257,12 +256,7 @@ func (o *SyntheticsSSLCertificateIssuer) UnmarshalJSON(bytes []byte) (err error) St *string `json:"ST,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -276,6 +270,7 @@ func (o *SyntheticsSSLCertificateIssuer) UnmarshalJSON(bytes []byte) (err error) o.O = all.O o.Ou = all.Ou o.St = all.St + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ssl_certificate_subject.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ssl_certificate_subject.go index 33256f8ee..0606ddcba 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ssl_certificate_subject.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_ssl_certificate_subject.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -280,7 +280,6 @@ func (o SyntheticsSSLCertificateSubject) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsSSLCertificateSubject) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { C *string `json:"C,omitempty"` Cn *string `json:"CN,omitempty"` @@ -291,12 +290,7 @@ func (o *SyntheticsSSLCertificateSubject) UnmarshalJSON(bytes []byte) (err error AltName *string `json:"altName,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -311,6 +305,7 @@ func (o *SyntheticsSSLCertificateSubject) UnmarshalJSON(bytes []byte) (err error o.Ou = all.Ou o.St = all.St o.AltName = all.AltName + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_status.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_status.go index 480a4718f..acefcfc7c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_status.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_status.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsStatus Determines whether or not the batch has passed, failed, or is in progress. @@ -65,47 +66,3 @@ func (v SyntheticsStatus) IsValid() bool { func (v SyntheticsStatus) Ptr() *SyntheticsStatus { return &v } - -// NullableSyntheticsStatus handles when a null is used for SyntheticsStatus. -type NullableSyntheticsStatus struct { - value *SyntheticsStatus - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsStatus) Get() *SyntheticsStatus { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsStatus) Set(val *SyntheticsStatus) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsStatus) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsStatus) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsStatus initializes the struct as if Set has been called. -func NewNullableSyntheticsStatus(val *SyntheticsStatus) *NullableSyntheticsStatus { - return &NullableSyntheticsStatus{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsStatus) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_step.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_step.go index e1798e0d1..4a2f8e2d4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_step.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_step.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -280,7 +280,6 @@ func (o SyntheticsStep) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsStep) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AllowFailure *bool `json:"allowFailure,omitempty"` IsCritical *bool `json:"isCritical,omitempty"` @@ -291,12 +290,7 @@ func (o *SyntheticsStep) UnmarshalJSON(bytes []byte) (err error) { Type *SyntheticsStepType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -304,24 +298,27 @@ func (o *SyntheticsStep) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.AllowFailure = all.AllowFailure o.IsCritical = all.IsCritical o.Name = all.Name o.NoScreenshot = all.NoScreenshot o.Params = all.Params o.Timeout = all.Timeout - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_step_detail.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_step_detail.go index 2944425f6..0789195e3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_step_detail.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_step_detail.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -611,7 +611,6 @@ func (o SyntheticsStepDetail) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsStepDetail) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { BrowserErrors []SyntheticsBrowserError `json:"browserErrors,omitempty"` CheckType *SyntheticsCheckType `json:"checkType,omitempty"` @@ -632,12 +631,7 @@ func (o *SyntheticsStepDetail) UnmarshalJSON(bytes []byte) (err error) { Warnings []SyntheticsStepDetailWarning `json:"warnings,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -645,50 +639,45 @@ func (o *SyntheticsStepDetail) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.CheckType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.PlayingTab; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.BrowserErrors = all.BrowserErrors - o.CheckType = all.CheckType + if all.CheckType != nil && !all.CheckType.IsValid() { + hasInvalidField = true + } else { + o.CheckType = all.CheckType + } o.Description = all.Description o.Duration = all.Duration o.Error = all.Error - o.PlayingTab = all.PlayingTab + if all.PlayingTab != nil && !all.PlayingTab.IsValid() { + hasInvalidField = true + } else { + o.PlayingTab = all.PlayingTab + } o.ScreenshotBucketKey = all.ScreenshotBucketKey o.Skipped = all.Skipped o.SnapshotBucketKey = all.SnapshotBucketKey o.StepId = all.StepId o.SubTestStepDetails = all.SubTestStepDetails o.TimeToInteractive = all.TimeToInteractive - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } o.Url = all.Url o.Value = all.Value o.VitalsMetrics = all.VitalsMetrics o.Warnings = all.Warnings + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_step_detail_warning.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_step_detail_warning.go index bd8b35e35..e862c29b8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_step_detail_warning.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_step_detail_warning.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o SyntheticsStepDetailWarning) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsStepDetailWarning) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Message *string `json:"message"` Type *SyntheticsWarningType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Message == nil { return fmt.Errorf("required field message missing") @@ -129,19 +124,22 @@ func (o *SyntheticsStepDetailWarning) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Message = *all.Message - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_step_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_step_type.go index 0fbd2e6c0..2cd959d83 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_step_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_step_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsStepType Step type used in your Synthetic test. @@ -109,47 +110,3 @@ func (v SyntheticsStepType) IsValid() bool { func (v SyntheticsStepType) Ptr() *SyntheticsStepType { return &v } - -// NullableSyntheticsStepType handles when a null is used for SyntheticsStepType. -type NullableSyntheticsStepType struct { - value *SyntheticsStepType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsStepType) Get() *SyntheticsStepType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsStepType) Set(val *SyntheticsStepType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsStepType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsStepType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsStepType initializes the struct as if Set has been called. -func NewNullableSyntheticsStepType(val *SyntheticsStepType) *NullableSyntheticsStepType { - return &NullableSyntheticsStepType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsStepType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsStepType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_call_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_call_type.go index aee6a7a94..cb5c12cc3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_call_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_call_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsTestCallType The type of gRPC call to perform. @@ -63,47 +64,3 @@ func (v SyntheticsTestCallType) IsValid() bool { func (v SyntheticsTestCallType) Ptr() *SyntheticsTestCallType { return &v } - -// NullableSyntheticsTestCallType handles when a null is used for SyntheticsTestCallType. -type NullableSyntheticsTestCallType struct { - value *SyntheticsTestCallType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsTestCallType) Get() *SyntheticsTestCallType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsTestCallType) Set(val *SyntheticsTestCallType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsTestCallType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsTestCallType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsTestCallType initializes the struct as if Set has been called. -func NewNullableSyntheticsTestCallType(val *SyntheticsTestCallType) *NullableSyntheticsTestCallType { - return &NullableSyntheticsTestCallType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsTestCallType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsTestCallType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_ci_options.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_ci_options.go index ef7108fbd..f6af41ad9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_ci_options.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_ci_options.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SyntheticsTestCiOptions) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsTestCiOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ExecutionRule *SyntheticsTestExecutionRule `json:"executionRule,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,18 +94,21 @@ func (o *SyntheticsTestCiOptions) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.ExecutionRule; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.ExecutionRule != nil && !all.ExecutionRule.IsValid() { + hasInvalidField = true + } else { + o.ExecutionRule = all.ExecutionRule } - o.ExecutionRule = all.ExecutionRule + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_config.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_config.go index 8be7a3802..3bebe5265 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_config.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_config.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -181,7 +181,6 @@ func (o SyntheticsTestConfig) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsTestConfig) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Assertions []SyntheticsAssertion `json:"assertions,omitempty"` ConfigVariables []SyntheticsConfigVariable `json:"configVariables,omitempty"` @@ -189,12 +188,7 @@ func (o *SyntheticsTestConfig) UnmarshalJSON(bytes []byte) (err error) { Variables []SyntheticsBrowserVariable `json:"variables,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -202,20 +196,23 @@ func (o *SyntheticsTestConfig) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Assertions = all.Assertions o.ConfigVariables = all.ConfigVariables if all.Request != nil && all.Request.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Request = all.Request o.Variables = all.Variables + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_details.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_details.go index 5e165f457..1dc798b40 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_details.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_details.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -480,7 +480,6 @@ func (o SyntheticsTestDetails) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsTestDetails) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Config *SyntheticsTestConfig `json:"config,omitempty"` Creator *Creator `json:"creator,omitempty"` @@ -497,12 +496,7 @@ func (o *SyntheticsTestDetails) UnmarshalJSON(bytes []byte) (err error) { Type *SyntheticsTestDetailsType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -510,44 +504,14 @@ func (o *SyntheticsTestDetails) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Subtype; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Config != nil && all.Config.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Config = all.Config if all.Creator != nil && all.Creator.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Creator = all.Creator o.Locations = all.Locations @@ -555,22 +519,35 @@ func (o *SyntheticsTestDetails) UnmarshalJSON(bytes []byte) (err error) { o.MonitorId = all.MonitorId o.Name = all.Name if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Options = all.Options o.PublicId = all.PublicId - o.Status = all.Status + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } o.Steps = all.Steps - o.Subtype = all.Subtype + if all.Subtype != nil && !all.Subtype.IsValid() { + hasInvalidField = true + } else { + o.Subtype = all.Subtype + } o.Tags = all.Tags - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_details_sub_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_details_sub_type.go index 7ca26e4c0..11c135820 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_details_sub_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_details_sub_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsTestDetailsSubType The subtype of the Synthetic API test, `http`, `ssl`, `tcp`, @@ -78,47 +79,3 @@ func (v SyntheticsTestDetailsSubType) IsValid() bool { func (v SyntheticsTestDetailsSubType) Ptr() *SyntheticsTestDetailsSubType { return &v } - -// NullableSyntheticsTestDetailsSubType handles when a null is used for SyntheticsTestDetailsSubType. -type NullableSyntheticsTestDetailsSubType struct { - value *SyntheticsTestDetailsSubType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsTestDetailsSubType) Get() *SyntheticsTestDetailsSubType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsTestDetailsSubType) Set(val *SyntheticsTestDetailsSubType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsTestDetailsSubType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsTestDetailsSubType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsTestDetailsSubType initializes the struct as if Set has been called. -func NewNullableSyntheticsTestDetailsSubType(val *SyntheticsTestDetailsSubType) *NullableSyntheticsTestDetailsSubType { - return &NullableSyntheticsTestDetailsSubType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsTestDetailsSubType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsTestDetailsSubType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_details_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_details_type.go index ffd6a0644..ec7430b2b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_details_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_details_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsTestDetailsType Type of the Synthetic test, either `api` or `browser`. @@ -63,47 +64,3 @@ func (v SyntheticsTestDetailsType) IsValid() bool { func (v SyntheticsTestDetailsType) Ptr() *SyntheticsTestDetailsType { return &v } - -// NullableSyntheticsTestDetailsType handles when a null is used for SyntheticsTestDetailsType. -type NullableSyntheticsTestDetailsType struct { - value *SyntheticsTestDetailsType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsTestDetailsType) Get() *SyntheticsTestDetailsType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsTestDetailsType) Set(val *SyntheticsTestDetailsType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsTestDetailsType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsTestDetailsType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsTestDetailsType initializes the struct as if Set has been called. -func NewNullableSyntheticsTestDetailsType(val *SyntheticsTestDetailsType) *NullableSyntheticsTestDetailsType { - return &NullableSyntheticsTestDetailsType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsTestDetailsType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsTestDetailsType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_execution_rule.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_execution_rule.go index 6012db82a..b947b0e51 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_execution_rule.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_execution_rule.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsTestExecutionRule Execution rule for a Synthetic test. @@ -65,47 +66,3 @@ func (v SyntheticsTestExecutionRule) IsValid() bool { func (v SyntheticsTestExecutionRule) Ptr() *SyntheticsTestExecutionRule { return &v } - -// NullableSyntheticsTestExecutionRule handles when a null is used for SyntheticsTestExecutionRule. -type NullableSyntheticsTestExecutionRule struct { - value *SyntheticsTestExecutionRule - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsTestExecutionRule) Get() *SyntheticsTestExecutionRule { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsTestExecutionRule) Set(val *SyntheticsTestExecutionRule) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsTestExecutionRule) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsTestExecutionRule) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsTestExecutionRule initializes the struct as if Set has been called. -func NewNullableSyntheticsTestExecutionRule(val *SyntheticsTestExecutionRule) *NullableSyntheticsTestExecutionRule { - return &NullableSyntheticsTestExecutionRule{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsTestExecutionRule) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsTestExecutionRule) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_monitor_status.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_monitor_status.go index 5f7fc1216..15157e7ec 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_monitor_status.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_monitor_status.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsTestMonitorStatus The status of your Synthetic monitor. @@ -68,47 +69,3 @@ func (v SyntheticsTestMonitorStatus) IsValid() bool { func (v SyntheticsTestMonitorStatus) Ptr() *SyntheticsTestMonitorStatus { return &v } - -// NullableSyntheticsTestMonitorStatus handles when a null is used for SyntheticsTestMonitorStatus. -type NullableSyntheticsTestMonitorStatus struct { - value *SyntheticsTestMonitorStatus - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsTestMonitorStatus) Get() *SyntheticsTestMonitorStatus { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsTestMonitorStatus) Set(val *SyntheticsTestMonitorStatus) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsTestMonitorStatus) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsTestMonitorStatus) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsTestMonitorStatus initializes the struct as if Set has been called. -func NewNullableSyntheticsTestMonitorStatus(val *SyntheticsTestMonitorStatus) *NullableSyntheticsTestMonitorStatus { - return &NullableSyntheticsTestMonitorStatus{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsTestMonitorStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsTestMonitorStatus) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_options.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_options.go index 701d727d4..6adb77677 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_options.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_options.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -788,7 +788,6 @@ func (o SyntheticsTestOptions) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsTestOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AcceptSelfSigned *bool `json:"accept_self_signed,omitempty"` AllowInsecure *bool `json:"allow_insecure,omitempty"` @@ -814,12 +813,7 @@ func (o *SyntheticsTestOptions) UnmarshalJSON(bytes []byte) (err error) { TickEvery *int64 `json:"tick_every,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -827,74 +821,57 @@ func (o *SyntheticsTestOptions) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.HttpVersion; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.AcceptSelfSigned = all.AcceptSelfSigned o.AllowInsecure = all.AllowInsecure o.CheckCertificateRevocation = all.CheckCertificateRevocation if all.Ci != nil && all.Ci.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Ci = all.Ci o.DeviceIds = all.DeviceIds o.DisableCors = all.DisableCors o.DisableCsp = all.DisableCsp o.FollowRedirects = all.FollowRedirects - o.HttpVersion = all.HttpVersion + if all.HttpVersion != nil && !all.HttpVersion.IsValid() { + hasInvalidField = true + } else { + o.HttpVersion = all.HttpVersion + } o.IgnoreServerCertificateError = all.IgnoreServerCertificateError o.InitialNavigationTimeout = all.InitialNavigationTimeout o.MinFailureDuration = all.MinFailureDuration o.MinLocationFailed = all.MinLocationFailed o.MonitorName = all.MonitorName if all.MonitorOptions != nil && all.MonitorOptions.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.MonitorOptions = all.MonitorOptions o.MonitorPriority = all.MonitorPriority o.NoScreenshot = all.NoScreenshot o.RestrictedRoles = all.RestrictedRoles if all.Retry != nil && all.Retry.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Retry = all.Retry if all.RumSettings != nil && all.RumSettings.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.RumSettings = all.RumSettings if all.Scheduling != nil && all.Scheduling.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Scheduling = all.Scheduling o.TickEvery = all.TickEvery + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_options_http_version.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_options_http_version.go index 0b8eab339..4f63c0cae 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_options_http_version.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_options_http_version.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsTestOptionsHTTPVersion HTTP version to use for a Synthetic test. @@ -65,47 +66,3 @@ func (v SyntheticsTestOptionsHTTPVersion) IsValid() bool { func (v SyntheticsTestOptionsHTTPVersion) Ptr() *SyntheticsTestOptionsHTTPVersion { return &v } - -// NullableSyntheticsTestOptionsHTTPVersion handles when a null is used for SyntheticsTestOptionsHTTPVersion. -type NullableSyntheticsTestOptionsHTTPVersion struct { - value *SyntheticsTestOptionsHTTPVersion - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsTestOptionsHTTPVersion) Get() *SyntheticsTestOptionsHTTPVersion { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsTestOptionsHTTPVersion) Set(val *SyntheticsTestOptionsHTTPVersion) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsTestOptionsHTTPVersion) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsTestOptionsHTTPVersion) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsTestOptionsHTTPVersion initializes the struct as if Set has been called. -func NewNullableSyntheticsTestOptionsHTTPVersion(val *SyntheticsTestOptionsHTTPVersion) *NullableSyntheticsTestOptionsHTTPVersion { - return &NullableSyntheticsTestOptionsHTTPVersion{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsTestOptionsHTTPVersion) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsTestOptionsHTTPVersion) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_options_monitor_options.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_options_monitor_options.go index 36653d5a4..6a33c3e39 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_options_monitor_options.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_options_monitor_options.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -84,17 +84,11 @@ func (o SyntheticsTestOptionsMonitorOptions) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsTestOptionsMonitorOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { RenotifyInterval *int64 `json:"renotify_interval,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -103,6 +97,7 @@ func (o *SyntheticsTestOptionsMonitorOptions) UnmarshalJSON(bytes []byte) (err e return err } o.RenotifyInterval = all.RenotifyInterval + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_options_retry.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_options_retry.go index a8cf021ea..56e340e9d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_options_retry.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_options_retry.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -117,18 +117,12 @@ func (o SyntheticsTestOptionsRetry) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsTestOptionsRetry) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Count *int64 `json:"count,omitempty"` Interval *float64 `json:"interval,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -138,6 +132,7 @@ func (o *SyntheticsTestOptionsRetry) UnmarshalJSON(bytes []byte) (err error) { } o.Count = all.Count o.Interval = all.Interval + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_options_scheduling.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_options_scheduling.go index 121bb2987..c51de0e12 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_options_scheduling.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_options_scheduling.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SyntheticsTestOptionsScheduling) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsTestOptionsScheduling) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Timeframes []SyntheticsTestOptionsSchedulingTimeframe `json:"timeframes,omitempty"` Timezone *string `json:"timezone,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *SyntheticsTestOptionsScheduling) UnmarshalJSON(bytes []byte) (err error } o.Timeframes = all.Timeframes o.Timezone = all.Timezone + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_options_scheduling_timeframe.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_options_scheduling_timeframe.go index 6dae0aea0..63919dfbf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_options_scheduling_timeframe.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_options_scheduling_timeframe.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o SyntheticsTestOptionsSchedulingTimeframe) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *SyntheticsTestOptionsSchedulingTimeframe) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Day *int32 `json:"day,omitempty"` From *string `json:"from,omitempty"` To *string `json:"to,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *SyntheticsTestOptionsSchedulingTimeframe) UnmarshalJSON(bytes []byte) ( o.Day = all.Day o.From = all.From o.To = all.To + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_pause_status.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_pause_status.go index f204918eb..7d1de3784 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_pause_status.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_pause_status.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsTestPauseStatus Define whether you want to start (`live`) or pause (`paused`) a @@ -64,47 +65,3 @@ func (v SyntheticsTestPauseStatus) IsValid() bool { func (v SyntheticsTestPauseStatus) Ptr() *SyntheticsTestPauseStatus { return &v } - -// NullableSyntheticsTestPauseStatus handles when a null is used for SyntheticsTestPauseStatus. -type NullableSyntheticsTestPauseStatus struct { - value *SyntheticsTestPauseStatus - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsTestPauseStatus) Get() *SyntheticsTestPauseStatus { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsTestPauseStatus) Set(val *SyntheticsTestPauseStatus) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsTestPauseStatus) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsTestPauseStatus) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsTestPauseStatus initializes the struct as if Set has been called. -func NewNullableSyntheticsTestPauseStatus(val *SyntheticsTestPauseStatus) *NullableSyntheticsTestPauseStatus { - return &NullableSyntheticsTestPauseStatus{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsTestPauseStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsTestPauseStatus) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_process_status.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_process_status.go index 300fca9ae..37ff71e52 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_process_status.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_process_status.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsTestProcessStatus Status of a Synthetic test. @@ -67,47 +68,3 @@ func (v SyntheticsTestProcessStatus) IsValid() bool { func (v SyntheticsTestProcessStatus) Ptr() *SyntheticsTestProcessStatus { return &v } - -// NullableSyntheticsTestProcessStatus handles when a null is used for SyntheticsTestProcessStatus. -type NullableSyntheticsTestProcessStatus struct { - value *SyntheticsTestProcessStatus - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsTestProcessStatus) Get() *SyntheticsTestProcessStatus { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsTestProcessStatus) Set(val *SyntheticsTestProcessStatus) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsTestProcessStatus) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsTestProcessStatus) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsTestProcessStatus initializes the struct as if Set has been called. -func NewNullableSyntheticsTestProcessStatus(val *SyntheticsTestProcessStatus) *NullableSyntheticsTestProcessStatus { - return &NullableSyntheticsTestProcessStatus{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsTestProcessStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsTestProcessStatus) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_request.go index fef53d6e7..3c01b8d52 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_request.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -48,6 +48,8 @@ type SyntheticsTestRequest struct { NoSavingResponseBody *bool `json:"noSavingResponseBody,omitempty"` // Number of pings to use per test. NumberOfPackets *int32 `json:"numberOfPackets,omitempty"` + // Persist cookies across redirects. + PersistCookies *bool `json:"persistCookies,omitempty"` // Port to use when performing the test. Port *int64 `json:"port,omitempty"` // The proxy to perform the test. @@ -592,6 +594,34 @@ func (o *SyntheticsTestRequest) SetNumberOfPackets(v int32) { o.NumberOfPackets = &v } +// GetPersistCookies returns the PersistCookies field value if set, zero value otherwise. +func (o *SyntheticsTestRequest) GetPersistCookies() bool { + if o == nil || o.PersistCookies == nil { + var ret bool + return ret + } + return *o.PersistCookies +} + +// GetPersistCookiesOk returns a tuple with the PersistCookies field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequest) GetPersistCookiesOk() (*bool, bool) { + if o == nil || o.PersistCookies == nil { + return nil, false + } + return o.PersistCookies, true +} + +// HasPersistCookies returns a boolean if a field has been set. +func (o *SyntheticsTestRequest) HasPersistCookies() bool { + return o != nil && o.PersistCookies != nil +} + +// SetPersistCookies gets a reference to the given bool and assigns it to the PersistCookies field. +func (o *SyntheticsTestRequest) SetPersistCookies(v bool) { + o.PersistCookies = &v +} + // GetPort returns the Port field value if set, zero value otherwise. func (o *SyntheticsTestRequest) GetPort() int64 { if o == nil || o.Port == nil { @@ -876,6 +906,9 @@ func (o SyntheticsTestRequest) MarshalJSON() ([]byte, error) { if o.NumberOfPackets != nil { toSerialize["numberOfPackets"] = o.NumberOfPackets } + if o.PersistCookies != nil { + toSerialize["persistCookies"] = o.PersistCookies + } if o.Port != nil { toSerialize["port"] = o.Port } @@ -909,7 +942,6 @@ func (o SyntheticsTestRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsTestRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AllowInsecure *bool `json:"allow_insecure,omitempty"` BasicAuth *SyntheticsBasicAuth `json:"basicAuth,omitempty"` @@ -929,6 +961,7 @@ func (o *SyntheticsTestRequest) UnmarshalJSON(bytes []byte) (err error) { Method *string `json:"method,omitempty"` NoSavingResponseBody *bool `json:"noSavingResponseBody,omitempty"` NumberOfPackets *int32 `json:"numberOfPackets,omitempty"` + PersistCookies *bool `json:"persistCookies,omitempty"` Port *int64 `json:"port,omitempty"` Proxy *SyntheticsTestRequestProxy `json:"proxy,omitempty"` Query interface{} `json:"query,omitempty"` @@ -939,46 +972,31 @@ func (o *SyntheticsTestRequest) UnmarshalJSON(bytes []byte) (err error) { Url *string `json:"url,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"allow_insecure", "basicAuth", "body", "bodyType", "callType", "certificate", "certificateDomains", "compressedJsonDescriptor", "dnsServer", "dnsServerPort", "follow_redirects", "headers", "host", "message", "metadata", "method", "noSavingResponseBody", "numberOfPackets", "port", "proxy", "query", "servername", "service", "shouldTrackHops", "timeout", "url"}) + datadog.DeleteKeys(additionalProperties, &[]string{"allow_insecure", "basicAuth", "body", "bodyType", "callType", "certificate", "certificateDomains", "compressedJsonDescriptor", "dnsServer", "dnsServerPort", "follow_redirects", "headers", "host", "message", "metadata", "method", "noSavingResponseBody", "numberOfPackets", "persistCookies", "port", "proxy", "query", "servername", "service", "shouldTrackHops", "timeout", "url"}) } else { return err } - if v := all.BodyType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.CallType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.AllowInsecure = all.AllowInsecure o.BasicAuth = all.BasicAuth o.Body = all.Body - o.BodyType = all.BodyType - o.CallType = all.CallType + if all.BodyType != nil && !all.BodyType.IsValid() { + hasInvalidField = true + } else { + o.BodyType = all.BodyType + } + if all.CallType != nil && !all.CallType.IsValid() { + hasInvalidField = true + } else { + o.CallType = all.CallType + } if all.Certificate != nil && all.Certificate.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Certificate = all.Certificate o.CertificateDomains = all.CertificateDomains @@ -993,13 +1011,10 @@ func (o *SyntheticsTestRequest) UnmarshalJSON(bytes []byte) (err error) { o.Method = all.Method o.NoSavingResponseBody = all.NoSavingResponseBody o.NumberOfPackets = all.NumberOfPackets + o.PersistCookies = all.PersistCookies o.Port = all.Port if all.Proxy != nil && all.Proxy.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Proxy = all.Proxy o.Query = all.Query @@ -1008,9 +1023,14 @@ func (o *SyntheticsTestRequest) UnmarshalJSON(bytes []byte) (err error) { o.ShouldTrackHops = all.ShouldTrackHops o.Timeout = all.Timeout o.Url = all.Url + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_request_body_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_request_body_type.go index 2dabf7327..72c354391 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_request_body_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_request_body_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsTestRequestBodyType Type of the request body. @@ -71,47 +72,3 @@ func (v SyntheticsTestRequestBodyType) IsValid() bool { func (v SyntheticsTestRequestBodyType) Ptr() *SyntheticsTestRequestBodyType { return &v } - -// NullableSyntheticsTestRequestBodyType handles when a null is used for SyntheticsTestRequestBodyType. -type NullableSyntheticsTestRequestBodyType struct { - value *SyntheticsTestRequestBodyType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsTestRequestBodyType) Get() *SyntheticsTestRequestBodyType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsTestRequestBodyType) Set(val *SyntheticsTestRequestBodyType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsTestRequestBodyType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsTestRequestBodyType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsTestRequestBodyType initializes the struct as if Set has been called. -func NewNullableSyntheticsTestRequestBodyType(val *SyntheticsTestRequestBodyType) *NullableSyntheticsTestRequestBodyType { - return &NullableSyntheticsTestRequestBodyType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsTestRequestBodyType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsTestRequestBodyType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_request_certificate.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_request_certificate.go index 1b6b8456f..11295862a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_request_certificate.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_request_certificate.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SyntheticsTestRequestCertificate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsTestRequestCertificate) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Cert *SyntheticsTestRequestCertificateItem `json:"cert,omitempty"` Key *SyntheticsTestRequestCertificateItem `json:"key,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,25 +128,24 @@ func (o *SyntheticsTestRequestCertificate) UnmarshalJSON(bytes []byte) (err erro } else { return err } + + hasInvalidField := false if all.Cert != nil && all.Cert.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Cert = all.Cert if all.Key != nil && all.Key.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Key = all.Key + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_request_certificate_item.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_request_certificate_item.go index 5775c3e20..df4bdb08a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_request_certificate_item.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_request_certificate_item.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o SyntheticsTestRequestCertificateItem) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsTestRequestCertificateItem) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Content *string `json:"content,omitempty"` Filename *string `json:"filename,omitempty"` UpdatedAt *string `json:"updatedAt,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *SyntheticsTestRequestCertificateItem) UnmarshalJSON(bytes []byte) (err o.Content = all.Content o.Filename = all.Filename o.UpdatedAt = all.UpdatedAt + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_request_proxy.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_request_proxy.go index 7d3a85429..55fc209ed 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_request_proxy.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_test_request_proxy.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o SyntheticsTestRequestProxy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsTestRequestProxy) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Headers map[string]string `json:"headers,omitempty"` Url *string `json:"url"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Url == nil { return fmt.Errorf("required field url missing") @@ -134,6 +129,7 @@ func (o *SyntheticsTestRequestProxy) UnmarshalJSON(bytes []byte) (err error) { } o.Headers = all.Headers o.Url = *all.Url + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_timing.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_timing.go index dd47e5c31..3c92672eb 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_timing.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_timing.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -347,7 +347,6 @@ func (o SyntheticsTiming) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsTiming) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Dns *float64 `json:"dns,omitempty"` Download *float64 `json:"download,omitempty"` @@ -360,12 +359,7 @@ func (o *SyntheticsTiming) UnmarshalJSON(bytes []byte) (err error) { Wait *float64 `json:"wait,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -382,6 +376,7 @@ func (o *SyntheticsTiming) UnmarshalJSON(bytes []byte) (err error) { o.Tcp = all.Tcp o.Total = all.Total o.Wait = all.Wait + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_trigger_body.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_trigger_body.go index 7c998bbdc..920437b85 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_trigger_body.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_trigger_body.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o SyntheticsTriggerBody) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsTriggerBody) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Tests *[]SyntheticsTriggerTest `json:"tests"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Tests == nil { return fmt.Errorf("required field tests missing") @@ -99,6 +94,7 @@ func (o *SyntheticsTriggerBody) UnmarshalJSON(bytes []byte) (err error) { return err } o.Tests = *all.Tests + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_trigger_ci_test_location.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_trigger_ci_test_location.go index b00fba955..a3d1d9549 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_trigger_ci_test_location.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_trigger_ci_test_location.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SyntheticsTriggerCITestLocation) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsTriggerCITestLocation) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *int64 `json:"id,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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *SyntheticsTriggerCITestLocation) UnmarshalJSON(bytes []byte) (err error } o.Id = all.Id o.Name = all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_trigger_ci_test_run_result.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_trigger_ci_test_run_result.go index 677755fcd..5d9e15241 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_trigger_ci_test_run_result.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_trigger_ci_test_run_result.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -181,7 +181,6 @@ func (o SyntheticsTriggerCITestRunResult) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsTriggerCITestRunResult) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Device *SyntheticsDeviceID `json:"device,omitempty"` Location *int64 `json:"location,omitempty"` @@ -189,12 +188,7 @@ func (o *SyntheticsTriggerCITestRunResult) UnmarshalJSON(bytes []byte) (err erro ResultId *string `json:"result_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -202,21 +196,24 @@ func (o *SyntheticsTriggerCITestRunResult) UnmarshalJSON(bytes []byte) (err erro } else { return err } - if v := all.Device; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.Device != nil && !all.Device.IsValid() { + hasInvalidField = true + } else { + o.Device = all.Device } - o.Device = all.Device o.Location = all.Location o.PublicId = all.PublicId o.ResultId = all.ResultId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_trigger_ci_tests_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_trigger_ci_tests_response.go index dc00ce63a..60f8a4582 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_trigger_ci_tests_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_trigger_ci_tests_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -192,7 +192,6 @@ func (o SyntheticsTriggerCITestsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsTriggerCITestsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { BatchId datadog.NullableString `json:"batch_id,omitempty"` Locations []SyntheticsTriggerCITestLocation `json:"locations,omitempty"` @@ -200,12 +199,7 @@ func (o *SyntheticsTriggerCITestsResponse) UnmarshalJSON(bytes []byte) (err erro TriggeredCheckIds []string `json:"triggered_check_ids,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -217,6 +211,7 @@ func (o *SyntheticsTriggerCITestsResponse) UnmarshalJSON(bytes []byte) (err erro o.Locations = all.Locations o.Results = all.Results o.TriggeredCheckIds = all.TriggeredCheckIds + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_trigger_test_.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_trigger_test_.go index fc5e64ec9..f461f0ea2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_trigger_test_.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_trigger_test_.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o SyntheticsTriggerTest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsTriggerTest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Metadata *SyntheticsCIBatchMetadata `json:"metadata,omitempty"` PublicId *string `json:"public_id"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.PublicId == nil { return fmt.Errorf("required field public_id missing") @@ -132,18 +127,21 @@ func (o *SyntheticsTriggerTest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Metadata = all.Metadata o.PublicId = *all.PublicId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_update_test_pause_status_payload.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_update_test_pause_status_payload.go index 706f30d0f..72f577be4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_update_test_pause_status_payload.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_update_test_pause_status_payload.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -83,17 +83,11 @@ func (o SyntheticsUpdateTestPauseStatusPayload) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsUpdateTestPauseStatusPayload) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { NewStatus *SyntheticsTestPauseStatus `json:"new_status,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,18 +95,21 @@ func (o *SyntheticsUpdateTestPauseStatusPayload) UnmarshalJSON(bytes []byte) (er } else { return err } - if v := all.NewStatus; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.NewStatus != nil && !all.NewStatus.IsValid() { + hasInvalidField = true + } else { + o.NewStatus = all.NewStatus } - o.NewStatus = all.NewStatus + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_variable_parser.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_variable_parser.go index 83f5895ac..d933391c1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_variable_parser.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_variable_parser.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o SyntheticsVariableParser) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsVariableParser) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Type *SyntheticsGlobalVariableParserType `json:"type"` Value *string `json:"value,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -132,19 +127,22 @@ func (o *SyntheticsVariableParser) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type } - o.Type = *all.Type o.Value = all.Value + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_warning_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_warning_type.go index 2162c6e4a..e293ae2e7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_warning_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_synthetics_warning_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SyntheticsWarningType User locator used. @@ -61,47 +62,3 @@ func (v SyntheticsWarningType) IsValid() bool { func (v SyntheticsWarningType) Ptr() *SyntheticsWarningType { return &v } - -// NullableSyntheticsWarningType handles when a null is used for SyntheticsWarningType. -type NullableSyntheticsWarningType struct { - value *SyntheticsWarningType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsWarningType) Get() *SyntheticsWarningType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsWarningType) Set(val *SyntheticsWarningType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsWarningType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsWarningType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsWarningType initializes the struct as if Set has been called. -func NewNullableSyntheticsWarningType(val *SyntheticsWarningType) *NullableSyntheticsWarningType { - return &NullableSyntheticsWarningType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsWarningType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsWarningType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_table_widget_cell_display_mode.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_table_widget_cell_display_mode.go index 9956fdcdd..4a3c29737 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_table_widget_cell_display_mode.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_table_widget_cell_display_mode.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // TableWidgetCellDisplayMode Define a display mode for the table cell. @@ -63,47 +64,3 @@ func (v TableWidgetCellDisplayMode) IsValid() bool { func (v TableWidgetCellDisplayMode) Ptr() *TableWidgetCellDisplayMode { return &v } - -// NullableTableWidgetCellDisplayMode handles when a null is used for TableWidgetCellDisplayMode. -type NullableTableWidgetCellDisplayMode struct { - value *TableWidgetCellDisplayMode - isSet bool -} - -// Get returns the associated value. -func (v NullableTableWidgetCellDisplayMode) Get() *TableWidgetCellDisplayMode { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTableWidgetCellDisplayMode) Set(val *TableWidgetCellDisplayMode) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTableWidgetCellDisplayMode) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTableWidgetCellDisplayMode) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTableWidgetCellDisplayMode initializes the struct as if Set has been called. -func NewNullableTableWidgetCellDisplayMode(val *TableWidgetCellDisplayMode) *NullableTableWidgetCellDisplayMode { - return &NullableTableWidgetCellDisplayMode{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTableWidgetCellDisplayMode) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTableWidgetCellDisplayMode) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_table_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_table_widget_definition.go index 8c181ba98..166800616 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_table_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_table_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -304,7 +305,6 @@ func (o TableWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TableWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` HasSearchBar *TableWidgetHasSearchBar `json:"has_search_bar,omitempty"` @@ -316,12 +316,7 @@ func (o *TableWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { Type *TableWidgetDefinitionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Requests == nil { return fmt.Errorf("required field requests missing") @@ -335,48 +330,39 @@ func (o *TableWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.HasSearchBar; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.CustomLinks = all.CustomLinks - o.HasSearchBar = all.HasSearchBar + if all.HasSearchBar != nil && !all.HasSearchBar.IsValid() { + hasInvalidField = true + } else { + o.HasSearchBar = all.HasSearchBar + } o.Requests = *all.Requests if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Time = all.Time o.Title = all.Title - o.TitleAlign = all.TitleAlign + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } o.TitleSize = all.TitleSize - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_table_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_table_widget_definition_type.go index fcb9fa07a..053037b7c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_table_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_table_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // TableWidgetDefinitionType Type of the table widget. @@ -61,47 +62,3 @@ func (v TableWidgetDefinitionType) IsValid() bool { func (v TableWidgetDefinitionType) Ptr() *TableWidgetDefinitionType { return &v } - -// NullableTableWidgetDefinitionType handles when a null is used for TableWidgetDefinitionType. -type NullableTableWidgetDefinitionType struct { - value *TableWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableTableWidgetDefinitionType) Get() *TableWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTableWidgetDefinitionType) Set(val *TableWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTableWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTableWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTableWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableTableWidgetDefinitionType(val *TableWidgetDefinitionType) *NullableTableWidgetDefinitionType { - return &NullableTableWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTableWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTableWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_table_widget_has_search_bar.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_table_widget_has_search_bar.go index b1c6510f1..ed9f48f9b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_table_widget_has_search_bar.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_table_widget_has_search_bar.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // TableWidgetHasSearchBar Controls the display of the search bar. @@ -65,47 +66,3 @@ func (v TableWidgetHasSearchBar) IsValid() bool { func (v TableWidgetHasSearchBar) Ptr() *TableWidgetHasSearchBar { return &v } - -// NullableTableWidgetHasSearchBar handles when a null is used for TableWidgetHasSearchBar. -type NullableTableWidgetHasSearchBar struct { - value *TableWidgetHasSearchBar - isSet bool -} - -// Get returns the associated value. -func (v NullableTableWidgetHasSearchBar) Get() *TableWidgetHasSearchBar { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTableWidgetHasSearchBar) Set(val *TableWidgetHasSearchBar) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTableWidgetHasSearchBar) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTableWidgetHasSearchBar) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTableWidgetHasSearchBar initializes the struct as if Set has been called. -func NewNullableTableWidgetHasSearchBar(val *TableWidgetHasSearchBar) *NullableTableWidgetHasSearchBar { - return &NullableTableWidgetHasSearchBar{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTableWidgetHasSearchBar) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTableWidgetHasSearchBar) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_table_widget_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_table_widget_request.go index dcc08774c..40952b1d9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_table_widget_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_table_widget_request.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -44,7 +44,7 @@ type TableWidgetRequest struct { Q *string `json:"q,omitempty"` // List of queries that can be returned directly or used in formulas. Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - // Timeseries or Scalar response. + // Timeseries, scalar, or event list response. Event list response formats are supported by Geomap widgets. ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` // The log query. RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` @@ -676,7 +676,6 @@ func (o TableWidgetRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TableWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregator *WidgetAggregator `json:"aggregator,omitempty"` Alias *string `json:"alias,omitempty"` @@ -699,12 +698,7 @@ func (o *TableWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -712,115 +706,74 @@ func (o *TableWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Aggregator; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Order; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ResponseFormat; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregator = all.Aggregator + + hasInvalidField := false + if all.Aggregator != nil && !all.Aggregator.IsValid() { + hasInvalidField = true + } else { + o.Aggregator = all.Aggregator + } o.Alias = all.Alias if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ApmQuery = all.ApmQuery if all.ApmStatsQuery != nil && all.ApmStatsQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ApmStatsQuery = all.ApmStatsQuery o.CellDisplayMode = all.CellDisplayMode o.ConditionalFormats = all.ConditionalFormats if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.EventQuery = all.EventQuery o.Formulas = all.Formulas o.Limit = all.Limit if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LogQuery = all.LogQuery if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.NetworkQuery = all.NetworkQuery - o.Order = all.Order + if all.Order != nil && !all.Order.IsValid() { + hasInvalidField = true + } else { + o.Order = all.Order + } if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ProcessQuery = all.ProcessQuery if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ProfileMetricsQuery = all.ProfileMetricsQuery o.Q = all.Q o.Queries = all.Queries - o.ResponseFormat = all.ResponseFormat + if all.ResponseFormat != nil && !all.ResponseFormat.IsValid() { + hasInvalidField = true + } else { + o.ResponseFormat = all.ResponseFormat + } if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.RumQuery = all.RumQuery if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.SecurityQuery = all.SecurityQuery + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tag_to_hosts.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tag_to_hosts.go index a2eb113a3..21d1455ca 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tag_to_hosts.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tag_to_hosts.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o TagToHosts) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TagToHosts) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Tags map[string][]string `json:"tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *TagToHosts) UnmarshalJSON(bytes []byte) (err error) { return err } o.Tags = all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_target_format_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_target_format_type.go index 97fadc891..57114b79b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_target_format_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_target_format_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // TargetFormatType If the `target_type` of the remapper is `attribute`, try to cast the value to a new specific type. @@ -69,47 +70,3 @@ func (v TargetFormatType) IsValid() bool { func (v TargetFormatType) Ptr() *TargetFormatType { return &v } - -// NullableTargetFormatType handles when a null is used for TargetFormatType. -type NullableTargetFormatType struct { - value *TargetFormatType - isSet bool -} - -// Get returns the associated value. -func (v NullableTargetFormatType) Get() *TargetFormatType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTargetFormatType) Set(val *TargetFormatType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTargetFormatType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTargetFormatType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTargetFormatType initializes the struct as if Set has been called. -func NewNullableTargetFormatType(val *TargetFormatType) *NullableTargetFormatType { - return &NullableTargetFormatType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTargetFormatType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTargetFormatType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_background.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_background.go index ac04e7bc0..9a94f35e2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_background.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_background.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -112,18 +113,12 @@ func (o TimeseriesBackground) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TimeseriesBackground) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Type *TimeseriesBackgroundType `json:"type"` Yaxis *WidgetAxis `json:"yaxis,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -134,26 +129,25 @@ func (o *TimeseriesBackground) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if !all.Type.IsValid() { + hasInvalidField = true + } else { + 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Yaxis = all.Yaxis + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_background_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_background_type.go index 3f7aa0422..9faaad3c3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_background_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_background_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // TimeseriesBackgroundType Timeseries is made using an area or bars. @@ -63,47 +64,3 @@ func (v TimeseriesBackgroundType) IsValid() bool { func (v TimeseriesBackgroundType) Ptr() *TimeseriesBackgroundType { return &v } - -// NullableTimeseriesBackgroundType handles when a null is used for TimeseriesBackgroundType. -type NullableTimeseriesBackgroundType struct { - value *TimeseriesBackgroundType - isSet bool -} - -// Get returns the associated value. -func (v NullableTimeseriesBackgroundType) Get() *TimeseriesBackgroundType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTimeseriesBackgroundType) Set(val *TimeseriesBackgroundType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTimeseriesBackgroundType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTimeseriesBackgroundType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTimeseriesBackgroundType initializes the struct as if Set has been called. -func NewNullableTimeseriesBackgroundType(val *TimeseriesBackgroundType) *NullableTimeseriesBackgroundType { - return &NullableTimeseriesBackgroundType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTimeseriesBackgroundType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTimeseriesBackgroundType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_widget_definition.go index 8f9367b47..719a52a08 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -535,7 +536,6 @@ func (o TimeseriesWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TimeseriesWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` Events []WidgetEvent `json:"events,omitempty"` @@ -554,12 +554,7 @@ func (o *TimeseriesWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { Yaxis *WidgetAxis `json:"yaxis,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Requests == nil { return fmt.Errorf("required field requests missing") @@ -573,69 +568,52 @@ func (o *TimeseriesWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.LegendLayout; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.CustomLinks = all.CustomLinks o.Events = all.Events o.LegendColumns = all.LegendColumns - o.LegendLayout = all.LegendLayout + if all.LegendLayout != nil && !all.LegendLayout.IsValid() { + hasInvalidField = true + } else { + o.LegendLayout = all.LegendLayout + } o.LegendSize = all.LegendSize o.Markers = all.Markers o.Requests = *all.Requests if all.RightYaxis != nil && all.RightYaxis.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.RightYaxis = all.RightYaxis o.ShowLegend = all.ShowLegend if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Time = all.Time o.Title = all.Title - o.TitleAlign = all.TitleAlign + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } o.TitleSize = all.TitleSize - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } if all.Yaxis != nil && all.Yaxis.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Yaxis = all.Yaxis + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_widget_definition_type.go index 3546c94a9..7ef4475dc 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // TimeseriesWidgetDefinitionType Type of the timeseries widget. @@ -61,47 +62,3 @@ func (v TimeseriesWidgetDefinitionType) IsValid() bool { func (v TimeseriesWidgetDefinitionType) Ptr() *TimeseriesWidgetDefinitionType { return &v } - -// NullableTimeseriesWidgetDefinitionType handles when a null is used for TimeseriesWidgetDefinitionType. -type NullableTimeseriesWidgetDefinitionType struct { - value *TimeseriesWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableTimeseriesWidgetDefinitionType) Get() *TimeseriesWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTimeseriesWidgetDefinitionType) Set(val *TimeseriesWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTimeseriesWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTimeseriesWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTimeseriesWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableTimeseriesWidgetDefinitionType(val *TimeseriesWidgetDefinitionType) *NullableTimeseriesWidgetDefinitionType { - return &NullableTimeseriesWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTimeseriesWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTimeseriesWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_widget_expression_alias.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_widget_expression_alias.go index a550b2e51..4ff9938b5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_widget_expression_alias.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_widget_expression_alias.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o TimeseriesWidgetExpressionAlias) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TimeseriesWidgetExpressionAlias) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AliasName *string `json:"alias_name,omitempty"` Expression *string `json:"expression"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Expression == nil { return fmt.Errorf("required field expression missing") @@ -134,6 +129,7 @@ func (o *TimeseriesWidgetExpressionAlias) UnmarshalJSON(bytes []byte) (err error } o.AliasName = all.AliasName o.Expression = *all.Expression + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_widget_legend_column.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_widget_legend_column.go index 305362972..373b9a8b2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_widget_legend_column.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_widget_legend_column.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // TimeseriesWidgetLegendColumn Legend column. @@ -69,47 +70,3 @@ func (v TimeseriesWidgetLegendColumn) IsValid() bool { func (v TimeseriesWidgetLegendColumn) Ptr() *TimeseriesWidgetLegendColumn { return &v } - -// NullableTimeseriesWidgetLegendColumn handles when a null is used for TimeseriesWidgetLegendColumn. -type NullableTimeseriesWidgetLegendColumn struct { - value *TimeseriesWidgetLegendColumn - isSet bool -} - -// Get returns the associated value. -func (v NullableTimeseriesWidgetLegendColumn) Get() *TimeseriesWidgetLegendColumn { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTimeseriesWidgetLegendColumn) Set(val *TimeseriesWidgetLegendColumn) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTimeseriesWidgetLegendColumn) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTimeseriesWidgetLegendColumn) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTimeseriesWidgetLegendColumn initializes the struct as if Set has been called. -func NewNullableTimeseriesWidgetLegendColumn(val *TimeseriesWidgetLegendColumn) *NullableTimeseriesWidgetLegendColumn { - return &NullableTimeseriesWidgetLegendColumn{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTimeseriesWidgetLegendColumn) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTimeseriesWidgetLegendColumn) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_widget_legend_layout.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_widget_legend_layout.go index 4870eaaba..cd319a57d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_widget_legend_layout.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_widget_legend_layout.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // TimeseriesWidgetLegendLayout Layout of the legend. @@ -65,47 +66,3 @@ func (v TimeseriesWidgetLegendLayout) IsValid() bool { func (v TimeseriesWidgetLegendLayout) Ptr() *TimeseriesWidgetLegendLayout { return &v } - -// NullableTimeseriesWidgetLegendLayout handles when a null is used for TimeseriesWidgetLegendLayout. -type NullableTimeseriesWidgetLegendLayout struct { - value *TimeseriesWidgetLegendLayout - isSet bool -} - -// Get returns the associated value. -func (v NullableTimeseriesWidgetLegendLayout) Get() *TimeseriesWidgetLegendLayout { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTimeseriesWidgetLegendLayout) Set(val *TimeseriesWidgetLegendLayout) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTimeseriesWidgetLegendLayout) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTimeseriesWidgetLegendLayout) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTimeseriesWidgetLegendLayout initializes the struct as if Set has been called. -func NewNullableTimeseriesWidgetLegendLayout(val *TimeseriesWidgetLegendLayout) *NullableTimeseriesWidgetLegendLayout { - return &NullableTimeseriesWidgetLegendLayout{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTimeseriesWidgetLegendLayout) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTimeseriesWidgetLegendLayout) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_widget_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_widget_request.go index 97465db68..c8f9867a4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_widget_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_timeseries_widget_request.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -38,7 +38,7 @@ type TimeseriesWidgetRequest struct { Q *string `json:"q,omitempty"` // List of queries that can be returned directly or used in formulas. Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - // Timeseries or Scalar response. + // Timeseries, scalar, or event list response. Event list response formats are supported by Geomap widgets. ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` // The log query. RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` @@ -610,7 +610,6 @@ func (o TimeseriesWidgetRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TimeseriesWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` AuditQuery *LogQueryDefinition `json:"audit_query,omitempty"` @@ -631,12 +630,7 @@ func (o *TimeseriesWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { Style *WidgetRequestStyle `json:"style,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -644,112 +638,71 @@ func (o *TimeseriesWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.DisplayType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ResponseFormat; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ApmQuery = all.ApmQuery if all.AuditQuery != nil && all.AuditQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.AuditQuery = all.AuditQuery - o.DisplayType = all.DisplayType + if all.DisplayType != nil && !all.DisplayType.IsValid() { + hasInvalidField = true + } else { + o.DisplayType = all.DisplayType + } if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.EventQuery = all.EventQuery o.Formulas = all.Formulas if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LogQuery = all.LogQuery o.Metadata = all.Metadata if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.NetworkQuery = all.NetworkQuery o.OnRightYaxis = all.OnRightYaxis if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ProcessQuery = all.ProcessQuery if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ProfileMetricsQuery = all.ProfileMetricsQuery o.Q = all.Q o.Queries = all.Queries - o.ResponseFormat = all.ResponseFormat + if all.ResponseFormat != nil && !all.ResponseFormat.IsValid() { + hasInvalidField = true + } else { + o.ResponseFormat = all.ResponseFormat + } if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.RumQuery = all.RumQuery if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.SecurityQuery = all.SecurityQuery if all.Style != nil && all.Style.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Style = all.Style + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_toplist_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_toplist_widget_definition.go index 8519d86f2..ca5d2d8a2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_toplist_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_toplist_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -271,7 +272,6 @@ func (o ToplistWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ToplistWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` Requests *[]ToplistWidgetRequest `json:"requests"` @@ -282,12 +282,7 @@ func (o *ToplistWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { Type *ToplistWidgetDefinitionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Requests == nil { return fmt.Errorf("required field requests missing") @@ -301,39 +296,34 @@ func (o *ToplistWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.CustomLinks = all.CustomLinks o.Requests = *all.Requests if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Time = all.Time o.Title = all.Title - o.TitleAlign = all.TitleAlign + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } o.TitleSize = all.TitleSize - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_toplist_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_toplist_widget_definition_type.go index 6d6c0b5aa..2d75be527 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_toplist_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_toplist_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ToplistWidgetDefinitionType Type of the top list widget. @@ -61,47 +62,3 @@ func (v ToplistWidgetDefinitionType) IsValid() bool { func (v ToplistWidgetDefinitionType) Ptr() *ToplistWidgetDefinitionType { return &v } - -// NullableToplistWidgetDefinitionType handles when a null is used for ToplistWidgetDefinitionType. -type NullableToplistWidgetDefinitionType struct { - value *ToplistWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableToplistWidgetDefinitionType) Get() *ToplistWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableToplistWidgetDefinitionType) Set(val *ToplistWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableToplistWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableToplistWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableToplistWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableToplistWidgetDefinitionType(val *ToplistWidgetDefinitionType) *NullableToplistWidgetDefinitionType { - return &NullableToplistWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableToplistWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableToplistWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_toplist_widget_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_toplist_widget_request.go index d5fe82856..906f53703 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_toplist_widget_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_toplist_widget_request.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -34,7 +34,7 @@ type ToplistWidgetRequest struct { Q *string `json:"q,omitempty"` // List of queries that can be returned directly or used in formulas. Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - // Timeseries or Scalar response. + // Timeseries, scalar, or event list response. Event list response formats are supported by Geomap widgets. ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` // The log query. RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` @@ -544,7 +544,6 @@ func (o ToplistWidgetRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ToplistWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` AuditQuery *LogQueryDefinition `json:"audit_query,omitempty"` @@ -563,12 +562,7 @@ func (o *ToplistWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { Style *WidgetRequestStyle `json:"style,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -576,102 +570,65 @@ func (o *ToplistWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.ResponseFormat; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ApmQuery = all.ApmQuery if all.AuditQuery != nil && all.AuditQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.AuditQuery = all.AuditQuery o.ConditionalFormats = all.ConditionalFormats if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.EventQuery = all.EventQuery o.Formulas = all.Formulas if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LogQuery = all.LogQuery if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.NetworkQuery = all.NetworkQuery if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ProcessQuery = all.ProcessQuery if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ProfileMetricsQuery = all.ProfileMetricsQuery o.Q = all.Q o.Queries = all.Queries - o.ResponseFormat = all.ResponseFormat + if all.ResponseFormat != nil && !all.ResponseFormat.IsValid() { + hasInvalidField = true + } else { + o.ResponseFormat = all.ResponseFormat + } if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.RumQuery = all.RumQuery if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.SecurityQuery = all.SecurityQuery if all.Style != nil && all.Style.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Style = all.Style + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_topology_map_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_topology_map_widget_definition.go index 84df583e5..0dee30068 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_topology_map_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_topology_map_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -238,7 +239,6 @@ func (o TopologyMapWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TopologyMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` Requests *[]TopologyRequest `json:"requests"` @@ -248,12 +248,7 @@ func (o *TopologyMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { Type *TopologyMapWidgetDefinitionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Requests == nil { return fmt.Errorf("required field requests missing") @@ -267,31 +262,30 @@ func (o *TopologyMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.CustomLinks = all.CustomLinks o.Requests = *all.Requests o.Title = all.Title - o.TitleAlign = all.TitleAlign + if all.TitleAlign != nil && !all.TitleAlign.IsValid() { + hasInvalidField = true + } else { + o.TitleAlign = all.TitleAlign + } o.TitleSize = all.TitleSize - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_topology_map_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_topology_map_widget_definition_type.go index 41689f30d..c75e77233 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_topology_map_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_topology_map_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // TopologyMapWidgetDefinitionType Type of the topology map widget. @@ -61,47 +62,3 @@ func (v TopologyMapWidgetDefinitionType) IsValid() bool { func (v TopologyMapWidgetDefinitionType) Ptr() *TopologyMapWidgetDefinitionType { return &v } - -// NullableTopologyMapWidgetDefinitionType handles when a null is used for TopologyMapWidgetDefinitionType. -type NullableTopologyMapWidgetDefinitionType struct { - value *TopologyMapWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableTopologyMapWidgetDefinitionType) Get() *TopologyMapWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTopologyMapWidgetDefinitionType) Set(val *TopologyMapWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTopologyMapWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTopologyMapWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTopologyMapWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableTopologyMapWidgetDefinitionType(val *TopologyMapWidgetDefinitionType) *NullableTopologyMapWidgetDefinitionType { - return &NullableTopologyMapWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTopologyMapWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTopologyMapWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_topology_query.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_topology_query.go index bc0cf92f9..b74da409d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_topology_query.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_topology_query.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o TopologyQuery) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TopologyQuery) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DataSource *TopologyQueryDataSource `json:"data_source,omitempty"` Filters []string `json:"filters,omitempty"` Service *string `json:"service,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,20 +162,23 @@ func (o *TopologyQuery) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.DataSource; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.DataSource != nil && !all.DataSource.IsValid() { + hasInvalidField = true + } else { + o.DataSource = all.DataSource } - o.DataSource = all.DataSource o.Filters = all.Filters o.Service = all.Service + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_topology_query_data_source.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_topology_query_data_source.go index 3cec93db5..bfd2ee618 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_topology_query_data_source.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_topology_query_data_source.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // TopologyQueryDataSource Name of the data source @@ -63,47 +64,3 @@ func (v TopologyQueryDataSource) IsValid() bool { func (v TopologyQueryDataSource) Ptr() *TopologyQueryDataSource { return &v } - -// NullableTopologyQueryDataSource handles when a null is used for TopologyQueryDataSource. -type NullableTopologyQueryDataSource struct { - value *TopologyQueryDataSource - isSet bool -} - -// Get returns the associated value. -func (v NullableTopologyQueryDataSource) Get() *TopologyQueryDataSource { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTopologyQueryDataSource) Set(val *TopologyQueryDataSource) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTopologyQueryDataSource) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTopologyQueryDataSource) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTopologyQueryDataSource initializes the struct as if Set has been called. -func NewNullableTopologyQueryDataSource(val *TopologyQueryDataSource) *NullableTopologyQueryDataSource { - return &NullableTopologyQueryDataSource{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTopologyQueryDataSource) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTopologyQueryDataSource) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_topology_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_topology_request.go index 3278ab413..f1670407d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_topology_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_topology_request.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o TopologyRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TopologyRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Query *TopologyQuery `json:"query,omitempty"` RequestType *TopologyRequestType `json:"request_type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,26 +128,25 @@ func (o *TopologyRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.RequestType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Query != nil && all.Query.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Query = all.Query - o.RequestType = all.RequestType + if all.RequestType != nil && !all.RequestType.IsValid() { + hasInvalidField = true + } else { + o.RequestType = all.RequestType + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_topology_request_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_topology_request_type.go index 333166c6d..13afcc374 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_topology_request_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_topology_request_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // TopologyRequestType Widget request type. @@ -61,47 +62,3 @@ func (v TopologyRequestType) IsValid() bool { func (v TopologyRequestType) Ptr() *TopologyRequestType { return &v } - -// NullableTopologyRequestType handles when a null is used for TopologyRequestType. -type NullableTopologyRequestType struct { - value *TopologyRequestType - isSet bool -} - -// Get returns the associated value. -func (v NullableTopologyRequestType) Get() *TopologyRequestType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTopologyRequestType) Set(val *TopologyRequestType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTopologyRequestType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTopologyRequestType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTopologyRequestType initializes the struct as if Set has been called. -func NewNullableTopologyRequestType(val *TopologyRequestType) *NullableTopologyRequestType { - return &NullableTopologyRequestType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTopologyRequestType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTopologyRequestType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tree_map_color_by.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tree_map_color_by.go index fe6a2ba4e..b9d84398e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tree_map_color_by.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tree_map_color_by.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // TreeMapColorBy (deprecated) The attribute formerly used to determine color in the widget. @@ -61,47 +62,3 @@ func (v TreeMapColorBy) IsValid() bool { func (v TreeMapColorBy) Ptr() *TreeMapColorBy { return &v } - -// NullableTreeMapColorBy handles when a null is used for TreeMapColorBy. -type NullableTreeMapColorBy struct { - value *TreeMapColorBy - isSet bool -} - -// Get returns the associated value. -func (v NullableTreeMapColorBy) Get() *TreeMapColorBy { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTreeMapColorBy) Set(val *TreeMapColorBy) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTreeMapColorBy) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTreeMapColorBy) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTreeMapColorBy initializes the struct as if Set has been called. -func NewNullableTreeMapColorBy(val *TreeMapColorBy) *NullableTreeMapColorBy { - return &NullableTreeMapColorBy{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTreeMapColorBy) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTreeMapColorBy) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tree_map_group_by.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tree_map_group_by.go index 8188eac6c..1727d7f14 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tree_map_group_by.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tree_map_group_by.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // TreeMapGroupBy (deprecated) The attribute formerly used to group elements in the widget. @@ -65,47 +66,3 @@ func (v TreeMapGroupBy) IsValid() bool { func (v TreeMapGroupBy) Ptr() *TreeMapGroupBy { return &v } - -// NullableTreeMapGroupBy handles when a null is used for TreeMapGroupBy. -type NullableTreeMapGroupBy struct { - value *TreeMapGroupBy - isSet bool -} - -// Get returns the associated value. -func (v NullableTreeMapGroupBy) Get() *TreeMapGroupBy { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTreeMapGroupBy) Set(val *TreeMapGroupBy) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTreeMapGroupBy) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTreeMapGroupBy) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTreeMapGroupBy initializes the struct as if Set has been called. -func NewNullableTreeMapGroupBy(val *TreeMapGroupBy) *NullableTreeMapGroupBy { - return &NullableTreeMapGroupBy{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTreeMapGroupBy) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTreeMapGroupBy) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tree_map_size_by.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tree_map_size_by.go index 7b40b83c4..fe710f181 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tree_map_size_by.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tree_map_size_by.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // TreeMapSizeBy (deprecated) The attribute formerly used to determine size in the widget. @@ -63,47 +64,3 @@ func (v TreeMapSizeBy) IsValid() bool { func (v TreeMapSizeBy) Ptr() *TreeMapSizeBy { return &v } - -// NullableTreeMapSizeBy handles when a null is used for TreeMapSizeBy. -type NullableTreeMapSizeBy struct { - value *TreeMapSizeBy - isSet bool -} - -// Get returns the associated value. -func (v NullableTreeMapSizeBy) Get() *TreeMapSizeBy { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTreeMapSizeBy) Set(val *TreeMapSizeBy) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTreeMapSizeBy) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTreeMapSizeBy) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTreeMapSizeBy initializes the struct as if Set has been called. -func NewNullableTreeMapSizeBy(val *TreeMapSizeBy) *NullableTreeMapSizeBy { - return &NullableTreeMapSizeBy{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTreeMapSizeBy) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTreeMapSizeBy) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tree_map_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tree_map_widget_definition.go index 14047f0e3..6c17a9286 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tree_map_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tree_map_widget_definition.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -320,7 +321,6 @@ func (o TreeMapWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TreeMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ColorBy *TreeMapColorBy `json:"color_by,omitempty"` CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` @@ -332,12 +332,7 @@ func (o *TreeMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { Type *TreeMapWidgetDefinitionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Requests == nil { return fmt.Errorf("required field requests missing") @@ -351,56 +346,43 @@ func (o *TreeMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.ColorBy; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.GroupBy; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.SizeBy; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ColorBy = all.ColorBy + + hasInvalidField := false + if all.ColorBy != nil && !all.ColorBy.IsValid() { + hasInvalidField = true + } else { + o.ColorBy = all.ColorBy + } o.CustomLinks = all.CustomLinks - o.GroupBy = all.GroupBy + if all.GroupBy != nil && !all.GroupBy.IsValid() { + hasInvalidField = true + } else { + o.GroupBy = all.GroupBy + } o.Requests = *all.Requests - o.SizeBy = all.SizeBy + if all.SizeBy != nil && !all.SizeBy.IsValid() { + hasInvalidField = true + } else { + o.SizeBy = all.SizeBy + } if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Time = all.Time o.Title = all.Title - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tree_map_widget_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tree_map_widget_definition_type.go index 26f2844fb..c9e7ed6d6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tree_map_widget_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tree_map_widget_definition_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // TreeMapWidgetDefinitionType Type of the treemap widget. @@ -61,47 +62,3 @@ func (v TreeMapWidgetDefinitionType) IsValid() bool { func (v TreeMapWidgetDefinitionType) Ptr() *TreeMapWidgetDefinitionType { return &v } - -// NullableTreeMapWidgetDefinitionType handles when a null is used for TreeMapWidgetDefinitionType. -type NullableTreeMapWidgetDefinitionType struct { - value *TreeMapWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableTreeMapWidgetDefinitionType) Get() *TreeMapWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTreeMapWidgetDefinitionType) Set(val *TreeMapWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTreeMapWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTreeMapWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTreeMapWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableTreeMapWidgetDefinitionType(val *TreeMapWidgetDefinitionType) *NullableTreeMapWidgetDefinitionType { - return &NullableTreeMapWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTreeMapWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTreeMapWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tree_map_widget_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tree_map_widget_request.go index e8f3ecda2..58bc62b2c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tree_map_widget_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_tree_map_widget_request.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -18,7 +18,7 @@ type TreeMapWidgetRequest struct { Q *string `json:"q,omitempty"` // List of queries that can be returned directly or used in formulas. Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - // Timeseries or Scalar response. + // Timeseries, scalar, or event list response. Event list response formats are supported by Geomap widgets. ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` @@ -181,7 +181,6 @@ func (o TreeMapWidgetRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TreeMapWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Formulas []WidgetFormula `json:"formulas,omitempty"` Q *string `json:"q,omitempty"` @@ -189,12 +188,7 @@ func (o *TreeMapWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -202,21 +196,24 @@ func (o *TreeMapWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.ResponseFormat; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Formulas = all.Formulas o.Q = all.Q o.Queries = all.Queries - o.ResponseFormat = all.ResponseFormat + if all.ResponseFormat != nil && !all.ResponseFormat.IsValid() { + hasInvalidField = true + } else { + o.ResponseFormat = all.ResponseFormat + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_analyzed_logs_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_analyzed_logs_hour.go index 1cdc3d82c..fc81a4417 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_analyzed_logs_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_analyzed_logs_hour.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -197,7 +198,6 @@ func (o UsageAnalyzedLogsHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageAnalyzedLogsHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AnalyzedLogs datadog.NullableInt64 `json:"analyzed_logs,omitempty"` Hour *time.Time `json:"hour,omitempty"` @@ -205,12 +205,7 @@ func (o *UsageAnalyzedLogsHour) UnmarshalJSON(bytes []byte) (err error) { PublicId *string `json:"public_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -222,6 +217,7 @@ func (o *UsageAnalyzedLogsHour) UnmarshalJSON(bytes []byte) (err error) { o.Hour = all.Hour o.OrgName = all.OrgName o.PublicId = all.PublicId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_analyzed_logs_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_analyzed_logs_response.go index ae1dc3910..962581732 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_analyzed_logs_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_analyzed_logs_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageAnalyzedLogsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageAnalyzedLogsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageAnalyzedLogsHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageAnalyzedLogsResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_aggregates_body.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_aggregates_body.go index 250c2f310..2d90907f0 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_aggregates_body.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_aggregates_body.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o UsageAttributionAggregatesBody) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageAttributionAggregatesBody) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AggType *string `json:"agg_type,omitempty"` Field *string `json:"field,omitempty"` Value *float64 `json:"value,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *UsageAttributionAggregatesBody) UnmarshalJSON(bytes []byte) (err error) o.AggType = all.AggType o.Field = all.Field o.Value = all.Value + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_body.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_body.go index 1b99efdc7..2be1f07ec 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_body.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_body.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -290,7 +291,6 @@ func (o UsageAttributionBody) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageAttributionBody) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Month *time.Time `json:"month,omitempty"` OrgName *string `json:"org_name,omitempty"` @@ -301,12 +301,7 @@ func (o *UsageAttributionBody) UnmarshalJSON(bytes []byte) (err error) { Values *UsageAttributionValues `json:"values,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -314,6 +309,8 @@ func (o *UsageAttributionBody) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Month = all.Month o.OrgName = all.OrgName o.PublicId = all.PublicId @@ -321,16 +318,17 @@ func (o *UsageAttributionBody) UnmarshalJSON(bytes []byte) (err error) { o.Tags = all.Tags o.UpdatedAt = all.UpdatedAt if all.Values != nil && all.Values.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Values = all.Values + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_metadata.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_metadata.go index 5c919ca66..c40f315e3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_metadata.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_metadata.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o UsageAttributionMetadata) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageAttributionMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregates []UsageAttributionAggregatesBody `json:"aggregates,omitempty"` Pagination *UsageAttributionPagination `json:"pagination,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *UsageAttributionMetadata) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Aggregates = all.Aggregates if all.Pagination != nil && all.Pagination.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Pagination = all.Pagination + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_pagination.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_pagination.go index ccd7c228d..b8ed4c5f1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_pagination.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_pagination.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -214,7 +214,6 @@ func (o UsageAttributionPagination) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageAttributionPagination) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Limit *int64 `json:"limit,omitempty"` Offset *int64 `json:"offset,omitempty"` @@ -223,12 +222,7 @@ func (o *UsageAttributionPagination) UnmarshalJSON(bytes []byte) (err error) { TotalNumberOfRecords *int64 `json:"total_number_of_records,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -241,6 +235,7 @@ func (o *UsageAttributionPagination) UnmarshalJSON(bytes []byte) (err error) { o.SortDirection = all.SortDirection o.SortName = all.SortName o.TotalNumberOfRecords = all.TotalNumberOfRecords + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_response.go index 397f23bbe..0f939b563 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o UsageAttributionResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageAttributionResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Metadata *UsageAttributionMetadata `json:"metadata,omitempty"` Usage []UsageAttributionBody `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *UsageAttributionResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Metadata = all.Metadata o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_sort.go index f996e8bd6..ec858a5a2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_sort.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_sort.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // UsageAttributionSort The field to sort by. @@ -131,47 +132,3 @@ func (v UsageAttributionSort) IsValid() bool { func (v UsageAttributionSort) Ptr() *UsageAttributionSort { return &v } - -// NullableUsageAttributionSort handles when a null is used for UsageAttributionSort. -type NullableUsageAttributionSort struct { - value *UsageAttributionSort - isSet bool -} - -// Get returns the associated value. -func (v NullableUsageAttributionSort) Get() *UsageAttributionSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableUsageAttributionSort) Set(val *UsageAttributionSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableUsageAttributionSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableUsageAttributionSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableUsageAttributionSort initializes the struct as if Set has been called. -func NewNullableUsageAttributionSort(val *UsageAttributionSort) *NullableUsageAttributionSort { - return &NullableUsageAttributionSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableUsageAttributionSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableUsageAttributionSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_supported_metrics.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_supported_metrics.go index 8f506c950..42dc6d6b5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_supported_metrics.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_supported_metrics.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // UsageAttributionSupportedMetrics Supported fields for usage attribution requests (valid requests contain one or more metrics, or `*` for all). @@ -153,47 +154,3 @@ func (v UsageAttributionSupportedMetrics) IsValid() bool { func (v UsageAttributionSupportedMetrics) Ptr() *UsageAttributionSupportedMetrics { return &v } - -// NullableUsageAttributionSupportedMetrics handles when a null is used for UsageAttributionSupportedMetrics. -type NullableUsageAttributionSupportedMetrics struct { - value *UsageAttributionSupportedMetrics - isSet bool -} - -// Get returns the associated value. -func (v NullableUsageAttributionSupportedMetrics) Get() *UsageAttributionSupportedMetrics { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableUsageAttributionSupportedMetrics) Set(val *UsageAttributionSupportedMetrics) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableUsageAttributionSupportedMetrics) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableUsageAttributionSupportedMetrics) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableUsageAttributionSupportedMetrics initializes the struct as if Set has been called. -func NewNullableUsageAttributionSupportedMetrics(val *UsageAttributionSupportedMetrics) *NullableUsageAttributionSupportedMetrics { - return &NullableUsageAttributionSupportedMetrics{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableUsageAttributionSupportedMetrics) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableUsageAttributionSupportedMetrics) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_values.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_values.go index 3006d565b..babffe45e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_values.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_attribution_values.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -1765,7 +1765,6 @@ func (o UsageAttributionValues) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageAttributionValues) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApiPercentage *float64 `json:"api_percentage,omitempty"` ApiUsage *float64 `json:"api_usage,omitempty"` @@ -1821,12 +1820,7 @@ func (o *UsageAttributionValues) UnmarshalJSON(bytes []byte) (err error) { SnmpUsage *float64 `json:"snmp_usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -1886,6 +1880,7 @@ func (o *UsageAttributionValues) UnmarshalJSON(bytes []byte) (err error) { o.ProfiledHostsUsage = all.ProfiledHostsUsage o.SnmpPercentage = all.SnmpPercentage o.SnmpUsage = all.SnmpUsage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_audit_logs_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_audit_logs_hour.go index b18efe6c4..51c8e7a1f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_audit_logs_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_audit_logs_hour.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -197,7 +198,6 @@ func (o UsageAuditLogsHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageAuditLogsHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Hour *time.Time `json:"hour,omitempty"` LinesIndexed datadog.NullableInt64 `json:"lines_indexed,omitempty"` @@ -205,12 +205,7 @@ func (o *UsageAuditLogsHour) UnmarshalJSON(bytes []byte) (err error) { PublicId *string `json:"public_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -222,6 +217,7 @@ func (o *UsageAuditLogsHour) UnmarshalJSON(bytes []byte) (err error) { o.LinesIndexed = all.LinesIndexed o.OrgName = all.OrgName o.PublicId = all.PublicId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_audit_logs_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_audit_logs_response.go index a34d31ff6..a698b903d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_audit_logs_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_audit_logs_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageAuditLogsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageAuditLogsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageAuditLogsHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageAuditLogsResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_billable_summary_body.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_billable_summary_body.go index 987c16f34..accab02ca 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_billable_summary_body.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_billable_summary_body.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -289,7 +290,6 @@ func (o UsageBillableSummaryBody) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageBillableSummaryBody) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AccountBillableUsage *int64 `json:"account_billable_usage,omitempty"` ElapsedUsageHours *int64 `json:"elapsed_usage_hours,omitempty"` @@ -300,12 +300,7 @@ func (o *UsageBillableSummaryBody) UnmarshalJSON(bytes []byte) (err error) { UsageUnit *string `json:"usage_unit,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -320,6 +315,7 @@ func (o *UsageBillableSummaryBody) UnmarshalJSON(bytes []byte) (err error) { o.OrgBillableUsage = all.OrgBillableUsage o.PercentageInAccount = all.PercentageInAccount o.UsageUnit = all.UsageUnit + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_billable_summary_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_billable_summary_hour.go index f74c41994..28fef6f22 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_billable_summary_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_billable_summary_hour.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -355,7 +356,6 @@ func (o UsageBillableSummaryHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageBillableSummaryHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { BillingPlan *string `json:"billing_plan,omitempty"` EndDate *time.Time `json:"end_date,omitempty"` @@ -368,12 +368,7 @@ func (o *UsageBillableSummaryHour) UnmarshalJSON(bytes []byte) (err error) { Usage *UsageBillableSummaryKeys `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -381,6 +376,8 @@ func (o *UsageBillableSummaryHour) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.BillingPlan = all.BillingPlan o.EndDate = all.EndDate o.NumOrgs = all.NumOrgs @@ -390,16 +387,17 @@ func (o *UsageBillableSummaryHour) UnmarshalJSON(bytes []byte) (err error) { o.Region = all.Region o.StartDate = all.StartDate if all.Usage != nil && all.Usage.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_billable_summary_keys.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_billable_summary_keys.go index 62c8509fa..52fed1210 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_billable_summary_keys.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_billable_summary_keys.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -2953,7 +2953,6 @@ func (o UsageBillableSummaryKeys) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageBillableSummaryKeys) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApmFargateAverage *UsageBillableSummaryBody `json:"apm_fargate_average,omitempty"` ApmFargateSum *UsageBillableSummaryBody `json:"apm_fargate_sum,omitempty"` @@ -3045,12 +3044,7 @@ func (o *UsageBillableSummaryKeys) UnmarshalJSON(bytes []byte) (err error) { TimeseriesSum *UsageBillableSummaryBody `json:"timeseries_sum,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -3058,713 +3052,368 @@ func (o *UsageBillableSummaryKeys) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.ApmFargateAverage != nil && all.ApmFargateAverage.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ApmFargateAverage = all.ApmFargateAverage if all.ApmFargateSum != nil && all.ApmFargateSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ApmFargateSum = all.ApmFargateSum if all.ApmHostSum != nil && all.ApmHostSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ApmHostSum = all.ApmHostSum if all.ApmHostTop99p != nil && all.ApmHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ApmHostTop99p = all.ApmHostTop99p if all.ApmProfilerHostSum != nil && all.ApmProfilerHostSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ApmProfilerHostSum = all.ApmProfilerHostSum if all.ApmProfilerHostTop99p != nil && all.ApmProfilerHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ApmProfilerHostTop99p = all.ApmProfilerHostTop99p if all.ApmTraceSearchSum != nil && all.ApmTraceSearchSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ApmTraceSearchSum = all.ApmTraceSearchSum if all.ApplicationSecurityFargateAverage != nil && all.ApplicationSecurityFargateAverage.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ApplicationSecurityFargateAverage = all.ApplicationSecurityFargateAverage if all.ApplicationSecurityHostSum != nil && all.ApplicationSecurityHostSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ApplicationSecurityHostSum = all.ApplicationSecurityHostSum if all.ApplicationSecurityHostTop99p != nil && all.ApplicationSecurityHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ApplicationSecurityHostTop99p = all.ApplicationSecurityHostTop99p if all.CiPipelineIndexedSpansSum != nil && all.CiPipelineIndexedSpansSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.CiPipelineIndexedSpansSum = all.CiPipelineIndexedSpansSum if all.CiPipelineMaximum != nil && all.CiPipelineMaximum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.CiPipelineMaximum = all.CiPipelineMaximum if all.CiPipelineSum != nil && all.CiPipelineSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.CiPipelineSum = all.CiPipelineSum if all.CiTestIndexedSpansSum != nil && all.CiTestIndexedSpansSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.CiTestIndexedSpansSum = all.CiTestIndexedSpansSum if all.CiTestingMaximum != nil && all.CiTestingMaximum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.CiTestingMaximum = all.CiTestingMaximum if all.CiTestingSum != nil && all.CiTestingSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.CiTestingSum = all.CiTestingSum if all.CloudCostManagementAverage != nil && all.CloudCostManagementAverage.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.CloudCostManagementAverage = all.CloudCostManagementAverage if all.CloudCostManagementSum != nil && all.CloudCostManagementSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.CloudCostManagementSum = all.CloudCostManagementSum if all.CspmContainerSum != nil && all.CspmContainerSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.CspmContainerSum = all.CspmContainerSum if all.CspmHostSum != nil && all.CspmHostSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.CspmHostSum = all.CspmHostSum if all.CspmHostTop99p != nil && all.CspmHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.CspmHostTop99p = all.CspmHostTop99p if all.CustomEventSum != nil && all.CustomEventSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.CustomEventSum = all.CustomEventSum if all.CwsContainerSum != nil && all.CwsContainerSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.CwsContainerSum = all.CwsContainerSum if all.CwsHostSum != nil && all.CwsHostSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.CwsHostSum = all.CwsHostSum if all.CwsHostTop99p != nil && all.CwsHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.CwsHostTop99p = all.CwsHostTop99p if all.DbmHostSum != nil && all.DbmHostSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.DbmHostSum = all.DbmHostSum if all.DbmHostTop99p != nil && all.DbmHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.DbmHostTop99p = all.DbmHostTop99p if all.DbmNormalizedQueriesAverage != nil && all.DbmNormalizedQueriesAverage.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.DbmNormalizedQueriesAverage = all.DbmNormalizedQueriesAverage if all.DbmNormalizedQueriesSum != nil && all.DbmNormalizedQueriesSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.DbmNormalizedQueriesSum = all.DbmNormalizedQueriesSum if all.FargateContainerApmAndProfilerAverage != nil && all.FargateContainerApmAndProfilerAverage.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.FargateContainerApmAndProfilerAverage = all.FargateContainerApmAndProfilerAverage if all.FargateContainerApmAndProfilerSum != nil && all.FargateContainerApmAndProfilerSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.FargateContainerApmAndProfilerSum = all.FargateContainerApmAndProfilerSum if all.FargateContainerAverage != nil && all.FargateContainerAverage.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.FargateContainerAverage = all.FargateContainerAverage if all.FargateContainerProfilerAverage != nil && all.FargateContainerProfilerAverage.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.FargateContainerProfilerAverage = all.FargateContainerProfilerAverage if all.FargateContainerProfilerSum != nil && all.FargateContainerProfilerSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.FargateContainerProfilerSum = all.FargateContainerProfilerSum if all.FargateContainerSum != nil && all.FargateContainerSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.FargateContainerSum = all.FargateContainerSum if all.IncidentManagementMaximum != nil && all.IncidentManagementMaximum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.IncidentManagementMaximum = all.IncidentManagementMaximum if all.IncidentManagementSum != nil && all.IncidentManagementSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.IncidentManagementSum = all.IncidentManagementSum if all.InfraAndApmHostSum != nil && all.InfraAndApmHostSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.InfraAndApmHostSum = all.InfraAndApmHostSum if all.InfraAndApmHostTop99p != nil && all.InfraAndApmHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.InfraAndApmHostTop99p = all.InfraAndApmHostTop99p if all.InfraContainerSum != nil && all.InfraContainerSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.InfraContainerSum = all.InfraContainerSum if all.InfraHostSum != nil && all.InfraHostSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.InfraHostSum = all.InfraHostSum if all.InfraHostTop99p != nil && all.InfraHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.InfraHostTop99p = all.InfraHostTop99p if all.IngestedSpansSum != nil && all.IngestedSpansSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.IngestedSpansSum = all.IngestedSpansSum if all.IngestedTimeseriesAverage != nil && all.IngestedTimeseriesAverage.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.IngestedTimeseriesAverage = all.IngestedTimeseriesAverage if all.IngestedTimeseriesSum != nil && all.IngestedTimeseriesSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.IngestedTimeseriesSum = all.IngestedTimeseriesSum if all.IotSum != nil && all.IotSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.IotSum = all.IotSum if all.IotTop99p != nil && all.IotTop99p.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.IotTop99p = all.IotTop99p if all.LambdaFunctionAverage != nil && all.LambdaFunctionAverage.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LambdaFunctionAverage = all.LambdaFunctionAverage if all.LambdaFunctionSum != nil && all.LambdaFunctionSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LambdaFunctionSum = all.LambdaFunctionSum if all.LogsForwardingSum != nil && all.LogsForwardingSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LogsForwardingSum = all.LogsForwardingSum if all.LogsIndexed15daySum != nil && all.LogsIndexed15daySum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LogsIndexed15daySum = all.LogsIndexed15daySum if all.LogsIndexed180daySum != nil && all.LogsIndexed180daySum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LogsIndexed180daySum = all.LogsIndexed180daySum if all.LogsIndexed30daySum != nil && all.LogsIndexed30daySum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LogsIndexed30daySum = all.LogsIndexed30daySum if all.LogsIndexed360daySum != nil && all.LogsIndexed360daySum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LogsIndexed360daySum = all.LogsIndexed360daySum if all.LogsIndexed3daySum != nil && all.LogsIndexed3daySum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LogsIndexed3daySum = all.LogsIndexed3daySum if all.LogsIndexed45daySum != nil && all.LogsIndexed45daySum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LogsIndexed45daySum = all.LogsIndexed45daySum if all.LogsIndexed60daySum != nil && all.LogsIndexed60daySum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LogsIndexed60daySum = all.LogsIndexed60daySum if all.LogsIndexed7daySum != nil && all.LogsIndexed7daySum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LogsIndexed7daySum = all.LogsIndexed7daySum if all.LogsIndexed90daySum != nil && all.LogsIndexed90daySum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LogsIndexed90daySum = all.LogsIndexed90daySum if all.LogsIndexedCustomRetentionSum != nil && all.LogsIndexedCustomRetentionSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LogsIndexedCustomRetentionSum = all.LogsIndexedCustomRetentionSum if all.LogsIndexedSum != nil && all.LogsIndexedSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LogsIndexedSum = all.LogsIndexedSum if all.LogsIngestedSum != nil && all.LogsIngestedSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LogsIngestedSum = all.LogsIngestedSum if all.NetworkDeviceSum != nil && all.NetworkDeviceSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.NetworkDeviceSum = all.NetworkDeviceSum if all.NetworkDeviceTop99p != nil && all.NetworkDeviceTop99p.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.NetworkDeviceTop99p = all.NetworkDeviceTop99p if all.NpmFlowSum != nil && all.NpmFlowSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.NpmFlowSum = all.NpmFlowSum if all.NpmHostSum != nil && all.NpmHostSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.NpmHostSum = all.NpmHostSum if all.NpmHostTop99p != nil && all.NpmHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.NpmHostTop99p = all.NpmHostTop99p if all.ObservabilityPipelineSum != nil && all.ObservabilityPipelineSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ObservabilityPipelineSum = all.ObservabilityPipelineSum if all.OnlineArchiveSum != nil && all.OnlineArchiveSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.OnlineArchiveSum = all.OnlineArchiveSum if all.ProfContainerSum != nil && all.ProfContainerSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ProfContainerSum = all.ProfContainerSum if all.ProfHostSum != nil && all.ProfHostSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ProfHostSum = all.ProfHostSum if all.ProfHostTop99p != nil && all.ProfHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ProfHostTop99p = all.ProfHostTop99p if all.RumLiteSum != nil && all.RumLiteSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.RumLiteSum = all.RumLiteSum if all.RumReplaySum != nil && all.RumReplaySum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.RumReplaySum = all.RumReplaySum if all.RumSum != nil && all.RumSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.RumSum = all.RumSum if all.RumUnitsSum != nil && all.RumUnitsSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.RumUnitsSum = all.RumUnitsSum if all.SensitiveDataScannerSum != nil && all.SensitiveDataScannerSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.SensitiveDataScannerSum = all.SensitiveDataScannerSum if all.ServerlessApmSum != nil && all.ServerlessApmSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ServerlessApmSum = all.ServerlessApmSum if all.ServerlessInfraAverage != nil && all.ServerlessInfraAverage.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ServerlessInfraAverage = all.ServerlessInfraAverage if all.ServerlessInfraSum != nil && all.ServerlessInfraSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ServerlessInfraSum = all.ServerlessInfraSum if all.ServerlessInvocationSum != nil && all.ServerlessInvocationSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ServerlessInvocationSum = all.ServerlessInvocationSum if all.SiemSum != nil && all.SiemSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.SiemSum = all.SiemSum if all.StandardTimeseriesAverage != nil && all.StandardTimeseriesAverage.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.StandardTimeseriesAverage = all.StandardTimeseriesAverage if all.SyntheticsApiTestsSum != nil && all.SyntheticsApiTestsSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.SyntheticsApiTestsSum = all.SyntheticsApiTestsSum if all.SyntheticsAppTestingMaximum != nil && all.SyntheticsAppTestingMaximum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.SyntheticsAppTestingMaximum = all.SyntheticsAppTestingMaximum if all.SyntheticsBrowserChecksSum != nil && all.SyntheticsBrowserChecksSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.SyntheticsBrowserChecksSum = all.SyntheticsBrowserChecksSum if all.TimeseriesAverage != nil && all.TimeseriesAverage.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.TimeseriesAverage = all.TimeseriesAverage if all.TimeseriesSum != nil && all.TimeseriesSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.TimeseriesSum = all.TimeseriesSum + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_billable_summary_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_billable_summary_response.go index 7d912614e..2d14cb102 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_billable_summary_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_billable_summary_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageBillableSummaryResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageBillableSummaryResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageBillableSummaryHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageBillableSummaryResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_ci_visibility_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_ci_visibility_hour.go index e02ef3776..77f979604 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_ci_visibility_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_ci_visibility_hour.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -16,6 +16,8 @@ type UsageCIVisibilityHour struct { CiPipelineIndexedSpans datadog.NullableInt64 `json:"ci_pipeline_indexed_spans,omitempty"` // The number of spans for tests in the queried hour. CiTestIndexedSpans datadog.NullableInt64 `json:"ci_test_indexed_spans,omitempty"` + // Shows the total count of all active Git committers for Intelligent Test Runner in the current month. A committer is active if they commit at least 3 times in a given month. + CiVisibilityItrCommitters datadog.NullableInt64 `json:"ci_visibility_itr_committers,omitempty"` // Shows the total count of all active Git committers for Pipelines in the current month. A committer is active if they commit at least 3 times in a given month. CiVisibilityPipelineCommitters datadog.NullableInt64 `json:"ci_visibility_pipeline_committers,omitempty"` // The total count of all active Git committers for tests in the current month. A committer is active if they commit at least 3 times in a given month. @@ -124,6 +126,45 @@ func (o *UsageCIVisibilityHour) UnsetCiTestIndexedSpans() { o.CiTestIndexedSpans.Unset() } +// GetCiVisibilityItrCommitters returns the CiVisibilityItrCommitters field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UsageCIVisibilityHour) GetCiVisibilityItrCommitters() int64 { + if o == nil || o.CiVisibilityItrCommitters.Get() == nil { + var ret int64 + return ret + } + return *o.CiVisibilityItrCommitters.Get() +} + +// GetCiVisibilityItrCommittersOk returns a tuple with the CiVisibilityItrCommitters field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *UsageCIVisibilityHour) GetCiVisibilityItrCommittersOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.CiVisibilityItrCommitters.Get(), o.CiVisibilityItrCommitters.IsSet() +} + +// HasCiVisibilityItrCommitters returns a boolean if a field has been set. +func (o *UsageCIVisibilityHour) HasCiVisibilityItrCommitters() bool { + return o != nil && o.CiVisibilityItrCommitters.IsSet() +} + +// SetCiVisibilityItrCommitters gets a reference to the given datadog.NullableInt64 and assigns it to the CiVisibilityItrCommitters field. +func (o *UsageCIVisibilityHour) SetCiVisibilityItrCommitters(v int64) { + o.CiVisibilityItrCommitters.Set(&v) +} + +// SetCiVisibilityItrCommittersNil sets the value for CiVisibilityItrCommitters to be an explicit nil. +func (o *UsageCIVisibilityHour) SetCiVisibilityItrCommittersNil() { + o.CiVisibilityItrCommitters.Set(nil) +} + +// UnsetCiVisibilityItrCommitters ensures that no value is present for CiVisibilityItrCommitters, not even an explicit nil. +func (o *UsageCIVisibilityHour) UnsetCiVisibilityItrCommitters() { + o.CiVisibilityItrCommitters.Unset() +} + // GetCiVisibilityPipelineCommitters returns the CiVisibilityPipelineCommitters field value if set, zero value otherwise (both if not set or set to explicit null). func (o *UsageCIVisibilityHour) GetCiVisibilityPipelineCommitters() int64 { if o == nil || o.CiVisibilityPipelineCommitters.Get() == nil { @@ -270,6 +311,9 @@ func (o UsageCIVisibilityHour) MarshalJSON() ([]byte, error) { if o.CiTestIndexedSpans.IsSet() { toSerialize["ci_test_indexed_spans"] = o.CiTestIndexedSpans.Get() } + if o.CiVisibilityItrCommitters.IsSet() { + toSerialize["ci_visibility_itr_committers"] = o.CiVisibilityItrCommitters.Get() + } if o.CiVisibilityPipelineCommitters.IsSet() { toSerialize["ci_visibility_pipeline_committers"] = o.CiVisibilityPipelineCommitters.Get() } @@ -291,35 +335,32 @@ func (o UsageCIVisibilityHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageCIVisibilityHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CiPipelineIndexedSpans datadog.NullableInt64 `json:"ci_pipeline_indexed_spans,omitempty"` CiTestIndexedSpans datadog.NullableInt64 `json:"ci_test_indexed_spans,omitempty"` + CiVisibilityItrCommitters datadog.NullableInt64 `json:"ci_visibility_itr_committers,omitempty"` CiVisibilityPipelineCommitters datadog.NullableInt64 `json:"ci_visibility_pipeline_committers,omitempty"` CiVisibilityTestCommitters datadog.NullableInt64 `json:"ci_visibility_test_committers,omitempty"` OrgName *string `json:"org_name,omitempty"` PublicId *string `json:"public_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"ci_pipeline_indexed_spans", "ci_test_indexed_spans", "ci_visibility_pipeline_committers", "ci_visibility_test_committers", "org_name", "public_id"}) + datadog.DeleteKeys(additionalProperties, &[]string{"ci_pipeline_indexed_spans", "ci_test_indexed_spans", "ci_visibility_itr_committers", "ci_visibility_pipeline_committers", "ci_visibility_test_committers", "org_name", "public_id"}) } else { return err } o.CiPipelineIndexedSpans = all.CiPipelineIndexedSpans o.CiTestIndexedSpans = all.CiTestIndexedSpans + o.CiVisibilityItrCommitters = all.CiVisibilityItrCommitters o.CiVisibilityPipelineCommitters = all.CiVisibilityPipelineCommitters o.CiVisibilityTestCommitters = all.CiVisibilityTestCommitters o.OrgName = all.OrgName o.PublicId = all.PublicId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_ci_visibility_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_ci_visibility_response.go index 68728a73e..62907b68c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_ci_visibility_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_ci_visibility_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageCIVisibilityResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageCIVisibilityResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageCIVisibilityHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageCIVisibilityResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_cloud_security_posture_management_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_cloud_security_posture_management_hour.go index d74b5e47b..6384f14d6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_cloud_security_posture_management_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_cloud_security_posture_management_hour.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -461,7 +462,6 @@ func (o UsageCloudSecurityPostureManagementHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageCloudSecurityPostureManagementHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AasHostCount datadog.NullableFloat64 `json:"aas_host_count,omitempty"` AwsHostCount datadog.NullableFloat64 `json:"aws_host_count,omitempty"` @@ -475,12 +475,7 @@ func (o *UsageCloudSecurityPostureManagementHour) UnmarshalJSON(bytes []byte) (e PublicId *string `json:"public_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -498,6 +493,7 @@ func (o *UsageCloudSecurityPostureManagementHour) UnmarshalJSON(bytes []byte) (e o.Hour = all.Hour o.OrgName = all.OrgName o.PublicId = all.PublicId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_cloud_security_posture_management_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_cloud_security_posture_management_response.go index 6c560ceb3..9a54854ff 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_cloud_security_posture_management_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_cloud_security_posture_management_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageCloudSecurityPostureManagementResponse) MarshalJSON() ([]byte, erro // UnmarshalJSON deserializes the given payload. func (o *UsageCloudSecurityPostureManagementResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageCloudSecurityPostureManagementHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageCloudSecurityPostureManagementResponse) UnmarshalJSON(bytes []byte return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_custom_reports_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_custom_reports_attributes.go index ef2a1b271..f58738799 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_custom_reports_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_custom_reports_attributes.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -214,7 +214,6 @@ func (o UsageCustomReportsAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageCustomReportsAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ComputedOn *string `json:"computed_on,omitempty"` EndDate *string `json:"end_date,omitempty"` @@ -223,12 +222,7 @@ func (o *UsageCustomReportsAttributes) UnmarshalJSON(bytes []byte) (err error) { Tags []string `json:"tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -241,6 +235,7 @@ func (o *UsageCustomReportsAttributes) UnmarshalJSON(bytes []byte) (err error) { o.Size = all.Size o.StartDate = all.StartDate o.Tags = all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_custom_reports_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_custom_reports_data.go index 767018b95..4e52fe77c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_custom_reports_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_custom_reports_data.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o UsageCustomReportsData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageCustomReportsData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *UsageCustomReportsAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *UsageReportsType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *UsageCustomReportsData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_custom_reports_meta.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_custom_reports_meta.go index 7d39c3450..372e3d661 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_custom_reports_meta.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_custom_reports_meta.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageCustomReportsMeta) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageCustomReportsMeta) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Page *UsageCustomReportsPage `json:"page,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *UsageCustomReportsMeta) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Page = all.Page + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_custom_reports_page.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_custom_reports_page.go index d5845948f..e79453555 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_custom_reports_page.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_custom_reports_page.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageCustomReportsPage) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageCustomReportsPage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { TotalCount *int64 `json:"total_count,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageCustomReportsPage) UnmarshalJSON(bytes []byte) (err error) { return err } o.TotalCount = all.TotalCount + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_custom_reports_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_custom_reports_response.go index 814c0bbf4..0a70f8424 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_custom_reports_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_custom_reports_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o UsageCustomReportsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageCustomReportsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []UsageCustomReportsData `json:"data,omitempty"` Meta *UsageCustomReportsMeta `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *UsageCustomReportsResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Data = all.Data if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_cws_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_cws_hour.go index 5ac2a1d15..25ed5b152 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_cws_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_cws_hour.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -241,7 +242,6 @@ func (o UsageCWSHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageCWSHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CwsContainerCount datadog.NullableInt64 `json:"cws_container_count,omitempty"` CwsHostCount datadog.NullableInt64 `json:"cws_host_count,omitempty"` @@ -250,12 +250,7 @@ func (o *UsageCWSHour) UnmarshalJSON(bytes []byte) (err error) { PublicId *string `json:"public_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -268,6 +263,7 @@ func (o *UsageCWSHour) UnmarshalJSON(bytes []byte) (err error) { o.Hour = all.Hour o.OrgName = all.OrgName o.PublicId = all.PublicId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_cws_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_cws_response.go index abec28336..ac96242d2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_cws_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_cws_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageCWSResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageCWSResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageCWSHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageCWSResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_dbm_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_dbm_hour.go index a528059f6..e0ae06572 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_dbm_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_dbm_hour.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -241,7 +242,6 @@ func (o UsageDBMHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageDBMHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DbmHostCount datadog.NullableInt64 `json:"dbm_host_count,omitempty"` DbmQueriesCount datadog.NullableInt64 `json:"dbm_queries_count,omitempty"` @@ -250,12 +250,7 @@ func (o *UsageDBMHour) UnmarshalJSON(bytes []byte) (err error) { PublicId *string `json:"public_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -268,6 +263,7 @@ func (o *UsageDBMHour) UnmarshalJSON(bytes []byte) (err error) { o.Hour = all.Hour o.OrgName = all.OrgName o.PublicId = all.PublicId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_dbm_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_dbm_response.go index 05e2284c2..c748f7acf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_dbm_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_dbm_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageDBMResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageDBMResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageDBMHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageDBMResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_fargate_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_fargate_hour.go index 52ec10b93..442dee834 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_fargate_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_fargate_hour.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -329,7 +330,6 @@ func (o UsageFargateHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageFargateHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApmFargateCount datadog.NullableInt64 `json:"apm_fargate_count,omitempty"` AppsecFargateCount datadog.NullableInt64 `json:"appsec_fargate_count,omitempty"` @@ -340,12 +340,7 @@ func (o *UsageFargateHour) UnmarshalJSON(bytes []byte) (err error) { TasksCount datadog.NullableInt64 `json:"tasks_count,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -360,6 +355,7 @@ func (o *UsageFargateHour) UnmarshalJSON(bytes []byte) (err error) { o.OrgName = all.OrgName o.PublicId = all.PublicId o.TasksCount = all.TasksCount + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_fargate_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_fargate_response.go index 5bff7dcc4..6a309c296 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_fargate_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_fargate_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageFargateResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageFargateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageFargateHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageFargateResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_host_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_host_hour.go index e20954a7d..ffb3e9b0f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_host_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_host_hour.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -785,7 +786,6 @@ func (o UsageHostHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageHostHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AgentHostCount datadog.NullableInt64 `json:"agent_host_count,omitempty"` AlibabaHostCount datadog.NullableInt64 `json:"alibaba_host_count,omitempty"` @@ -806,12 +806,7 @@ func (o *UsageHostHour) UnmarshalJSON(bytes []byte) (err error) { VsphereHostCount datadog.NullableInt64 `json:"vsphere_host_count,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -836,6 +831,7 @@ func (o *UsageHostHour) UnmarshalJSON(bytes []byte) (err error) { o.OrgName = all.OrgName o.PublicId = all.PublicId o.VsphereHostCount = all.VsphereHostCount + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_hosts_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_hosts_response.go index 14d027645..1017b452e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_hosts_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_hosts_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageHostsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageHostsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageHostHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageHostsResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_incident_management_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_incident_management_hour.go index 05a1c2afc..8459c8984 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_incident_management_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_incident_management_hour.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -197,7 +198,6 @@ func (o UsageIncidentManagementHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageIncidentManagementHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Hour *time.Time `json:"hour,omitempty"` MonthlyActiveUsers datadog.NullableInt64 `json:"monthly_active_users,omitempty"` @@ -205,12 +205,7 @@ func (o *UsageIncidentManagementHour) UnmarshalJSON(bytes []byte) (err error) { PublicId *string `json:"public_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -222,6 +217,7 @@ func (o *UsageIncidentManagementHour) UnmarshalJSON(bytes []byte) (err error) { o.MonthlyActiveUsers = all.MonthlyActiveUsers o.OrgName = all.OrgName o.PublicId = all.PublicId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_incident_management_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_incident_management_response.go index 7810d903c..93a137829 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_incident_management_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_incident_management_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageIncidentManagementResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageIncidentManagementResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageIncidentManagementHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageIncidentManagementResponse) UnmarshalJSON(bytes []byte) (err error return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_indexed_spans_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_indexed_spans_hour.go index ba0928ba9..0b00f8681 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_indexed_spans_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_indexed_spans_hour.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -197,7 +198,6 @@ func (o UsageIndexedSpansHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageIndexedSpansHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Hour *time.Time `json:"hour,omitempty"` IndexedEventsCount datadog.NullableInt64 `json:"indexed_events_count,omitempty"` @@ -205,12 +205,7 @@ func (o *UsageIndexedSpansHour) UnmarshalJSON(bytes []byte) (err error) { PublicId *string `json:"public_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -222,6 +217,7 @@ func (o *UsageIndexedSpansHour) UnmarshalJSON(bytes []byte) (err error) { o.IndexedEventsCount = all.IndexedEventsCount o.OrgName = all.OrgName o.PublicId = all.PublicId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_indexed_spans_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_indexed_spans_response.go index be75ca942..4ce566d3d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_indexed_spans_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_indexed_spans_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageIndexedSpansResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageIndexedSpansResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageIndexedSpansHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageIndexedSpansResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_ingested_spans_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_ingested_spans_hour.go index 182483450..a3985acc5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_ingested_spans_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_ingested_spans_hour.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -197,7 +198,6 @@ func (o UsageIngestedSpansHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageIngestedSpansHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Hour *time.Time `json:"hour,omitempty"` IngestedEventsBytes datadog.NullableInt64 `json:"ingested_events_bytes,omitempty"` @@ -205,12 +205,7 @@ func (o *UsageIngestedSpansHour) UnmarshalJSON(bytes []byte) (err error) { PublicId *string `json:"public_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -222,6 +217,7 @@ func (o *UsageIngestedSpansHour) UnmarshalJSON(bytes []byte) (err error) { o.IngestedEventsBytes = all.IngestedEventsBytes o.OrgName = all.OrgName o.PublicId = all.PublicId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_ingested_spans_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_ingested_spans_response.go index 532ad85c0..24c7e9412 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_ingested_spans_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_ingested_spans_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageIngestedSpansResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageIngestedSpansResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageIngestedSpansHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageIngestedSpansResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_io_t_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_io_t_hour.go index bff6d7abc..f981a94f7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_io_t_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_io_t_hour.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -197,7 +198,6 @@ func (o UsageIoTHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageIoTHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Hour *time.Time `json:"hour,omitempty"` IotDeviceCount datadog.NullableInt64 `json:"iot_device_count,omitempty"` @@ -205,12 +205,7 @@ func (o *UsageIoTHour) UnmarshalJSON(bytes []byte) (err error) { PublicId *string `json:"public_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -222,6 +217,7 @@ func (o *UsageIoTHour) UnmarshalJSON(bytes []byte) (err error) { o.IotDeviceCount = all.IotDeviceCount o.OrgName = all.OrgName o.PublicId = all.PublicId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_io_t_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_io_t_response.go index 0e593c99b..c7bd27d0f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_io_t_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_io_t_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageIoTResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageIoTResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageIoTHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageIoTResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_lambda_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_lambda_hour.go index 48a9652c8..957eafb07 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_lambda_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_lambda_hour.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -242,7 +243,6 @@ func (o UsageLambdaHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageLambdaHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { FuncCount datadog.NullableInt64 `json:"func_count,omitempty"` Hour *time.Time `json:"hour,omitempty"` @@ -251,12 +251,7 @@ func (o *UsageLambdaHour) UnmarshalJSON(bytes []byte) (err error) { PublicId *string `json:"public_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -269,6 +264,7 @@ func (o *UsageLambdaHour) UnmarshalJSON(bytes []byte) (err error) { o.InvocationsSum = all.InvocationsSum o.OrgName = all.OrgName o.PublicId = all.PublicId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_lambda_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_lambda_response.go index 319a13dbc..e1bb41ed5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_lambda_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_lambda_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -83,17 +83,11 @@ func (o UsageLambdaResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageLambdaResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageLambdaHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -102,6 +96,7 @@ func (o *UsageLambdaResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_logs_by_index_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_logs_by_index_hour.go index b9af299ad..721772079 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_logs_by_index_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_logs_by_index_hour.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -285,7 +286,6 @@ func (o UsageLogsByIndexHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageLogsByIndexHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { EventCount *int64 `json:"event_count,omitempty"` Hour *time.Time `json:"hour,omitempty"` @@ -296,12 +296,7 @@ func (o *UsageLogsByIndexHour) UnmarshalJSON(bytes []byte) (err error) { Retention *int64 `json:"retention,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -316,6 +311,7 @@ func (o *UsageLogsByIndexHour) UnmarshalJSON(bytes []byte) (err error) { o.OrgName = all.OrgName o.PublicId = all.PublicId o.Retention = all.Retention + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_logs_by_index_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_logs_by_index_response.go index 19de4113f..4f547ca95 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_logs_by_index_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_logs_by_index_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageLogsByIndexResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageLogsByIndexResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageLogsByIndexHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageLogsByIndexResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_logs_by_retention_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_logs_by_retention_hour.go index a02c0c5ae..a03580aa6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_logs_by_retention_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_logs_by_retention_hour.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -291,7 +291,6 @@ func (o UsageLogsByRetentionHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageLogsByRetentionHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IndexedEventsCount datadog.NullableInt64 `json:"indexed_events_count,omitempty"` LiveIndexedEventsCount datadog.NullableInt64 `json:"live_indexed_events_count,omitempty"` @@ -301,12 +300,7 @@ func (o *UsageLogsByRetentionHour) UnmarshalJSON(bytes []byte) (err error) { Retention datadog.NullableString `json:"retention,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -320,6 +314,7 @@ func (o *UsageLogsByRetentionHour) UnmarshalJSON(bytes []byte) (err error) { o.PublicId = all.PublicId o.RehydratedIndexedEventsCount = all.RehydratedIndexedEventsCount o.Retention = all.Retention + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_logs_by_retention_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_logs_by_retention_response.go index 4b7abada5..7b2d3bef7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_logs_by_retention_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_logs_by_retention_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageLogsByRetentionResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageLogsByRetentionResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageLogsByRetentionHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageLogsByRetentionResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_logs_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_logs_hour.go index 846c5d0ee..9ebabfebb 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_logs_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_logs_hour.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -505,7 +506,6 @@ func (o UsageLogsHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageLogsHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { BillableIngestedBytes datadog.NullableInt64 `json:"billable_ingested_bytes,omitempty"` Hour *time.Time `json:"hour,omitempty"` @@ -520,12 +520,7 @@ func (o *UsageLogsHour) UnmarshalJSON(bytes []byte) (err error) { PublicId *string `json:"public_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -544,6 +539,7 @@ func (o *UsageLogsHour) UnmarshalJSON(bytes []byte) (err error) { o.LogsRehydratedIngestedBytes = all.LogsRehydratedIngestedBytes o.OrgName = all.OrgName o.PublicId = all.PublicId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_logs_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_logs_response.go index 325569421..6c5c8c1a7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_logs_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_logs_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageLogsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageLogsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageLogsHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageLogsResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_metric_category.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_metric_category.go index d2e2981a6..c7f1ad55a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_metric_category.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_metric_category.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // UsageMetricCategory Contains the metric category. @@ -63,47 +64,3 @@ func (v UsageMetricCategory) IsValid() bool { func (v UsageMetricCategory) Ptr() *UsageMetricCategory { return &v } - -// NullableUsageMetricCategory handles when a null is used for UsageMetricCategory. -type NullableUsageMetricCategory struct { - value *UsageMetricCategory - isSet bool -} - -// Get returns the associated value. -func (v NullableUsageMetricCategory) Get() *UsageMetricCategory { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableUsageMetricCategory) Set(val *UsageMetricCategory) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableUsageMetricCategory) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableUsageMetricCategory) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableUsageMetricCategory initializes the struct as if Set has been called. -func NewNullableUsageMetricCategory(val *UsageMetricCategory) *NullableUsageMetricCategory { - return &NullableUsageMetricCategory{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableUsageMetricCategory) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableUsageMetricCategory) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_network_flows_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_network_flows_hour.go index 6522ece01..87ba49533 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_network_flows_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_network_flows_hour.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -197,7 +198,6 @@ func (o UsageNetworkFlowsHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageNetworkFlowsHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Hour *time.Time `json:"hour,omitempty"` IndexedEventsCount datadog.NullableInt64 `json:"indexed_events_count,omitempty"` @@ -205,12 +205,7 @@ func (o *UsageNetworkFlowsHour) UnmarshalJSON(bytes []byte) (err error) { PublicId *string `json:"public_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -222,6 +217,7 @@ func (o *UsageNetworkFlowsHour) UnmarshalJSON(bytes []byte) (err error) { o.IndexedEventsCount = all.IndexedEventsCount o.OrgName = all.OrgName o.PublicId = all.PublicId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_network_flows_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_network_flows_response.go index 9803e0a6b..fb5fd147b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_network_flows_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_network_flows_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageNetworkFlowsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageNetworkFlowsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageNetworkFlowsHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageNetworkFlowsResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_network_hosts_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_network_hosts_hour.go index 0b7897ccf..f90e67cae 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_network_hosts_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_network_hosts_hour.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -197,7 +198,6 @@ func (o UsageNetworkHostsHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageNetworkHostsHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { HostCount datadog.NullableInt64 `json:"host_count,omitempty"` Hour *time.Time `json:"hour,omitempty"` @@ -205,12 +205,7 @@ func (o *UsageNetworkHostsHour) UnmarshalJSON(bytes []byte) (err error) { PublicId *string `json:"public_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -222,6 +217,7 @@ func (o *UsageNetworkHostsHour) UnmarshalJSON(bytes []byte) (err error) { o.Hour = all.Hour o.OrgName = all.OrgName o.PublicId = all.PublicId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_network_hosts_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_network_hosts_response.go index 95e2c7a13..b01db0914 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_network_hosts_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_network_hosts_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageNetworkHostsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageNetworkHostsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageNetworkHostsHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageNetworkHostsResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_online_archive_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_online_archive_hour.go index 353d9bd14..8abd684c3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_online_archive_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_online_archive_hour.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -197,7 +198,6 @@ func (o UsageOnlineArchiveHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageOnlineArchiveHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Hour *time.Time `json:"hour,omitempty"` OnlineArchiveEventsCount datadog.NullableInt64 `json:"online_archive_events_count,omitempty"` @@ -205,12 +205,7 @@ func (o *UsageOnlineArchiveHour) UnmarshalJSON(bytes []byte) (err error) { PublicId *string `json:"public_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -222,6 +217,7 @@ func (o *UsageOnlineArchiveHour) UnmarshalJSON(bytes []byte) (err error) { o.OnlineArchiveEventsCount = all.OnlineArchiveEventsCount o.OrgName = all.OrgName o.PublicId = all.PublicId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_online_archive_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_online_archive_response.go index e54fafabf..a112cd9e7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_online_archive_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_online_archive_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageOnlineArchiveResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageOnlineArchiveResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageOnlineArchiveHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageOnlineArchiveResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_profiling_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_profiling_hour.go index 0774a5a6c..d92a2ddd6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_profiling_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_profiling_hour.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -241,7 +242,6 @@ func (o UsageProfilingHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageProfilingHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AvgContainerAgentCount datadog.NullableInt64 `json:"avg_container_agent_count,omitempty"` HostCount datadog.NullableInt64 `json:"host_count,omitempty"` @@ -250,12 +250,7 @@ func (o *UsageProfilingHour) UnmarshalJSON(bytes []byte) (err error) { PublicId *string `json:"public_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -268,6 +263,7 @@ func (o *UsageProfilingHour) UnmarshalJSON(bytes []byte) (err error) { o.Hour = all.Hour o.OrgName = all.OrgName o.PublicId = all.PublicId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_profiling_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_profiling_response.go index 0f3b2c72f..d1d095bf2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_profiling_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_profiling_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageProfilingResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageProfilingResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageProfilingHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageProfilingResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_reports_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_reports_type.go index 9f6579d18..3c27789a7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_reports_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_reports_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // UsageReportsType The type of reports. @@ -61,47 +62,3 @@ func (v UsageReportsType) IsValid() bool { func (v UsageReportsType) Ptr() *UsageReportsType { return &v } - -// NullableUsageReportsType handles when a null is used for UsageReportsType. -type NullableUsageReportsType struct { - value *UsageReportsType - isSet bool -} - -// Get returns the associated value. -func (v NullableUsageReportsType) Get() *UsageReportsType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableUsageReportsType) Set(val *UsageReportsType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableUsageReportsType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableUsageReportsType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableUsageReportsType initializes the struct as if Set has been called. -func NewNullableUsageReportsType(val *UsageReportsType) *NullableUsageReportsType { - return &NullableUsageReportsType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableUsageReportsType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableUsageReportsType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_rum_sessions_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_rum_sessions_hour.go index bb0484856..62b09eaa6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_rum_sessions_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_rum_sessions_hour.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -406,7 +407,6 @@ func (o UsageRumSessionsHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageRumSessionsHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Hour *time.Time `json:"hour,omitempty"` OrgName *string `json:"org_name,omitempty"` @@ -419,12 +419,7 @@ func (o *UsageRumSessionsHour) UnmarshalJSON(bytes []byte) (err error) { SessionCountReactnative datadog.NullableInt64 `json:"session_count_reactnative,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -441,6 +436,7 @@ func (o *UsageRumSessionsHour) UnmarshalJSON(bytes []byte) (err error) { o.SessionCountFlutter = all.SessionCountFlutter o.SessionCountIos = all.SessionCountIos o.SessionCountReactnative = all.SessionCountReactnative + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_rum_sessions_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_rum_sessions_response.go index caa2a4c0b..52cb7dacf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_rum_sessions_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_rum_sessions_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageRumSessionsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageRumSessionsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageRumSessionsHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageRumSessionsResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_rum_units_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_rum_units_hour.go index 2fc1047e7..e9e2b4224 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_rum_units_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_rum_units_hour.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -247,7 +247,6 @@ func (o UsageRumUnitsHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageRumUnitsHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { BrowserRumUnits datadog.NullableInt64 `json:"browser_rum_units,omitempty"` MobileRumUnits datadog.NullableInt64 `json:"mobile_rum_units,omitempty"` @@ -256,12 +255,7 @@ func (o *UsageRumUnitsHour) UnmarshalJSON(bytes []byte) (err error) { RumUnits datadog.NullableInt64 `json:"rum_units,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -274,6 +268,7 @@ func (o *UsageRumUnitsHour) UnmarshalJSON(bytes []byte) (err error) { o.OrgName = all.OrgName o.PublicId = all.PublicId o.RumUnits = all.RumUnits + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_rum_units_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_rum_units_response.go index 459ff0052..5961e9252 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_rum_units_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_rum_units_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageRumUnitsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageRumUnitsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageRumUnitsHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageRumUnitsResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_sds_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_sds_hour.go index d4a9b4d8b..c0d97c503 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_sds_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_sds_hour.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -373,7 +374,6 @@ func (o UsageSDSHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageSDSHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApmScannedBytes datadog.NullableInt64 `json:"apm_scanned_bytes,omitempty"` EventsScannedBytes datadog.NullableInt64 `json:"events_scanned_bytes,omitempty"` @@ -385,12 +385,7 @@ func (o *UsageSDSHour) UnmarshalJSON(bytes []byte) (err error) { TotalScannedBytes datadog.NullableInt64 `json:"total_scanned_bytes,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -406,6 +401,7 @@ func (o *UsageSDSHour) UnmarshalJSON(bytes []byte) (err error) { o.PublicId = all.PublicId o.RumScannedBytes = all.RumScannedBytes o.TotalScannedBytes = all.TotalScannedBytes + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_sds_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_sds_response.go index d91b58664..c98159a24 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_sds_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_sds_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageSDSResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageSDSResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageSDSHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageSDSResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_snmp_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_snmp_hour.go index f607c1958..4c53db3a5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_snmp_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_snmp_hour.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -197,7 +198,6 @@ func (o UsageSNMPHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageSNMPHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Hour *time.Time `json:"hour,omitempty"` OrgName *string `json:"org_name,omitempty"` @@ -205,12 +205,7 @@ func (o *UsageSNMPHour) UnmarshalJSON(bytes []byte) (err error) { SnmpDevices datadog.NullableInt64 `json:"snmp_devices,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -222,6 +217,7 @@ func (o *UsageSNMPHour) UnmarshalJSON(bytes []byte) (err error) { o.OrgName = all.OrgName o.PublicId = all.PublicId o.SnmpDevices = all.SnmpDevices + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_snmp_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_snmp_response.go index 16ae408f6..6f6176b4f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_snmp_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_snmp_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageSNMPResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageSNMPResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageSNMPHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageSNMPResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_sort.go index 520cfeb51..3ee11cec0 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_sort.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_sort.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // UsageSort The field to sort by. @@ -67,47 +68,3 @@ func (v UsageSort) IsValid() bool { func (v UsageSort) Ptr() *UsageSort { return &v } - -// NullableUsageSort handles when a null is used for UsageSort. -type NullableUsageSort struct { - value *UsageSort - isSet bool -} - -// Get returns the associated value. -func (v NullableUsageSort) Get() *UsageSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableUsageSort) Set(val *UsageSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableUsageSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableUsageSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableUsageSort initializes the struct as if Set has been called. -func NewNullableUsageSort(val *UsageSort) *NullableUsageSort { - return &NullableUsageSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableUsageSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableUsageSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_sort_direction.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_sort_direction.go index d511c9f9b..ff7831280 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_sort_direction.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_sort_direction.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // UsageSortDirection The direction to sort by. @@ -63,47 +64,3 @@ func (v UsageSortDirection) IsValid() bool { func (v UsageSortDirection) Ptr() *UsageSortDirection { return &v } - -// NullableUsageSortDirection handles when a null is used for UsageSortDirection. -type NullableUsageSortDirection struct { - value *UsageSortDirection - isSet bool -} - -// Get returns the associated value. -func (v NullableUsageSortDirection) Get() *UsageSortDirection { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableUsageSortDirection) Set(val *UsageSortDirection) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableUsageSortDirection) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableUsageSortDirection) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableUsageSortDirection initializes the struct as if Set has been called. -func NewNullableUsageSortDirection(val *UsageSortDirection) *NullableUsageSortDirection { - return &NullableUsageSortDirection{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableUsageSortDirection) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableUsageSortDirection) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_specified_custom_reports_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_specified_custom_reports_attributes.go index 20dbee8d6..148213816 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_specified_custom_reports_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_specified_custom_reports_attributes.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -247,7 +247,6 @@ func (o UsageSpecifiedCustomReportsAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageSpecifiedCustomReportsAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ComputedOn *string `json:"computed_on,omitempty"` EndDate *string `json:"end_date,omitempty"` @@ -257,12 +256,7 @@ func (o *UsageSpecifiedCustomReportsAttributes) UnmarshalJSON(bytes []byte) (err Tags []string `json:"tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -276,6 +270,7 @@ func (o *UsageSpecifiedCustomReportsAttributes) UnmarshalJSON(bytes []byte) (err o.Size = all.Size o.StartDate = all.StartDate o.Tags = all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_specified_custom_reports_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_specified_custom_reports_data.go index 6f2b9205f..f59b0e20e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_specified_custom_reports_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_specified_custom_reports_data.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o UsageSpecifiedCustomReportsData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageSpecifiedCustomReportsData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *UsageSpecifiedCustomReportsAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *UsageReportsType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *UsageSpecifiedCustomReportsData) UnmarshalJSON(bytes []byte) (err error } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_specified_custom_reports_meta.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_specified_custom_reports_meta.go index 648877b4b..3160cb1ce 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_specified_custom_reports_meta.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_specified_custom_reports_meta.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageSpecifiedCustomReportsMeta) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageSpecifiedCustomReportsMeta) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Page *UsageSpecifiedCustomReportsPage `json:"page,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *UsageSpecifiedCustomReportsMeta) UnmarshalJSON(bytes []byte) (err error } else { return err } + + hasInvalidField := false if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Page = all.Page + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_specified_custom_reports_page.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_specified_custom_reports_page.go index b585a221e..aefdf0aaf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_specified_custom_reports_page.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_specified_custom_reports_page.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageSpecifiedCustomReportsPage) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageSpecifiedCustomReportsPage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { TotalCount *int64 `json:"total_count,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageSpecifiedCustomReportsPage) UnmarshalJSON(bytes []byte) (err error return err } o.TotalCount = all.TotalCount + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_specified_custom_reports_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_specified_custom_reports_response.go index 82ae25ea0..80e8581c9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_specified_custom_reports_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_specified_custom_reports_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o UsageSpecifiedCustomReportsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageSpecifiedCustomReportsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *UsageSpecifiedCustomReportsData `json:"data,omitempty"` Meta *UsageSpecifiedCustomReportsMeta `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,25 +128,24 @@ func (o *UsageSpecifiedCustomReportsResponse) UnmarshalJSON(bytes []byte) (err e } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_summary_date.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_summary_date.go index aaf21de06..10ac090b9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_summary_date.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_summary_date.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -50,6 +51,8 @@ type UsageSummaryDate struct { CiPipelineIndexedSpansSum *int64 `json:"ci_pipeline_indexed_spans_sum,omitempty"` // Shows the sum of all CI test indexed spans over all hours in the current month for all organizations. CiTestIndexedSpansSum *int64 `json:"ci_test_indexed_spans_sum,omitempty"` + // Shows the high-water mark of all CI visibility intelligent test runner committers over all hours in the current month for all organizations. + CiVisibilityItrCommittersHwm *int64 `json:"ci_visibility_itr_committers_hwm,omitempty"` // Shows the high-water mark of all CI visibility pipeline committers over all hours in the current month for all organizations. CiVisibilityPipelineCommittersHwm *int64 `json:"ci_visibility_pipeline_committers_hwm,omitempty"` // Shows the high-water mark of all CI visibility test committers over all hours in the current month for all organizations. @@ -180,6 +183,8 @@ type UsageSummaryDate struct { VsphereHostTop99p *int64 `json:"vsphere_host_top99p,omitempty"` // Shows the 99th percentile of all Application Vulnerability Management hosts over all hours in the current date for the given org. VulnManagementHostCountTop99p *int64 `json:"vuln_management_host_count_top99p,omitempty"` + // Sum of all workflows executed over all hours in the current date for all organizations. + WorkflowExecutionsUsageSum *int64 `json:"workflow_executions_usage_sum,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{} @@ -709,6 +714,34 @@ func (o *UsageSummaryDate) SetCiTestIndexedSpansSum(v int64) { o.CiTestIndexedSpansSum = &v } +// GetCiVisibilityItrCommittersHwm returns the CiVisibilityItrCommittersHwm field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetCiVisibilityItrCommittersHwm() int64 { + if o == nil || o.CiVisibilityItrCommittersHwm == nil { + var ret int64 + return ret + } + return *o.CiVisibilityItrCommittersHwm +} + +// GetCiVisibilityItrCommittersHwmOk returns a tuple with the CiVisibilityItrCommittersHwm field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetCiVisibilityItrCommittersHwmOk() (*int64, bool) { + if o == nil || o.CiVisibilityItrCommittersHwm == nil { + return nil, false + } + return o.CiVisibilityItrCommittersHwm, true +} + +// HasCiVisibilityItrCommittersHwm returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasCiVisibilityItrCommittersHwm() bool { + return o != nil && o.CiVisibilityItrCommittersHwm != nil +} + +// SetCiVisibilityItrCommittersHwm gets a reference to the given int64 and assigns it to the CiVisibilityItrCommittersHwm field. +func (o *UsageSummaryDate) SetCiVisibilityItrCommittersHwm(v int64) { + o.CiVisibilityItrCommittersHwm = &v +} + // GetCiVisibilityPipelineCommittersHwm returns the CiVisibilityPipelineCommittersHwm field value if set, zero value otherwise. func (o *UsageSummaryDate) GetCiVisibilityPipelineCommittersHwm() int64 { if o == nil || o.CiVisibilityPipelineCommittersHwm == nil { @@ -2529,6 +2562,34 @@ func (o *UsageSummaryDate) SetVulnManagementHostCountTop99p(v int64) { o.VulnManagementHostCountTop99p = &v } +// GetWorkflowExecutionsUsageSum returns the WorkflowExecutionsUsageSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetWorkflowExecutionsUsageSum() int64 { + if o == nil || o.WorkflowExecutionsUsageSum == nil { + var ret int64 + return ret + } + return *o.WorkflowExecutionsUsageSum +} + +// GetWorkflowExecutionsUsageSumOk returns a tuple with the WorkflowExecutionsUsageSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetWorkflowExecutionsUsageSumOk() (*int64, bool) { + if o == nil || o.WorkflowExecutionsUsageSum == nil { + return nil, false + } + return o.WorkflowExecutionsUsageSum, true +} + +// HasWorkflowExecutionsUsageSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasWorkflowExecutionsUsageSum() bool { + return o != nil && o.WorkflowExecutionsUsageSum != nil +} + +// SetWorkflowExecutionsUsageSum gets a reference to the given int64 and assigns it to the WorkflowExecutionsUsageSum field. +func (o *UsageSummaryDate) SetWorkflowExecutionsUsageSum(v int64) { + o.WorkflowExecutionsUsageSum = &v +} + // MarshalJSON serializes the struct using spec logic. func (o UsageSummaryDate) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -2589,6 +2650,9 @@ func (o UsageSummaryDate) MarshalJSON() ([]byte, error) { if o.CiTestIndexedSpansSum != nil { toSerialize["ci_test_indexed_spans_sum"] = o.CiTestIndexedSpansSum } + if o.CiVisibilityItrCommittersHwm != nil { + toSerialize["ci_visibility_itr_committers_hwm"] = o.CiVisibilityItrCommittersHwm + } if o.CiVisibilityPipelineCommittersHwm != nil { toSerialize["ci_visibility_pipeline_committers_hwm"] = o.CiVisibilityPipelineCommittersHwm } @@ -2788,6 +2852,9 @@ func (o UsageSummaryDate) MarshalJSON() ([]byte, error) { if o.VulnManagementHostCountTop99p != nil { toSerialize["vuln_management_host_count_top99p"] = o.VulnManagementHostCountTop99p } + if o.WorkflowExecutionsUsageSum != nil { + toSerialize["workflow_executions_usage_sum"] = o.WorkflowExecutionsUsageSum + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -2797,7 +2864,6 @@ func (o UsageSummaryDate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageSummaryDate) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AgentHostTop99p *int64 `json:"agent_host_top99p,omitempty"` ApmAzureAppServiceHostTop99p *int64 `json:"apm_azure_app_service_host_top99p,omitempty"` @@ -2817,6 +2883,7 @@ func (o *UsageSummaryDate) UnmarshalJSON(bytes []byte) (err error) { BrowserRumUnitsSum *int64 `json:"browser_rum_units_sum,omitempty"` CiPipelineIndexedSpansSum *int64 `json:"ci_pipeline_indexed_spans_sum,omitempty"` CiTestIndexedSpansSum *int64 `json:"ci_test_indexed_spans_sum,omitempty"` + CiVisibilityItrCommittersHwm *int64 `json:"ci_visibility_itr_committers_hwm,omitempty"` CiVisibilityPipelineCommittersHwm *int64 `json:"ci_visibility_pipeline_committers_hwm,omitempty"` CiVisibilityTestCommittersHwm *int64 `json:"ci_visibility_test_committers_hwm,omitempty"` CloudCostManagementAwsHostCountAvg *int64 `json:"cloud_cost_management_aws_host_count_avg,omitempty"` @@ -2882,18 +2949,14 @@ func (o *UsageSummaryDate) UnmarshalJSON(bytes []byte) (err error) { UniversalServiceMonitoringHostTop99p *int64 `json:"universal_service_monitoring_host_top99p,omitempty"` VsphereHostTop99p *int64 `json:"vsphere_host_top99p,omitempty"` VulnManagementHostCountTop99p *int64 `json:"vuln_management_host_count_top99p,omitempty"` + WorkflowExecutionsUsageSum *int64 `json:"workflow_executions_usage_sum,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"agent_host_top99p", "apm_azure_app_service_host_top99p", "apm_fargate_count_avg", "apm_host_top99p", "appsec_fargate_count_avg", "audit_logs_lines_indexed_sum", "audit_trail_enabled_hwm", "avg_profiled_fargate_tasks", "aws_host_top99p", "aws_lambda_func_count", "aws_lambda_invocations_sum", "azure_app_service_top99p", "billable_ingested_bytes_sum", "browser_rum_lite_session_count_sum", "browser_rum_replay_session_count_sum", "browser_rum_units_sum", "ci_pipeline_indexed_spans_sum", "ci_test_indexed_spans_sum", "ci_visibility_pipeline_committers_hwm", "ci_visibility_test_committers_hwm", "cloud_cost_management_aws_host_count_avg", "cloud_cost_management_azure_host_count_avg", "cloud_cost_management_host_count_avg", "container_avg", "container_excl_agent_avg", "container_hwm", "cspm_aas_host_top99p", "cspm_aws_host_top99p", "cspm_azure_host_top99p", "cspm_container_avg", "cspm_container_hwm", "cspm_gcp_host_top99p", "cspm_host_top99p", "custom_ts_avg", "cws_container_count_avg", "cws_host_top99p", "date", "dbm_host_top99p", "dbm_queries_count_avg", "fargate_tasks_count_avg", "fargate_tasks_count_hwm", "forwarding_events_bytes_sum", "gcp_host_top99p", "heroku_host_top99p", "incident_management_monthly_active_users_hwm", "indexed_events_count_sum", "infra_host_top99p", "ingested_events_bytes_sum", "iot_device_sum", "iot_device_top99p", "mobile_rum_lite_session_count_sum", "mobile_rum_session_count_android_sum", "mobile_rum_session_count_flutter_sum", "mobile_rum_session_count_ios_sum", "mobile_rum_session_count_reactnative_sum", "mobile_rum_session_count_roku_sum", "mobile_rum_session_count_sum", "mobile_rum_units_sum", "netflow_indexed_events_count_sum", "npm_host_top99p", "observability_pipelines_bytes_processed_sum", "online_archive_events_count_sum", "opentelemetry_apm_host_top99p", "opentelemetry_host_top99p", "orgs", "profiling_host_top99p", "rum_browser_and_mobile_session_count", "rum_session_count_sum", "rum_total_session_count_sum", "rum_units_sum", "sds_apm_scanned_bytes_sum", "sds_events_scanned_bytes_sum", "sds_logs_scanned_bytes_sum", "sds_rum_scanned_bytes_sum", "sds_total_scanned_bytes_sum", "synthetics_browser_check_calls_count_sum", "synthetics_check_calls_count_sum", "synthetics_parallel_testing_max_slots_hwm", "trace_search_indexed_events_count_sum", "twol_ingested_events_bytes_sum", "universal_service_monitoring_host_top99p", "vsphere_host_top99p", "vuln_management_host_count_top99p"}) + datadog.DeleteKeys(additionalProperties, &[]string{"agent_host_top99p", "apm_azure_app_service_host_top99p", "apm_fargate_count_avg", "apm_host_top99p", "appsec_fargate_count_avg", "audit_logs_lines_indexed_sum", "audit_trail_enabled_hwm", "avg_profiled_fargate_tasks", "aws_host_top99p", "aws_lambda_func_count", "aws_lambda_invocations_sum", "azure_app_service_top99p", "billable_ingested_bytes_sum", "browser_rum_lite_session_count_sum", "browser_rum_replay_session_count_sum", "browser_rum_units_sum", "ci_pipeline_indexed_spans_sum", "ci_test_indexed_spans_sum", "ci_visibility_itr_committers_hwm", "ci_visibility_pipeline_committers_hwm", "ci_visibility_test_committers_hwm", "cloud_cost_management_aws_host_count_avg", "cloud_cost_management_azure_host_count_avg", "cloud_cost_management_host_count_avg", "container_avg", "container_excl_agent_avg", "container_hwm", "cspm_aas_host_top99p", "cspm_aws_host_top99p", "cspm_azure_host_top99p", "cspm_container_avg", "cspm_container_hwm", "cspm_gcp_host_top99p", "cspm_host_top99p", "custom_ts_avg", "cws_container_count_avg", "cws_host_top99p", "date", "dbm_host_top99p", "dbm_queries_count_avg", "fargate_tasks_count_avg", "fargate_tasks_count_hwm", "forwarding_events_bytes_sum", "gcp_host_top99p", "heroku_host_top99p", "incident_management_monthly_active_users_hwm", "indexed_events_count_sum", "infra_host_top99p", "ingested_events_bytes_sum", "iot_device_sum", "iot_device_top99p", "mobile_rum_lite_session_count_sum", "mobile_rum_session_count_android_sum", "mobile_rum_session_count_flutter_sum", "mobile_rum_session_count_ios_sum", "mobile_rum_session_count_reactnative_sum", "mobile_rum_session_count_roku_sum", "mobile_rum_session_count_sum", "mobile_rum_units_sum", "netflow_indexed_events_count_sum", "npm_host_top99p", "observability_pipelines_bytes_processed_sum", "online_archive_events_count_sum", "opentelemetry_apm_host_top99p", "opentelemetry_host_top99p", "orgs", "profiling_host_top99p", "rum_browser_and_mobile_session_count", "rum_session_count_sum", "rum_total_session_count_sum", "rum_units_sum", "sds_apm_scanned_bytes_sum", "sds_events_scanned_bytes_sum", "sds_logs_scanned_bytes_sum", "sds_rum_scanned_bytes_sum", "sds_total_scanned_bytes_sum", "synthetics_browser_check_calls_count_sum", "synthetics_check_calls_count_sum", "synthetics_parallel_testing_max_slots_hwm", "trace_search_indexed_events_count_sum", "twol_ingested_events_bytes_sum", "universal_service_monitoring_host_top99p", "vsphere_host_top99p", "vuln_management_host_count_top99p", "workflow_executions_usage_sum"}) } else { return err } @@ -2915,6 +2978,7 @@ func (o *UsageSummaryDate) UnmarshalJSON(bytes []byte) (err error) { o.BrowserRumUnitsSum = all.BrowserRumUnitsSum o.CiPipelineIndexedSpansSum = all.CiPipelineIndexedSpansSum o.CiTestIndexedSpansSum = all.CiTestIndexedSpansSum + o.CiVisibilityItrCommittersHwm = all.CiVisibilityItrCommittersHwm o.CiVisibilityPipelineCommittersHwm = all.CiVisibilityPipelineCommittersHwm o.CiVisibilityTestCommittersHwm = all.CiVisibilityTestCommittersHwm o.CloudCostManagementAwsHostCountAvg = all.CloudCostManagementAwsHostCountAvg @@ -2980,6 +3044,8 @@ func (o *UsageSummaryDate) UnmarshalJSON(bytes []byte) (err error) { o.UniversalServiceMonitoringHostTop99p = all.UniversalServiceMonitoringHostTop99p o.VsphereHostTop99p = all.VsphereHostTop99p o.VulnManagementHostCountTop99p = all.VulnManagementHostCountTop99p + o.WorkflowExecutionsUsageSum = all.WorkflowExecutionsUsageSum + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_summary_date_org.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_summary_date_org.go index add113eb3..c1686106c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_summary_date_org.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_summary_date_org.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -49,6 +49,8 @@ type UsageSummaryDateOrg struct { CiPipelineIndexedSpansSum *int64 `json:"ci_pipeline_indexed_spans_sum,omitempty"` // Shows the sum of all CI test indexed spans over all hours in the current date for the given org. CiTestIndexedSpansSum *int64 `json:"ci_test_indexed_spans_sum,omitempty"` + // Shows the high-water mark of all CI visibility intelligent test runner committers over all hours in the current date for the given org. + CiVisibilityItrCommittersHwm *int64 `json:"ci_visibility_itr_committers_hwm,omitempty"` // Shows the high-water mark of all CI visibility pipeline committers over all hours in the current date for the given org. CiVisibilityPipelineCommittersHwm *int64 `json:"ci_visibility_pipeline_committers_hwm,omitempty"` // Shows the high-water mark of all CI visibility test committers over all hours in the current date for the given org. @@ -183,6 +185,8 @@ type UsageSummaryDateOrg struct { VsphereHostTop99p *int64 `json:"vsphere_host_top99p,omitempty"` // Shows the 99th percentile of all Application Vulnerability Management hosts over all hours in the current date for the given org. VulnManagementHostCountTop99p *int64 `json:"vuln_management_host_count_top99p,omitempty"` + // Sum of all workflows executed over all hours in the current date for the given org. + WorkflowExecutionsUsageSum *int64 `json:"workflow_executions_usage_sum,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{} @@ -712,6 +716,34 @@ func (o *UsageSummaryDateOrg) SetCiTestIndexedSpansSum(v int64) { o.CiTestIndexedSpansSum = &v } +// GetCiVisibilityItrCommittersHwm returns the CiVisibilityItrCommittersHwm field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetCiVisibilityItrCommittersHwm() int64 { + if o == nil || o.CiVisibilityItrCommittersHwm == nil { + var ret int64 + return ret + } + return *o.CiVisibilityItrCommittersHwm +} + +// GetCiVisibilityItrCommittersHwmOk returns a tuple with the CiVisibilityItrCommittersHwm field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetCiVisibilityItrCommittersHwmOk() (*int64, bool) { + if o == nil || o.CiVisibilityItrCommittersHwm == nil { + return nil, false + } + return o.CiVisibilityItrCommittersHwm, true +} + +// HasCiVisibilityItrCommittersHwm returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasCiVisibilityItrCommittersHwm() bool { + return o != nil && o.CiVisibilityItrCommittersHwm != nil +} + +// SetCiVisibilityItrCommittersHwm gets a reference to the given int64 and assigns it to the CiVisibilityItrCommittersHwm field. +func (o *UsageSummaryDateOrg) SetCiVisibilityItrCommittersHwm(v int64) { + o.CiVisibilityItrCommittersHwm = &v +} + // GetCiVisibilityPipelineCommittersHwm returns the CiVisibilityPipelineCommittersHwm field value if set, zero value otherwise. func (o *UsageSummaryDateOrg) GetCiVisibilityPipelineCommittersHwm() int64 { if o == nil || o.CiVisibilityPipelineCommittersHwm == nil { @@ -2588,6 +2620,34 @@ func (o *UsageSummaryDateOrg) SetVulnManagementHostCountTop99p(v int64) { o.VulnManagementHostCountTop99p = &v } +// GetWorkflowExecutionsUsageSum returns the WorkflowExecutionsUsageSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetWorkflowExecutionsUsageSum() int64 { + if o == nil || o.WorkflowExecutionsUsageSum == nil { + var ret int64 + return ret + } + return *o.WorkflowExecutionsUsageSum +} + +// GetWorkflowExecutionsUsageSumOk returns a tuple with the WorkflowExecutionsUsageSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetWorkflowExecutionsUsageSumOk() (*int64, bool) { + if o == nil || o.WorkflowExecutionsUsageSum == nil { + return nil, false + } + return o.WorkflowExecutionsUsageSum, true +} + +// HasWorkflowExecutionsUsageSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasWorkflowExecutionsUsageSum() bool { + return o != nil && o.WorkflowExecutionsUsageSum != nil +} + +// SetWorkflowExecutionsUsageSum gets a reference to the given int64 and assigns it to the WorkflowExecutionsUsageSum field. +func (o *UsageSummaryDateOrg) SetWorkflowExecutionsUsageSum(v int64) { + o.WorkflowExecutionsUsageSum = &v +} + // MarshalJSON serializes the struct using spec logic. func (o UsageSummaryDateOrg) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -2648,6 +2708,9 @@ func (o UsageSummaryDateOrg) MarshalJSON() ([]byte, error) { if o.CiTestIndexedSpansSum != nil { toSerialize["ci_test_indexed_spans_sum"] = o.CiTestIndexedSpansSum } + if o.CiVisibilityItrCommittersHwm != nil { + toSerialize["ci_visibility_itr_committers_hwm"] = o.CiVisibilityItrCommittersHwm + } if o.CiVisibilityPipelineCommittersHwm != nil { toSerialize["ci_visibility_pipeline_committers_hwm"] = o.CiVisibilityPipelineCommittersHwm } @@ -2849,6 +2912,9 @@ func (o UsageSummaryDateOrg) MarshalJSON() ([]byte, error) { if o.VulnManagementHostCountTop99p != nil { toSerialize["vuln_management_host_count_top99p"] = o.VulnManagementHostCountTop99p } + if o.WorkflowExecutionsUsageSum != nil { + toSerialize["workflow_executions_usage_sum"] = o.WorkflowExecutionsUsageSum + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -2858,7 +2924,6 @@ func (o UsageSummaryDateOrg) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageSummaryDateOrg) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AgentHostTop99p *int64 `json:"agent_host_top99p,omitempty"` ApmAzureAppServiceHostTop99p *int64 `json:"apm_azure_app_service_host_top99p,omitempty"` @@ -2878,6 +2943,7 @@ func (o *UsageSummaryDateOrg) UnmarshalJSON(bytes []byte) (err error) { BrowserRumUnitsSum *int64 `json:"browser_rum_units_sum,omitempty"` CiPipelineIndexedSpansSum *int64 `json:"ci_pipeline_indexed_spans_sum,omitempty"` CiTestIndexedSpansSum *int64 `json:"ci_test_indexed_spans_sum,omitempty"` + CiVisibilityItrCommittersHwm *int64 `json:"ci_visibility_itr_committers_hwm,omitempty"` CiVisibilityPipelineCommittersHwm *int64 `json:"ci_visibility_pipeline_committers_hwm,omitempty"` CiVisibilityTestCommittersHwm *int64 `json:"ci_visibility_test_committers_hwm,omitempty"` CloudCostManagementAwsHostCountAvg *int64 `json:"cloud_cost_management_aws_host_count_avg,omitempty"` @@ -2945,18 +3011,14 @@ func (o *UsageSummaryDateOrg) UnmarshalJSON(bytes []byte) (err error) { UniversalServiceMonitoringHostTop99p *int64 `json:"universal_service_monitoring_host_top99p,omitempty"` VsphereHostTop99p *int64 `json:"vsphere_host_top99p,omitempty"` VulnManagementHostCountTop99p *int64 `json:"vuln_management_host_count_top99p,omitempty"` + WorkflowExecutionsUsageSum *int64 `json:"workflow_executions_usage_sum,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"agent_host_top99p", "apm_azure_app_service_host_top99p", "apm_fargate_count_avg", "apm_host_top99p", "appsec_fargate_count_avg", "audit_logs_lines_indexed_sum", "audit_trail_enabled_hwm", "avg_profiled_fargate_tasks", "aws_host_top99p", "aws_lambda_func_count", "aws_lambda_invocations_sum", "azure_app_service_top99p", "billable_ingested_bytes_sum", "browser_rum_lite_session_count_sum", "browser_rum_replay_session_count_sum", "browser_rum_units_sum", "ci_pipeline_indexed_spans_sum", "ci_test_indexed_spans_sum", "ci_visibility_pipeline_committers_hwm", "ci_visibility_test_committers_hwm", "cloud_cost_management_aws_host_count_avg", "cloud_cost_management_azure_host_count_avg", "cloud_cost_management_host_count_avg", "container_avg", "container_excl_agent_avg", "container_hwm", "cspm_aas_host_top99p", "cspm_aws_host_top99p", "cspm_azure_host_top99p", "cspm_container_avg", "cspm_container_hwm", "cspm_gcp_host_top99p", "cspm_host_top99p", "custom_ts_avg", "cws_container_count_avg", "cws_host_top99p", "dbm_host_top99p_sum", "dbm_queries_avg_sum", "fargate_tasks_count_avg", "fargate_tasks_count_hwm", "forwarding_events_bytes_sum", "gcp_host_top99p", "heroku_host_top99p", "id", "incident_management_monthly_active_users_hwm", "indexed_events_count_sum", "infra_host_top99p", "ingested_events_bytes_sum", "iot_device_agg_sum", "iot_device_top99p_sum", "mobile_rum_lite_session_count_sum", "mobile_rum_session_count_android_sum", "mobile_rum_session_count_flutter_sum", "mobile_rum_session_count_ios_sum", "mobile_rum_session_count_reactnative_sum", "mobile_rum_session_count_roku_sum", "mobile_rum_session_count_sum", "mobile_rum_units_sum", "name", "netflow_indexed_events_count_sum", "npm_host_top99p", "observability_pipelines_bytes_processed_sum", "online_archive_events_count_sum", "opentelemetry_apm_host_top99p", "opentelemetry_host_top99p", "profiling_host_top99p", "public_id", "region", "rum_browser_and_mobile_session_count", "rum_session_count_sum", "rum_total_session_count_sum", "rum_units_sum", "sds_apm_scanned_bytes_sum", "sds_events_scanned_bytes_sum", "sds_logs_scanned_bytes_sum", "sds_rum_scanned_bytes_sum", "sds_total_scanned_bytes_sum", "synthetics_browser_check_calls_count_sum", "synthetics_check_calls_count_sum", "synthetics_parallel_testing_max_slots_hwm", "trace_search_indexed_events_count_sum", "twol_ingested_events_bytes_sum", "universal_service_monitoring_host_top99p", "vsphere_host_top99p", "vuln_management_host_count_top99p"}) + datadog.DeleteKeys(additionalProperties, &[]string{"agent_host_top99p", "apm_azure_app_service_host_top99p", "apm_fargate_count_avg", "apm_host_top99p", "appsec_fargate_count_avg", "audit_logs_lines_indexed_sum", "audit_trail_enabled_hwm", "avg_profiled_fargate_tasks", "aws_host_top99p", "aws_lambda_func_count", "aws_lambda_invocations_sum", "azure_app_service_top99p", "billable_ingested_bytes_sum", "browser_rum_lite_session_count_sum", "browser_rum_replay_session_count_sum", "browser_rum_units_sum", "ci_pipeline_indexed_spans_sum", "ci_test_indexed_spans_sum", "ci_visibility_itr_committers_hwm", "ci_visibility_pipeline_committers_hwm", "ci_visibility_test_committers_hwm", "cloud_cost_management_aws_host_count_avg", "cloud_cost_management_azure_host_count_avg", "cloud_cost_management_host_count_avg", "container_avg", "container_excl_agent_avg", "container_hwm", "cspm_aas_host_top99p", "cspm_aws_host_top99p", "cspm_azure_host_top99p", "cspm_container_avg", "cspm_container_hwm", "cspm_gcp_host_top99p", "cspm_host_top99p", "custom_ts_avg", "cws_container_count_avg", "cws_host_top99p", "dbm_host_top99p_sum", "dbm_queries_avg_sum", "fargate_tasks_count_avg", "fargate_tasks_count_hwm", "forwarding_events_bytes_sum", "gcp_host_top99p", "heroku_host_top99p", "id", "incident_management_monthly_active_users_hwm", "indexed_events_count_sum", "infra_host_top99p", "ingested_events_bytes_sum", "iot_device_agg_sum", "iot_device_top99p_sum", "mobile_rum_lite_session_count_sum", "mobile_rum_session_count_android_sum", "mobile_rum_session_count_flutter_sum", "mobile_rum_session_count_ios_sum", "mobile_rum_session_count_reactnative_sum", "mobile_rum_session_count_roku_sum", "mobile_rum_session_count_sum", "mobile_rum_units_sum", "name", "netflow_indexed_events_count_sum", "npm_host_top99p", "observability_pipelines_bytes_processed_sum", "online_archive_events_count_sum", "opentelemetry_apm_host_top99p", "opentelemetry_host_top99p", "profiling_host_top99p", "public_id", "region", "rum_browser_and_mobile_session_count", "rum_session_count_sum", "rum_total_session_count_sum", "rum_units_sum", "sds_apm_scanned_bytes_sum", "sds_events_scanned_bytes_sum", "sds_logs_scanned_bytes_sum", "sds_rum_scanned_bytes_sum", "sds_total_scanned_bytes_sum", "synthetics_browser_check_calls_count_sum", "synthetics_check_calls_count_sum", "synthetics_parallel_testing_max_slots_hwm", "trace_search_indexed_events_count_sum", "twol_ingested_events_bytes_sum", "universal_service_monitoring_host_top99p", "vsphere_host_top99p", "vuln_management_host_count_top99p", "workflow_executions_usage_sum"}) } else { return err } @@ -2978,6 +3040,7 @@ func (o *UsageSummaryDateOrg) UnmarshalJSON(bytes []byte) (err error) { o.BrowserRumUnitsSum = all.BrowserRumUnitsSum o.CiPipelineIndexedSpansSum = all.CiPipelineIndexedSpansSum o.CiTestIndexedSpansSum = all.CiTestIndexedSpansSum + o.CiVisibilityItrCommittersHwm = all.CiVisibilityItrCommittersHwm o.CiVisibilityPipelineCommittersHwm = all.CiVisibilityPipelineCommittersHwm o.CiVisibilityTestCommittersHwm = all.CiVisibilityTestCommittersHwm o.CloudCostManagementAwsHostCountAvg = all.CloudCostManagementAwsHostCountAvg @@ -3045,6 +3108,8 @@ func (o *UsageSummaryDateOrg) UnmarshalJSON(bytes []byte) (err error) { o.UniversalServiceMonitoringHostTop99p = all.UniversalServiceMonitoringHostTop99p o.VsphereHostTop99p = all.VsphereHostTop99p o.VulnManagementHostCountTop99p = all.VulnManagementHostCountTop99p + o.WorkflowExecutionsUsageSum = all.WorkflowExecutionsUsageSum + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_summary_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_summary_response.go index 2f5fc2d32..0aca3905d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_summary_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_summary_response.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -52,6 +53,8 @@ type UsageSummaryResponse struct { CiPipelineIndexedSpansAggSum *int64 `json:"ci_pipeline_indexed_spans_agg_sum,omitempty"` // Shows the sum of all CI test indexed spans over all hours in the current months for all organizations. CiTestIndexedSpansAggSum *int64 `json:"ci_test_indexed_spans_agg_sum,omitempty"` + // Shows the high-water mark of all CI visibility intelligent test runner committers over all hours in the current months for all organizations. + CiVisibilityItrCommittersHwmSum *int64 `json:"ci_visibility_itr_committers_hwm_sum,omitempty"` // Shows the high-water mark of all CI visibility pipeline committers over all hours in the current months for all organizations. CiVisibilityPipelineCommittersHwmSum *int64 `json:"ci_visibility_pipeline_committers_hwm_sum,omitempty"` // Shows the high-water mark of all CI visibility test committers over all hours in the current months for all organizations. @@ -198,6 +201,8 @@ type UsageSummaryResponse struct { VsphereHostTop99pSum *int64 `json:"vsphere_host_top99p_sum,omitempty"` // Shows the 99th percentile of all Application Vulnerability Management hosts over all hours in the current months for all organizations. VulnManagementHostCountTop99pSum *int64 `json:"vuln_management_host_count_top99p_sum,omitempty"` + // Sum of all workflows executed over all hours in the current months for all organizations. + WorkflowExecutionsUsageAggSum *int64 `json:"workflow_executions_usage_agg_sum,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{} @@ -755,6 +760,34 @@ func (o *UsageSummaryResponse) SetCiTestIndexedSpansAggSum(v int64) { o.CiTestIndexedSpansAggSum = &v } +// GetCiVisibilityItrCommittersHwmSum returns the CiVisibilityItrCommittersHwmSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetCiVisibilityItrCommittersHwmSum() int64 { + if o == nil || o.CiVisibilityItrCommittersHwmSum == nil { + var ret int64 + return ret + } + return *o.CiVisibilityItrCommittersHwmSum +} + +// GetCiVisibilityItrCommittersHwmSumOk returns a tuple with the CiVisibilityItrCommittersHwmSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetCiVisibilityItrCommittersHwmSumOk() (*int64, bool) { + if o == nil || o.CiVisibilityItrCommittersHwmSum == nil { + return nil, false + } + return o.CiVisibilityItrCommittersHwmSum, true +} + +// HasCiVisibilityItrCommittersHwmSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasCiVisibilityItrCommittersHwmSum() bool { + return o != nil && o.CiVisibilityItrCommittersHwmSum != nil +} + +// SetCiVisibilityItrCommittersHwmSum gets a reference to the given int64 and assigns it to the CiVisibilityItrCommittersHwmSum field. +func (o *UsageSummaryResponse) SetCiVisibilityItrCommittersHwmSum(v int64) { + o.CiVisibilityItrCommittersHwmSum = &v +} + // GetCiVisibilityPipelineCommittersHwmSum returns the CiVisibilityPipelineCommittersHwmSum field value if set, zero value otherwise. func (o *UsageSummaryResponse) GetCiVisibilityPipelineCommittersHwmSum() int64 { if o == nil || o.CiVisibilityPipelineCommittersHwmSum == nil { @@ -2799,6 +2832,34 @@ func (o *UsageSummaryResponse) SetVulnManagementHostCountTop99pSum(v int64) { o.VulnManagementHostCountTop99pSum = &v } +// GetWorkflowExecutionsUsageAggSum returns the WorkflowExecutionsUsageAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetWorkflowExecutionsUsageAggSum() int64 { + if o == nil || o.WorkflowExecutionsUsageAggSum == nil { + var ret int64 + return ret + } + return *o.WorkflowExecutionsUsageAggSum +} + +// GetWorkflowExecutionsUsageAggSumOk returns a tuple with the WorkflowExecutionsUsageAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetWorkflowExecutionsUsageAggSumOk() (*int64, bool) { + if o == nil || o.WorkflowExecutionsUsageAggSum == nil { + return nil, false + } + return o.WorkflowExecutionsUsageAggSum, true +} + +// HasWorkflowExecutionsUsageAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasWorkflowExecutionsUsageAggSum() bool { + return o != nil && o.WorkflowExecutionsUsageAggSum != nil +} + +// SetWorkflowExecutionsUsageAggSum gets a reference to the given int64 and assigns it to the WorkflowExecutionsUsageAggSum field. +func (o *UsageSummaryResponse) SetWorkflowExecutionsUsageAggSum(v int64) { + o.WorkflowExecutionsUsageAggSum = &v +} + // MarshalJSON serializes the struct using spec logic. func (o UsageSummaryResponse) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -2862,6 +2923,9 @@ func (o UsageSummaryResponse) MarshalJSON() ([]byte, error) { if o.CiTestIndexedSpansAggSum != nil { toSerialize["ci_test_indexed_spans_agg_sum"] = o.CiTestIndexedSpansAggSum } + if o.CiVisibilityItrCommittersHwmSum != nil { + toSerialize["ci_visibility_itr_committers_hwm_sum"] = o.CiVisibilityItrCommittersHwmSum + } if o.CiVisibilityPipelineCommittersHwmSum != nil { toSerialize["ci_visibility_pipeline_committers_hwm_sum"] = o.CiVisibilityPipelineCommittersHwmSum } @@ -3093,6 +3157,9 @@ func (o UsageSummaryResponse) MarshalJSON() ([]byte, error) { if o.VulnManagementHostCountTop99pSum != nil { toSerialize["vuln_management_host_count_top99p_sum"] = o.VulnManagementHostCountTop99pSum } + if o.WorkflowExecutionsUsageAggSum != nil { + toSerialize["workflow_executions_usage_agg_sum"] = o.WorkflowExecutionsUsageAggSum + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -3102,7 +3169,6 @@ func (o UsageSummaryResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageSummaryResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AgentHostTop99pSum *int64 `json:"agent_host_top99p_sum,omitempty"` ApmAzureAppServiceHostTop99pSum *int64 `json:"apm_azure_app_service_host_top99p_sum,omitempty"` @@ -3123,6 +3189,7 @@ func (o *UsageSummaryResponse) UnmarshalJSON(bytes []byte) (err error) { BrowserRumUnitsAggSum *int64 `json:"browser_rum_units_agg_sum,omitempty"` CiPipelineIndexedSpansAggSum *int64 `json:"ci_pipeline_indexed_spans_agg_sum,omitempty"` CiTestIndexedSpansAggSum *int64 `json:"ci_test_indexed_spans_agg_sum,omitempty"` + CiVisibilityItrCommittersHwmSum *int64 `json:"ci_visibility_itr_committers_hwm_sum,omitempty"` CiVisibilityPipelineCommittersHwmSum *int64 `json:"ci_visibility_pipeline_committers_hwm_sum,omitempty"` CiVisibilityTestCommittersHwmSum *int64 `json:"ci_visibility_test_committers_hwm_sum,omitempty"` CloudCostManagementAwsHostCountAvgSum *int64 `json:"cloud_cost_management_aws_host_count_avg_sum,omitempty"` @@ -3196,21 +3263,19 @@ func (o *UsageSummaryResponse) UnmarshalJSON(bytes []byte) (err error) { Usage []UsageSummaryDate `json:"usage,omitempty"` VsphereHostTop99pSum *int64 `json:"vsphere_host_top99p_sum,omitempty"` VulnManagementHostCountTop99pSum *int64 `json:"vuln_management_host_count_top99p_sum,omitempty"` + WorkflowExecutionsUsageAggSum *int64 `json:"workflow_executions_usage_agg_sum,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"agent_host_top99p_sum", "apm_azure_app_service_host_top99p_sum", "apm_fargate_count_avg_sum", "apm_host_top99p_sum", "appsec_fargate_count_avg_sum", "audit_logs_lines_indexed_agg_sum", "audit_trail_enabled_hwm_sum", "avg_profiled_fargate_tasks_sum", "aws_host_top99p_sum", "aws_lambda_func_count", "aws_lambda_invocations_sum", "azure_app_service_top99p_sum", "azure_host_top99p_sum", "billable_ingested_bytes_agg_sum", "browser_rum_lite_session_count_agg_sum", "browser_rum_replay_session_count_agg_sum", "browser_rum_units_agg_sum", "ci_pipeline_indexed_spans_agg_sum", "ci_test_indexed_spans_agg_sum", "ci_visibility_pipeline_committers_hwm_sum", "ci_visibility_test_committers_hwm_sum", "cloud_cost_management_aws_host_count_avg_sum", "cloud_cost_management_azure_host_count_avg_sum", "cloud_cost_management_host_count_avg_sum", "container_avg_sum", "container_excl_agent_avg_sum", "container_hwm_sum", "cspm_aas_host_top99p_sum", "cspm_aws_host_top99p_sum", "cspm_azure_host_top99p_sum", "cspm_container_avg_sum", "cspm_container_hwm_sum", "cspm_gcp_host_top99p_sum", "cspm_host_top99p_sum", "custom_ts_sum", "cws_containers_avg_sum", "cws_host_top99p_sum", "dbm_host_top99p_sum", "dbm_queries_avg_sum", "end_date", "fargate_tasks_count_avg_sum", "fargate_tasks_count_hwm_sum", "forwarding_events_bytes_agg_sum", "gcp_host_top99p_sum", "heroku_host_top99p_sum", "incident_management_monthly_active_users_hwm_sum", "indexed_events_count_agg_sum", "infra_host_top99p_sum", "ingested_events_bytes_agg_sum", "iot_device_agg_sum", "iot_device_top99p_sum", "last_updated", "live_indexed_events_agg_sum", "live_ingested_bytes_agg_sum", "logs_by_retention", "mobile_rum_lite_session_count_agg_sum", "mobile_rum_session_count_agg_sum", "mobile_rum_session_count_android_agg_sum", "mobile_rum_session_count_flutter_agg_sum", "mobile_rum_session_count_ios_agg_sum", "mobile_rum_session_count_reactnative_agg_sum", "mobile_rum_session_count_roku_agg_sum", "mobile_rum_units_agg_sum", "netflow_indexed_events_count_agg_sum", "npm_host_top99p_sum", "observability_pipelines_bytes_processed_agg_sum", "online_archive_events_count_agg_sum", "opentelemetry_apm_host_top99p_sum", "opentelemetry_host_top99p_sum", "profiling_container_agent_count_avg", "profiling_host_count_top99p_sum", "rehydrated_indexed_events_agg_sum", "rehydrated_ingested_bytes_agg_sum", "rum_browser_and_mobile_session_count", "rum_session_count_agg_sum", "rum_total_session_count_agg_sum", "rum_units_agg_sum", "sds_apm_scanned_bytes_sum", "sds_events_scanned_bytes_sum", "sds_logs_scanned_bytes_sum", "sds_rum_scanned_bytes_sum", "sds_total_scanned_bytes_sum", "start_date", "synthetics_browser_check_calls_count_agg_sum", "synthetics_check_calls_count_agg_sum", "synthetics_parallel_testing_max_slots_hwm_sum", "trace_search_indexed_events_count_agg_sum", "twol_ingested_events_bytes_agg_sum", "universal_service_monitoring_host_top99p_sum", "usage", "vsphere_host_top99p_sum", "vuln_management_host_count_top99p_sum"}) + datadog.DeleteKeys(additionalProperties, &[]string{"agent_host_top99p_sum", "apm_azure_app_service_host_top99p_sum", "apm_fargate_count_avg_sum", "apm_host_top99p_sum", "appsec_fargate_count_avg_sum", "audit_logs_lines_indexed_agg_sum", "audit_trail_enabled_hwm_sum", "avg_profiled_fargate_tasks_sum", "aws_host_top99p_sum", "aws_lambda_func_count", "aws_lambda_invocations_sum", "azure_app_service_top99p_sum", "azure_host_top99p_sum", "billable_ingested_bytes_agg_sum", "browser_rum_lite_session_count_agg_sum", "browser_rum_replay_session_count_agg_sum", "browser_rum_units_agg_sum", "ci_pipeline_indexed_spans_agg_sum", "ci_test_indexed_spans_agg_sum", "ci_visibility_itr_committers_hwm_sum", "ci_visibility_pipeline_committers_hwm_sum", "ci_visibility_test_committers_hwm_sum", "cloud_cost_management_aws_host_count_avg_sum", "cloud_cost_management_azure_host_count_avg_sum", "cloud_cost_management_host_count_avg_sum", "container_avg_sum", "container_excl_agent_avg_sum", "container_hwm_sum", "cspm_aas_host_top99p_sum", "cspm_aws_host_top99p_sum", "cspm_azure_host_top99p_sum", "cspm_container_avg_sum", "cspm_container_hwm_sum", "cspm_gcp_host_top99p_sum", "cspm_host_top99p_sum", "custom_ts_sum", "cws_containers_avg_sum", "cws_host_top99p_sum", "dbm_host_top99p_sum", "dbm_queries_avg_sum", "end_date", "fargate_tasks_count_avg_sum", "fargate_tasks_count_hwm_sum", "forwarding_events_bytes_agg_sum", "gcp_host_top99p_sum", "heroku_host_top99p_sum", "incident_management_monthly_active_users_hwm_sum", "indexed_events_count_agg_sum", "infra_host_top99p_sum", "ingested_events_bytes_agg_sum", "iot_device_agg_sum", "iot_device_top99p_sum", "last_updated", "live_indexed_events_agg_sum", "live_ingested_bytes_agg_sum", "logs_by_retention", "mobile_rum_lite_session_count_agg_sum", "mobile_rum_session_count_agg_sum", "mobile_rum_session_count_android_agg_sum", "mobile_rum_session_count_flutter_agg_sum", "mobile_rum_session_count_ios_agg_sum", "mobile_rum_session_count_reactnative_agg_sum", "mobile_rum_session_count_roku_agg_sum", "mobile_rum_units_agg_sum", "netflow_indexed_events_count_agg_sum", "npm_host_top99p_sum", "observability_pipelines_bytes_processed_agg_sum", "online_archive_events_count_agg_sum", "opentelemetry_apm_host_top99p_sum", "opentelemetry_host_top99p_sum", "profiling_container_agent_count_avg", "profiling_host_count_top99p_sum", "rehydrated_indexed_events_agg_sum", "rehydrated_ingested_bytes_agg_sum", "rum_browser_and_mobile_session_count", "rum_session_count_agg_sum", "rum_total_session_count_agg_sum", "rum_units_agg_sum", "sds_apm_scanned_bytes_sum", "sds_events_scanned_bytes_sum", "sds_logs_scanned_bytes_sum", "sds_rum_scanned_bytes_sum", "sds_total_scanned_bytes_sum", "start_date", "synthetics_browser_check_calls_count_agg_sum", "synthetics_check_calls_count_agg_sum", "synthetics_parallel_testing_max_slots_hwm_sum", "trace_search_indexed_events_count_agg_sum", "twol_ingested_events_bytes_agg_sum", "universal_service_monitoring_host_top99p_sum", "usage", "vsphere_host_top99p_sum", "vuln_management_host_count_top99p_sum", "workflow_executions_usage_agg_sum"}) } else { return err } + + hasInvalidField := false o.AgentHostTop99pSum = all.AgentHostTop99pSum o.ApmAzureAppServiceHostTop99pSum = all.ApmAzureAppServiceHostTop99pSum o.ApmFargateCountAvgSum = all.ApmFargateCountAvgSum @@ -3230,6 +3295,7 @@ func (o *UsageSummaryResponse) UnmarshalJSON(bytes []byte) (err error) { o.BrowserRumUnitsAggSum = all.BrowserRumUnitsAggSum o.CiPipelineIndexedSpansAggSum = all.CiPipelineIndexedSpansAggSum o.CiTestIndexedSpansAggSum = all.CiTestIndexedSpansAggSum + o.CiVisibilityItrCommittersHwmSum = all.CiVisibilityItrCommittersHwmSum o.CiVisibilityPipelineCommittersHwmSum = all.CiVisibilityPipelineCommittersHwmSum o.CiVisibilityTestCommittersHwmSum = all.CiVisibilityTestCommittersHwmSum o.CloudCostManagementAwsHostCountAvgSum = all.CloudCostManagementAwsHostCountAvgSum @@ -3266,11 +3332,7 @@ func (o *UsageSummaryResponse) UnmarshalJSON(bytes []byte) (err error) { o.LiveIndexedEventsAggSum = all.LiveIndexedEventsAggSum o.LiveIngestedBytesAggSum = all.LiveIngestedBytesAggSum if all.LogsByRetention != nil && all.LogsByRetention.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LogsByRetention = all.LogsByRetention o.MobileRumLiteSessionCountAggSum = all.MobileRumLiteSessionCountAggSum @@ -3310,9 +3372,15 @@ func (o *UsageSummaryResponse) UnmarshalJSON(bytes []byte) (err error) { o.Usage = all.Usage o.VsphereHostTop99pSum = all.VsphereHostTop99pSum o.VulnManagementHostCountTop99pSum = all.VulnManagementHostCountTop99pSum + o.WorkflowExecutionsUsageAggSum = all.WorkflowExecutionsUsageAggSum + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_synthetics_api_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_synthetics_api_hour.go index ddaa6aecd..99d9a71db 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_synthetics_api_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_synthetics_api_hour.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -197,7 +198,6 @@ func (o UsageSyntheticsAPIHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageSyntheticsAPIHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CheckCallsCount datadog.NullableInt64 `json:"check_calls_count,omitempty"` Hour *time.Time `json:"hour,omitempty"` @@ -205,12 +205,7 @@ func (o *UsageSyntheticsAPIHour) UnmarshalJSON(bytes []byte) (err error) { PublicId *string `json:"public_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -222,6 +217,7 @@ func (o *UsageSyntheticsAPIHour) UnmarshalJSON(bytes []byte) (err error) { o.Hour = all.Hour o.OrgName = all.OrgName o.PublicId = all.PublicId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_synthetics_api_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_synthetics_api_response.go index 248d7760b..0fa2ddea8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_synthetics_api_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_synthetics_api_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageSyntheticsAPIResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageSyntheticsAPIResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageSyntheticsAPIHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageSyntheticsAPIResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_synthetics_browser_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_synthetics_browser_hour.go index ca1793972..aeaa07337 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_synthetics_browser_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_synthetics_browser_hour.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -197,7 +198,6 @@ func (o UsageSyntheticsBrowserHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageSyntheticsBrowserHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { BrowserCheckCallsCount datadog.NullableInt64 `json:"browser_check_calls_count,omitempty"` Hour *time.Time `json:"hour,omitempty"` @@ -205,12 +205,7 @@ func (o *UsageSyntheticsBrowserHour) UnmarshalJSON(bytes []byte) (err error) { PublicId *string `json:"public_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -222,6 +217,7 @@ func (o *UsageSyntheticsBrowserHour) UnmarshalJSON(bytes []byte) (err error) { o.Hour = all.Hour o.OrgName = all.OrgName o.PublicId = all.PublicId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_synthetics_browser_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_synthetics_browser_response.go index 1e6b3a060..a70d12fec 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_synthetics_browser_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_synthetics_browser_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageSyntheticsBrowserResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageSyntheticsBrowserResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageSyntheticsBrowserHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageSyntheticsBrowserResponse) UnmarshalJSON(bytes []byte) (err error) return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_synthetics_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_synthetics_hour.go index 8cad47722..d0aa2d797 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_synthetics_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_synthetics_hour.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -186,7 +187,6 @@ func (o UsageSyntheticsHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageSyntheticsHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CheckCallsCount *int64 `json:"check_calls_count,omitempty"` Hour *time.Time `json:"hour,omitempty"` @@ -194,12 +194,7 @@ func (o *UsageSyntheticsHour) UnmarshalJSON(bytes []byte) (err error) { PublicId *string `json:"public_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -211,6 +206,7 @@ func (o *UsageSyntheticsHour) UnmarshalJSON(bytes []byte) (err error) { o.Hour = all.Hour o.OrgName = all.OrgName o.PublicId = all.PublicId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_synthetics_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_synthetics_response.go index 2bd1abb0d..ada739ba9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_synthetics_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_synthetics_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageSyntheticsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageSyntheticsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageSyntheticsHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageSyntheticsResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_timeseries_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_timeseries_hour.go index f28a074e6..85c9cfbf6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_timeseries_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_timeseries_hour.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -252,7 +253,6 @@ func (o UsageTimeseriesHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageTimeseriesHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Hour *time.Time `json:"hour,omitempty"` NumCustomInputTimeseries *int64 `json:"num_custom_input_timeseries,omitempty"` @@ -262,12 +262,7 @@ func (o *UsageTimeseriesHour) UnmarshalJSON(bytes []byte) (err error) { PublicId *string `json:"public_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -281,6 +276,7 @@ func (o *UsageTimeseriesHour) UnmarshalJSON(bytes []byte) (err error) { o.NumCustomTimeseries = all.NumCustomTimeseries o.OrgName = all.OrgName o.PublicId = all.PublicId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_timeseries_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_timeseries_response.go index 44aa7d413..f9365f451 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_timeseries_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_timeseries_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageTimeseriesResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageTimeseriesResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Usage []UsageTimeseriesHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageTimeseriesResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_top_avg_metrics_hour.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_top_avg_metrics_hour.go index 013910bcc..67d4e2bdb 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_top_avg_metrics_hour.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_top_avg_metrics_hour.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -181,7 +181,6 @@ func (o UsageTopAvgMetricsHour) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageTopAvgMetricsHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AvgMetricHour *int64 `json:"avg_metric_hour,omitempty"` MaxMetricHour *int64 `json:"max_metric_hour,omitempty"` @@ -189,12 +188,7 @@ func (o *UsageTopAvgMetricsHour) UnmarshalJSON(bytes []byte) (err error) { MetricName *string `json:"metric_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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -202,21 +196,24 @@ func (o *UsageTopAvgMetricsHour) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.MetricCategory; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.AvgMetricHour = all.AvgMetricHour o.MaxMetricHour = all.MaxMetricHour - o.MetricCategory = all.MetricCategory + if all.MetricCategory != nil && !all.MetricCategory.IsValid() { + hasInvalidField = true + } else { + o.MetricCategory = all.MetricCategory + } o.MetricName = all.MetricName + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_top_avg_metrics_metadata.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_top_avg_metrics_metadata.go index 60cba71d3..44db904f9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_top_avg_metrics_metadata.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_top_avg_metrics_metadata.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -157,19 +158,13 @@ func (o UsageTopAvgMetricsMetadata) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageTopAvgMetricsMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Day *time.Time `json:"day,omitempty"` Month *time.Time `json:"month,omitempty"` Pagination *UsageTopAvgMetricsPagination `json:"pagination,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -177,19 +172,22 @@ func (o *UsageTopAvgMetricsMetadata) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Day = all.Day o.Month = all.Month if all.Pagination != nil && all.Pagination.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Pagination = all.Pagination + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_top_avg_metrics_pagination.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_top_avg_metrics_pagination.go index 3bab83b59..ca787b2e1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_top_avg_metrics_pagination.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_top_avg_metrics_pagination.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -170,19 +170,13 @@ func (o UsageTopAvgMetricsPagination) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageTopAvgMetricsPagination) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Limit *int64 `json:"limit,omitempty"` NextRecordId datadog.NullableString `json:"next_record_id,omitempty"` TotalNumberOfRecords datadog.NullableInt64 `json:"total_number_of_records,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -193,6 +187,7 @@ func (o *UsageTopAvgMetricsPagination) UnmarshalJSON(bytes []byte) (err error) { o.Limit = all.Limit o.NextRecordId = all.NextRecordId o.TotalNumberOfRecords = all.TotalNumberOfRecords + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_top_avg_metrics_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_top_avg_metrics_response.go index 99465f226..e5c920e6e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_top_avg_metrics_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_usage_top_avg_metrics_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o UsageTopAvgMetricsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageTopAvgMetricsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Metadata *UsageTopAvgMetricsMetadata `json:"metadata,omitempty"` Usage []UsageTopAvgMetricsHour `json:"usage,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *UsageTopAvgMetricsResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Metadata = all.Metadata o.Usage = all.Usage + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_user.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_user.go index e3ee941ee..c203efd4a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_user.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_user.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -13,7 +13,7 @@ import ( // User Create, edit, and disable users. type User struct { // The access role of the user. Options are **st** (standard user), **adm** (admin user), or **ro** (read-only user). - AccessRole *AccessRole `json:"access_role,omitempty"` + AccessRole NullableAccessRole `json:"access_role,omitempty"` // The new disabled status of the user. Disabled *bool `json:"disabled,omitempty"` // The new email of the user. @@ -37,8 +37,6 @@ type User struct { // will change when the set of required properties is changed. func NewUser() *User { this := User{} - var accessRole AccessRole = ACCESSROLE_STANDARD - this.AccessRole = &accessRole return &this } @@ -47,37 +45,46 @@ func NewUser() *User { // but it doesn't guarantee that properties required by API are set. func NewUserWithDefaults() *User { this := User{} - var accessRole AccessRole = ACCESSROLE_STANDARD - this.AccessRole = &accessRole return &this } -// GetAccessRole returns the AccessRole field value if set, zero value otherwise. +// GetAccessRole returns the AccessRole field value if set, zero value otherwise (both if not set or set to explicit null). func (o *User) GetAccessRole() AccessRole { - if o == nil || o.AccessRole == nil { + if o == nil || o.AccessRole.Get() == nil { var ret AccessRole return ret } - return *o.AccessRole + return *o.AccessRole.Get() } // GetAccessRoleOk returns a tuple with the AccessRole field value if set, nil otherwise // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. func (o *User) GetAccessRoleOk() (*AccessRole, bool) { - if o == nil || o.AccessRole == nil { + if o == nil { return nil, false } - return o.AccessRole, true + return o.AccessRole.Get(), o.AccessRole.IsSet() } // HasAccessRole returns a boolean if a field has been set. func (o *User) HasAccessRole() bool { - return o != nil && o.AccessRole != nil + return o != nil && o.AccessRole.IsSet() } -// SetAccessRole gets a reference to the given AccessRole and assigns it to the AccessRole field. +// SetAccessRole gets a reference to the given NullableAccessRole and assigns it to the AccessRole field. func (o *User) SetAccessRole(v AccessRole) { - o.AccessRole = &v + o.AccessRole.Set(&v) +} + +// SetAccessRoleNil sets the value for AccessRole to be an explicit nil. +func (o *User) SetAccessRoleNil() { + o.AccessRole.Set(nil) +} + +// UnsetAccessRole ensures that no value is present for AccessRole, not even an explicit nil. +func (o *User) UnsetAccessRole() { + o.AccessRole.Unset() } // GetDisabled returns the Disabled field value if set, zero value otherwise. @@ -254,8 +261,8 @@ func (o User) MarshalJSON() ([]byte, error) { if o.UnparsedObject != nil { return json.Marshal(o.UnparsedObject) } - if o.AccessRole != nil { - toSerialize["access_role"] = o.AccessRole + if o.AccessRole.IsSet() { + toSerialize["access_role"] = o.AccessRole.Get() } if o.Disabled != nil { toSerialize["disabled"] = o.Disabled @@ -284,23 +291,17 @@ func (o User) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *User) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { - AccessRole *AccessRole `json:"access_role,omitempty"` - Disabled *bool `json:"disabled,omitempty"` - Email *string `json:"email,omitempty"` - Handle *string `json:"handle,omitempty"` - Icon *string `json:"icon,omitempty"` - Name *string `json:"name,omitempty"` - Verified *bool `json:"verified,omitempty"` + AccessRole NullableAccessRole `json:"access_role,omitempty"` + Disabled *bool `json:"disabled,omitempty"` + Email *string `json:"email,omitempty"` + Handle *string `json:"handle,omitempty"` + Icon *string `json:"icon,omitempty"` + Name *string `json:"name,omitempty"` + Verified *bool `json:"verified,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -308,24 +309,27 @@ func (o *User) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.AccessRole; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.AccessRole.Get() != nil && !all.AccessRole.Get().IsValid() { + hasInvalidField = true + } else { + o.AccessRole = all.AccessRole } - o.AccessRole = all.AccessRole o.Disabled = all.Disabled o.Email = all.Email o.Handle = all.Handle o.Icon = all.Icon o.Name = all.Name o.Verified = all.Verified + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_user_disable_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_user_disable_response.go index 4881249d5..146623643 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_user_disable_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_user_disable_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UserDisableResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserDisableResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Message *string `json:"message,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UserDisableResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Message = all.Message + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_user_list_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_user_list_response.go index 1ae35cbaa..65fefad9b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_user_list_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_user_list_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UserListResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Users []User `json:"users,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UserListResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Users = all.Users + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_user_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_user_response.go index 7e6c044e4..40e0ed0ff 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_user_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_user_response.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UserResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { User *User `json:"user,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *UserResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.User != nil && all.User.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.User = all.User + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_webhooks_integration.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_webhooks_integration.go index d336bd50d..48cc15abe 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_webhooks_integration.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_webhooks_integration.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -235,7 +236,6 @@ func (o WebhooksIntegration) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *WebhooksIntegration) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CustomHeaders datadog.NullableString `json:"custom_headers,omitempty"` EncodeAs *WebhooksIntegrationEncoding `json:"encode_as,omitempty"` @@ -244,12 +244,7 @@ func (o *WebhooksIntegration) UnmarshalJSON(bytes []byte) (err error) { Url *string `json:"url"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -263,22 +258,25 @@ func (o *WebhooksIntegration) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.EncodeAs; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.CustomHeaders = all.CustomHeaders - o.EncodeAs = all.EncodeAs + if all.EncodeAs != nil && !all.EncodeAs.IsValid() { + hasInvalidField = true + } else { + o.EncodeAs = all.EncodeAs + } o.Name = *all.Name o.Payload = all.Payload o.Url = *all.Url + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_webhooks_integration_custom_variable.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_webhooks_integration_custom_variable.go index 9f3eed3b0..2ebb64f11 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_webhooks_integration_custom_variable.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_webhooks_integration_custom_variable.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -132,19 +133,13 @@ func (o WebhooksIntegrationCustomVariable) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *WebhooksIntegrationCustomVariable) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IsSecret *bool `json:"is_secret"` Name *string `json:"name"` Value *string `json:"value"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.IsSecret == nil { return fmt.Errorf("required field is_secret missing") @@ -164,6 +159,7 @@ func (o *WebhooksIntegrationCustomVariable) UnmarshalJSON(bytes []byte) (err err o.IsSecret = *all.IsSecret o.Name = *all.Name o.Value = *all.Value + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_webhooks_integration_custom_variable_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_webhooks_integration_custom_variable_response.go index 676bcaa4d..4a71a57ae 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_webhooks_integration_custom_variable_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_webhooks_integration_custom_variable_response.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -138,19 +139,13 @@ func (o WebhooksIntegrationCustomVariableResponse) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *WebhooksIntegrationCustomVariableResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IsSecret *bool `json:"is_secret"` Name *string `json:"name"` Value *string `json:"value,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.IsSecret == nil { return fmt.Errorf("required field is_secret missing") @@ -167,6 +162,7 @@ func (o *WebhooksIntegrationCustomVariableResponse) UnmarshalJSON(bytes []byte) o.IsSecret = *all.IsSecret o.Name = *all.Name o.Value = all.Value + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_webhooks_integration_custom_variable_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_webhooks_integration_custom_variable_update_request.go index c279c51ec..4a746acd9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_webhooks_integration_custom_variable_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_webhooks_integration_custom_variable_update_request.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -151,19 +151,13 @@ func (o WebhooksIntegrationCustomVariableUpdateRequest) MarshalJSON() ([]byte, e // UnmarshalJSON deserializes the given payload. func (o *WebhooksIntegrationCustomVariableUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IsSecret *bool `json:"is_secret,omitempty"` Name *string `json:"name,omitempty"` Value *string `json:"value,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -174,6 +168,7 @@ func (o *WebhooksIntegrationCustomVariableUpdateRequest) UnmarshalJSON(bytes []b o.IsSecret = all.IsSecret o.Name = all.Name o.Value = all.Value + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_webhooks_integration_encoding.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_webhooks_integration_encoding.go index 5f55fba4c..0f42a819a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_webhooks_integration_encoding.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_webhooks_integration_encoding.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WebhooksIntegrationEncoding Encoding type. Can be given either `json` or `form`. @@ -63,47 +64,3 @@ func (v WebhooksIntegrationEncoding) IsValid() bool { func (v WebhooksIntegrationEncoding) Ptr() *WebhooksIntegrationEncoding { return &v } - -// NullableWebhooksIntegrationEncoding handles when a null is used for WebhooksIntegrationEncoding. -type NullableWebhooksIntegrationEncoding struct { - value *WebhooksIntegrationEncoding - isSet bool -} - -// Get returns the associated value. -func (v NullableWebhooksIntegrationEncoding) Get() *WebhooksIntegrationEncoding { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWebhooksIntegrationEncoding) Set(val *WebhooksIntegrationEncoding) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWebhooksIntegrationEncoding) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWebhooksIntegrationEncoding) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWebhooksIntegrationEncoding initializes the struct as if Set has been called. -func NewNullableWebhooksIntegrationEncoding(val *WebhooksIntegrationEncoding) *NullableWebhooksIntegrationEncoding { - return &NullableWebhooksIntegrationEncoding{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWebhooksIntegrationEncoding) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWebhooksIntegrationEncoding) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_webhooks_integration_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_webhooks_integration_update_request.go index db50cf1b9..f72586481 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_webhooks_integration_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_webhooks_integration_update_request.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -237,7 +237,6 @@ func (o WebhooksIntegrationUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *WebhooksIntegrationUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CustomHeaders *string `json:"custom_headers,omitempty"` EncodeAs *WebhooksIntegrationEncoding `json:"encode_as,omitempty"` @@ -246,12 +245,7 @@ func (o *WebhooksIntegrationUpdateRequest) UnmarshalJSON(bytes []byte) (err erro Url *string `json:"url,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -259,22 +253,25 @@ func (o *WebhooksIntegrationUpdateRequest) UnmarshalJSON(bytes []byte) (err erro } else { return err } - if v := all.EncodeAs; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.CustomHeaders = all.CustomHeaders - o.EncodeAs = all.EncodeAs + if all.EncodeAs != nil && !all.EncodeAs.IsValid() { + hasInvalidField = true + } else { + o.EncodeAs = all.EncodeAs + } o.Name = all.Name o.Payload = all.Payload o.Url = all.Url + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget.go index 764fa6d40..0458cf166 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget.go @@ -5,18 +5,20 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // Widget Information about widget. // // **Note**: The `layout` property is required for widgets in dashboards with `free` `layout_type`. -// For the **new dashboard layout**, the `layout` property depends on the `reflow_type` of the dashboard. -// - If `reflow_type` is `fixed`, `layout` is required. -// - If `reflow_type` is `auto`, `layout` should not be set. +// +// For the **new dashboard layout**, the `layout` property depends on the `reflow_type` of the dashboard. +// - If `reflow_type` is `fixed`, `layout` is required. +// - If `reflow_type` is `auto`, `layout` should not be set. type Widget struct { // [Definition of the widget](https://docs.datadoghq.com/dashboards/widgets/). Definition WidgetDefinition `json:"definition"` @@ -148,19 +150,13 @@ func (o Widget) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Widget) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Definition *WidgetDefinition `json:"definition"` Id *int64 `json:"id,omitempty"` Layout *WidgetLayout `json:"layout,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Definition == nil { return fmt.Errorf("required field definition missing") @@ -171,19 +167,22 @@ func (o *Widget) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Definition = *all.Definition o.Id = all.Id if all.Layout != nil && all.Layout.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Layout = all.Layout + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_aggregator.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_aggregator.go index eeb4e5a93..d00e80a5a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_aggregator.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_aggregator.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetAggregator Aggregator used for the request. @@ -71,47 +72,3 @@ func (v WidgetAggregator) IsValid() bool { func (v WidgetAggregator) Ptr() *WidgetAggregator { return &v } - -// NullableWidgetAggregator handles when a null is used for WidgetAggregator. -type NullableWidgetAggregator struct { - value *WidgetAggregator - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetAggregator) Get() *WidgetAggregator { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetAggregator) Set(val *WidgetAggregator) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetAggregator) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetAggregator) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetAggregator initializes the struct as if Set has been called. -func NewNullableWidgetAggregator(val *WidgetAggregator) *NullableWidgetAggregator { - return &NullableWidgetAggregator{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetAggregator) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetAggregator) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_axis.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_axis.go index cc8c71538..f40e755f4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_axis.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_axis.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -226,7 +226,6 @@ func (o WidgetAxis) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *WidgetAxis) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IncludeZero *bool `json:"include_zero,omitempty"` Label *string `json:"label,omitempty"` @@ -235,12 +234,7 @@ func (o *WidgetAxis) UnmarshalJSON(bytes []byte) (err error) { Scale *string `json:"scale,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -253,6 +247,7 @@ func (o *WidgetAxis) UnmarshalJSON(bytes []byte) (err error) { o.Max = all.Max o.Min = all.Min o.Scale = all.Scale + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_change_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_change_type.go index fbfa6adfe..9c163b429 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_change_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_change_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetChangeType Show the absolute or the relative change. @@ -63,47 +64,3 @@ func (v WidgetChangeType) IsValid() bool { func (v WidgetChangeType) Ptr() *WidgetChangeType { return &v } - -// NullableWidgetChangeType handles when a null is used for WidgetChangeType. -type NullableWidgetChangeType struct { - value *WidgetChangeType - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetChangeType) Get() *WidgetChangeType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetChangeType) Set(val *WidgetChangeType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetChangeType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetChangeType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetChangeType initializes the struct as if Set has been called. -func NewNullableWidgetChangeType(val *WidgetChangeType) *NullableWidgetChangeType { - return &NullableWidgetChangeType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetChangeType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetChangeType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_color_preference.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_color_preference.go index f8688d3de..c70ed4065 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_color_preference.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_color_preference.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetColorPreference Which color to use on the widget. @@ -63,47 +64,3 @@ func (v WidgetColorPreference) IsValid() bool { func (v WidgetColorPreference) Ptr() *WidgetColorPreference { return &v } - -// NullableWidgetColorPreference handles when a null is used for WidgetColorPreference. -type NullableWidgetColorPreference struct { - value *WidgetColorPreference - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetColorPreference) Get() *WidgetColorPreference { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetColorPreference) Set(val *WidgetColorPreference) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetColorPreference) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetColorPreference) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetColorPreference initializes the struct as if Set has been called. -func NewNullableWidgetColorPreference(val *WidgetColorPreference) *NullableWidgetColorPreference { - return &NullableWidgetColorPreference{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetColorPreference) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetColorPreference) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_comparator.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_comparator.go index 4cf96562b..f8ce9cf9b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_comparator.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_comparator.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetComparator Comparator to apply. @@ -14,6 +15,7 @@ type WidgetComparator string // List of WidgetComparator. const ( + WIDGETCOMPARATOR_EQUAL_TO WidgetComparator = "=" WIDGETCOMPARATOR_GREATER_THAN WidgetComparator = ">" WIDGETCOMPARATOR_GREATER_THAN_OR_EQUAL_TO WidgetComparator = ">=" WIDGETCOMPARATOR_LESS_THAN WidgetComparator = "<" @@ -21,6 +23,7 @@ const ( ) var allowedWidgetComparatorEnumValues = []WidgetComparator{ + WIDGETCOMPARATOR_EQUAL_TO, WIDGETCOMPARATOR_GREATER_THAN, WIDGETCOMPARATOR_GREATER_THAN_OR_EQUAL_TO, WIDGETCOMPARATOR_LESS_THAN, @@ -67,47 +70,3 @@ func (v WidgetComparator) IsValid() bool { func (v WidgetComparator) Ptr() *WidgetComparator { return &v } - -// NullableWidgetComparator handles when a null is used for WidgetComparator. -type NullableWidgetComparator struct { - value *WidgetComparator - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetComparator) Get() *WidgetComparator { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetComparator) Set(val *WidgetComparator) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetComparator) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetComparator) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetComparator initializes the struct as if Set has been called. -func NewNullableWidgetComparator(val *WidgetComparator) *NullableWidgetComparator { - return &NullableWidgetComparator{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetComparator) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetComparator) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_compare_to.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_compare_to.go index 6d4de95e6..ba99c3c14 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_compare_to.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_compare_to.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetCompareTo Timeframe used for the change comparison. @@ -67,47 +68,3 @@ func (v WidgetCompareTo) IsValid() bool { func (v WidgetCompareTo) Ptr() *WidgetCompareTo { return &v } - -// NullableWidgetCompareTo handles when a null is used for WidgetCompareTo. -type NullableWidgetCompareTo struct { - value *WidgetCompareTo - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetCompareTo) Get() *WidgetCompareTo { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetCompareTo) Set(val *WidgetCompareTo) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetCompareTo) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetCompareTo) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetCompareTo initializes the struct as if Set has been called. -func NewNullableWidgetCompareTo(val *WidgetCompareTo) *NullableWidgetCompareTo { - return &NullableWidgetCompareTo{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetCompareTo) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetCompareTo) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_conditional_format.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_conditional_format.go index 5132d5621..f61988764 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_conditional_format.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_conditional_format.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -329,7 +330,6 @@ func (o WidgetConditionalFormat) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *WidgetConditionalFormat) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Comparator *WidgetComparator `json:"comparator"` CustomBgColor *string `json:"custom_bg_color,omitempty"` @@ -342,12 +342,7 @@ func (o *WidgetConditionalFormat) UnmarshalJSON(bytes []byte) (err error) { Value *float64 `json:"value"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Comparator == nil { return fmt.Errorf("required field comparator missing") @@ -364,34 +359,33 @@ func (o *WidgetConditionalFormat) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Comparator; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Palette; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Comparator = *all.Comparator + + hasInvalidField := false + if !all.Comparator.IsValid() { + hasInvalidField = true + } else { + 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 + if !all.Palette.IsValid() { + hasInvalidField = true + } else { + o.Palette = *all.Palette + } o.Timeframe = all.Timeframe o.Value = *all.Value + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_custom_link.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_custom_link.go index 0a614f337..34f1e11ca 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_custom_link.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_custom_link.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -181,7 +181,6 @@ func (o WidgetCustomLink) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *WidgetCustomLink) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IsHidden *bool `json:"is_hidden,omitempty"` Label *string `json:"label,omitempty"` @@ -189,12 +188,7 @@ func (o *WidgetCustomLink) UnmarshalJSON(bytes []byte) (err error) { OverrideLabel *string `json:"override_label,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,6 +200,7 @@ func (o *WidgetCustomLink) UnmarshalJSON(bytes []byte) (err error) { o.Label = all.Label o.Link = all.Link o.OverrideLabel = all.OverrideLabel + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_definition.go index 1f2aea00d..f13d963f5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_definition.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" ) // WidgetDefinition - [Definition of the widget](https://docs.datadoghq.com/dashboards/widgets/). @@ -1063,53 +1063,3 @@ func (obj *WidgetDefinition) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableWidgetDefinition handles when a null is used for WidgetDefinition. -type NullableWidgetDefinition struct { - value *WidgetDefinition - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetDefinition) Get() *WidgetDefinition { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetDefinition) Set(val *WidgetDefinition) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetDefinition) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableWidgetDefinition) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetDefinition initializes the struct as if Set has been called. -func NewNullableWidgetDefinition(val *WidgetDefinition) *NullableWidgetDefinition { - return &NullableWidgetDefinition{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetDefinition) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetDefinition) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_display_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_display_type.go index 9e23919d1..6a7aa45cf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_display_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_display_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetDisplayType Type of display to use for the request. @@ -14,15 +15,17 @@ type WidgetDisplayType string // List of WidgetDisplayType. const ( - WIDGETDISPLAYTYPE_AREA WidgetDisplayType = "area" - WIDGETDISPLAYTYPE_BARS WidgetDisplayType = "bars" - WIDGETDISPLAYTYPE_LINE WidgetDisplayType = "line" + WIDGETDISPLAYTYPE_AREA WidgetDisplayType = "area" + WIDGETDISPLAYTYPE_BARS WidgetDisplayType = "bars" + WIDGETDISPLAYTYPE_LINE WidgetDisplayType = "line" + WIDGETDISPLAYTYPE_OVERLAY WidgetDisplayType = "overlay" ) var allowedWidgetDisplayTypeEnumValues = []WidgetDisplayType{ WIDGETDISPLAYTYPE_AREA, WIDGETDISPLAYTYPE_BARS, WIDGETDISPLAYTYPE_LINE, + WIDGETDISPLAYTYPE_OVERLAY, } // GetAllowedValues reeturns the list of possible values. @@ -65,47 +68,3 @@ func (v WidgetDisplayType) IsValid() bool { func (v WidgetDisplayType) Ptr() *WidgetDisplayType { return &v } - -// NullableWidgetDisplayType handles when a null is used for WidgetDisplayType. -type NullableWidgetDisplayType struct { - value *WidgetDisplayType - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetDisplayType) Get() *WidgetDisplayType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetDisplayType) Set(val *WidgetDisplayType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetDisplayType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetDisplayType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetDisplayType initializes the struct as if Set has been called. -func NewNullableWidgetDisplayType(val *WidgetDisplayType) *NullableWidgetDisplayType { - return &NullableWidgetDisplayType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetDisplayType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetDisplayType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_event.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_event.go index 3a335716c..4736dd8f2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_event.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_event.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -113,18 +114,12 @@ func (o WidgetEvent) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *WidgetEvent) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Q *string `json:"q"` TagsExecution *string `json:"tags_execution,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Q == nil { return fmt.Errorf("required field q missing") @@ -137,6 +132,7 @@ func (o *WidgetEvent) UnmarshalJSON(bytes []byte) (err error) { } o.Q = *all.Q o.TagsExecution = all.TagsExecution + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_event_size.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_event_size.go index 4100d7055..fddcf7ffb 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_event_size.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_event_size.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetEventSize Size to use to display an event. @@ -63,47 +64,3 @@ func (v WidgetEventSize) IsValid() bool { func (v WidgetEventSize) Ptr() *WidgetEventSize { return &v } - -// NullableWidgetEventSize handles when a null is used for WidgetEventSize. -type NullableWidgetEventSize struct { - value *WidgetEventSize - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetEventSize) Get() *WidgetEventSize { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetEventSize) Set(val *WidgetEventSize) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetEventSize) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetEventSize) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetEventSize initializes the struct as if Set has been called. -func NewNullableWidgetEventSize(val *WidgetEventSize) *NullableWidgetEventSize { - return &NullableWidgetEventSize{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetEventSize) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetEventSize) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_field_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_field_sort.go index 84987eca7..dd1f3a05b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_field_sort.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_field_sort.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o WidgetFieldSort) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *WidgetFieldSort) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Column *string `json:"column"` Order *WidgetSort `json:"order"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Column == nil { return fmt.Errorf("required field column missing") @@ -129,19 +124,22 @@ func (o *WidgetFieldSort) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Order; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Column = *all.Column - o.Order = *all.Order + if !all.Order.IsValid() { + hasInvalidField = true + } else { + o.Order = *all.Order + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_formula.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_formula.go index bfd5cf1e3..3cd22a9da 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_formula.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_formula.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -242,7 +243,6 @@ func (o WidgetFormula) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *WidgetFormula) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Alias *string `json:"alias,omitempty"` CellDisplayMode *TableWidgetCellDisplayMode `json:"cell_display_mode,omitempty"` @@ -252,12 +252,7 @@ func (o *WidgetFormula) UnmarshalJSON(bytes []byte) (err error) { Style *WidgetFormulaStyle `json:"style,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Formula == nil { return fmt.Errorf("required field formula missing") @@ -268,37 +263,32 @@ func (o *WidgetFormula) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.CellDisplayMode; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Alias = all.Alias - o.CellDisplayMode = all.CellDisplayMode + if all.CellDisplayMode != nil && !all.CellDisplayMode.IsValid() { + hasInvalidField = true + } else { + o.CellDisplayMode = all.CellDisplayMode + } o.ConditionalFormats = all.ConditionalFormats o.Formula = *all.Formula if all.Limit != nil && all.Limit.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Limit = all.Limit if all.Style != nil && all.Style.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Style = all.Style + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_formula_limit.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_formula_limit.go index 78952a5b5..be01e089b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_formula_limit.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_formula_limit.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -119,18 +119,12 @@ func (o WidgetFormulaLimit) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *WidgetFormulaLimit) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Count *int64 `json:"count,omitempty"` Order *QuerySortOrder `json:"order,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -138,19 +132,22 @@ func (o *WidgetFormulaLimit) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Order; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Count = all.Count - o.Order = all.Order + if all.Order != nil && !all.Order.IsValid() { + hasInvalidField = true + } else { + o.Order = all.Order + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_formula_style.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_formula_style.go index ea3ad796a..ebb52fec6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_formula_style.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_formula_style.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o WidgetFormulaStyle) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *WidgetFormulaStyle) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Palette *string `json:"palette,omitempty"` PaletteIndex *int64 `json:"palette_index,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *WidgetFormulaStyle) UnmarshalJSON(bytes []byte) (err error) { } o.Palette = all.Palette o.PaletteIndex = all.PaletteIndex + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_grouping.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_grouping.go index 81bb3a75d..5d38933ce 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_grouping.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_grouping.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetGrouping The kind of grouping to use. @@ -63,47 +64,3 @@ func (v WidgetGrouping) IsValid() bool { func (v WidgetGrouping) Ptr() *WidgetGrouping { return &v } - -// NullableWidgetGrouping handles when a null is used for WidgetGrouping. -type NullableWidgetGrouping struct { - value *WidgetGrouping - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetGrouping) Get() *WidgetGrouping { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetGrouping) Set(val *WidgetGrouping) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetGrouping) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetGrouping) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetGrouping initializes the struct as if Set has been called. -func NewNullableWidgetGrouping(val *WidgetGrouping) *NullableWidgetGrouping { - return &NullableWidgetGrouping{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetGrouping) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetGrouping) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_horizontal_align.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_horizontal_align.go index ade2260f9..8933cbd62 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_horizontal_align.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_horizontal_align.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetHorizontalAlign Horizontal alignment. @@ -65,47 +66,3 @@ func (v WidgetHorizontalAlign) IsValid() bool { func (v WidgetHorizontalAlign) Ptr() *WidgetHorizontalAlign { return &v } - -// NullableWidgetHorizontalAlign handles when a null is used for WidgetHorizontalAlign. -type NullableWidgetHorizontalAlign struct { - value *WidgetHorizontalAlign - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetHorizontalAlign) Get() *WidgetHorizontalAlign { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetHorizontalAlign) Set(val *WidgetHorizontalAlign) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetHorizontalAlign) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetHorizontalAlign) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetHorizontalAlign initializes the struct as if Set has been called. -func NewNullableWidgetHorizontalAlign(val *WidgetHorizontalAlign) *NullableWidgetHorizontalAlign { - return &NullableWidgetHorizontalAlign{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetHorizontalAlign) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetHorizontalAlign) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_image_sizing.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_image_sizing.go index b02814ddc..5d138eb0b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_image_sizing.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_image_sizing.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetImageSizing How to size the image on the widget. The values are based on the image `object-fit` CSS properties. @@ -76,47 +77,3 @@ func (v WidgetImageSizing) IsValid() bool { func (v WidgetImageSizing) Ptr() *WidgetImageSizing { return &v } - -// NullableWidgetImageSizing handles when a null is used for WidgetImageSizing. -type NullableWidgetImageSizing struct { - value *WidgetImageSizing - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetImageSizing) Get() *WidgetImageSizing { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetImageSizing) Set(val *WidgetImageSizing) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetImageSizing) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetImageSizing) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetImageSizing initializes the struct as if Set has been called. -func NewNullableWidgetImageSizing(val *WidgetImageSizing) *NullableWidgetImageSizing { - return &NullableWidgetImageSizing{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetImageSizing) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetImageSizing) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_layout.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_layout.go index 7820adb7b..57ac14908 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_layout.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_layout.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -192,7 +193,6 @@ func (o WidgetLayout) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *WidgetLayout) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Height *int64 `json:"height"` IsColumnBreak *bool `json:"is_column_break,omitempty"` @@ -201,12 +201,7 @@ func (o *WidgetLayout) UnmarshalJSON(bytes []byte) (err error) { Y *int64 `json:"y"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Height == nil { return fmt.Errorf("required field height missing") @@ -231,6 +226,7 @@ func (o *WidgetLayout) UnmarshalJSON(bytes []byte) (err error) { o.Width = *all.Width o.X = *all.X o.Y = *all.Y + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_layout_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_layout_type.go index e6d5c299a..9f9ae384a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_layout_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_layout_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetLayoutType Layout type of the group. @@ -61,47 +62,3 @@ func (v WidgetLayoutType) IsValid() bool { func (v WidgetLayoutType) Ptr() *WidgetLayoutType { return &v } - -// NullableWidgetLayoutType handles when a null is used for WidgetLayoutType. -type NullableWidgetLayoutType struct { - value *WidgetLayoutType - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetLayoutType) Get() *WidgetLayoutType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetLayoutType) Set(val *WidgetLayoutType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetLayoutType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetLayoutType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetLayoutType initializes the struct as if Set has been called. -func NewNullableWidgetLayoutType(val *WidgetLayoutType) *NullableWidgetLayoutType { - return &NullableWidgetLayoutType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetLayoutType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetLayoutType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_line_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_line_type.go index 2dbe33892..3beb7ee31 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_line_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_line_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetLineType Type of lines displayed. @@ -65,47 +66,3 @@ func (v WidgetLineType) IsValid() bool { func (v WidgetLineType) Ptr() *WidgetLineType { return &v } - -// NullableWidgetLineType handles when a null is used for WidgetLineType. -type NullableWidgetLineType struct { - value *WidgetLineType - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetLineType) Get() *WidgetLineType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetLineType) Set(val *WidgetLineType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetLineType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetLineType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetLineType initializes the struct as if Set has been called. -func NewNullableWidgetLineType(val *WidgetLineType) *NullableWidgetLineType { - return &NullableWidgetLineType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetLineType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetLineType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_line_width.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_line_width.go index cd45aeaf9..9f3056a4b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_line_width.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_line_width.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetLineWidth Width of line displayed. @@ -65,47 +66,3 @@ func (v WidgetLineWidth) IsValid() bool { func (v WidgetLineWidth) Ptr() *WidgetLineWidth { return &v } - -// NullableWidgetLineWidth handles when a null is used for WidgetLineWidth. -type NullableWidgetLineWidth struct { - value *WidgetLineWidth - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetLineWidth) Get() *WidgetLineWidth { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetLineWidth) Set(val *WidgetLineWidth) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetLineWidth) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetLineWidth) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetLineWidth initializes the struct as if Set has been called. -func NewNullableWidgetLineWidth(val *WidgetLineWidth) *NullableWidgetLineWidth { - return &NullableWidgetLineWidth{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetLineWidth) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetLineWidth) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_live_span.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_live_span.go index bc5dc2f5e..02917e7f3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_live_span.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_live_span.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetLiveSpan The available timeframes depend on the widget you are using. @@ -89,47 +90,3 @@ func (v WidgetLiveSpan) IsValid() bool { func (v WidgetLiveSpan) Ptr() *WidgetLiveSpan { return &v } - -// NullableWidgetLiveSpan handles when a null is used for WidgetLiveSpan. -type NullableWidgetLiveSpan struct { - value *WidgetLiveSpan - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetLiveSpan) Get() *WidgetLiveSpan { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetLiveSpan) Set(val *WidgetLiveSpan) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetLiveSpan) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetLiveSpan) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetLiveSpan initializes the struct as if Set has been called. -func NewNullableWidgetLiveSpan(val *WidgetLiveSpan) *NullableWidgetLiveSpan { - return &NullableWidgetLiveSpan{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetLiveSpan) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetLiveSpan) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_margin.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_margin.go index 77f9c9c84..038b46d0e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_margin.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_margin.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetMargin Size of the margins around the image. @@ -70,47 +71,3 @@ func (v WidgetMargin) IsValid() bool { func (v WidgetMargin) Ptr() *WidgetMargin { return &v } - -// NullableWidgetMargin handles when a null is used for WidgetMargin. -type NullableWidgetMargin struct { - value *WidgetMargin - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetMargin) Get() *WidgetMargin { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetMargin) Set(val *WidgetMargin) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetMargin) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetMargin) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetMargin initializes the struct as if Set has been called. -func NewNullableWidgetMargin(val *WidgetMargin) *NullableWidgetMargin { - return &NullableWidgetMargin{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetMargin) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetMargin) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_marker.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_marker.go index 77ad652e9..fedc25d39 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_marker.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_marker.go @@ -5,9 +5,10 @@ package datadogV1 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -180,7 +181,6 @@ func (o WidgetMarker) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *WidgetMarker) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DisplayType *string `json:"display_type,omitempty"` Label *string `json:"label,omitempty"` @@ -188,12 +188,7 @@ func (o *WidgetMarker) UnmarshalJSON(bytes []byte) (err error) { Value *string `json:"value"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Value == nil { return fmt.Errorf("required field value missing") @@ -208,6 +203,7 @@ func (o *WidgetMarker) UnmarshalJSON(bytes []byte) (err error) { o.Label = all.Label o.Time = all.Time o.Value = *all.Value + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_message_display.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_message_display.go index 8dedcfb85..abceb1ec4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_message_display.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_message_display.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetMessageDisplay Amount of log lines to display @@ -65,47 +66,3 @@ func (v WidgetMessageDisplay) IsValid() bool { func (v WidgetMessageDisplay) Ptr() *WidgetMessageDisplay { return &v } - -// NullableWidgetMessageDisplay handles when a null is used for WidgetMessageDisplay. -type NullableWidgetMessageDisplay struct { - value *WidgetMessageDisplay - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetMessageDisplay) Get() *WidgetMessageDisplay { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetMessageDisplay) Set(val *WidgetMessageDisplay) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetMessageDisplay) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetMessageDisplay) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetMessageDisplay initializes the struct as if Set has been called. -func NewNullableWidgetMessageDisplay(val *WidgetMessageDisplay) *NullableWidgetMessageDisplay { - return &NullableWidgetMessageDisplay{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetMessageDisplay) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetMessageDisplay) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_monitor_summary_display_format.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_monitor_summary_display_format.go index bf2796807..aedced058 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_monitor_summary_display_format.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_monitor_summary_display_format.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetMonitorSummaryDisplayFormat What to display on the widget. @@ -65,47 +66,3 @@ func (v WidgetMonitorSummaryDisplayFormat) IsValid() bool { func (v WidgetMonitorSummaryDisplayFormat) Ptr() *WidgetMonitorSummaryDisplayFormat { return &v } - -// NullableWidgetMonitorSummaryDisplayFormat handles when a null is used for WidgetMonitorSummaryDisplayFormat. -type NullableWidgetMonitorSummaryDisplayFormat struct { - value *WidgetMonitorSummaryDisplayFormat - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetMonitorSummaryDisplayFormat) Get() *WidgetMonitorSummaryDisplayFormat { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetMonitorSummaryDisplayFormat) Set(val *WidgetMonitorSummaryDisplayFormat) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetMonitorSummaryDisplayFormat) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetMonitorSummaryDisplayFormat) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetMonitorSummaryDisplayFormat initializes the struct as if Set has been called. -func NewNullableWidgetMonitorSummaryDisplayFormat(val *WidgetMonitorSummaryDisplayFormat) *NullableWidgetMonitorSummaryDisplayFormat { - return &NullableWidgetMonitorSummaryDisplayFormat{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetMonitorSummaryDisplayFormat) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetMonitorSummaryDisplayFormat) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_monitor_summary_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_monitor_summary_sort.go index 3bdf7eb0a..3f94b4482 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_monitor_summary_sort.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_monitor_summary_sort.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetMonitorSummarySort Widget sorting methods. @@ -93,47 +94,3 @@ func (v WidgetMonitorSummarySort) IsValid() bool { func (v WidgetMonitorSummarySort) Ptr() *WidgetMonitorSummarySort { return &v } - -// NullableWidgetMonitorSummarySort handles when a null is used for WidgetMonitorSummarySort. -type NullableWidgetMonitorSummarySort struct { - value *WidgetMonitorSummarySort - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetMonitorSummarySort) Get() *WidgetMonitorSummarySort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetMonitorSummarySort) Set(val *WidgetMonitorSummarySort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetMonitorSummarySort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetMonitorSummarySort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetMonitorSummarySort initializes the struct as if Set has been called. -func NewNullableWidgetMonitorSummarySort(val *WidgetMonitorSummarySort) *NullableWidgetMonitorSummarySort { - return &NullableWidgetMonitorSummarySort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetMonitorSummarySort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetMonitorSummarySort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_node_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_node_type.go index b8a0412fb..1ada24d3b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_node_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_node_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetNodeType Which type of node to use in the map. @@ -63,47 +64,3 @@ func (v WidgetNodeType) IsValid() bool { func (v WidgetNodeType) Ptr() *WidgetNodeType { return &v } - -// NullableWidgetNodeType handles when a null is used for WidgetNodeType. -type NullableWidgetNodeType struct { - value *WidgetNodeType - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetNodeType) Get() *WidgetNodeType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetNodeType) Set(val *WidgetNodeType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetNodeType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetNodeType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetNodeType initializes the struct as if Set has been called. -func NewNullableWidgetNodeType(val *WidgetNodeType) *NullableWidgetNodeType { - return &NullableWidgetNodeType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetNodeType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetNodeType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_order_by.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_order_by.go index 0731f2b80..1ebdedab3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_order_by.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_order_by.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetOrderBy What to order by. @@ -67,47 +68,3 @@ func (v WidgetOrderBy) IsValid() bool { func (v WidgetOrderBy) Ptr() *WidgetOrderBy { return &v } - -// NullableWidgetOrderBy handles when a null is used for WidgetOrderBy. -type NullableWidgetOrderBy struct { - value *WidgetOrderBy - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetOrderBy) Get() *WidgetOrderBy { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetOrderBy) Set(val *WidgetOrderBy) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetOrderBy) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetOrderBy) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetOrderBy initializes the struct as if Set has been called. -func NewNullableWidgetOrderBy(val *WidgetOrderBy) *NullableWidgetOrderBy { - return &NullableWidgetOrderBy{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetOrderBy) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetOrderBy) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_palette.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_palette.go index 35b4ab37a..8456c3fc7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_palette.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_palette.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetPalette Color palette to apply. @@ -97,47 +98,3 @@ func (v WidgetPalette) IsValid() bool { func (v WidgetPalette) Ptr() *WidgetPalette { return &v } - -// NullableWidgetPalette handles when a null is used for WidgetPalette. -type NullableWidgetPalette struct { - value *WidgetPalette - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetPalette) Get() *WidgetPalette { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetPalette) Set(val *WidgetPalette) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetPalette) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetPalette) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetPalette initializes the struct as if Set has been called. -func NewNullableWidgetPalette(val *WidgetPalette) *NullableWidgetPalette { - return &NullableWidgetPalette{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetPalette) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetPalette) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_request_style.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_request_style.go index 0d49fd1b9..f4fcd0088 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_request_style.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_request_style.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o WidgetRequestStyle) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *WidgetRequestStyle) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { LineType *WidgetLineType `json:"line_type,omitempty"` LineWidth *WidgetLineWidth `json:"line_width,omitempty"` Palette *string `json:"palette,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,28 +162,27 @@ func (o *WidgetRequestStyle) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.LineType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.LineWidth; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.LineType = all.LineType - o.LineWidth = all.LineWidth + + hasInvalidField := false + if all.LineType != nil && !all.LineType.IsValid() { + hasInvalidField = true + } else { + o.LineType = all.LineType + } + if all.LineWidth != nil && !all.LineWidth.IsValid() { + hasInvalidField = true + } else { + o.LineWidth = all.LineWidth + } o.Palette = all.Palette + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_service_summary_display_format.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_service_summary_display_format.go index f6e988370..7ac7f718f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_service_summary_display_format.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_service_summary_display_format.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetServiceSummaryDisplayFormat Number of columns to display. @@ -65,47 +66,3 @@ func (v WidgetServiceSummaryDisplayFormat) IsValid() bool { func (v WidgetServiceSummaryDisplayFormat) Ptr() *WidgetServiceSummaryDisplayFormat { return &v } - -// NullableWidgetServiceSummaryDisplayFormat handles when a null is used for WidgetServiceSummaryDisplayFormat. -type NullableWidgetServiceSummaryDisplayFormat struct { - value *WidgetServiceSummaryDisplayFormat - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetServiceSummaryDisplayFormat) Get() *WidgetServiceSummaryDisplayFormat { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetServiceSummaryDisplayFormat) Set(val *WidgetServiceSummaryDisplayFormat) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetServiceSummaryDisplayFormat) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetServiceSummaryDisplayFormat) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetServiceSummaryDisplayFormat initializes the struct as if Set has been called. -func NewNullableWidgetServiceSummaryDisplayFormat(val *WidgetServiceSummaryDisplayFormat) *NullableWidgetServiceSummaryDisplayFormat { - return &NullableWidgetServiceSummaryDisplayFormat{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetServiceSummaryDisplayFormat) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetServiceSummaryDisplayFormat) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_size_format.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_size_format.go index deb3bbac3..0314cc6f0 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_size_format.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_size_format.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetSizeFormat Size of the widget. @@ -65,47 +66,3 @@ func (v WidgetSizeFormat) IsValid() bool { func (v WidgetSizeFormat) Ptr() *WidgetSizeFormat { return &v } - -// NullableWidgetSizeFormat handles when a null is used for WidgetSizeFormat. -type NullableWidgetSizeFormat struct { - value *WidgetSizeFormat - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetSizeFormat) Get() *WidgetSizeFormat { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetSizeFormat) Set(val *WidgetSizeFormat) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetSizeFormat) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetSizeFormat) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetSizeFormat initializes the struct as if Set has been called. -func NewNullableWidgetSizeFormat(val *WidgetSizeFormat) *NullableWidgetSizeFormat { - return &NullableWidgetSizeFormat{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetSizeFormat) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetSizeFormat) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_sort.go index 7afbba0a0..eee5f9a23 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_sort.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_sort.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetSort Widget sorting methods. @@ -63,47 +64,3 @@ func (v WidgetSort) IsValid() bool { func (v WidgetSort) Ptr() *WidgetSort { return &v } - -// NullableWidgetSort handles when a null is used for WidgetSort. -type NullableWidgetSort struct { - value *WidgetSort - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetSort) Get() *WidgetSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetSort) Set(val *WidgetSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetSort initializes the struct as if Set has been called. -func NewNullableWidgetSort(val *WidgetSort) *NullableWidgetSort { - return &NullableWidgetSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_style.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_style.go index ad0749ee4..13f66324d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_style.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_style.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o WidgetStyle) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *WidgetStyle) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Palette *string `json:"palette,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *WidgetStyle) UnmarshalJSON(bytes []byte) (err error) { return err } o.Palette = all.Palette + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_summary_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_summary_type.go index f1e0ae6e8..75ab94571 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_summary_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_summary_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetSummaryType Which summary type should be used. @@ -65,47 +66,3 @@ func (v WidgetSummaryType) IsValid() bool { func (v WidgetSummaryType) Ptr() *WidgetSummaryType { return &v } - -// NullableWidgetSummaryType handles when a null is used for WidgetSummaryType. -type NullableWidgetSummaryType struct { - value *WidgetSummaryType - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetSummaryType) Get() *WidgetSummaryType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetSummaryType) Set(val *WidgetSummaryType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetSummaryType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetSummaryType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetSummaryType initializes the struct as if Set has been called. -func NewNullableWidgetSummaryType(val *WidgetSummaryType) *NullableWidgetSummaryType { - return &NullableWidgetSummaryType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetSummaryType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetSummaryType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_text_align.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_text_align.go index 31ad0205a..6bb5955d1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_text_align.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_text_align.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetTextAlign How to align the text on the widget. @@ -65,47 +66,3 @@ func (v WidgetTextAlign) IsValid() bool { func (v WidgetTextAlign) Ptr() *WidgetTextAlign { return &v } - -// NullableWidgetTextAlign handles when a null is used for WidgetTextAlign. -type NullableWidgetTextAlign struct { - value *WidgetTextAlign - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetTextAlign) Get() *WidgetTextAlign { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetTextAlign) Set(val *WidgetTextAlign) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetTextAlign) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetTextAlign) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetTextAlign initializes the struct as if Set has been called. -func NewNullableWidgetTextAlign(val *WidgetTextAlign) *NullableWidgetTextAlign { - return &NullableWidgetTextAlign{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetTextAlign) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetTextAlign) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_tick_edge.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_tick_edge.go index 4a902c12b..2bf66da70 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_tick_edge.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_tick_edge.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetTickEdge Define how you want to align the text on the widget. @@ -67,47 +68,3 @@ func (v WidgetTickEdge) IsValid() bool { func (v WidgetTickEdge) Ptr() *WidgetTickEdge { return &v } - -// NullableWidgetTickEdge handles when a null is used for WidgetTickEdge. -type NullableWidgetTickEdge struct { - value *WidgetTickEdge - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetTickEdge) Get() *WidgetTickEdge { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetTickEdge) Set(val *WidgetTickEdge) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetTickEdge) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetTickEdge) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetTickEdge initializes the struct as if Set has been called. -func NewNullableWidgetTickEdge(val *WidgetTickEdge) *NullableWidgetTickEdge { - return &NullableWidgetTickEdge{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetTickEdge) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetTickEdge) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_time.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_time.go index 73ea17cf3..fbe0345a6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_time.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_time.go @@ -5,7 +5,7 @@ package datadogV1 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o WidgetTime) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *WidgetTime) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { LiveSpan *WidgetLiveSpan `json:"live_span,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,18 +94,21 @@ func (o *WidgetTime) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.LiveSpan; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.LiveSpan != nil && !all.LiveSpan.IsValid() { + hasInvalidField = true + } else { + o.LiveSpan = all.LiveSpan } - o.LiveSpan = all.LiveSpan + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_time_windows_.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_time_windows_.go index 99bfcd313..b7f04291a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_time_windows_.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_time_windows_.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetTimeWindows Define a time window. @@ -75,47 +76,3 @@ func (v WidgetTimeWindows) IsValid() bool { func (v WidgetTimeWindows) Ptr() *WidgetTimeWindows { return &v } - -// NullableWidgetTimeWindows handles when a null is used for WidgetTimeWindows. -type NullableWidgetTimeWindows struct { - value *WidgetTimeWindows - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetTimeWindows) Get() *WidgetTimeWindows { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetTimeWindows) Set(val *WidgetTimeWindows) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetTimeWindows) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetTimeWindows) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetTimeWindows initializes the struct as if Set has been called. -func NewNullableWidgetTimeWindows(val *WidgetTimeWindows) *NullableWidgetTimeWindows { - return &NullableWidgetTimeWindows{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetTimeWindows) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetTimeWindows) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_vertical_align.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_vertical_align.go index 52352c4a9..80bb3c6aa 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_vertical_align.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_vertical_align.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetVerticalAlign Vertical alignment. @@ -65,47 +66,3 @@ func (v WidgetVerticalAlign) IsValid() bool { func (v WidgetVerticalAlign) Ptr() *WidgetVerticalAlign { return &v } - -// NullableWidgetVerticalAlign handles when a null is used for WidgetVerticalAlign. -type NullableWidgetVerticalAlign struct { - value *WidgetVerticalAlign - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetVerticalAlign) Get() *WidgetVerticalAlign { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetVerticalAlign) Set(val *WidgetVerticalAlign) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetVerticalAlign) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetVerticalAlign) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetVerticalAlign initializes the struct as if Set has been called. -func NewNullableWidgetVerticalAlign(val *WidgetVerticalAlign) *NullableWidgetVerticalAlign { - return &NullableWidgetVerticalAlign{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetVerticalAlign) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetVerticalAlign) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_view_mode.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_view_mode.go index 39c416519..624870cd6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_view_mode.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_view_mode.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetViewMode Define how you want the SLO to be displayed. @@ -65,47 +66,3 @@ func (v WidgetViewMode) IsValid() bool { func (v WidgetViewMode) Ptr() *WidgetViewMode { return &v } - -// NullableWidgetViewMode handles when a null is used for WidgetViewMode. -type NullableWidgetViewMode struct { - value *WidgetViewMode - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetViewMode) Get() *WidgetViewMode { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetViewMode) Set(val *WidgetViewMode) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetViewMode) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetViewMode) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetViewMode initializes the struct as if Set has been called. -func NewNullableWidgetViewMode(val *WidgetViewMode) *NullableWidgetViewMode { - return &NullableWidgetViewMode{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetViewMode) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetViewMode) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_viz_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_viz_type.go index 188fb7108..61fee44f8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_viz_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/model_widget_viz_type.go @@ -5,8 +5,9 @@ package datadogV1 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // WidgetVizType Whether to display the Alert Graph as a timeseries or a top list. @@ -63,47 +64,3 @@ func (v WidgetVizType) IsValid() bool { func (v WidgetVizType) Ptr() *WidgetVizType { return &v } - -// NullableWidgetVizType handles when a null is used for WidgetVizType. -type NullableWidgetVizType struct { - value *WidgetVizType - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetVizType) Get() *WidgetVizType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetVizType) Set(val *WidgetVizType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetVizType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetVizType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetVizType initializes the struct as if Set has been called. -func NewNullableWidgetVizType(val *WidgetVizType) *NullableWidgetVizType { - return &NullableWidgetVizType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetVizType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetVizType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_ci_visibility_pipelines.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_ci_visibility_pipelines.go index 9d9500030..fed043a73 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_ci_visibility_pipelines.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_ci_visibility_pipelines.go @@ -6,6 +6,8 @@ package datadogV2 import ( _context "context" + _fmt "fmt" + _log "log" _nethttp "net/http" _neturl "net/url" "time" @@ -17,7 +19,7 @@ import ( type CIVisibilityPipelinesApi datadog.Service // AggregateCIAppPipelineEvents Aggregate pipelines events. -// The API endpoint to aggregate CI Visibility pipeline events into buckets of computed metrics and timeseries. +// Use this API endpoint to aggregate CI Visibility pipeline events into buckets of computed metrics and timeseries. func (a *CIVisibilityPipelinesApi) AggregateCIAppPipelineEvents(ctx _context.Context, body CIAppPipelinesAggregateRequest) (CIAppPipelinesAnalyticsAggregateResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -90,9 +92,9 @@ func (a *CIVisibilityPipelinesApi) AggregateCIAppPipelineEvents(ctx _context.Con } // CreateCIAppPipelineEvent Send pipeline event. -// Send your pipeline event to your Datadog platform over HTTP. For details about how pipeline executions are modeled and what execution types we support, see the [guide](https://docs.datadoghq.com/continuous_integration/guides/pipeline_data_model/). +// Send your pipeline event to your Datadog platform over HTTP. For details about how pipeline executions are modeled and what execution types we support, see [Pipeline Data Model And Execution Types](https://docs.datadoghq.com/continuous_integration/guides/pipeline_data_model/). // -// This API endpoint is in private beta. +// Pipeline events can be submitted with a timestamp that is up to 18 hours in the past. func (a *CIVisibilityPipelinesApi) CreateCIAppPipelineEvent(ctx _context.Context, body CIAppCreatePipelineEventRequest) (interface{}, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -100,6 +102,13 @@ func (a *CIVisibilityPipelinesApi) CreateCIAppPipelineEvent(ctx _context.Context localVarReturnValue interface{} ) + operationId := "v2.CreateCIAppPipelineEvent" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.CIVisibilityPipelinesApi.CreateCIAppPipelineEvent") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} @@ -217,7 +226,7 @@ func (r *ListCIAppPipelineEventsOptionalParameters) WithPageLimit(pageLimit int3 } // ListCIAppPipelineEvents Get a list of pipelines events. -// List endpoint returns CI Visibility pipeline events that match a [log search query](https://docs.datadoghq.com/logs/explorer/search_syntax/). +// List endpoint returns CI Visibility pipeline events that match a [search query](https://docs.datadoghq.com/continuous_integration/explorer/search_syntax/). // [Results are paginated similarly to logs](https://docs.datadoghq.com/logs/guide/collect-multiple-logs-with-pagination). // // Use this endpoint to see your latest pipeline events. @@ -391,7 +400,7 @@ func (r *SearchCIAppPipelineEventsOptionalParameters) WithBody(body CIAppPipelin } // SearchCIAppPipelineEvents Search pipelines events. -// List endpoint returns CI Visibility pipeline events that match a [log search query](https://docs.datadoghq.com/logs/explorer/search_syntax/). +// List endpoint returns CI Visibility pipeline events that match a [search query](https://docs.datadoghq.com/continuous_integration/explorer/search_syntax/). // [Results are paginated similarly to logs](https://docs.datadoghq.com/logs/guide/collect-multiple-logs-with-pagination). // // Use this endpoint to build complex events filtering and search. diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_downtimes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_downtimes.go new file mode 100644 index 000000000..ca84ffa21 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_downtimes.go @@ -0,0 +1,554 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + _context "context" + _fmt "fmt" + _log "log" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimesApi service type +type DowntimesApi datadog.Service + +// CancelDowntime Cancel a downtime. +// Cancel a downtime. +func (a *DowntimesApi) CancelDowntime(ctx _context.Context, downtimeId string) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + operationId := "v2.CancelDowntime" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.DowntimesApi.CancelDowntime") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/downtime/{downtime_id}" + localVarPath = strings.Replace(localVarPath, "{"+"downtime_id"+"}", _neturl.PathEscape(datadog.ParameterToString(downtimeId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// CreateDowntime Schedule a downtime. +// Schedule a downtime. +func (a *DowntimesApi) CreateDowntime(ctx _context.Context, body DowntimeCreateRequest) (DowntimeResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue DowntimeResponse + ) + + operationId := "v2.CreateDowntime" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.DowntimesApi.CreateDowntime") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/downtime" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetDowntimeOptionalParameters holds optional parameters for GetDowntime. +type GetDowntimeOptionalParameters struct { + Include *string +} + +// NewGetDowntimeOptionalParameters creates an empty struct for parameters. +func NewGetDowntimeOptionalParameters() *GetDowntimeOptionalParameters { + this := GetDowntimeOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *GetDowntimeOptionalParameters) WithInclude(include string) *GetDowntimeOptionalParameters { + r.Include = &include + return r +} + +// GetDowntime Get a downtime. +// Get downtime detail by `downtime_id`. +func (a *DowntimesApi) GetDowntime(ctx _context.Context, downtimeId string, o ...GetDowntimeOptionalParameters) (DowntimeResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue DowntimeResponse + optionalParams GetDowntimeOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type GetDowntimeOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.GetDowntime" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.DowntimesApi.GetDowntime") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/downtime/{downtime_id}" + localVarPath = strings.Replace(localVarPath, "{"+"downtime_id"+"}", _neturl.PathEscape(datadog.ParameterToString(downtimeId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListDowntimesOptionalParameters holds optional parameters for ListDowntimes. +type ListDowntimesOptionalParameters struct { + CurrentOnly *bool + Include *string +} + +// NewListDowntimesOptionalParameters creates an empty struct for parameters. +func NewListDowntimesOptionalParameters() *ListDowntimesOptionalParameters { + this := ListDowntimesOptionalParameters{} + return &this +} + +// WithCurrentOnly sets the corresponding parameter name and returns the struct. +func (r *ListDowntimesOptionalParameters) WithCurrentOnly(currentOnly bool) *ListDowntimesOptionalParameters { + r.CurrentOnly = ¤tOnly + return r +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *ListDowntimesOptionalParameters) WithInclude(include string) *ListDowntimesOptionalParameters { + r.Include = &include + return r +} + +// ListDowntimes Get all downtimes. +// Get all scheduled downtimes. +func (a *DowntimesApi) ListDowntimes(ctx _context.Context, o ...ListDowntimesOptionalParameters) (ListDowntimesResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue ListDowntimesResponse + optionalParams ListDowntimesOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListDowntimesOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.ListDowntimes" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.DowntimesApi.ListDowntimes") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/downtime" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.CurrentOnly != nil { + localVarQueryParams.Add("current_only", datadog.ParameterToString(*optionalParams.CurrentOnly, "")) + } + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListMonitorDowntimes Get active downtimes for a monitor. +// Get all active downtimes for the specified monitor. +func (a *DowntimesApi) ListMonitorDowntimes(ctx _context.Context, monitorId int64) (MonitorDowntimeMatchResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue MonitorDowntimeMatchResponse + ) + + operationId := "v2.ListMonitorDowntimes" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.DowntimesApi.ListMonitorDowntimes") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/monitor/{monitor_id}/downtime_matches" + localVarPath = strings.Replace(localVarPath, "{"+"monitor_id"+"}", _neturl.PathEscape(datadog.ParameterToString(monitorId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// UpdateDowntime Update a downtime. +// Update a downtime by `downtime_id`. +func (a *DowntimesApi) UpdateDowntime(ctx _context.Context, downtimeId string, body DowntimeUpdateRequest) (DowntimeResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue DowntimeResponse + ) + + operationId := "v2.UpdateDowntime" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.DowntimesApi.UpdateDowntime") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/downtime/{downtime_id}" + localVarPath = strings.Replace(localVarPath, "{"+"downtime_id"+"}", _neturl.PathEscape(datadog.ParameterToString(downtimeId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewDowntimesApi Returns NewDowntimesApi. +func NewDowntimesApi(client *datadog.APIClient) *DowntimesApi { + return &DowntimesApi{ + Client: client, + } +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_logs.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_logs.go index 073c82087..6945fd979 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_logs.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_logs.go @@ -266,7 +266,7 @@ func (a *LogsApi) ListLogsWithPagination(ctx _context.Context, o ...ListLogsOpti // ListLogsGetOptionalParameters holds optional parameters for ListLogsGet. type ListLogsGetOptionalParameters struct { FilterQuery *string - FilterIndex *string + FilterIndexes *[]string FilterFrom *time.Time FilterTo *time.Time FilterStorageTier *LogsStorageTier @@ -287,9 +287,9 @@ func (r *ListLogsGetOptionalParameters) WithFilterQuery(filterQuery string) *Lis return r } -// WithFilterIndex sets the corresponding parameter name and returns the struct. -func (r *ListLogsGetOptionalParameters) WithFilterIndex(filterIndex string) *ListLogsGetOptionalParameters { - r.FilterIndex = &filterIndex +// WithFilterIndexes sets the corresponding parameter name and returns the struct. +func (r *ListLogsGetOptionalParameters) WithFilterIndexes(filterIndexes []string) *ListLogsGetOptionalParameters { + r.FilterIndexes = &filterIndexes return r } @@ -369,8 +369,8 @@ func (a *LogsApi) ListLogsGet(ctx _context.Context, o ...ListLogsGetOptionalPara if optionalParams.FilterQuery != nil { localVarQueryParams.Add("filter[query]", datadog.ParameterToString(*optionalParams.FilterQuery, "")) } - if optionalParams.FilterIndex != nil { - localVarQueryParams.Add("filter[index]", datadog.ParameterToString(*optionalParams.FilterIndex, "")) + if optionalParams.FilterIndexes != nil { + localVarQueryParams.Add("filter[indexes]", datadog.ParameterToString(*optionalParams.FilterIndexes, "csv")) } if optionalParams.FilterFrom != nil { localVarQueryParams.Add("filter[from]", datadog.ParameterToString(*optionalParams.FilterFrom, "")) diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_metrics.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_metrics.go index c761104fd..a66868219 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_metrics.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_metrics.go @@ -923,7 +923,7 @@ func (a *MetricsApi) ListVolumesByMetricName(ctx _context.Context, metricName st } // QueryScalarData Query scalar data across multiple products. -// Query scalar values (as seen on Query Value, Table and Toplist widgets). +// Query scalar values (as seen on Query Value, Table, and Toplist widgets). // Multiple data sources are supported with the ability to // process the data using formulas and functions. func (a *MetricsApi) QueryScalarData(ctx _context.Context, body ScalarFormulaQueryRequest) (ScalarFormulaQueryResponse, *_nethttp.Response, error) { diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_security_monitoring.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_security_monitoring.go index ee7357b76..7d6dd0f5d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_security_monitoring.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_security_monitoring.go @@ -765,11 +765,11 @@ func (a *SecurityMonitoringApi) GetSecurityMonitoringRule(ctx _context.Context, // GetSecurityMonitoringSignal Get a signal's details. // Get a signal's details. -func (a *SecurityMonitoringApi) GetSecurityMonitoringSignal(ctx _context.Context, signalId string) (SecurityMonitoringSignal, *_nethttp.Response, error) { +func (a *SecurityMonitoringApi) GetSecurityMonitoringSignal(ctx _context.Context, signalId string) (SecurityMonitoringSignalResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} - localVarReturnValue SecurityMonitoringSignal + localVarReturnValue SecurityMonitoringSignalResponse ) localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SecurityMonitoringApi.GetSecurityMonitoringSignal") @@ -959,7 +959,6 @@ func (r *ListFindingsOptionalParameters) WithFilterStatus(filterStatus FindingSt // - Core attributes, including status, evaluation, high-level resource details, muted state, and rule details. // - `evaluation_changed_at` and `resource_discovery_date` time stamps. // - An array of associated tags. -// func (a *SecurityMonitoringApi) ListFindings(ctx _context.Context, o ...ListFindingsOptionalParameters) (ListFindingsResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_spans.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_spans.go new file mode 100644 index 000000000..4e2c684d9 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_spans.go @@ -0,0 +1,454 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + _context "context" + _nethttp "net/http" + _neturl "net/url" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SpansApi service type +type SpansApi datadog.Service + +// AggregateSpans Aggregate spans. +// The API endpoint to aggregate spans into buckets and compute metrics and timeseries. +// This endpoint is rate limited to `300` requests per hour. +func (a *SpansApi) AggregateSpans(ctx _context.Context, body SpansAggregateRequest) (SpansAggregateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue SpansAggregateResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SpansApi.AggregateSpans") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/spans/analytics/aggregate" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListSpans Search spans. +// List endpoint returns spans that match a span search query. +// [Results are paginated][1]. +// +// Use this endpoint to build complex spans filtering and search. +// This endpoint is rate limited to `300` requests per hour. +// +// [1]: /logs/guide/collect-multiple-logs-with-pagination?tab=v2api +func (a *SpansApi) ListSpans(ctx _context.Context, body SpansListRequest) (SpansListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue SpansListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SpansApi.ListSpans") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/spans/events/search" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 422 || localVarHTTPResponse.StatusCode == 429 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListSpansWithPagination provides a paginated version of ListSpans returning a channel with all items. +func (a *SpansApi) ListSpansWithPagination(ctx _context.Context, body SpansListRequest) (<-chan datadog.PaginationResult[Span], func()) { + ctx, cancel := _context.WithCancel(ctx) + pageSize_ := int32(10) + if body.Data == nil { + body.Data = NewSpansListRequestData() + } + if body.Data.Attributes == nil { + body.Data.Attributes = NewSpansListRequestAttributes() + } + if body.Data.Attributes.Page == nil { + body.Data.Attributes.Page = NewSpansListRequestPage() + } + if body.Data.Attributes.Page.Limit == nil { + // int32 + body.Data.Attributes.Page.Limit = &pageSize_ + } else { + pageSize_ = *body.Data.Attributes.Page.Limit + } + + items := make(chan datadog.PaginationResult[Span], pageSize_) + go func() { + for { + resp, _, err := a.ListSpans(ctx, body) + if err != nil { + var returnItem Span + items <- datadog.PaginationResult[Span]{returnItem, err} + break + } + respData, ok := resp.GetDataOk() + if !ok { + break + } + results := *respData + + for _, item := range results { + select { + case items <- datadog.PaginationResult[Span]{item, nil}: + case <-ctx.Done(): + close(items) + return + } + } + if len(results) < int(pageSize_) { + break + } + cursorMeta, ok := resp.GetMetaOk() + if !ok { + break + } + cursorMetaPage, ok := cursorMeta.GetPageOk() + if !ok { + break + } + cursorMetaPageAfter, ok := cursorMetaPage.GetAfterOk() + if !ok { + break + } + + body.Data.Attributes.Page.Cursor = cursorMetaPageAfter + } + close(items) + }() + return items, cancel +} + +// ListSpansGetOptionalParameters holds optional parameters for ListSpansGet. +type ListSpansGetOptionalParameters struct { + FilterQuery *string + FilterFrom *string + FilterTo *string + Sort *SpansSort + PageCursor *string + PageLimit *int32 +} + +// NewListSpansGetOptionalParameters creates an empty struct for parameters. +func NewListSpansGetOptionalParameters() *ListSpansGetOptionalParameters { + this := ListSpansGetOptionalParameters{} + return &this +} + +// WithFilterQuery sets the corresponding parameter name and returns the struct. +func (r *ListSpansGetOptionalParameters) WithFilterQuery(filterQuery string) *ListSpansGetOptionalParameters { + r.FilterQuery = &filterQuery + return r +} + +// WithFilterFrom sets the corresponding parameter name and returns the struct. +func (r *ListSpansGetOptionalParameters) WithFilterFrom(filterFrom string) *ListSpansGetOptionalParameters { + r.FilterFrom = &filterFrom + return r +} + +// WithFilterTo sets the corresponding parameter name and returns the struct. +func (r *ListSpansGetOptionalParameters) WithFilterTo(filterTo string) *ListSpansGetOptionalParameters { + r.FilterTo = &filterTo + return r +} + +// WithSort sets the corresponding parameter name and returns the struct. +func (r *ListSpansGetOptionalParameters) WithSort(sort SpansSort) *ListSpansGetOptionalParameters { + r.Sort = &sort + return r +} + +// WithPageCursor sets the corresponding parameter name and returns the struct. +func (r *ListSpansGetOptionalParameters) WithPageCursor(pageCursor string) *ListSpansGetOptionalParameters { + r.PageCursor = &pageCursor + return r +} + +// WithPageLimit sets the corresponding parameter name and returns the struct. +func (r *ListSpansGetOptionalParameters) WithPageLimit(pageLimit int32) *ListSpansGetOptionalParameters { + r.PageLimit = &pageLimit + return r +} + +// ListSpansGet Get a list of spans. +// List endpoint returns spans that match a span search query. +// [Results are paginated][1]. +// +// Use this endpoint to see your latest spans. +// This endpoint is rate limited to `300` requests per hour. +// +// [1]: /logs/guide/collect-multiple-logs-with-pagination?tab=v2api +func (a *SpansApi) ListSpansGet(ctx _context.Context, o ...ListSpansGetOptionalParameters) (SpansListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SpansListResponse + optionalParams ListSpansGetOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListSpansGetOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SpansApi.ListSpansGet") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/spans/events" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.FilterQuery != nil { + localVarQueryParams.Add("filter[query]", datadog.ParameterToString(*optionalParams.FilterQuery, "")) + } + if optionalParams.FilterFrom != nil { + localVarQueryParams.Add("filter[from]", datadog.ParameterToString(*optionalParams.FilterFrom, "")) + } + if optionalParams.FilterTo != nil { + localVarQueryParams.Add("filter[to]", datadog.ParameterToString(*optionalParams.FilterTo, "")) + } + if optionalParams.Sort != nil { + localVarQueryParams.Add("sort", datadog.ParameterToString(*optionalParams.Sort, "")) + } + if optionalParams.PageCursor != nil { + localVarQueryParams.Add("page[cursor]", datadog.ParameterToString(*optionalParams.PageCursor, "")) + } + if optionalParams.PageLimit != nil { + localVarQueryParams.Add("page[limit]", datadog.ParameterToString(*optionalParams.PageLimit, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 422 || localVarHTTPResponse.StatusCode == 429 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListSpansGetWithPagination provides a paginated version of ListSpansGet returning a channel with all items. +func (a *SpansApi) ListSpansGetWithPagination(ctx _context.Context, o ...ListSpansGetOptionalParameters) (<-chan datadog.PaginationResult[Span], func()) { + ctx, cancel := _context.WithCancel(ctx) + pageSize_ := int32(10) + if len(o) == 0 { + o = append(o, ListSpansGetOptionalParameters{}) + } + if o[0].PageLimit != nil { + pageSize_ = *o[0].PageLimit + } + o[0].PageLimit = &pageSize_ + + items := make(chan datadog.PaginationResult[Span], pageSize_) + go func() { + for { + resp, _, err := a.ListSpansGet(ctx, o...) + if err != nil { + var returnItem Span + items <- datadog.PaginationResult[Span]{returnItem, err} + break + } + respData, ok := resp.GetDataOk() + if !ok { + break + } + results := *respData + + for _, item := range results { + select { + case items <- datadog.PaginationResult[Span]{item, nil}: + case <-ctx.Done(): + close(items) + return + } + } + if len(results) < int(pageSize_) { + break + } + cursorMeta, ok := resp.GetMetaOk() + if !ok { + break + } + cursorMetaPage, ok := cursorMeta.GetPageOk() + if !ok { + break + } + cursorMetaPageAfter, ok := cursorMetaPage.GetAfterOk() + if !ok { + break + } + + o[0].PageCursor = cursorMetaPageAfter + } + close(items) + }() + return items, cancel +} + +// NewSpansApi Returns NewSpansApi. +func NewSpansApi(client *datadog.APIClient) *SpansApi { + return &SpansApi{ + Client: client, + } +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_teams.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_teams.go index 55e10ae89..43113f2da 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_teams.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/api_teams.go @@ -838,6 +838,77 @@ func (a *TeamsApi) GetTeamPermissionSettings(ctx _context.Context, teamId string return localVarReturnValue, localVarHTTPResponse, nil } +// GetUserMemberships Get user memberships. +// Get a list of memberships for a user +func (a *TeamsApi) GetUserMemberships(ctx _context.Context, userUuid string) (UserTeamsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UserTeamsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.TeamsApi.GetUserMemberships") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/users/{user_uuid}/memberships" + localVarPath = strings.Replace(localVarPath, "{"+"user_uuid"+"}", _neturl.PathEscape(datadog.ParameterToString(userUuid, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // ListTeamsOptionalParameters holds optional parameters for ListTeams. type ListTeamsOptionalParameters struct { PageNumber *int64 diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/doc.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/doc.go index 8b7f50b43..ec23dd015 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/doc.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/doc.go @@ -3,251 +3,261 @@ // Copyright 2019-Present Datadog, Inc. // List of APIs: -// - [AuditApi.ListAuditLogs] -// - [AuditApi.SearchAuditLogs] -// - [AuthNMappingsApi.CreateAuthNMapping] -// - [AuthNMappingsApi.DeleteAuthNMapping] -// - [AuthNMappingsApi.GetAuthNMapping] -// - [AuthNMappingsApi.ListAuthNMappings] -// - [AuthNMappingsApi.UpdateAuthNMapping] -// - [CIVisibilityPipelinesApi.AggregateCIAppPipelineEvents] -// - [CIVisibilityPipelinesApi.CreateCIAppPipelineEvent] -// - [CIVisibilityPipelinesApi.ListCIAppPipelineEvents] -// - [CIVisibilityPipelinesApi.SearchCIAppPipelineEvents] -// - [CIVisibilityTestsApi.AggregateCIAppTestEvents] -// - [CIVisibilityTestsApi.ListCIAppTestEvents] -// - [CIVisibilityTestsApi.SearchCIAppTestEvents] -// - [CloudWorkloadSecurityApi.CreateCloudWorkloadSecurityAgentRule] -// - [CloudWorkloadSecurityApi.DeleteCloudWorkloadSecurityAgentRule] -// - [CloudWorkloadSecurityApi.DownloadCloudWorkloadPolicyFile] -// - [CloudWorkloadSecurityApi.GetCloudWorkloadSecurityAgentRule] -// - [CloudWorkloadSecurityApi.ListCloudWorkloadSecurityAgentRules] -// - [CloudWorkloadSecurityApi.UpdateCloudWorkloadSecurityAgentRule] -// - [CloudflareIntegrationApi.CreateCloudflareAccount] -// - [CloudflareIntegrationApi.DeleteCloudflareAccount] -// - [CloudflareIntegrationApi.GetCloudflareAccount] -// - [CloudflareIntegrationApi.ListCloudflareAccounts] -// - [CloudflareIntegrationApi.UpdateCloudflareAccount] -// - [ConfluentCloudApi.CreateConfluentAccount] -// - [ConfluentCloudApi.CreateConfluentResource] -// - [ConfluentCloudApi.DeleteConfluentAccount] -// - [ConfluentCloudApi.DeleteConfluentResource] -// - [ConfluentCloudApi.GetConfluentAccount] -// - [ConfluentCloudApi.GetConfluentResource] -// - [ConfluentCloudApi.ListConfluentAccount] -// - [ConfluentCloudApi.ListConfluentResource] -// - [ConfluentCloudApi.UpdateConfluentAccount] -// - [ConfluentCloudApi.UpdateConfluentResource] -// - [DashboardListsApi.CreateDashboardListItems] -// - [DashboardListsApi.DeleteDashboardListItems] -// - [DashboardListsApi.GetDashboardListItems] -// - [DashboardListsApi.UpdateDashboardListItems] -// - [EventsApi.ListEvents] -// - [EventsApi.SearchEvents] -// - [FastlyIntegrationApi.CreateFastlyAccount] -// - [FastlyIntegrationApi.CreateFastlyService] -// - [FastlyIntegrationApi.DeleteFastlyAccount] -// - [FastlyIntegrationApi.DeleteFastlyService] -// - [FastlyIntegrationApi.GetFastlyAccount] -// - [FastlyIntegrationApi.GetFastlyService] -// - [FastlyIntegrationApi.ListFastlyAccounts] -// - [FastlyIntegrationApi.ListFastlyServices] -// - [FastlyIntegrationApi.UpdateFastlyAccount] -// - [FastlyIntegrationApi.UpdateFastlyService] -// - [GCPIntegrationApi.CreateGCPSTSAccount] -// - [GCPIntegrationApi.DeleteGCPSTSAccount] -// - [GCPIntegrationApi.GetGCPSTSDelegate] -// - [GCPIntegrationApi.ListGCPSTSAccounts] -// - [GCPIntegrationApi.MakeGCPSTSDelegate] -// - [GCPIntegrationApi.UpdateGCPSTSAccount] -// - [IPAllowlistApi.GetIPAllowlist] -// - [IPAllowlistApi.UpdateIPAllowlist] -// - [IncidentServicesApi.CreateIncidentService] -// - [IncidentServicesApi.DeleteIncidentService] -// - [IncidentServicesApi.GetIncidentService] -// - [IncidentServicesApi.ListIncidentServices] -// - [IncidentServicesApi.UpdateIncidentService] -// - [IncidentTeamsApi.CreateIncidentTeam] -// - [IncidentTeamsApi.DeleteIncidentTeam] -// - [IncidentTeamsApi.GetIncidentTeam] -// - [IncidentTeamsApi.ListIncidentTeams] -// - [IncidentTeamsApi.UpdateIncidentTeam] -// - [IncidentsApi.CreateIncident] -// - [IncidentsApi.CreateIncidentIntegration] -// - [IncidentsApi.CreateIncidentTodo] -// - [IncidentsApi.DeleteIncident] -// - [IncidentsApi.DeleteIncidentIntegration] -// - [IncidentsApi.DeleteIncidentTodo] -// - [IncidentsApi.GetIncident] -// - [IncidentsApi.GetIncidentIntegration] -// - [IncidentsApi.GetIncidentTodo] -// - [IncidentsApi.ListIncidentAttachments] -// - [IncidentsApi.ListIncidentIntegrations] -// - [IncidentsApi.ListIncidentTodos] -// - [IncidentsApi.ListIncidents] -// - [IncidentsApi.SearchIncidents] -// - [IncidentsApi.UpdateIncident] -// - [IncidentsApi.UpdateIncidentAttachments] -// - [IncidentsApi.UpdateIncidentIntegration] -// - [IncidentsApi.UpdateIncidentTodo] -// - [KeyManagementApi.CreateAPIKey] -// - [KeyManagementApi.CreateCurrentUserApplicationKey] -// - [KeyManagementApi.DeleteAPIKey] -// - [KeyManagementApi.DeleteApplicationKey] -// - [KeyManagementApi.DeleteCurrentUserApplicationKey] -// - [KeyManagementApi.GetAPIKey] -// - [KeyManagementApi.GetApplicationKey] -// - [KeyManagementApi.GetCurrentUserApplicationKey] -// - [KeyManagementApi.ListAPIKeys] -// - [KeyManagementApi.ListApplicationKeys] -// - [KeyManagementApi.ListCurrentUserApplicationKeys] -// - [KeyManagementApi.UpdateAPIKey] -// - [KeyManagementApi.UpdateApplicationKey] -// - [KeyManagementApi.UpdateCurrentUserApplicationKey] -// - [LogsApi.AggregateLogs] -// - [LogsApi.ListLogs] -// - [LogsApi.ListLogsGet] -// - [LogsApi.SubmitLog] -// - [LogsArchivesApi.AddReadRoleToArchive] -// - [LogsArchivesApi.CreateLogsArchive] -// - [LogsArchivesApi.DeleteLogsArchive] -// - [LogsArchivesApi.GetLogsArchive] -// - [LogsArchivesApi.GetLogsArchiveOrder] -// - [LogsArchivesApi.ListArchiveReadRoles] -// - [LogsArchivesApi.ListLogsArchives] -// - [LogsArchivesApi.RemoveRoleFromArchive] -// - [LogsArchivesApi.UpdateLogsArchive] -// - [LogsArchivesApi.UpdateLogsArchiveOrder] -// - [LogsMetricsApi.CreateLogsMetric] -// - [LogsMetricsApi.DeleteLogsMetric] -// - [LogsMetricsApi.GetLogsMetric] -// - [LogsMetricsApi.ListLogsMetrics] -// - [LogsMetricsApi.UpdateLogsMetric] -// - [MetricsApi.CreateBulkTagsMetricsConfiguration] -// - [MetricsApi.CreateTagConfiguration] -// - [MetricsApi.DeleteBulkTagsMetricsConfiguration] -// - [MetricsApi.DeleteTagConfiguration] -// - [MetricsApi.EstimateMetricsOutputSeries] -// - [MetricsApi.ListActiveMetricConfigurations] -// - [MetricsApi.ListTagConfigurationByName] -// - [MetricsApi.ListTagConfigurations] -// - [MetricsApi.ListTagsByMetricName] -// - [MetricsApi.ListVolumesByMetricName] -// - [MetricsApi.QueryScalarData] -// - [MetricsApi.QueryTimeseriesData] -// - [MetricsApi.SubmitMetrics] -// - [MetricsApi.UpdateTagConfiguration] -// - [MonitorsApi.CreateMonitorConfigPolicy] -// - [MonitorsApi.DeleteMonitorConfigPolicy] -// - [MonitorsApi.GetMonitorConfigPolicy] -// - [MonitorsApi.ListMonitorConfigPolicies] -// - [MonitorsApi.UpdateMonitorConfigPolicy] -// - [OpsgenieIntegrationApi.CreateOpsgenieService] -// - [OpsgenieIntegrationApi.DeleteOpsgenieService] -// - [OpsgenieIntegrationApi.GetOpsgenieService] -// - [OpsgenieIntegrationApi.ListOpsgenieServices] -// - [OpsgenieIntegrationApi.UpdateOpsgenieService] -// - [OrganizationsApi.UploadIdPMetadata] -// - [ProcessesApi.ListProcesses] -// - [RUMApi.AggregateRUMEvents] -// - [RUMApi.CreateRUMApplication] -// - [RUMApi.DeleteRUMApplication] -// - [RUMApi.GetRUMApplication] -// - [RUMApi.GetRUMApplications] -// - [RUMApi.ListRUMEvents] -// - [RUMApi.SearchRUMEvents] -// - [RUMApi.UpdateRUMApplication] -// - [RestrictionPoliciesApi.DeleteRestrictionPolicy] -// - [RestrictionPoliciesApi.GetRestrictionPolicy] -// - [RestrictionPoliciesApi.UpdateRestrictionPolicy] -// - [RolesApi.AddPermissionToRole] -// - [RolesApi.AddUserToRole] -// - [RolesApi.CloneRole] -// - [RolesApi.CreateRole] -// - [RolesApi.DeleteRole] -// - [RolesApi.GetRole] -// - [RolesApi.ListPermissions] -// - [RolesApi.ListRolePermissions] -// - [RolesApi.ListRoleUsers] -// - [RolesApi.ListRoles] -// - [RolesApi.RemovePermissionFromRole] -// - [RolesApi.RemoveUserFromRole] -// - [RolesApi.UpdateRole] -// - [SecurityMonitoringApi.CreateSecurityFilter] -// - [SecurityMonitoringApi.CreateSecurityMonitoringRule] -// - [SecurityMonitoringApi.DeleteSecurityFilter] -// - [SecurityMonitoringApi.DeleteSecurityMonitoringRule] -// - [SecurityMonitoringApi.EditSecurityMonitoringSignalAssignee] -// - [SecurityMonitoringApi.EditSecurityMonitoringSignalIncidents] -// - [SecurityMonitoringApi.EditSecurityMonitoringSignalState] -// - [SecurityMonitoringApi.GetFinding] -// - [SecurityMonitoringApi.GetSecurityFilter] -// - [SecurityMonitoringApi.GetSecurityMonitoringRule] -// - [SecurityMonitoringApi.GetSecurityMonitoringSignal] -// - [SecurityMonitoringApi.ListFindings] -// - [SecurityMonitoringApi.ListSecurityFilters] -// - [SecurityMonitoringApi.ListSecurityMonitoringRules] -// - [SecurityMonitoringApi.ListSecurityMonitoringSignals] -// - [SecurityMonitoringApi.SearchSecurityMonitoringSignals] -// - [SecurityMonitoringApi.UpdateFinding] -// - [SecurityMonitoringApi.UpdateSecurityFilter] -// - [SecurityMonitoringApi.UpdateSecurityMonitoringRule] -// - [SensitiveDataScannerApi.CreateScanningGroup] -// - [SensitiveDataScannerApi.CreateScanningRule] -// - [SensitiveDataScannerApi.DeleteScanningGroup] -// - [SensitiveDataScannerApi.DeleteScanningRule] -// - [SensitiveDataScannerApi.ListScanningGroups] -// - [SensitiveDataScannerApi.ListStandardPatterns] -// - [SensitiveDataScannerApi.ReorderScanningGroups] -// - [SensitiveDataScannerApi.UpdateScanningGroup] -// - [SensitiveDataScannerApi.UpdateScanningRule] -// - [ServiceAccountsApi.CreateServiceAccount] -// - [ServiceAccountsApi.CreateServiceAccountApplicationKey] -// - [ServiceAccountsApi.DeleteServiceAccountApplicationKey] -// - [ServiceAccountsApi.GetServiceAccountApplicationKey] -// - [ServiceAccountsApi.ListServiceAccountApplicationKeys] -// - [ServiceAccountsApi.UpdateServiceAccountApplicationKey] -// - [ServiceDefinitionApi.CreateOrUpdateServiceDefinitions] -// - [ServiceDefinitionApi.DeleteServiceDefinition] -// - [ServiceDefinitionApi.GetServiceDefinition] -// - [ServiceDefinitionApi.ListServiceDefinitions] -// - [SpansMetricsApi.CreateSpansMetric] -// - [SpansMetricsApi.DeleteSpansMetric] -// - [SpansMetricsApi.GetSpansMetric] -// - [SpansMetricsApi.ListSpansMetrics] -// - [SpansMetricsApi.UpdateSpansMetric] -// - [SyntheticsApi.GetOnDemandConcurrencyCap] -// - [SyntheticsApi.SetOnDemandConcurrencyCap] -// - [TeamsApi.CreateTeam] -// - [TeamsApi.CreateTeamLink] -// - [TeamsApi.CreateTeamMembership] -// - [TeamsApi.DeleteTeam] -// - [TeamsApi.DeleteTeamLink] -// - [TeamsApi.DeleteTeamMembership] -// - [TeamsApi.GetTeam] -// - [TeamsApi.GetTeamLink] -// - [TeamsApi.GetTeamLinks] -// - [TeamsApi.GetTeamMemberships] -// - [TeamsApi.GetTeamPermissionSettings] -// - [TeamsApi.ListTeams] -// - [TeamsApi.UpdateTeam] -// - [TeamsApi.UpdateTeamLink] -// - [TeamsApi.UpdateTeamMembership] -// - [TeamsApi.UpdateTeamPermissionSetting] -// - [UsageMeteringApi.GetCostByOrg] -// - [UsageMeteringApi.GetEstimatedCostByOrg] -// - [UsageMeteringApi.GetHistoricalCostByOrg] -// - [UsageMeteringApi.GetHourlyUsage] -// - [UsageMeteringApi.GetUsageApplicationSecurityMonitoring] -// - [UsageMeteringApi.GetUsageLambdaTracedInvocations] -// - [UsageMeteringApi.GetUsageObservabilityPipelines] -// - [UsersApi.CreateUser] -// - [UsersApi.DisableUser] -// - [UsersApi.GetInvitation] -// - [UsersApi.GetUser] -// - [UsersApi.ListUserOrganizations] -// - [UsersApi.ListUserPermissions] -// - [UsersApi.ListUsers] -// - [UsersApi.SendInvitations] -// - [UsersApi.UpdateUser] +// - [AuditApi.ListAuditLogs] +// - [AuditApi.SearchAuditLogs] +// - [AuthNMappingsApi.CreateAuthNMapping] +// - [AuthNMappingsApi.DeleteAuthNMapping] +// - [AuthNMappingsApi.GetAuthNMapping] +// - [AuthNMappingsApi.ListAuthNMappings] +// - [AuthNMappingsApi.UpdateAuthNMapping] +// - [CIVisibilityPipelinesApi.AggregateCIAppPipelineEvents] +// - [CIVisibilityPipelinesApi.CreateCIAppPipelineEvent] +// - [CIVisibilityPipelinesApi.ListCIAppPipelineEvents] +// - [CIVisibilityPipelinesApi.SearchCIAppPipelineEvents] +// - [CIVisibilityTestsApi.AggregateCIAppTestEvents] +// - [CIVisibilityTestsApi.ListCIAppTestEvents] +// - [CIVisibilityTestsApi.SearchCIAppTestEvents] +// - [CloudWorkloadSecurityApi.CreateCloudWorkloadSecurityAgentRule] +// - [CloudWorkloadSecurityApi.DeleteCloudWorkloadSecurityAgentRule] +// - [CloudWorkloadSecurityApi.DownloadCloudWorkloadPolicyFile] +// - [CloudWorkloadSecurityApi.GetCloudWorkloadSecurityAgentRule] +// - [CloudWorkloadSecurityApi.ListCloudWorkloadSecurityAgentRules] +// - [CloudWorkloadSecurityApi.UpdateCloudWorkloadSecurityAgentRule] +// - [CloudflareIntegrationApi.CreateCloudflareAccount] +// - [CloudflareIntegrationApi.DeleteCloudflareAccount] +// - [CloudflareIntegrationApi.GetCloudflareAccount] +// - [CloudflareIntegrationApi.ListCloudflareAccounts] +// - [CloudflareIntegrationApi.UpdateCloudflareAccount] +// - [ConfluentCloudApi.CreateConfluentAccount] +// - [ConfluentCloudApi.CreateConfluentResource] +// - [ConfluentCloudApi.DeleteConfluentAccount] +// - [ConfluentCloudApi.DeleteConfluentResource] +// - [ConfluentCloudApi.GetConfluentAccount] +// - [ConfluentCloudApi.GetConfluentResource] +// - [ConfluentCloudApi.ListConfluentAccount] +// - [ConfluentCloudApi.ListConfluentResource] +// - [ConfluentCloudApi.UpdateConfluentAccount] +// - [ConfluentCloudApi.UpdateConfluentResource] +// - [DashboardListsApi.CreateDashboardListItems] +// - [DashboardListsApi.DeleteDashboardListItems] +// - [DashboardListsApi.GetDashboardListItems] +// - [DashboardListsApi.UpdateDashboardListItems] +// - [DowntimesApi.CancelDowntime] +// - [DowntimesApi.CreateDowntime] +// - [DowntimesApi.GetDowntime] +// - [DowntimesApi.ListDowntimes] +// - [DowntimesApi.ListMonitorDowntimes] +// - [DowntimesApi.UpdateDowntime] +// - [EventsApi.ListEvents] +// - [EventsApi.SearchEvents] +// - [FastlyIntegrationApi.CreateFastlyAccount] +// - [FastlyIntegrationApi.CreateFastlyService] +// - [FastlyIntegrationApi.DeleteFastlyAccount] +// - [FastlyIntegrationApi.DeleteFastlyService] +// - [FastlyIntegrationApi.GetFastlyAccount] +// - [FastlyIntegrationApi.GetFastlyService] +// - [FastlyIntegrationApi.ListFastlyAccounts] +// - [FastlyIntegrationApi.ListFastlyServices] +// - [FastlyIntegrationApi.UpdateFastlyAccount] +// - [FastlyIntegrationApi.UpdateFastlyService] +// - [GCPIntegrationApi.CreateGCPSTSAccount] +// - [GCPIntegrationApi.DeleteGCPSTSAccount] +// - [GCPIntegrationApi.GetGCPSTSDelegate] +// - [GCPIntegrationApi.ListGCPSTSAccounts] +// - [GCPIntegrationApi.MakeGCPSTSDelegate] +// - [GCPIntegrationApi.UpdateGCPSTSAccount] +// - [IPAllowlistApi.GetIPAllowlist] +// - [IPAllowlistApi.UpdateIPAllowlist] +// - [IncidentServicesApi.CreateIncidentService] +// - [IncidentServicesApi.DeleteIncidentService] +// - [IncidentServicesApi.GetIncidentService] +// - [IncidentServicesApi.ListIncidentServices] +// - [IncidentServicesApi.UpdateIncidentService] +// - [IncidentTeamsApi.CreateIncidentTeam] +// - [IncidentTeamsApi.DeleteIncidentTeam] +// - [IncidentTeamsApi.GetIncidentTeam] +// - [IncidentTeamsApi.ListIncidentTeams] +// - [IncidentTeamsApi.UpdateIncidentTeam] +// - [IncidentsApi.CreateIncident] +// - [IncidentsApi.CreateIncidentIntegration] +// - [IncidentsApi.CreateIncidentTodo] +// - [IncidentsApi.DeleteIncident] +// - [IncidentsApi.DeleteIncidentIntegration] +// - [IncidentsApi.DeleteIncidentTodo] +// - [IncidentsApi.GetIncident] +// - [IncidentsApi.GetIncidentIntegration] +// - [IncidentsApi.GetIncidentTodo] +// - [IncidentsApi.ListIncidentAttachments] +// - [IncidentsApi.ListIncidentIntegrations] +// - [IncidentsApi.ListIncidentTodos] +// - [IncidentsApi.ListIncidents] +// - [IncidentsApi.SearchIncidents] +// - [IncidentsApi.UpdateIncident] +// - [IncidentsApi.UpdateIncidentAttachments] +// - [IncidentsApi.UpdateIncidentIntegration] +// - [IncidentsApi.UpdateIncidentTodo] +// - [KeyManagementApi.CreateAPIKey] +// - [KeyManagementApi.CreateCurrentUserApplicationKey] +// - [KeyManagementApi.DeleteAPIKey] +// - [KeyManagementApi.DeleteApplicationKey] +// - [KeyManagementApi.DeleteCurrentUserApplicationKey] +// - [KeyManagementApi.GetAPIKey] +// - [KeyManagementApi.GetApplicationKey] +// - [KeyManagementApi.GetCurrentUserApplicationKey] +// - [KeyManagementApi.ListAPIKeys] +// - [KeyManagementApi.ListApplicationKeys] +// - [KeyManagementApi.ListCurrentUserApplicationKeys] +// - [KeyManagementApi.UpdateAPIKey] +// - [KeyManagementApi.UpdateApplicationKey] +// - [KeyManagementApi.UpdateCurrentUserApplicationKey] +// - [LogsApi.AggregateLogs] +// - [LogsApi.ListLogs] +// - [LogsApi.ListLogsGet] +// - [LogsApi.SubmitLog] +// - [LogsArchivesApi.AddReadRoleToArchive] +// - [LogsArchivesApi.CreateLogsArchive] +// - [LogsArchivesApi.DeleteLogsArchive] +// - [LogsArchivesApi.GetLogsArchive] +// - [LogsArchivesApi.GetLogsArchiveOrder] +// - [LogsArchivesApi.ListArchiveReadRoles] +// - [LogsArchivesApi.ListLogsArchives] +// - [LogsArchivesApi.RemoveRoleFromArchive] +// - [LogsArchivesApi.UpdateLogsArchive] +// - [LogsArchivesApi.UpdateLogsArchiveOrder] +// - [LogsMetricsApi.CreateLogsMetric] +// - [LogsMetricsApi.DeleteLogsMetric] +// - [LogsMetricsApi.GetLogsMetric] +// - [LogsMetricsApi.ListLogsMetrics] +// - [LogsMetricsApi.UpdateLogsMetric] +// - [MetricsApi.CreateBulkTagsMetricsConfiguration] +// - [MetricsApi.CreateTagConfiguration] +// - [MetricsApi.DeleteBulkTagsMetricsConfiguration] +// - [MetricsApi.DeleteTagConfiguration] +// - [MetricsApi.EstimateMetricsOutputSeries] +// - [MetricsApi.ListActiveMetricConfigurations] +// - [MetricsApi.ListTagConfigurationByName] +// - [MetricsApi.ListTagConfigurations] +// - [MetricsApi.ListTagsByMetricName] +// - [MetricsApi.ListVolumesByMetricName] +// - [MetricsApi.QueryScalarData] +// - [MetricsApi.QueryTimeseriesData] +// - [MetricsApi.SubmitMetrics] +// - [MetricsApi.UpdateTagConfiguration] +// - [MonitorsApi.CreateMonitorConfigPolicy] +// - [MonitorsApi.DeleteMonitorConfigPolicy] +// - [MonitorsApi.GetMonitorConfigPolicy] +// - [MonitorsApi.ListMonitorConfigPolicies] +// - [MonitorsApi.UpdateMonitorConfigPolicy] +// - [OpsgenieIntegrationApi.CreateOpsgenieService] +// - [OpsgenieIntegrationApi.DeleteOpsgenieService] +// - [OpsgenieIntegrationApi.GetOpsgenieService] +// - [OpsgenieIntegrationApi.ListOpsgenieServices] +// - [OpsgenieIntegrationApi.UpdateOpsgenieService] +// - [OrganizationsApi.UploadIdPMetadata] +// - [ProcessesApi.ListProcesses] +// - [RUMApi.AggregateRUMEvents] +// - [RUMApi.CreateRUMApplication] +// - [RUMApi.DeleteRUMApplication] +// - [RUMApi.GetRUMApplication] +// - [RUMApi.GetRUMApplications] +// - [RUMApi.ListRUMEvents] +// - [RUMApi.SearchRUMEvents] +// - [RUMApi.UpdateRUMApplication] +// - [RestrictionPoliciesApi.DeleteRestrictionPolicy] +// - [RestrictionPoliciesApi.GetRestrictionPolicy] +// - [RestrictionPoliciesApi.UpdateRestrictionPolicy] +// - [RolesApi.AddPermissionToRole] +// - [RolesApi.AddUserToRole] +// - [RolesApi.CloneRole] +// - [RolesApi.CreateRole] +// - [RolesApi.DeleteRole] +// - [RolesApi.GetRole] +// - [RolesApi.ListPermissions] +// - [RolesApi.ListRolePermissions] +// - [RolesApi.ListRoleUsers] +// - [RolesApi.ListRoles] +// - [RolesApi.RemovePermissionFromRole] +// - [RolesApi.RemoveUserFromRole] +// - [RolesApi.UpdateRole] +// - [SecurityMonitoringApi.CreateSecurityFilter] +// - [SecurityMonitoringApi.CreateSecurityMonitoringRule] +// - [SecurityMonitoringApi.DeleteSecurityFilter] +// - [SecurityMonitoringApi.DeleteSecurityMonitoringRule] +// - [SecurityMonitoringApi.EditSecurityMonitoringSignalAssignee] +// - [SecurityMonitoringApi.EditSecurityMonitoringSignalIncidents] +// - [SecurityMonitoringApi.EditSecurityMonitoringSignalState] +// - [SecurityMonitoringApi.GetFinding] +// - [SecurityMonitoringApi.GetSecurityFilter] +// - [SecurityMonitoringApi.GetSecurityMonitoringRule] +// - [SecurityMonitoringApi.GetSecurityMonitoringSignal] +// - [SecurityMonitoringApi.ListFindings] +// - [SecurityMonitoringApi.ListSecurityFilters] +// - [SecurityMonitoringApi.ListSecurityMonitoringRules] +// - [SecurityMonitoringApi.ListSecurityMonitoringSignals] +// - [SecurityMonitoringApi.SearchSecurityMonitoringSignals] +// - [SecurityMonitoringApi.UpdateFinding] +// - [SecurityMonitoringApi.UpdateSecurityFilter] +// - [SecurityMonitoringApi.UpdateSecurityMonitoringRule] +// - [SensitiveDataScannerApi.CreateScanningGroup] +// - [SensitiveDataScannerApi.CreateScanningRule] +// - [SensitiveDataScannerApi.DeleteScanningGroup] +// - [SensitiveDataScannerApi.DeleteScanningRule] +// - [SensitiveDataScannerApi.ListScanningGroups] +// - [SensitiveDataScannerApi.ListStandardPatterns] +// - [SensitiveDataScannerApi.ReorderScanningGroups] +// - [SensitiveDataScannerApi.UpdateScanningGroup] +// - [SensitiveDataScannerApi.UpdateScanningRule] +// - [ServiceAccountsApi.CreateServiceAccount] +// - [ServiceAccountsApi.CreateServiceAccountApplicationKey] +// - [ServiceAccountsApi.DeleteServiceAccountApplicationKey] +// - [ServiceAccountsApi.GetServiceAccountApplicationKey] +// - [ServiceAccountsApi.ListServiceAccountApplicationKeys] +// - [ServiceAccountsApi.UpdateServiceAccountApplicationKey] +// - [ServiceDefinitionApi.CreateOrUpdateServiceDefinitions] +// - [ServiceDefinitionApi.DeleteServiceDefinition] +// - [ServiceDefinitionApi.GetServiceDefinition] +// - [ServiceDefinitionApi.ListServiceDefinitions] +// - [SpansApi.AggregateSpans] +// - [SpansApi.ListSpans] +// - [SpansApi.ListSpansGet] +// - [SpansMetricsApi.CreateSpansMetric] +// - [SpansMetricsApi.DeleteSpansMetric] +// - [SpansMetricsApi.GetSpansMetric] +// - [SpansMetricsApi.ListSpansMetrics] +// - [SpansMetricsApi.UpdateSpansMetric] +// - [SyntheticsApi.GetOnDemandConcurrencyCap] +// - [SyntheticsApi.SetOnDemandConcurrencyCap] +// - [TeamsApi.CreateTeam] +// - [TeamsApi.CreateTeamLink] +// - [TeamsApi.CreateTeamMembership] +// - [TeamsApi.DeleteTeam] +// - [TeamsApi.DeleteTeamLink] +// - [TeamsApi.DeleteTeamMembership] +// - [TeamsApi.GetTeam] +// - [TeamsApi.GetTeamLink] +// - [TeamsApi.GetTeamLinks] +// - [TeamsApi.GetTeamMemberships] +// - [TeamsApi.GetTeamPermissionSettings] +// - [TeamsApi.GetUserMemberships] +// - [TeamsApi.ListTeams] +// - [TeamsApi.UpdateTeam] +// - [TeamsApi.UpdateTeamLink] +// - [TeamsApi.UpdateTeamMembership] +// - [TeamsApi.UpdateTeamPermissionSetting] +// - [UsageMeteringApi.GetCostByOrg] +// - [UsageMeteringApi.GetEstimatedCostByOrg] +// - [UsageMeteringApi.GetHistoricalCostByOrg] +// - [UsageMeteringApi.GetHourlyUsage] +// - [UsageMeteringApi.GetUsageApplicationSecurityMonitoring] +// - [UsageMeteringApi.GetUsageLambdaTracedInvocations] +// - [UsageMeteringApi.GetUsageObservabilityPipelines] +// - [UsersApi.CreateUser] +// - [UsersApi.DisableUser] +// - [UsersApi.GetInvitation] +// - [UsersApi.GetUser] +// - [UsersApi.ListUserOrganizations] +// - [UsersApi.ListUserPermissions] +// - [UsersApi.ListUsers] +// - [UsersApi.SendInvitations] +// - [UsersApi.UpdateUser] package datadogV2 diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_error_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_error_response.go index f028075a6..9a0d06088 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_error_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_error_response.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o APIErrorResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *APIErrorResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Errors *[]string `json:"errors"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Errors == nil { return fmt.Errorf("required field errors missing") @@ -99,6 +94,7 @@ func (o *APIErrorResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Errors = *all.Errors + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_create_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_create_attributes.go index 229e08e9f..7dbef5c6b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_create_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_create_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o APIKeyCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *APIKeyCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Name *string `json:"name"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -99,6 +94,7 @@ func (o *APIKeyCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { return err } o.Name = *all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_create_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_create_data.go index 4e9818cd3..428d98b59 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_create_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_create_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o APIKeyCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *APIKeyCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *APIKeyCreateAttributes `json:"attributes"` Type *APIKeysType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -131,26 +126,25 @@ func (o *APIKeyCreateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_create_request.go index b65353190..a8d585417 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o APIKeyCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *APIKeyCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *APIKeyCreateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *APIKeyCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_relationships.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_relationships.go index a1d6f5fca..681aff7aa 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_relationships.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_relationships.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o APIKeyRelationships) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *APIKeyRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CreatedBy *RelationshipToUser `json:"created_by,omitempty"` ModifiedBy *RelationshipToUser `json:"modified_by,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,25 +128,24 @@ func (o *APIKeyRelationships) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.CreatedBy != nil && all.CreatedBy.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.CreatedBy = all.CreatedBy if all.ModifiedBy != nil && all.ModifiedBy.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ModifiedBy = all.ModifiedBy + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_response.go index 9927b9a2f..67c54064c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o APIKeyResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *APIKeyResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *FullAPIKey `json:"data,omitempty"` Included []APIKeyResponseIncludedItem `json:"included,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *APIKeyResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data o.Included = all.Included + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_response_included_item.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_response_included_item.go index 1b96fc09e..98b807e01 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_response_included_item.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_response_included_item.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // APIKeyResponseIncludedItem - An object related to an API key. @@ -71,53 +71,3 @@ func (obj *APIKeyResponseIncludedItem) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableAPIKeyResponseIncludedItem handles when a null is used for APIKeyResponseIncludedItem. -type NullableAPIKeyResponseIncludedItem struct { - value *APIKeyResponseIncludedItem - isSet bool -} - -// Get returns the associated value. -func (v NullableAPIKeyResponseIncludedItem) Get() *APIKeyResponseIncludedItem { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableAPIKeyResponseIncludedItem) Set(val *APIKeyResponseIncludedItem) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableAPIKeyResponseIncludedItem) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableAPIKeyResponseIncludedItem) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableAPIKeyResponseIncludedItem initializes the struct as if Set has been called. -func NewNullableAPIKeyResponseIncludedItem(val *APIKeyResponseIncludedItem) *NullableAPIKeyResponseIncludedItem { - return &NullableAPIKeyResponseIncludedItem{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableAPIKeyResponseIncludedItem) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableAPIKeyResponseIncludedItem) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_update_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_update_attributes.go index 9edb64373..68ba0c5cb 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_update_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_update_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o APIKeyUpdateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *APIKeyUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Name *string `json:"name"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -99,6 +94,7 @@ func (o *APIKeyUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { return err } o.Name = *all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_update_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_update_data.go index e67172f16..c3d879351 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_update_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_update_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -133,19 +134,13 @@ func (o APIKeyUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *APIKeyUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *APIKeyUpdateAttributes `json:"attributes"` Id *string `json:"id"` Type *APIKeysType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -162,27 +157,26 @@ func (o *APIKeyUpdateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_update_request.go index eb5f95654..bd1c94c55 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_key_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o APIKeyUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *APIKeyUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *APIKeyUpdateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *APIKeyUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_keys_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_keys_response.go index a3a4c3f38..46c45643b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_keys_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_keys_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o APIKeysResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *APIKeysResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []PartialAPIKey `json:"data,omitempty"` Included []APIKeyResponseIncludedItem `json:"included,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *APIKeysResponse) UnmarshalJSON(bytes []byte) (err error) { } o.Data = all.Data o.Included = all.Included + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_keys_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_keys_sort.go index e216cdc2e..3fbf55c63 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_keys_sort.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_keys_sort.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // APIKeysSort Sorting options @@ -75,47 +76,3 @@ func (v APIKeysSort) IsValid() bool { func (v APIKeysSort) Ptr() *APIKeysSort { return &v } - -// NullableAPIKeysSort handles when a null is used for APIKeysSort. -type NullableAPIKeysSort struct { - value *APIKeysSort - isSet bool -} - -// Get returns the associated value. -func (v NullableAPIKeysSort) Get() *APIKeysSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableAPIKeysSort) Set(val *APIKeysSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableAPIKeysSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableAPIKeysSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableAPIKeysSort initializes the struct as if Set has been called. -func NewNullableAPIKeysSort(val *APIKeysSort) *NullableAPIKeysSort { - return &NullableAPIKeysSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableAPIKeysSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableAPIKeysSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_keys_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_keys_type.go index e947a9498..8aa9d6958 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_keys_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_api_keys_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // APIKeysType API Keys resource type. @@ -61,47 +62,3 @@ func (v APIKeysType) IsValid() bool { func (v APIKeysType) Ptr() *APIKeysType { return &v } - -// NullableAPIKeysType handles when a null is used for APIKeysType. -type NullableAPIKeysType struct { - value *APIKeysType - isSet bool -} - -// Get returns the associated value. -func (v NullableAPIKeysType) Get() *APIKeysType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableAPIKeysType) Set(val *APIKeysType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableAPIKeysType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableAPIKeysType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableAPIKeysType initializes the struct as if Set has been called. -func NewNullableAPIKeysType(val *APIKeysType) *NullableAPIKeysType { - return &NullableAPIKeysType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableAPIKeysType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableAPIKeysType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_create_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_create_attributes.go index b6b753970..5698f9e15 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_create_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_create_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -15,7 +16,7 @@ import ( type ApplicationKeyCreateAttributes struct { // Name of the application key. Name string `json:"name"` - // Array of scopes to grant the application key. This feature is in private beta, please contact Datadog support to enable scopes for your application keys. + // Array of scopes to grant the application key. Scopes datadog.NullableList[string] `json:"scopes,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` @@ -121,18 +122,12 @@ func (o ApplicationKeyCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ApplicationKeyCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Name *string `json:"name"` Scopes datadog.NullableList[string] `json:"scopes,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -145,6 +140,7 @@ func (o *ApplicationKeyCreateAttributes) UnmarshalJSON(bytes []byte) (err error) } o.Name = *all.Name o.Scopes = all.Scopes + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_create_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_create_data.go index 20aae360a..842c6a18c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_create_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_create_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o ApplicationKeyCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ApplicationKeyCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *ApplicationKeyCreateAttributes `json:"attributes"` Type *ApplicationKeysType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -131,26 +126,25 @@ func (o *ApplicationKeyCreateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_create_request.go index de268c5b2..d3591a2b5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o ApplicationKeyCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ApplicationKeyCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *ApplicationKeyCreateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *ApplicationKeyCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_relationships.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_relationships.go index e66e08036..7ff75b8a8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_relationships.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_relationships.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o ApplicationKeyRelationships) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ApplicationKeyRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { OwnedBy *RelationshipToUser `json:"owned_by,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *ApplicationKeyRelationships) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.OwnedBy != nil && all.OwnedBy.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.OwnedBy = all.OwnedBy + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_response.go index 183aa6898..6f7c7832c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o ApplicationKeyResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ApplicationKeyResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *FullApplicationKey `json:"data,omitempty"` Included []ApplicationKeyResponseIncludedItem `json:"included,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *ApplicationKeyResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data o.Included = all.Included + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_response_included_item.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_response_included_item.go index 117c71bb9..4879cfe4a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_response_included_item.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_response_included_item.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // ApplicationKeyResponseIncludedItem - An object related to an application key. @@ -103,53 +103,3 @@ func (obj *ApplicationKeyResponseIncludedItem) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableApplicationKeyResponseIncludedItem handles when a null is used for ApplicationKeyResponseIncludedItem. -type NullableApplicationKeyResponseIncludedItem struct { - value *ApplicationKeyResponseIncludedItem - isSet bool -} - -// Get returns the associated value. -func (v NullableApplicationKeyResponseIncludedItem) Get() *ApplicationKeyResponseIncludedItem { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableApplicationKeyResponseIncludedItem) Set(val *ApplicationKeyResponseIncludedItem) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableApplicationKeyResponseIncludedItem) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableApplicationKeyResponseIncludedItem) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableApplicationKeyResponseIncludedItem initializes the struct as if Set has been called. -func NewNullableApplicationKeyResponseIncludedItem(val *ApplicationKeyResponseIncludedItem) *NullableApplicationKeyResponseIncludedItem { - return &NullableApplicationKeyResponseIncludedItem{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableApplicationKeyResponseIncludedItem) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableApplicationKeyResponseIncludedItem) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_update_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_update_attributes.go index d191636b2..419129c8a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_update_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_update_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -14,7 +14,7 @@ import ( type ApplicationKeyUpdateAttributes struct { // Name of the application key. Name *string `json:"name,omitempty"` - // Array of scopes to grant the application key. This feature is in private beta, please contact Datadog support to enable scopes for your application keys. + // Array of scopes to grant the application key. Scopes datadog.NullableList[string] `json:"scopes,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` @@ -126,18 +126,12 @@ func (o ApplicationKeyUpdateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ApplicationKeyUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Name *string `json:"name,omitempty"` Scopes datadog.NullableList[string] `json:"scopes,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -147,6 +141,7 @@ func (o *ApplicationKeyUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) } o.Name = all.Name o.Scopes = all.Scopes + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_update_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_update_data.go index 7eb8a24ce..677a92f4b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_update_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_update_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -133,19 +134,13 @@ func (o ApplicationKeyUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ApplicationKeyUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *ApplicationKeyUpdateAttributes `json:"attributes"` Id *string `json:"id"` Type *ApplicationKeysType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -162,27 +157,26 @@ func (o *ApplicationKeyUpdateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_update_request.go index 4289acac7..866265bf9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_key_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o ApplicationKeyUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ApplicationKeyUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *ApplicationKeyUpdateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *ApplicationKeyUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_keys_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_keys_sort.go index b35c9f19e..1ada2fde2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_keys_sort.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_keys_sort.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ApplicationKeysSort Sorting options @@ -71,47 +72,3 @@ func (v ApplicationKeysSort) IsValid() bool { func (v ApplicationKeysSort) Ptr() *ApplicationKeysSort { return &v } - -// NullableApplicationKeysSort handles when a null is used for ApplicationKeysSort. -type NullableApplicationKeysSort struct { - value *ApplicationKeysSort - isSet bool -} - -// Get returns the associated value. -func (v NullableApplicationKeysSort) Get() *ApplicationKeysSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableApplicationKeysSort) Set(val *ApplicationKeysSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableApplicationKeysSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableApplicationKeysSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableApplicationKeysSort initializes the struct as if Set has been called. -func NewNullableApplicationKeysSort(val *ApplicationKeysSort) *NullableApplicationKeysSort { - return &NullableApplicationKeysSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableApplicationKeysSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableApplicationKeysSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_keys_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_keys_type.go index 77f5070b2..5a2b6c76d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_keys_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_application_keys_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ApplicationKeysType Application Keys resource type. @@ -61,47 +62,3 @@ func (v ApplicationKeysType) IsValid() bool { func (v ApplicationKeysType) Ptr() *ApplicationKeysType { return &v } - -// NullableApplicationKeysType handles when a null is used for ApplicationKeysType. -type NullableApplicationKeysType struct { - value *ApplicationKeysType - isSet bool -} - -// Get returns the associated value. -func (v NullableApplicationKeysType) Get() *ApplicationKeysType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableApplicationKeysType) Set(val *ApplicationKeysType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableApplicationKeysType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableApplicationKeysType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableApplicationKeysType initializes the struct as if Set has been called. -func NewNullableApplicationKeysType(val *ApplicationKeysType) *NullableApplicationKeysType { - return &NullableApplicationKeysType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableApplicationKeysType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableApplicationKeysType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_event.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_event.go index ca38fe47f..ef9eca76f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_event.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_event.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o AuditLogsEvent) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuditLogsEvent) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *AuditLogsEventAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *AuditLogsEventType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *AuditLogsEvent) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_event_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_event_attributes.go index 95b1b63da..adbc0cf27 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_event_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_event_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -15,6 +16,8 @@ import ( type AuditLogsEventAttributes struct { // JSON object of attributes from Audit Logs events. Attributes map[string]interface{} `json:"attributes,omitempty"` + // Message of the event. + Message *string `json:"message,omitempty"` // Name of the application or service generating Audit Logs events. // This name is used to correlate Audit Logs to APM, so make sure you specify the same // value when you use both products. @@ -73,6 +76,34 @@ func (o *AuditLogsEventAttributes) SetAttributes(v map[string]interface{}) { o.Attributes = v } +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *AuditLogsEventAttributes) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsEventAttributes) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *AuditLogsEventAttributes) HasMessage() bool { + return o != nil && o.Message != nil +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *AuditLogsEventAttributes) SetMessage(v string) { + o.Message = &v +} + // GetService returns the Service field value if set, zero value otherwise. func (o *AuditLogsEventAttributes) GetService() string { if o == nil || o.Service == nil { @@ -166,6 +197,9 @@ func (o AuditLogsEventAttributes) MarshalJSON() ([]byte, error) { if o.Attributes != nil { toSerialize["attributes"] = o.Attributes } + if o.Message != nil { + toSerialize["message"] = o.Message + } if o.Service != nil { toSerialize["service"] = o.Service } @@ -188,31 +222,28 @@ func (o AuditLogsEventAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuditLogsEventAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes map[string]interface{} `json:"attributes,omitempty"` + Message *string `json:"message,omitempty"` Service *string `json:"service,omitempty"` Tags []string `json:"tags,omitempty"` Timestamp *time.Time `json:"timestamp,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "service", "tags", "timestamp"}) + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "message", "service", "tags", "timestamp"}) } else { return err } o.Attributes = all.Attributes + o.Message = all.Message o.Service = all.Service o.Tags = all.Tags o.Timestamp = all.Timestamp + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_event_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_event_type.go index 2aa856a8d..6cb94c350 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_event_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_event_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // AuditLogsEventType Type of the event. @@ -61,47 +62,3 @@ func (v AuditLogsEventType) IsValid() bool { func (v AuditLogsEventType) Ptr() *AuditLogsEventType { return &v } - -// NullableAuditLogsEventType handles when a null is used for AuditLogsEventType. -type NullableAuditLogsEventType struct { - value *AuditLogsEventType - isSet bool -} - -// Get returns the associated value. -func (v NullableAuditLogsEventType) Get() *AuditLogsEventType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableAuditLogsEventType) Set(val *AuditLogsEventType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableAuditLogsEventType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableAuditLogsEventType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableAuditLogsEventType initializes the struct as if Set has been called. -func NewNullableAuditLogsEventType(val *AuditLogsEventType) *NullableAuditLogsEventType { - return &NullableAuditLogsEventType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableAuditLogsEventType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableAuditLogsEventType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_events_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_events_response.go index 7625b49cb..f6c7b26f5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_events_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_events_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o AuditLogsEventsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuditLogsEventsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []AuditLogsEvent `json:"data,omitempty"` Links *AuditLogsResponseLinks `json:"links,omitempty"` Meta *AuditLogsResponseMetadata `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,26 +162,25 @@ func (o *AuditLogsEventsResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Data = all.Data if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Links = all.Links if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_query_filter.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_query_filter.go index bf9f994d3..463c970a6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_query_filter.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_query_filter.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -160,19 +160,13 @@ func (o AuditLogsQueryFilter) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuditLogsQueryFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { From *string `json:"from,omitempty"` Query *string `json:"query,omitempty"` To *string `json:"to,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -183,6 +177,7 @@ func (o *AuditLogsQueryFilter) UnmarshalJSON(bytes []byte) (err error) { o.From = all.From o.Query = all.Query o.To = all.To + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_query_options.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_query_options.go index 1bcbd3297..93bd876de 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_query_options.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_query_options.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -120,18 +120,12 @@ func (o AuditLogsQueryOptions) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuditLogsQueryOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { TimeOffset *int64 `json:"time_offset,omitempty"` Timezone *string `json:"timezone,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -141,6 +135,7 @@ func (o *AuditLogsQueryOptions) UnmarshalJSON(bytes []byte) (err error) { } o.TimeOffset = all.TimeOffset o.Timezone = all.Timezone + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_query_page_options.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_query_page_options.go index 1879fcacf..eb6ea36f2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_query_page_options.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_query_page_options.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -119,18 +119,12 @@ func (o AuditLogsQueryPageOptions) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuditLogsQueryPageOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Cursor *string `json:"cursor,omitempty"` Limit *int32 `json:"limit,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -140,6 +134,7 @@ func (o *AuditLogsQueryPageOptions) UnmarshalJSON(bytes []byte) (err error) { } o.Cursor = all.Cursor o.Limit = all.Limit + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_response_links.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_response_links.go index 6c3150d5a..771d4591a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_response_links.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_response_links.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -83,17 +83,11 @@ func (o AuditLogsResponseLinks) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuditLogsResponseLinks) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Next *string `json:"next,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -102,6 +96,7 @@ func (o *AuditLogsResponseLinks) UnmarshalJSON(bytes []byte) (err error) { return err } o.Next = all.Next + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_response_metadata.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_response_metadata.go index cab848449..64ea21ea1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_response_metadata.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_response_metadata.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -215,7 +215,6 @@ func (o AuditLogsResponseMetadata) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuditLogsResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Elapsed *int64 `json:"elapsed,omitempty"` Page *AuditLogsResponsePage `json:"page,omitempty"` @@ -224,12 +223,7 @@ func (o *AuditLogsResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { Warnings []AuditLogsWarning `json:"warnings,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -237,29 +231,28 @@ func (o *AuditLogsResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Elapsed = all.Elapsed if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Page = all.Page o.RequestId = all.RequestId - o.Status = all.Status + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } o.Warnings = all.Warnings + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_response_page.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_response_page.go index 2f7f61dcc..cc6205e82 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_response_page.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_response_page.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o AuditLogsResponsePage) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuditLogsResponsePage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { After *string `json:"after,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *AuditLogsResponsePage) UnmarshalJSON(bytes []byte) (err error) { return err } o.After = all.After + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_response_status.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_response_status.go index c6fc5de1e..99f39262b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_response_status.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_response_status.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // AuditLogsResponseStatus The status of the response. @@ -63,47 +64,3 @@ func (v AuditLogsResponseStatus) IsValid() bool { func (v AuditLogsResponseStatus) Ptr() *AuditLogsResponseStatus { return &v } - -// NullableAuditLogsResponseStatus handles when a null is used for AuditLogsResponseStatus. -type NullableAuditLogsResponseStatus struct { - value *AuditLogsResponseStatus - isSet bool -} - -// Get returns the associated value. -func (v NullableAuditLogsResponseStatus) Get() *AuditLogsResponseStatus { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableAuditLogsResponseStatus) Set(val *AuditLogsResponseStatus) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableAuditLogsResponseStatus) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableAuditLogsResponseStatus) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableAuditLogsResponseStatus initializes the struct as if Set has been called. -func NewNullableAuditLogsResponseStatus(val *AuditLogsResponseStatus) *NullableAuditLogsResponseStatus { - return &NullableAuditLogsResponseStatus{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableAuditLogsResponseStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableAuditLogsResponseStatus) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_search_events_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_search_events_request.go index 4750ec46c..89343a024 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_search_events_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_search_events_request.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -182,7 +182,6 @@ func (o AuditLogsSearchEventsRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuditLogsSearchEventsRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Filter *AuditLogsQueryFilter `json:"filter,omitempty"` Options *AuditLogsQueryOptions `json:"options,omitempty"` @@ -190,12 +189,7 @@ func (o *AuditLogsSearchEventsRequest) UnmarshalJSON(bytes []byte) (err error) { Sort *AuditLogsSort `json:"sort,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -203,42 +197,33 @@ func (o *AuditLogsSearchEventsRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Sort; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Filter = all.Filter if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Options = all.Options if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Page = all.Page - o.Sort = all.Sort + if all.Sort != nil && !all.Sort.IsValid() { + hasInvalidField = true + } else { + o.Sort = all.Sort + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_sort.go index 1ec910f77..e3a7521e3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_sort.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_sort.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // AuditLogsSort Sort parameters when querying events. @@ -63,47 +64,3 @@ func (v AuditLogsSort) IsValid() bool { func (v AuditLogsSort) Ptr() *AuditLogsSort { return &v } - -// NullableAuditLogsSort handles when a null is used for AuditLogsSort. -type NullableAuditLogsSort struct { - value *AuditLogsSort - isSet bool -} - -// Get returns the associated value. -func (v NullableAuditLogsSort) Get() *AuditLogsSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableAuditLogsSort) Set(val *AuditLogsSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableAuditLogsSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableAuditLogsSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableAuditLogsSort initializes the struct as if Set has been called. -func NewNullableAuditLogsSort(val *AuditLogsSort) *NullableAuditLogsSort { - return &NullableAuditLogsSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableAuditLogsSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableAuditLogsSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_warning.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_warning.go index de3d7c577..663986884 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_warning.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_audit_logs_warning.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o AuditLogsWarning) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuditLogsWarning) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Code *string `json:"code,omitempty"` Detail *string `json:"detail,omitempty"` Title *string `json:"title,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *AuditLogsWarning) UnmarshalJSON(bytes []byte) (err error) { o.Code = all.Code o.Detail = all.Detail o.Title = all.Title + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping.go index ebfa3088b..4d856f2d9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -172,7 +173,6 @@ func (o AuthNMapping) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuthNMapping) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *AuthNMappingAttributes `json:"attributes,omitempty"` Id *string `json:"id"` @@ -180,12 +180,7 @@ func (o *AuthNMapping) UnmarshalJSON(bytes []byte) (err error) { Type *AuthNMappingsType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -199,35 +194,30 @@ func (o *AuthNMapping) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_attributes.go index 63a554e61..954492511 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -223,7 +224,6 @@ func (o AuthNMappingAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuthNMappingAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AttributeKey *string `json:"attribute_key,omitempty"` AttributeValue *string `json:"attribute_value,omitempty"` @@ -232,12 +232,7 @@ func (o *AuthNMappingAttributes) UnmarshalJSON(bytes []byte) (err error) { SamlAssertionAttributeId *string `json:"saml_assertion_attribute_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -250,6 +245,7 @@ func (o *AuthNMappingAttributes) UnmarshalJSON(bytes []byte) (err error) { o.CreatedAt = all.CreatedAt o.ModifiedAt = all.ModifiedAt o.SamlAssertionAttributeId = all.SamlAssertionAttributeId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_create_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_create_attributes.go index e5feb3982..ce6a2f02c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_create_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_create_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o AuthNMappingCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuthNMappingCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AttributeKey *string `json:"attribute_key,omitempty"` AttributeValue *string `json:"attribute_value,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *AuthNMappingCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { } o.AttributeKey = all.AttributeKey o.AttributeValue = all.AttributeValue + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_create_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_create_data.go index 92cfdf097..30298005d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_create_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_create_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -145,19 +146,13 @@ func (o AuthNMappingCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuthNMappingCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *AuthNMappingCreateAttributes `json:"attributes,omitempty"` Relationships *AuthNMappingCreateRelationships `json:"relationships,omitempty"` Type *AuthNMappingsType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -168,34 +163,29 @@ func (o *AuthNMappingCreateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_create_relationships.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_create_relationships.go index 005e54f97..c43db14db 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_create_relationships.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_create_relationships.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o AuthNMappingCreateRelationships) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuthNMappingCreateRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Role *RelationshipToRole `json:"role,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *AuthNMappingCreateRelationships) UnmarshalJSON(bytes []byte) (err error } else { return err } + + hasInvalidField := false if all.Role != nil && all.Role.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Role = all.Role + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_create_request.go index b6cbb9b0d..f5529bd3c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o AuthNMappingCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuthNMappingCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *AuthNMappingCreateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *AuthNMappingCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_included.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_included.go index 22f4daf2c..21a740887 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_included.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_included.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // AuthNMappingIncluded - Included data in the AuthN Mapping response. @@ -103,53 +103,3 @@ func (obj *AuthNMappingIncluded) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableAuthNMappingIncluded handles when a null is used for AuthNMappingIncluded. -type NullableAuthNMappingIncluded struct { - value *AuthNMappingIncluded - isSet bool -} - -// Get returns the associated value. -func (v NullableAuthNMappingIncluded) Get() *AuthNMappingIncluded { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableAuthNMappingIncluded) Set(val *AuthNMappingIncluded) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableAuthNMappingIncluded) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableAuthNMappingIncluded) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableAuthNMappingIncluded initializes the struct as if Set has been called. -func NewNullableAuthNMappingIncluded(val *AuthNMappingIncluded) *NullableAuthNMappingIncluded { - return &NullableAuthNMappingIncluded{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableAuthNMappingIncluded) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableAuthNMappingIncluded) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_relationships.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_relationships.go index 73005ca26..2eb1ce9fd 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_relationships.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_relationships.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o AuthNMappingRelationships) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuthNMappingRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Role *RelationshipToRole `json:"role,omitempty"` SamlAssertionAttribute *RelationshipToSAMLAssertionAttribute `json:"saml_assertion_attribute,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,25 +128,24 @@ func (o *AuthNMappingRelationships) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Role != nil && all.Role.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Role = all.Role if all.SamlAssertionAttribute != nil && all.SamlAssertionAttribute.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.SamlAssertionAttribute = all.SamlAssertionAttribute + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_response.go index 5ec7fde17..0a14daec1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o AuthNMappingResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuthNMappingResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *AuthNMapping `json:"data,omitempty"` Included []AuthNMappingIncluded `json:"included,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *AuthNMappingResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data o.Included = all.Included + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_update_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_update_attributes.go index 9a61267d4..91217028a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_update_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_update_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o AuthNMappingUpdateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuthNMappingUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AttributeKey *string `json:"attribute_key,omitempty"` AttributeValue *string `json:"attribute_value,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *AuthNMappingUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { } o.AttributeKey = all.AttributeKey o.AttributeValue = all.AttributeValue + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_update_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_update_data.go index 2e1c4edb0..e8072e966 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_update_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_update_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -172,7 +173,6 @@ func (o AuthNMappingUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuthNMappingUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *AuthNMappingUpdateAttributes `json:"attributes,omitempty"` Id *string `json:"id"` @@ -180,12 +180,7 @@ func (o *AuthNMappingUpdateData) UnmarshalJSON(bytes []byte) (err error) { Type *AuthNMappingsType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -199,35 +194,30 @@ func (o *AuthNMappingUpdateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_update_relationships.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_update_relationships.go index ebe559844..f399aee06 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_update_relationships.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_update_relationships.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o AuthNMappingUpdateRelationships) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuthNMappingUpdateRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Role *RelationshipToRole `json:"role,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *AuthNMappingUpdateRelationships) UnmarshalJSON(bytes []byte) (err error } else { return err } + + hasInvalidField := false if all.Role != nil && all.Role.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Role = all.Role + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_update_request.go index bad1ea4d5..841162b57 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mapping_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o AuthNMappingUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuthNMappingUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *AuthNMappingUpdateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *AuthNMappingUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mappings_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mappings_response.go index e7bf8785e..5c536a984 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mappings_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mappings_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o AuthNMappingsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuthNMappingsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []AuthNMapping `json:"data,omitempty"` Included []AuthNMappingIncluded `json:"included,omitempty"` Meta *ResponseMetaAttributes `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,19 +162,22 @@ func (o *AuthNMappingsResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Data = all.Data o.Included = all.Included if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mappings_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mappings_sort.go index 6520bd653..b33f31938 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mappings_sort.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mappings_sort.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // AuthNMappingsSort Sorting options for AuthN Mappings. @@ -83,47 +84,3 @@ func (v AuthNMappingsSort) IsValid() bool { func (v AuthNMappingsSort) Ptr() *AuthNMappingsSort { return &v } - -// NullableAuthNMappingsSort handles when a null is used for AuthNMappingsSort. -type NullableAuthNMappingsSort struct { - value *AuthNMappingsSort - isSet bool -} - -// Get returns the associated value. -func (v NullableAuthNMappingsSort) Get() *AuthNMappingsSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableAuthNMappingsSort) Set(val *AuthNMappingsSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableAuthNMappingsSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableAuthNMappingsSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableAuthNMappingsSort initializes the struct as if Set has been called. -func NewNullableAuthNMappingsSort(val *AuthNMappingsSort) *NullableAuthNMappingsSort { - return &NullableAuthNMappingsSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableAuthNMappingsSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableAuthNMappingsSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mappings_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mappings_type.go index c1ed5cc8e..65cca5241 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mappings_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_auth_n_mappings_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // AuthNMappingsType AuthN Mappings resource type. @@ -61,47 +62,3 @@ func (v AuthNMappingsType) IsValid() bool { func (v AuthNMappingsType) Ptr() *AuthNMappingsType { return &v } - -// NullableAuthNMappingsType handles when a null is used for AuthNMappingsType. -type NullableAuthNMappingsType struct { - value *AuthNMappingsType - isSet bool -} - -// Get returns the associated value. -func (v NullableAuthNMappingsType) Get() *AuthNMappingsType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableAuthNMappingsType) Set(val *AuthNMappingsType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableAuthNMappingsType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableAuthNMappingsType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableAuthNMappingsType initializes the struct as if Set has been called. -func NewNullableAuthNMappingsType(val *AuthNMappingsType) *NullableAuthNMappingsType { - return &NullableAuthNMappingsType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableAuthNMappingsType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableAuthNMappingsType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_chargeback_breakdown.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_chargeback_breakdown.go index a8efd7df2..c0ca9893b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_chargeback_breakdown.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_chargeback_breakdown.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o ChargebackBreakdown) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ChargebackBreakdown) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ChargeType *string `json:"charge_type,omitempty"` Cost *float64 `json:"cost,omitempty"` ProductName *string `json:"product_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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *ChargebackBreakdown) UnmarshalJSON(bytes []byte) (err error) { o.ChargeType = all.ChargeType o.Cost = all.Cost o.ProductName = all.ProductName + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_aggregate_bucket_value.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_aggregate_bucket_value.go index 308dd339c..1a7dcbb80 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_aggregate_bucket_value.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_aggregate_bucket_value.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // CIAppAggregateBucketValue - A bucket value, can either be a timeseries or a single value. @@ -135,53 +135,3 @@ func (obj *CIAppAggregateBucketValue) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableCIAppAggregateBucketValue handles when a null is used for CIAppAggregateBucketValue. -type NullableCIAppAggregateBucketValue struct { - value *CIAppAggregateBucketValue - isSet bool -} - -// Get returns the associated value. -func (v NullableCIAppAggregateBucketValue) Get() *CIAppAggregateBucketValue { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCIAppAggregateBucketValue) Set(val *CIAppAggregateBucketValue) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCIAppAggregateBucketValue) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableCIAppAggregateBucketValue) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCIAppAggregateBucketValue initializes the struct as if Set has been called. -func NewNullableCIAppAggregateBucketValue(val *CIAppAggregateBucketValue) *NullableCIAppAggregateBucketValue { - return &NullableCIAppAggregateBucketValue{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCIAppAggregateBucketValue) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCIAppAggregateBucketValue) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_aggregate_bucket_value_timeseries.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_aggregate_bucket_value_timeseries.go index 62808f2be..98eb4905a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_aggregate_bucket_value_timeseries.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_aggregate_bucket_value_timeseries.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // CIAppAggregateBucketValueTimeseries A timeseries array. @@ -47,5 +47,17 @@ func (o CIAppAggregateBucketValueTimeseries) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppAggregateBucketValueTimeseries) UnmarshalJSON(bytes []byte) (err error) { - return json.Unmarshal(bytes, &o.Items) + if err = json.Unmarshal(bytes, &o.Items); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + if o.Items != nil && len(o.Items) > 0 { + for _, v := range o.Items { + if v.UnparsedObject != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + } + } + + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_aggregate_bucket_value_timeseries_point.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_aggregate_bucket_value_timeseries_point.go index 0b90c68f3..e543c3d83 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_aggregate_bucket_value_timeseries_point.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_aggregate_bucket_value_timeseries_point.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -120,18 +121,12 @@ func (o CIAppAggregateBucketValueTimeseriesPoint) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *CIAppAggregateBucketValueTimeseriesPoint) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Time *time.Time `json:"time,omitempty"` Value *float64 `json:"value,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -141,6 +136,7 @@ func (o *CIAppAggregateBucketValueTimeseriesPoint) UnmarshalJSON(bytes []byte) ( } o.Time = all.Time o.Value = all.Value + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_aggregate_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_aggregate_sort.go index 8c1cf7db9..43ca5fee5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_aggregate_sort.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_aggregate_sort.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -185,7 +185,6 @@ func (o CIAppAggregateSort) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppAggregateSort) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregation *CIAppAggregationFunction `json:"aggregation,omitempty"` Metric *string `json:"metric,omitempty"` @@ -193,12 +192,7 @@ func (o *CIAppAggregateSort) UnmarshalJSON(bytes []byte) (err error) { Type *CIAppAggregateSortType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,37 +200,32 @@ func (o *CIAppAggregateSort) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Aggregation; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Order; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregation = all.Aggregation + + hasInvalidField := false + if all.Aggregation != nil && !all.Aggregation.IsValid() { + hasInvalidField = true + } else { + o.Aggregation = all.Aggregation + } o.Metric = all.Metric - o.Order = all.Order - o.Type = all.Type + if all.Order != nil && !all.Order.IsValid() { + hasInvalidField = true + } else { + o.Order = all.Order + } + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_aggregate_sort_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_aggregate_sort_type.go index 379ffa1ee..cba5b5596 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_aggregate_sort_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_aggregate_sort_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // CIAppAggregateSortType The type of sorting algorithm. @@ -63,47 +64,3 @@ func (v CIAppAggregateSortType) IsValid() bool { func (v CIAppAggregateSortType) Ptr() *CIAppAggregateSortType { return &v } - -// NullableCIAppAggregateSortType handles when a null is used for CIAppAggregateSortType. -type NullableCIAppAggregateSortType struct { - value *CIAppAggregateSortType - isSet bool -} - -// Get returns the associated value. -func (v NullableCIAppAggregateSortType) Get() *CIAppAggregateSortType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCIAppAggregateSortType) Set(val *CIAppAggregateSortType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCIAppAggregateSortType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableCIAppAggregateSortType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCIAppAggregateSortType initializes the struct as if Set has been called. -func NewNullableCIAppAggregateSortType(val *CIAppAggregateSortType) *NullableCIAppAggregateSortType { - return &NullableCIAppAggregateSortType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCIAppAggregateSortType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCIAppAggregateSortType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_aggregation_function.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_aggregation_function.go index 225a40854..704ff7880 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_aggregation_function.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_aggregation_function.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // CIAppAggregationFunction An aggregation function. @@ -91,47 +92,3 @@ func (v CIAppAggregationFunction) IsValid() bool { func (v CIAppAggregationFunction) Ptr() *CIAppAggregationFunction { return &v } - -// NullableCIAppAggregationFunction handles when a null is used for CIAppAggregationFunction. -type NullableCIAppAggregationFunction struct { - value *CIAppAggregationFunction - isSet bool -} - -// Get returns the associated value. -func (v NullableCIAppAggregationFunction) Get() *CIAppAggregationFunction { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCIAppAggregationFunction) Set(val *CIAppAggregationFunction) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCIAppAggregationFunction) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableCIAppAggregationFunction) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCIAppAggregationFunction initializes the struct as if Set has been called. -func NewNullableCIAppAggregationFunction(val *CIAppAggregationFunction) *NullableCIAppAggregationFunction { - return &NullableCIAppAggregationFunction{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCIAppAggregationFunction) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCIAppAggregationFunction) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_ci_error.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_ci_error.go index 6ad2b2ce1..00eff1286 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_ci_error.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_ci_error.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -214,7 +214,6 @@ func (o CIAppCIError) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppCIError) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Domain *CIAppCIErrorDomain `json:"domain,omitempty"` Message datadog.NullableString `json:"message,omitempty"` @@ -222,12 +221,7 @@ func (o *CIAppCIError) UnmarshalJSON(bytes []byte) (err error) { Type datadog.NullableString `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -235,22 +229,25 @@ func (o *CIAppCIError) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Domain; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.Domain != nil && !all.Domain.IsValid() { + hasInvalidField = true + } else { + o.Domain = all.Domain } - o.Domain = all.Domain o.Message = all.Message o.Stack = all.Stack o.Type = all.Type + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_ci_error_domain.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_ci_error_domain.go index 090a37d02..539e75038 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_ci_error_domain.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_ci_error_domain.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // CIAppCIErrorDomain Error category used to differentiate between issues related to the developer or provider environments. @@ -65,47 +66,3 @@ func (v CIAppCIErrorDomain) IsValid() bool { func (v CIAppCIErrorDomain) Ptr() *CIAppCIErrorDomain { return &v } - -// NullableCIAppCIErrorDomain handles when a null is used for CIAppCIErrorDomain. -type NullableCIAppCIErrorDomain struct { - value *CIAppCIErrorDomain - isSet bool -} - -// Get returns the associated value. -func (v NullableCIAppCIErrorDomain) Get() *CIAppCIErrorDomain { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCIAppCIErrorDomain) Set(val *CIAppCIErrorDomain) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCIAppCIErrorDomain) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableCIAppCIErrorDomain) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCIAppCIErrorDomain initializes the struct as if Set has been called. -func NewNullableCIAppCIErrorDomain(val *CIAppCIErrorDomain) *NullableCIAppCIErrorDomain { - return &NullableCIAppCIErrorDomain{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCIAppCIErrorDomain) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCIAppCIErrorDomain) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_compute.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_compute.go index a831fdfac..2b4cb284b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_compute.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_compute.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -181,7 +182,6 @@ func (o CIAppCompute) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppCompute) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregation *CIAppAggregationFunction `json:"aggregation"` Interval *string `json:"interval,omitempty"` @@ -189,12 +189,7 @@ func (o *CIAppCompute) UnmarshalJSON(bytes []byte) (err error) { Type *CIAppComputeType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Aggregation == nil { return fmt.Errorf("required field aggregation missing") @@ -205,29 +200,28 @@ func (o *CIAppCompute) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Aggregation; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregation = *all.Aggregation + + hasInvalidField := false + if !all.Aggregation.IsValid() { + hasInvalidField = true + } else { + o.Aggregation = *all.Aggregation + } o.Interval = all.Interval o.Metric = all.Metric - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_compute_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_compute_type.go index e111c266e..faa99e6d0 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_compute_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_compute_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // CIAppComputeType The type of compute. @@ -63,47 +64,3 @@ func (v CIAppComputeType) IsValid() bool { func (v CIAppComputeType) Ptr() *CIAppComputeType { return &v } - -// NullableCIAppComputeType handles when a null is used for CIAppComputeType. -type NullableCIAppComputeType struct { - value *CIAppComputeType - isSet bool -} - -// Get returns the associated value. -func (v NullableCIAppComputeType) Get() *CIAppComputeType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCIAppComputeType) Set(val *CIAppComputeType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCIAppComputeType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableCIAppComputeType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCIAppComputeType initializes the struct as if Set has been called. -func NewNullableCIAppComputeType(val *CIAppComputeType) *NullableCIAppComputeType { - return &NullableCIAppComputeType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCIAppComputeType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCIAppComputeType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_create_pipeline_event_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_create_pipeline_event_request.go index 543c75b32..ec8e0e155 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_create_pipeline_event_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_create_pipeline_event_request.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o CIAppCreatePipelineEventRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppCreatePipelineEventRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *CIAppCreatePipelineEventRequestData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *CIAppCreatePipelineEventRequest) UnmarshalJSON(bytes []byte) (err error } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_create_pipeline_event_request_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_create_pipeline_event_request_attributes.go index 507206001..094d331d3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_create_pipeline_event_request_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_create_pipeline_event_request_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -143,19 +144,13 @@ func (o CIAppCreatePipelineEventRequestAttributes) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *CIAppCreatePipelineEventRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Env *string `json:"env,omitempty"` Resource *CIAppCreatePipelineEventRequestAttributesResource `json:"resource"` Service *string `json:"service,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Resource == nil { return fmt.Errorf("required field resource missing") @@ -169,6 +164,7 @@ func (o *CIAppCreatePipelineEventRequestAttributes) UnmarshalJSON(bytes []byte) o.Env = all.Env o.Resource = *all.Resource o.Service = all.Service + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_create_pipeline_event_request_attributes_resource.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_create_pipeline_event_request_attributes_resource.go index 8dbd24539..4898f5fef 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_create_pipeline_event_request_attributes_resource.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_create_pipeline_event_request_attributes_resource.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // CIAppCreatePipelineEventRequestAttributesResource - Details of the CI pipeline event. @@ -167,53 +167,3 @@ func (obj *CIAppCreatePipelineEventRequestAttributesResource) GetActualInstance( // all schemas are nil return nil } - -// NullableCIAppCreatePipelineEventRequestAttributesResource handles when a null is used for CIAppCreatePipelineEventRequestAttributesResource. -type NullableCIAppCreatePipelineEventRequestAttributesResource struct { - value *CIAppCreatePipelineEventRequestAttributesResource - isSet bool -} - -// Get returns the associated value. -func (v NullableCIAppCreatePipelineEventRequestAttributesResource) Get() *CIAppCreatePipelineEventRequestAttributesResource { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCIAppCreatePipelineEventRequestAttributesResource) Set(val *CIAppCreatePipelineEventRequestAttributesResource) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCIAppCreatePipelineEventRequestAttributesResource) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableCIAppCreatePipelineEventRequestAttributesResource) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCIAppCreatePipelineEventRequestAttributesResource initializes the struct as if Set has been called. -func NewNullableCIAppCreatePipelineEventRequestAttributesResource(val *CIAppCreatePipelineEventRequestAttributesResource) *NullableCIAppCreatePipelineEventRequestAttributesResource { - return &NullableCIAppCreatePipelineEventRequestAttributesResource{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCIAppCreatePipelineEventRequestAttributesResource) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCIAppCreatePipelineEventRequestAttributesResource) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_create_pipeline_event_request_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_create_pipeline_event_request_data.go index 8e8ca056f..f8d7bf8c1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_create_pipeline_event_request_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_create_pipeline_event_request_data.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -119,18 +119,12 @@ func (o CIAppCreatePipelineEventRequestData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppCreatePipelineEventRequestData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *CIAppCreatePipelineEventRequestAttributes `json:"attributes,omitempty"` Type *CIAppCreatePipelineEventRequestDataType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -138,26 +132,25 @@ func (o *CIAppCreatePipelineEventRequestData) UnmarshalJSON(bytes []byte) (err e } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_create_pipeline_event_request_data_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_create_pipeline_event_request_data_type.go index 581c53af6..43d07d007 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_create_pipeline_event_request_data_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_create_pipeline_event_request_data_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // CIAppCreatePipelineEventRequestDataType Type of the event. @@ -61,47 +62,3 @@ func (v CIAppCreatePipelineEventRequestDataType) IsValid() bool { func (v CIAppCreatePipelineEventRequestDataType) Ptr() *CIAppCreatePipelineEventRequestDataType { return &v } - -// NullableCIAppCreatePipelineEventRequestDataType handles when a null is used for CIAppCreatePipelineEventRequestDataType. -type NullableCIAppCreatePipelineEventRequestDataType struct { - value *CIAppCreatePipelineEventRequestDataType - isSet bool -} - -// Get returns the associated value. -func (v NullableCIAppCreatePipelineEventRequestDataType) Get() *CIAppCreatePipelineEventRequestDataType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCIAppCreatePipelineEventRequestDataType) Set(val *CIAppCreatePipelineEventRequestDataType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCIAppCreatePipelineEventRequestDataType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableCIAppCreatePipelineEventRequestDataType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCIAppCreatePipelineEventRequestDataType initializes the struct as if Set has been called. -func NewNullableCIAppCreatePipelineEventRequestDataType(val *CIAppCreatePipelineEventRequestDataType) *NullableCIAppCreatePipelineEventRequestDataType { - return &NullableCIAppCreatePipelineEventRequestDataType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCIAppCreatePipelineEventRequestDataType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCIAppCreatePipelineEventRequestDataType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_event_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_event_attributes.go index 6ed961e33..b3e42c607 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_event_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_event_attributes.go @@ -5,24 +5,19 @@ package datadogV2 import ( - "encoding/json" - "time" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // CIAppEventAttributes JSON object containing all event attributes and their associated values. type CIAppEventAttributes struct { - // JSON object of attributes from CI Visibility events. + // JSON object of attributes from CI Visibility test events. Attributes map[string]interface{} `json:"attributes,omitempty"` - // The name of the application or service generating CI Visibility events. - // It is used to switch from CI Visibility to APM, so make sure you define the same - // value when you use both products. - Service *string `json:"service,omitempty"` // Array of tags associated with your event. Tags []string `json:"tags,omitempty"` - // Timestamp of your event. - Timestamp *time.Time `json:"timestamp,omitempty"` + // Test run level. + TestLevel *CIAppTestLevel `json:"test_level,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{} @@ -73,34 +68,6 @@ func (o *CIAppEventAttributes) SetAttributes(v map[string]interface{}) { o.Attributes = v } -// GetService returns the Service field value if set, zero value otherwise. -func (o *CIAppEventAttributes) GetService() string { - if o == nil || o.Service == nil { - var ret string - return ret - } - return *o.Service -} - -// GetServiceOk returns a tuple with the Service field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CIAppEventAttributes) GetServiceOk() (*string, bool) { - if o == nil || o.Service == nil { - return nil, false - } - return o.Service, true -} - -// HasService returns a boolean if a field has been set. -func (o *CIAppEventAttributes) HasService() bool { - return o != nil && o.Service != nil -} - -// SetService gets a reference to the given string and assigns it to the Service field. -func (o *CIAppEventAttributes) SetService(v string) { - o.Service = &v -} - // GetTags returns the Tags field value if set, zero value otherwise. func (o *CIAppEventAttributes) GetTags() []string { if o == nil || o.Tags == nil { @@ -129,32 +96,32 @@ func (o *CIAppEventAttributes) SetTags(v []string) { o.Tags = v } -// GetTimestamp returns the Timestamp field value if set, zero value otherwise. -func (o *CIAppEventAttributes) GetTimestamp() time.Time { - if o == nil || o.Timestamp == nil { - var ret time.Time +// GetTestLevel returns the TestLevel field value if set, zero value otherwise. +func (o *CIAppEventAttributes) GetTestLevel() CIAppTestLevel { + if o == nil || o.TestLevel == nil { + var ret CIAppTestLevel return ret } - return *o.Timestamp + return *o.TestLevel } -// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise +// GetTestLevelOk returns a tuple with the TestLevel field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *CIAppEventAttributes) GetTimestampOk() (*time.Time, bool) { - if o == nil || o.Timestamp == nil { +func (o *CIAppEventAttributes) GetTestLevelOk() (*CIAppTestLevel, bool) { + if o == nil || o.TestLevel == nil { return nil, false } - return o.Timestamp, true + return o.TestLevel, true } -// HasTimestamp returns a boolean if a field has been set. -func (o *CIAppEventAttributes) HasTimestamp() bool { - return o != nil && o.Timestamp != nil +// HasTestLevel returns a boolean if a field has been set. +func (o *CIAppEventAttributes) HasTestLevel() bool { + return o != nil && o.TestLevel != nil } -// SetTimestamp gets a reference to the given time.Time and assigns it to the Timestamp field. -func (o *CIAppEventAttributes) SetTimestamp(v time.Time) { - o.Timestamp = &v +// SetTestLevel gets a reference to the given CIAppTestLevel and assigns it to the TestLevel field. +func (o *CIAppEventAttributes) SetTestLevel(v CIAppTestLevel) { + o.TestLevel = &v } // MarshalJSON serializes the struct using spec logic. @@ -166,18 +133,11 @@ func (o CIAppEventAttributes) MarshalJSON() ([]byte, error) { if o.Attributes != nil { toSerialize["attributes"] = o.Attributes } - if o.Service != nil { - toSerialize["service"] = o.Service - } if o.Tags != nil { toSerialize["tags"] = o.Tags } - if o.Timestamp != nil { - if o.Timestamp.Nanosecond() == 0 { - toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05.000Z07:00") - } + if o.TestLevel != nil { + toSerialize["test_level"] = o.TestLevel } for key, value := range o.AdditionalProperties { @@ -188,34 +148,37 @@ func (o CIAppEventAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppEventAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes map[string]interface{} `json:"attributes,omitempty"` - Service *string `json:"service,omitempty"` Tags []string `json:"tags,omitempty"` - Timestamp *time.Time `json:"timestamp,omitempty"` + TestLevel *CIAppTestLevel `json:"test_level,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "service", "tags", "timestamp"}) + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "tags", "test_level"}) } else { return err } + + hasInvalidField := false o.Attributes = all.Attributes - o.Service = all.Service o.Tags = all.Tags - o.Timestamp = all.Timestamp + if all.TestLevel != nil && !all.TestLevel.IsValid() { + hasInvalidField = true + } else { + o.TestLevel = all.TestLevel + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_git_info.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_git_info.go index 744f3cebe..67267a96c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_git_info.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_git_info.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -528,7 +529,6 @@ func (o CIAppGitInfo) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppGitInfo) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AuthorEmail *string `json:"author_email"` AuthorName datadog.NullableString `json:"author_name,omitempty"` @@ -544,12 +544,7 @@ func (o *CIAppGitInfo) UnmarshalJSON(bytes []byte) (err error) { Tag datadog.NullableString `json:"tag,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.AuthorEmail == nil { return fmt.Errorf("required field author_email missing") @@ -578,6 +573,7 @@ func (o *CIAppGitInfo) UnmarshalJSON(bytes []byte) (err error) { o.RepositoryUrl = *all.RepositoryUrl o.Sha = *all.Sha o.Tag = all.Tag + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_group_by_histogram.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_group_by_histogram.go index 03a093b91..acf42d2fe 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_group_by_histogram.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_group_by_histogram.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -134,19 +135,13 @@ func (o CIAppGroupByHistogram) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppGroupByHistogram) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Interval *float64 `json:"interval"` Max *float64 `json:"max"` Min *float64 `json:"min"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Interval == nil { return fmt.Errorf("required field interval missing") @@ -166,6 +161,7 @@ func (o *CIAppGroupByHistogram) UnmarshalJSON(bytes []byte) (err error) { o.Interval = *all.Interval o.Max = *all.Max o.Min = *all.Min + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_group_by_missing.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_group_by_missing.go index 69dd2ceb5..613da9b4c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_group_by_missing.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_group_by_missing.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // CIAppGroupByMissing - The value to use for logs that don't have the facet used to group-by. @@ -103,53 +103,3 @@ func (obj *CIAppGroupByMissing) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableCIAppGroupByMissing handles when a null is used for CIAppGroupByMissing. -type NullableCIAppGroupByMissing struct { - value *CIAppGroupByMissing - isSet bool -} - -// Get returns the associated value. -func (v NullableCIAppGroupByMissing) Get() *CIAppGroupByMissing { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCIAppGroupByMissing) Set(val *CIAppGroupByMissing) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCIAppGroupByMissing) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableCIAppGroupByMissing) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCIAppGroupByMissing initializes the struct as if Set has been called. -func NewNullableCIAppGroupByMissing(val *CIAppGroupByMissing) *NullableCIAppGroupByMissing { - return &NullableCIAppGroupByMissing{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCIAppGroupByMissing) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCIAppGroupByMissing) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_group_by_total.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_group_by_total.go index 6a177a944..278500b59 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_group_by_total.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_group_by_total.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // CIAppGroupByTotal - A resulting object to put the given computes in over all the matching records. @@ -135,53 +135,3 @@ func (obj *CIAppGroupByTotal) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableCIAppGroupByTotal handles when a null is used for CIAppGroupByTotal. -type NullableCIAppGroupByTotal struct { - value *CIAppGroupByTotal - isSet bool -} - -// Get returns the associated value. -func (v NullableCIAppGroupByTotal) Get() *CIAppGroupByTotal { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCIAppGroupByTotal) Set(val *CIAppGroupByTotal) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCIAppGroupByTotal) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableCIAppGroupByTotal) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCIAppGroupByTotal initializes the struct as if Set has been called. -func NewNullableCIAppGroupByTotal(val *CIAppGroupByTotal) *NullableCIAppGroupByTotal { - return &NullableCIAppGroupByTotal{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCIAppGroupByTotal) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCIAppGroupByTotal) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_host_info.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_host_info.go index 8437bfac2..ba123bec9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_host_info.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_host_info.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -181,7 +181,6 @@ func (o CIAppHostInfo) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppHostInfo) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Hostname *string `json:"hostname,omitempty"` Labels []string `json:"labels,omitempty"` @@ -189,12 +188,7 @@ func (o *CIAppHostInfo) UnmarshalJSON(bytes []byte) (err error) { Workspace *string `json:"workspace,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,6 +200,7 @@ func (o *CIAppHostInfo) UnmarshalJSON(bytes []byte) (err error) { o.Labels = all.Labels o.Name = all.Name o.Workspace = all.Workspace + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event.go index f3cbaa0ae..59e37a85c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -13,7 +13,7 @@ import ( // CIAppPipelineEvent Object description of a pipeline event after being processed and stored by Datadog. type CIAppPipelineEvent struct { // JSON object containing all event attributes and their associated values. - Attributes *CIAppEventAttributes `json:"attributes,omitempty"` + Attributes *CIAppPipelineEventAttributes `json:"attributes,omitempty"` // Unique ID of the event. Id *string `json:"id,omitempty"` // Type of the event. @@ -41,9 +41,9 @@ func NewCIAppPipelineEventWithDefaults() *CIAppPipelineEvent { } // GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *CIAppPipelineEvent) GetAttributes() CIAppEventAttributes { +func (o *CIAppPipelineEvent) GetAttributes() CIAppPipelineEventAttributes { if o == nil || o.Attributes == nil { - var ret CIAppEventAttributes + var ret CIAppPipelineEventAttributes return ret } return *o.Attributes @@ -51,7 +51,7 @@ func (o *CIAppPipelineEvent) GetAttributes() CIAppEventAttributes { // GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *CIAppPipelineEvent) GetAttributesOk() (*CIAppEventAttributes, bool) { +func (o *CIAppPipelineEvent) GetAttributesOk() (*CIAppPipelineEventAttributes, bool) { if o == nil || o.Attributes == nil { return nil, false } @@ -63,8 +63,8 @@ func (o *CIAppPipelineEvent) HasAttributes() bool { return o != nil && o.Attributes != nil } -// SetAttributes gets a reference to the given CIAppEventAttributes and assigns it to the Attributes field. -func (o *CIAppPipelineEvent) SetAttributes(v CIAppEventAttributes) { +// SetAttributes gets a reference to the given CIAppPipelineEventAttributes and assigns it to the Attributes field. +func (o *CIAppPipelineEvent) SetAttributes(v CIAppPipelineEventAttributes) { o.Attributes = &v } @@ -148,19 +148,13 @@ func (o CIAppPipelineEvent) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppPipelineEvent) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { - Attributes *CIAppEventAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Type *CIAppPipelineEventTypeName `json:"type,omitempty"` + Attributes *CIAppPipelineEventAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *CIAppPipelineEventTypeName `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,27 +162,26 @@ func (o *CIAppPipelineEvent) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_attributes.go new file mode 100644 index 000000000..810f754e9 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_attributes.go @@ -0,0 +1,184 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CIAppPipelineEventAttributes JSON object containing all event attributes and their associated values. +type CIAppPipelineEventAttributes struct { + // JSON object of attributes from CI Visibility pipeline events. + Attributes map[string]interface{} `json:"attributes,omitempty"` + // Pipeline execution level. + CiLevel *CIAppPipelineLevel `json:"ci_level,omitempty"` + // Array of tags associated with your event. + Tags []string `json:"tags,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{} +} + +// NewCIAppPipelineEventAttributes instantiates a new CIAppPipelineEventAttributes 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 NewCIAppPipelineEventAttributes() *CIAppPipelineEventAttributes { + this := CIAppPipelineEventAttributes{} + return &this +} + +// NewCIAppPipelineEventAttributesWithDefaults instantiates a new CIAppPipelineEventAttributes 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 NewCIAppPipelineEventAttributesWithDefaults() *CIAppPipelineEventAttributes { + this := CIAppPipelineEventAttributes{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *CIAppPipelineEventAttributes) GetAttributes() map[string]interface{} { + if o == nil || o.Attributes == nil { + var ret map[string]interface{} + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CIAppPipelineEventAttributes) GetAttributesOk() (*map[string]interface{}, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return &o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *CIAppPipelineEventAttributes) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given map[string]interface{} and assigns it to the Attributes field. +func (o *CIAppPipelineEventAttributes) SetAttributes(v map[string]interface{}) { + o.Attributes = v +} + +// GetCiLevel returns the CiLevel field value if set, zero value otherwise. +func (o *CIAppPipelineEventAttributes) GetCiLevel() CIAppPipelineLevel { + if o == nil || o.CiLevel == nil { + var ret CIAppPipelineLevel + return ret + } + return *o.CiLevel +} + +// GetCiLevelOk returns a tuple with the CiLevel field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CIAppPipelineEventAttributes) GetCiLevelOk() (*CIAppPipelineLevel, bool) { + if o == nil || o.CiLevel == nil { + return nil, false + } + return o.CiLevel, true +} + +// HasCiLevel returns a boolean if a field has been set. +func (o *CIAppPipelineEventAttributes) HasCiLevel() bool { + return o != nil && o.CiLevel != nil +} + +// SetCiLevel gets a reference to the given CIAppPipelineLevel and assigns it to the CiLevel field. +func (o *CIAppPipelineEventAttributes) SetCiLevel(v CIAppPipelineLevel) { + o.CiLevel = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *CIAppPipelineEventAttributes) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CIAppPipelineEventAttributes) GetTagsOk() (*[]string, bool) { + if o == nil || o.Tags == nil { + return nil, false + } + return &o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *CIAppPipelineEventAttributes) HasTags() bool { + return o != nil && o.Tags != nil +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *CIAppPipelineEventAttributes) SetTags(v []string) { + o.Tags = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CIAppPipelineEventAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.CiLevel != nil { + toSerialize["ci_level"] = o.CiLevel + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CIAppPipelineEventAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes map[string]interface{} `json:"attributes,omitempty"` + CiLevel *CIAppPipelineLevel `json:"ci_level,omitempty"` + Tags []string `json:"tags,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "ci_level", "tags"}) + } else { + return err + } + + hasInvalidField := false + o.Attributes = all.Attributes + if all.CiLevel != nil && !all.CiLevel.IsValid() { + hasInvalidField = true + } else { + o.CiLevel = all.CiLevel + } + o.Tags = all.Tags + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_job.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_job.go index 7339c1cde..edc53e105 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_job.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_job.go @@ -5,10 +5,11 @@ package datadogV2 import ( - "encoding/json" "fmt" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -720,7 +721,6 @@ func (o CIAppPipelineEventJob) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppPipelineEventJob) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Dependencies datadog.NullableList[string] `json:"dependencies,omitempty"` End *time.Time `json:"end"` @@ -743,12 +743,7 @@ func (o *CIAppPipelineEventJob) UnmarshalJSON(bytes []byte) (err error) { Url *string `json:"url"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.End == nil { return fmt.Errorf("required field end missing") @@ -786,28 +781,18 @@ func (o *CIAppPipelineEventJob) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Level; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Dependencies = all.Dependencies o.End = *all.End o.Error = all.Error o.Git = all.Git o.Id = *all.Id - o.Level = *all.Level + if !all.Level.IsValid() { + hasInvalidField = true + } else { + o.Level = *all.Level + } o.Metrics = all.Metrics o.Name = *all.Name o.Node = all.Node @@ -818,12 +803,21 @@ func (o *CIAppPipelineEventJob) UnmarshalJSON(bytes []byte) (err error) { o.StageId = all.StageId o.StageName = all.StageName o.Start = *all.Start - o.Status = *all.Status + if !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = *all.Status + } o.Tags = all.Tags o.Url = *all.Url + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_job_level.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_job_level.go index 96410b459..06d868ae6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_job_level.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_job_level.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // CIAppPipelineEventJobLevel Used to distinguish between pipelines, stages, jobs, and steps. @@ -61,47 +62,3 @@ func (v CIAppPipelineEventJobLevel) IsValid() bool { func (v CIAppPipelineEventJobLevel) Ptr() *CIAppPipelineEventJobLevel { return &v } - -// NullableCIAppPipelineEventJobLevel handles when a null is used for CIAppPipelineEventJobLevel. -type NullableCIAppPipelineEventJobLevel struct { - value *CIAppPipelineEventJobLevel - isSet bool -} - -// Get returns the associated value. -func (v NullableCIAppPipelineEventJobLevel) Get() *CIAppPipelineEventJobLevel { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCIAppPipelineEventJobLevel) Set(val *CIAppPipelineEventJobLevel) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCIAppPipelineEventJobLevel) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableCIAppPipelineEventJobLevel) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCIAppPipelineEventJobLevel initializes the struct as if Set has been called. -func NewNullableCIAppPipelineEventJobLevel(val *CIAppPipelineEventJobLevel) *NullableCIAppPipelineEventJobLevel { - return &NullableCIAppPipelineEventJobLevel{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCIAppPipelineEventJobLevel) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCIAppPipelineEventJobLevel) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_job_status.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_job_status.go index cccb32f7f..2f0fc520f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_job_status.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_job_status.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // CIAppPipelineEventJobStatus The final status of the job. @@ -67,47 +68,3 @@ func (v CIAppPipelineEventJobStatus) IsValid() bool { func (v CIAppPipelineEventJobStatus) Ptr() *CIAppPipelineEventJobStatus { return &v } - -// NullableCIAppPipelineEventJobStatus handles when a null is used for CIAppPipelineEventJobStatus. -type NullableCIAppPipelineEventJobStatus struct { - value *CIAppPipelineEventJobStatus - isSet bool -} - -// Get returns the associated value. -func (v NullableCIAppPipelineEventJobStatus) Get() *CIAppPipelineEventJobStatus { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCIAppPipelineEventJobStatus) Set(val *CIAppPipelineEventJobStatus) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCIAppPipelineEventJobStatus) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableCIAppPipelineEventJobStatus) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCIAppPipelineEventJobStatus initializes the struct as if Set has been called. -func NewNullableCIAppPipelineEventJobStatus(val *CIAppPipelineEventJobStatus) *NullableCIAppPipelineEventJobStatus { - return &NullableCIAppPipelineEventJobStatus{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCIAppPipelineEventJobStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCIAppPipelineEventJobStatus) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_parent_pipeline.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_parent_pipeline.go index f9ac1ddd4..316238c2b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_parent_pipeline.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_parent_pipeline.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o CIAppPipelineEventParentPipeline) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppPipelineEventParentPipeline) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id"` Url *string `json:"url,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -134,6 +129,7 @@ func (o *CIAppPipelineEventParentPipeline) UnmarshalJSON(bytes []byte) (err erro } o.Id = *all.Id o.Url = all.Url + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_pipeline.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_pipeline.go index 6a3d31289..00bc9d5de 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_pipeline.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_pipeline.go @@ -5,16 +5,17 @@ package datadogV2 import ( - "encoding/json" "fmt" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // CIAppPipelineEventPipeline Details of the top level pipeline, build, or workflow of your CI. type CIAppPipelineEventPipeline struct { - // Time when the pipeline run finished. The time format must be RFC3339. + // Time when the pipeline run finished. It cannot be older than 18 hours in the past from the current time. The time format must be RFC3339. End time.Time `json:"end"` // Contains information of the CI error. Error NullableCIAppCIError `json:"error,omitempty"` @@ -773,7 +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{}{} all := struct { End *time.Time `json:"end"` Error NullableCIAppCIError `json:"error,omitempty"` @@ -797,12 +797,7 @@ func (o *CIAppPipelineEventPipeline) UnmarshalJSON(bytes []byte) (err error) { Url *string `json:"url"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.End == nil { return fmt.Errorf("required field end missing") @@ -837,28 +832,18 @@ func (o *CIAppPipelineEventPipeline) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Level; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.End = *all.End o.Error = all.Error o.Git = all.Git o.IsManual = all.IsManual o.IsResumed = all.IsResumed - o.Level = *all.Level + if !all.Level.IsValid() { + hasInvalidField = true + } else { + o.Level = *all.Level + } o.Metrics = all.Metrics o.Name = *all.Name o.Node = all.Node @@ -869,13 +854,22 @@ func (o *CIAppPipelineEventPipeline) UnmarshalJSON(bytes []byte) (err error) { o.PreviousAttempt = all.PreviousAttempt o.QueueTime = all.QueueTime o.Start = *all.Start - o.Status = *all.Status + if !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = *all.Status + } o.Tags = all.Tags o.UniqueId = *all.UniqueId o.Url = *all.Url + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_pipeline_level.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_pipeline_level.go index c581bd92d..1da428b05 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_pipeline_level.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_pipeline_level.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // CIAppPipelineEventPipelineLevel Used to distinguish between pipelines, stages, jobs, and steps. @@ -61,47 +62,3 @@ func (v CIAppPipelineEventPipelineLevel) IsValid() bool { func (v CIAppPipelineEventPipelineLevel) Ptr() *CIAppPipelineEventPipelineLevel { return &v } - -// NullableCIAppPipelineEventPipelineLevel handles when a null is used for CIAppPipelineEventPipelineLevel. -type NullableCIAppPipelineEventPipelineLevel struct { - value *CIAppPipelineEventPipelineLevel - isSet bool -} - -// Get returns the associated value. -func (v NullableCIAppPipelineEventPipelineLevel) Get() *CIAppPipelineEventPipelineLevel { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCIAppPipelineEventPipelineLevel) Set(val *CIAppPipelineEventPipelineLevel) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCIAppPipelineEventPipelineLevel) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableCIAppPipelineEventPipelineLevel) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCIAppPipelineEventPipelineLevel initializes the struct as if Set has been called. -func NewNullableCIAppPipelineEventPipelineLevel(val *CIAppPipelineEventPipelineLevel) *NullableCIAppPipelineEventPipelineLevel { - return &NullableCIAppPipelineEventPipelineLevel{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCIAppPipelineEventPipelineLevel) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCIAppPipelineEventPipelineLevel) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_pipeline_status.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_pipeline_status.go index df05db544..81790ac08 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_pipeline_status.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_pipeline_status.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // CIAppPipelineEventPipelineStatus The final status of the pipeline. @@ -69,47 +70,3 @@ func (v CIAppPipelineEventPipelineStatus) IsValid() bool { func (v CIAppPipelineEventPipelineStatus) Ptr() *CIAppPipelineEventPipelineStatus { return &v } - -// NullableCIAppPipelineEventPipelineStatus handles when a null is used for CIAppPipelineEventPipelineStatus. -type NullableCIAppPipelineEventPipelineStatus struct { - value *CIAppPipelineEventPipelineStatus - isSet bool -} - -// Get returns the associated value. -func (v NullableCIAppPipelineEventPipelineStatus) Get() *CIAppPipelineEventPipelineStatus { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCIAppPipelineEventPipelineStatus) Set(val *CIAppPipelineEventPipelineStatus) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCIAppPipelineEventPipelineStatus) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableCIAppPipelineEventPipelineStatus) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCIAppPipelineEventPipelineStatus initializes the struct as if Set has been called. -func NewNullableCIAppPipelineEventPipelineStatus(val *CIAppPipelineEventPipelineStatus) *NullableCIAppPipelineEventPipelineStatus { - return &NullableCIAppPipelineEventPipelineStatus{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCIAppPipelineEventPipelineStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCIAppPipelineEventPipelineStatus) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_previous_pipeline.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_previous_pipeline.go index 6ccc9107b..92589fa5d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_previous_pipeline.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_previous_pipeline.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o CIAppPipelineEventPreviousPipeline) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppPipelineEventPreviousPipeline) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id"` Url *string `json:"url,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -134,6 +129,7 @@ func (o *CIAppPipelineEventPreviousPipeline) UnmarshalJSON(bytes []byte) (err er } o.Id = *all.Id o.Url = all.Url + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_stage.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_stage.go index a7e16b872..2f991b02f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_stage.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_stage.go @@ -5,10 +5,11 @@ package datadogV2 import ( - "encoding/json" "fmt" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -605,7 +606,6 @@ func (o CIAppPipelineEventStage) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppPipelineEventStage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Dependencies datadog.NullableList[string] `json:"dependencies,omitempty"` End *time.Time `json:"end"` @@ -625,12 +625,7 @@ func (o *CIAppPipelineEventStage) UnmarshalJSON(bytes []byte) (err error) { Tags datadog.NullableList[string] `json:"tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.End == nil { return fmt.Errorf("required field end missing") @@ -665,28 +660,18 @@ func (o *CIAppPipelineEventStage) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Level; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Dependencies = all.Dependencies o.End = *all.End o.Error = all.Error o.Git = all.Git o.Id = *all.Id - o.Level = *all.Level + if !all.Level.IsValid() { + hasInvalidField = true + } else { + o.Level = *all.Level + } o.Metrics = all.Metrics o.Name = *all.Name o.Node = all.Node @@ -695,11 +680,20 @@ func (o *CIAppPipelineEventStage) UnmarshalJSON(bytes []byte) (err error) { o.PipelineUniqueId = *all.PipelineUniqueId o.QueueTime = all.QueueTime o.Start = *all.Start - o.Status = *all.Status + if !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = *all.Status + } o.Tags = all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_stage_level.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_stage_level.go index 5a88cfe57..52ae9a332 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_stage_level.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_stage_level.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // CIAppPipelineEventStageLevel Used to distinguish between pipelines, stages, jobs and steps. @@ -61,47 +62,3 @@ func (v CIAppPipelineEventStageLevel) IsValid() bool { func (v CIAppPipelineEventStageLevel) Ptr() *CIAppPipelineEventStageLevel { return &v } - -// NullableCIAppPipelineEventStageLevel handles when a null is used for CIAppPipelineEventStageLevel. -type NullableCIAppPipelineEventStageLevel struct { - value *CIAppPipelineEventStageLevel - isSet bool -} - -// Get returns the associated value. -func (v NullableCIAppPipelineEventStageLevel) Get() *CIAppPipelineEventStageLevel { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCIAppPipelineEventStageLevel) Set(val *CIAppPipelineEventStageLevel) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCIAppPipelineEventStageLevel) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableCIAppPipelineEventStageLevel) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCIAppPipelineEventStageLevel initializes the struct as if Set has been called. -func NewNullableCIAppPipelineEventStageLevel(val *CIAppPipelineEventStageLevel) *NullableCIAppPipelineEventStageLevel { - return &NullableCIAppPipelineEventStageLevel{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCIAppPipelineEventStageLevel) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCIAppPipelineEventStageLevel) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_stage_status.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_stage_status.go index 516a84ee8..8bd96acf8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_stage_status.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_stage_status.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // CIAppPipelineEventStageStatus The final status of the stage. @@ -67,47 +68,3 @@ func (v CIAppPipelineEventStageStatus) IsValid() bool { func (v CIAppPipelineEventStageStatus) Ptr() *CIAppPipelineEventStageStatus { return &v } - -// NullableCIAppPipelineEventStageStatus handles when a null is used for CIAppPipelineEventStageStatus. -type NullableCIAppPipelineEventStageStatus struct { - value *CIAppPipelineEventStageStatus - isSet bool -} - -// Get returns the associated value. -func (v NullableCIAppPipelineEventStageStatus) Get() *CIAppPipelineEventStageStatus { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCIAppPipelineEventStageStatus) Set(val *CIAppPipelineEventStageStatus) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCIAppPipelineEventStageStatus) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableCIAppPipelineEventStageStatus) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCIAppPipelineEventStageStatus initializes the struct as if Set has been called. -func NewNullableCIAppPipelineEventStageStatus(val *CIAppPipelineEventStageStatus) *NullableCIAppPipelineEventStageStatus { - return &NullableCIAppPipelineEventStageStatus{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCIAppPipelineEventStageStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCIAppPipelineEventStageStatus) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_step.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_step.go index 99a9b64c4..c22ee88de 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_step.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_step.go @@ -5,10 +5,11 @@ package datadogV2 import ( - "encoding/json" "fmt" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -737,7 +738,6 @@ func (o CIAppPipelineEventStep) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppPipelineEventStep) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { End *time.Time `json:"end"` Error NullableCIAppCIError `json:"error,omitempty"` @@ -760,12 +760,7 @@ func (o *CIAppPipelineEventStep) UnmarshalJSON(bytes []byte) (err error) { Url datadog.NullableString `json:"url,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.End == nil { return fmt.Errorf("required field end missing") @@ -800,29 +795,19 @@ func (o *CIAppPipelineEventStep) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Level; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.End = *all.End o.Error = all.Error o.Git = all.Git o.Id = *all.Id o.JobId = all.JobId o.JobName = all.JobName - o.Level = *all.Level + if !all.Level.IsValid() { + hasInvalidField = true + } else { + o.Level = *all.Level + } o.Metrics = all.Metrics o.Name = *all.Name o.Node = all.Node @@ -832,12 +817,21 @@ func (o *CIAppPipelineEventStep) UnmarshalJSON(bytes []byte) (err error) { o.StageId = all.StageId o.StageName = all.StageName o.Start = *all.Start - o.Status = *all.Status + if !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = *all.Status + } o.Tags = all.Tags o.Url = all.Url + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_step_level.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_step_level.go index 4b889193a..9d966d13d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_step_level.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_step_level.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // CIAppPipelineEventStepLevel Used to distinguish between pipelines, stages, jobs and steps. @@ -61,47 +62,3 @@ func (v CIAppPipelineEventStepLevel) IsValid() bool { func (v CIAppPipelineEventStepLevel) Ptr() *CIAppPipelineEventStepLevel { return &v } - -// NullableCIAppPipelineEventStepLevel handles when a null is used for CIAppPipelineEventStepLevel. -type NullableCIAppPipelineEventStepLevel struct { - value *CIAppPipelineEventStepLevel - isSet bool -} - -// Get returns the associated value. -func (v NullableCIAppPipelineEventStepLevel) Get() *CIAppPipelineEventStepLevel { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCIAppPipelineEventStepLevel) Set(val *CIAppPipelineEventStepLevel) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCIAppPipelineEventStepLevel) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableCIAppPipelineEventStepLevel) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCIAppPipelineEventStepLevel initializes the struct as if Set has been called. -func NewNullableCIAppPipelineEventStepLevel(val *CIAppPipelineEventStepLevel) *NullableCIAppPipelineEventStepLevel { - return &NullableCIAppPipelineEventStepLevel{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCIAppPipelineEventStepLevel) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCIAppPipelineEventStepLevel) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_step_status.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_step_status.go index 06795b199..1b9e7a778 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_step_status.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_step_status.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // CIAppPipelineEventStepStatus The final status of the step. @@ -63,47 +64,3 @@ func (v CIAppPipelineEventStepStatus) IsValid() bool { func (v CIAppPipelineEventStepStatus) Ptr() *CIAppPipelineEventStepStatus { return &v } - -// NullableCIAppPipelineEventStepStatus handles when a null is used for CIAppPipelineEventStepStatus. -type NullableCIAppPipelineEventStepStatus struct { - value *CIAppPipelineEventStepStatus - isSet bool -} - -// Get returns the associated value. -func (v NullableCIAppPipelineEventStepStatus) Get() *CIAppPipelineEventStepStatus { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCIAppPipelineEventStepStatus) Set(val *CIAppPipelineEventStepStatus) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCIAppPipelineEventStepStatus) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableCIAppPipelineEventStepStatus) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCIAppPipelineEventStepStatus initializes the struct as if Set has been called. -func NewNullableCIAppPipelineEventStepStatus(val *CIAppPipelineEventStepStatus) *NullableCIAppPipelineEventStepStatus { - return &NullableCIAppPipelineEventStepStatus{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCIAppPipelineEventStepStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCIAppPipelineEventStepStatus) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_type_name.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_type_name.go index bf92362d4..6097013ca 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_type_name.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_event_type_name.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // CIAppPipelineEventTypeName Type of the event. @@ -61,47 +62,3 @@ func (v CIAppPipelineEventTypeName) IsValid() bool { func (v CIAppPipelineEventTypeName) Ptr() *CIAppPipelineEventTypeName { return &v } - -// NullableCIAppPipelineEventTypeName handles when a null is used for CIAppPipelineEventTypeName. -type NullableCIAppPipelineEventTypeName struct { - value *CIAppPipelineEventTypeName - isSet bool -} - -// Get returns the associated value. -func (v NullableCIAppPipelineEventTypeName) Get() *CIAppPipelineEventTypeName { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCIAppPipelineEventTypeName) Set(val *CIAppPipelineEventTypeName) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCIAppPipelineEventTypeName) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableCIAppPipelineEventTypeName) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCIAppPipelineEventTypeName initializes the struct as if Set has been called. -func NewNullableCIAppPipelineEventTypeName(val *CIAppPipelineEventTypeName) *NullableCIAppPipelineEventTypeName { - return &NullableCIAppPipelineEventTypeName{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCIAppPipelineEventTypeName) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCIAppPipelineEventTypeName) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_events_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_events_request.go index 76abf3428..5f84d2be7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_events_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_events_request.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -182,7 +182,6 @@ func (o CIAppPipelineEventsRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppPipelineEventsRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Filter *CIAppPipelinesQueryFilter `json:"filter,omitempty"` Options *CIAppQueryOptions `json:"options,omitempty"` @@ -190,12 +189,7 @@ func (o *CIAppPipelineEventsRequest) UnmarshalJSON(bytes []byte) (err error) { Sort *CIAppSort `json:"sort,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -203,42 +197,33 @@ func (o *CIAppPipelineEventsRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Sort; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Filter = all.Filter if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Options = all.Options if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Page = all.Page - o.Sort = all.Sort + if all.Sort != nil && !all.Sort.IsValid() { + hasInvalidField = true + } else { + o.Sort = all.Sort + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_events_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_events_response.go index 2b1ee9baf..3f620fd4a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_events_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_events_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o CIAppPipelineEventsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppPipelineEventsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []CIAppPipelineEvent `json:"data,omitempty"` Links *CIAppResponseLinks `json:"links,omitempty"` Meta *CIAppResponseMetadataWithPagination `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,26 +162,25 @@ func (o *CIAppPipelineEventsResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Data = all.Data if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Links = all.Links if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_level.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_level.go new file mode 100644 index 000000000..ac58f439c --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipeline_level.go @@ -0,0 +1,72 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/goccy/go-json" +) + +// CIAppPipelineLevel Pipeline execution level. +type CIAppPipelineLevel string + +// List of CIAppPipelineLevel. +const ( + CIAPPPIPELINELEVEL_PIPELINE CIAppPipelineLevel = "pipeline" + CIAPPPIPELINELEVEL_STAGE CIAppPipelineLevel = "stage" + CIAPPPIPELINELEVEL_JOB CIAppPipelineLevel = "job" + CIAPPPIPELINELEVEL_STEP CIAppPipelineLevel = "step" + CIAPPPIPELINELEVEL_CUSTOM CIAppPipelineLevel = "custom" +) + +var allowedCIAppPipelineLevelEnumValues = []CIAppPipelineLevel{ + CIAPPPIPELINELEVEL_PIPELINE, + CIAPPPIPELINELEVEL_STAGE, + CIAPPPIPELINELEVEL_JOB, + CIAPPPIPELINELEVEL_STEP, + CIAPPPIPELINELEVEL_CUSTOM, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *CIAppPipelineLevel) GetAllowedValues() []CIAppPipelineLevel { + return allowedCIAppPipelineLevelEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *CIAppPipelineLevel) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = CIAppPipelineLevel(value) + return nil +} + +// NewCIAppPipelineLevelFromValue returns a pointer to a valid CIAppPipelineLevel +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewCIAppPipelineLevelFromValue(v string) (*CIAppPipelineLevel, error) { + ev := CIAppPipelineLevel(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for CIAppPipelineLevel: valid values are %v", v, allowedCIAppPipelineLevelEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v CIAppPipelineLevel) IsValid() bool { + for _, existing := range allowedCIAppPipelineLevelEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to CIAppPipelineLevel value. +func (v CIAppPipelineLevel) Ptr() *CIAppPipelineLevel { + return &v +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipelines_aggregate_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipelines_aggregate_request.go index 513eb4357..2fcf163cb 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipelines_aggregate_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipelines_aggregate_request.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -182,7 +182,6 @@ func (o CIAppPipelinesAggregateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppPipelinesAggregateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Compute []CIAppCompute `json:"compute,omitempty"` Filter *CIAppPipelinesQueryFilter `json:"filter,omitempty"` @@ -190,12 +189,7 @@ func (o *CIAppPipelinesAggregateRequest) UnmarshalJSON(bytes []byte) (err error) Options *CIAppQueryOptions `json:"options,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -203,27 +197,26 @@ func (o *CIAppPipelinesAggregateRequest) UnmarshalJSON(bytes []byte) (err error) } else { return err } + + hasInvalidField := false o.Compute = all.Compute if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Filter = all.Filter o.GroupBy = all.GroupBy if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Options = all.Options + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipelines_aggregation_buckets_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipelines_aggregation_buckets_response.go index ede53ae10..89ecb5c9e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipelines_aggregation_buckets_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipelines_aggregation_buckets_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o CIAppPipelinesAggregationBucketsResponse) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *CIAppPipelinesAggregationBucketsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Buckets []CIAppPipelinesBucketResponse `json:"buckets,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *CIAppPipelinesAggregationBucketsResponse) UnmarshalJSON(bytes []byte) ( return err } o.Buckets = all.Buckets + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipelines_analytics_aggregate_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipelines_analytics_aggregate_response.go index 06567c900..ab4469e67 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipelines_analytics_aggregate_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipelines_analytics_aggregate_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o CIAppPipelinesAnalyticsAggregateResponse) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *CIAppPipelinesAnalyticsAggregateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *CIAppPipelinesAggregationBucketsResponse `json:"data,omitempty"` Links *CIAppResponseLinks `json:"links,omitempty"` Meta *CIAppResponseMetadata `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,33 +162,28 @@ func (o *CIAppPipelinesAnalyticsAggregateResponse) UnmarshalJSON(bytes []byte) ( } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Links = all.Links if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipelines_bucket_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipelines_bucket_response.go index afdef7b8f..2ed690c0b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipelines_bucket_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipelines_bucket_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o CIAppPipelinesBucketResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppPipelinesBucketResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { By map[string]interface{} `json:"by,omitempty"` Computes map[string]CIAppAggregateBucketValue `json:"computes,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *CIAppPipelinesBucketResponse) UnmarshalJSON(bytes []byte) (err error) { } o.By = all.By o.Computes = all.Computes + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipelines_group_by.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipelines_group_by.go index 17f9f031e..ce8ba9837 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipelines_group_by.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipelines_group_by.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -247,7 +248,6 @@ func (o CIAppPipelinesGroupBy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppPipelinesGroupBy) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Facet *string `json:"facet"` Histogram *CIAppGroupByHistogram `json:"histogram,omitempty"` @@ -257,12 +257,7 @@ func (o *CIAppPipelinesGroupBy) UnmarshalJSON(bytes []byte) (err error) { Total *CIAppGroupByTotal `json:"total,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Facet == nil { return fmt.Errorf("required field facet missing") @@ -273,29 +268,28 @@ func (o *CIAppPipelinesGroupBy) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Facet = *all.Facet if all.Histogram != nil && all.Histogram.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Histogram = all.Histogram o.Limit = all.Limit o.Missing = all.Missing if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Sort = all.Sort o.Total = all.Total + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipelines_query_filter.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipelines_query_filter.go index dfb941574..d37c72b60 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipelines_query_filter.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_pipelines_query_filter.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -14,7 +14,7 @@ import ( type CIAppPipelinesQueryFilter struct { // The minimum time for the requested events; supports date, math, and regular timestamps (in milliseconds). From *string `json:"from,omitempty"` - // The search query following the Log search syntax. + // The search query following the CI Visibility Explorer search syntax. Query *string `json:"query,omitempty"` // The maximum time for the requested events, supports date, math, and regular timestamps (in milliseconds). To *string `json:"to,omitempty"` @@ -160,19 +160,13 @@ func (o CIAppPipelinesQueryFilter) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppPipelinesQueryFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { From *string `json:"from,omitempty"` Query *string `json:"query,omitempty"` To *string `json:"to,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -183,6 +177,7 @@ func (o *CIAppPipelinesQueryFilter) UnmarshalJSON(bytes []byte) (err error) { o.From = all.From o.Query = all.Query o.To = all.To + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_query_options.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_query_options.go index 91e275342..88058abc3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_query_options.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_query_options.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -120,18 +120,12 @@ func (o CIAppQueryOptions) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppQueryOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { TimeOffset *int64 `json:"time_offset,omitempty"` Timezone *string `json:"timezone,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -141,6 +135,7 @@ func (o *CIAppQueryOptions) UnmarshalJSON(bytes []byte) (err error) { } o.TimeOffset = all.TimeOffset o.Timezone = all.Timezone + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_query_page_options.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_query_page_options.go index 8baa11727..abf58b3e5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_query_page_options.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_query_page_options.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -119,18 +119,12 @@ func (o CIAppQueryPageOptions) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppQueryPageOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Cursor *string `json:"cursor,omitempty"` Limit *int32 `json:"limit,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -140,6 +134,7 @@ func (o *CIAppQueryPageOptions) UnmarshalJSON(bytes []byte) (err error) { } o.Cursor = all.Cursor o.Limit = all.Limit + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_response_links.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_response_links.go index 7b8e25810..bd6ffca54 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_response_links.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_response_links.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -83,17 +83,11 @@ func (o CIAppResponseLinks) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppResponseLinks) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Next *string `json:"next,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -102,6 +96,7 @@ func (o *CIAppResponseLinks) UnmarshalJSON(bytes []byte) (err error) { return err } o.Next = all.Next + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_response_metadata.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_response_metadata.go index 6beb88a04..6356040d1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_response_metadata.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_response_metadata.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -182,7 +182,6 @@ func (o CIAppResponseMetadata) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Elapsed *int64 `json:"elapsed,omitempty"` RequestId *string `json:"request_id,omitempty"` @@ -190,12 +189,7 @@ func (o *CIAppResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { Warnings []CIAppWarning `json:"warnings,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -203,21 +197,24 @@ func (o *CIAppResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Elapsed = all.Elapsed o.RequestId = all.RequestId - o.Status = all.Status + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } o.Warnings = all.Warnings + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_response_metadata_with_pagination.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_response_metadata_with_pagination.go index 7c24c83f9..adb04c339 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_response_metadata_with_pagination.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_response_metadata_with_pagination.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -215,7 +215,6 @@ func (o CIAppResponseMetadataWithPagination) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppResponseMetadataWithPagination) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Elapsed *int64 `json:"elapsed,omitempty"` Page *CIAppResponsePage `json:"page,omitempty"` @@ -224,12 +223,7 @@ func (o *CIAppResponseMetadataWithPagination) UnmarshalJSON(bytes []byte) (err e Warnings []CIAppWarning `json:"warnings,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -237,29 +231,28 @@ func (o *CIAppResponseMetadataWithPagination) UnmarshalJSON(bytes []byte) (err e } else { return err } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Elapsed = all.Elapsed if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Page = all.Page o.RequestId = all.RequestId - o.Status = all.Status + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } o.Warnings = all.Warnings + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_response_page.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_response_page.go index 750cbf2ee..3851ace45 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_response_page.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_response_page.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o CIAppResponsePage) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppResponsePage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { After *string `json:"after,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *CIAppResponsePage) UnmarshalJSON(bytes []byte) (err error) { return err } o.After = all.After + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_response_status.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_response_status.go index b6ac14c1f..06038599d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_response_status.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_response_status.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // CIAppResponseStatus The status of the response. @@ -63,47 +64,3 @@ func (v CIAppResponseStatus) IsValid() bool { func (v CIAppResponseStatus) Ptr() *CIAppResponseStatus { return &v } - -// NullableCIAppResponseStatus handles when a null is used for CIAppResponseStatus. -type NullableCIAppResponseStatus struct { - value *CIAppResponseStatus - isSet bool -} - -// Get returns the associated value. -func (v NullableCIAppResponseStatus) Get() *CIAppResponseStatus { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCIAppResponseStatus) Set(val *CIAppResponseStatus) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCIAppResponseStatus) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableCIAppResponseStatus) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCIAppResponseStatus initializes the struct as if Set has been called. -func NewNullableCIAppResponseStatus(val *CIAppResponseStatus) *NullableCIAppResponseStatus { - return &NullableCIAppResponseStatus{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCIAppResponseStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCIAppResponseStatus) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_sort.go index e664c1c48..b91a0d325 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_sort.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_sort.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // CIAppSort Sort parameters when querying events. @@ -63,47 +64,3 @@ func (v CIAppSort) IsValid() bool { func (v CIAppSort) Ptr() *CIAppSort { return &v } - -// NullableCIAppSort handles when a null is used for CIAppSort. -type NullableCIAppSort struct { - value *CIAppSort - isSet bool -} - -// Get returns the associated value. -func (v NullableCIAppSort) Get() *CIAppSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCIAppSort) Set(val *CIAppSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCIAppSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableCIAppSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCIAppSort initializes the struct as if Set has been called. -func NewNullableCIAppSort(val *CIAppSort) *NullableCIAppSort { - return &NullableCIAppSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCIAppSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCIAppSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_sort_order.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_sort_order.go index 32ab61424..f4e8c6e0b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_sort_order.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_sort_order.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // CIAppSortOrder The order to use, ascending or descending. @@ -63,47 +64,3 @@ func (v CIAppSortOrder) IsValid() bool { func (v CIAppSortOrder) Ptr() *CIAppSortOrder { return &v } - -// NullableCIAppSortOrder handles when a null is used for CIAppSortOrder. -type NullableCIAppSortOrder struct { - value *CIAppSortOrder - isSet bool -} - -// Get returns the associated value. -func (v NullableCIAppSortOrder) Get() *CIAppSortOrder { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCIAppSortOrder) Set(val *CIAppSortOrder) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCIAppSortOrder) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableCIAppSortOrder) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCIAppSortOrder initializes the struct as if Set has been called. -func NewNullableCIAppSortOrder(val *CIAppSortOrder) *NullableCIAppSortOrder { - return &NullableCIAppSortOrder{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCIAppSortOrder) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCIAppSortOrder) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_test_event.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_test_event.go index 3b8995469..e0860da38 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_test_event.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_test_event.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o CIAppTestEvent) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppTestEvent) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *CIAppEventAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *CIAppTestEventTypeName `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,27 +162,26 @@ func (o *CIAppTestEvent) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_test_event_type_name.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_test_event_type_name.go index e189d3999..fa6d999ec 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_test_event_type_name.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_test_event_type_name.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // CIAppTestEventTypeName Type of the event. @@ -61,47 +62,3 @@ func (v CIAppTestEventTypeName) IsValid() bool { func (v CIAppTestEventTypeName) Ptr() *CIAppTestEventTypeName { return &v } - -// NullableCIAppTestEventTypeName handles when a null is used for CIAppTestEventTypeName. -type NullableCIAppTestEventTypeName struct { - value *CIAppTestEventTypeName - isSet bool -} - -// Get returns the associated value. -func (v NullableCIAppTestEventTypeName) Get() *CIAppTestEventTypeName { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCIAppTestEventTypeName) Set(val *CIAppTestEventTypeName) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCIAppTestEventTypeName) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableCIAppTestEventTypeName) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCIAppTestEventTypeName initializes the struct as if Set has been called. -func NewNullableCIAppTestEventTypeName(val *CIAppTestEventTypeName) *NullableCIAppTestEventTypeName { - return &NullableCIAppTestEventTypeName{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCIAppTestEventTypeName) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCIAppTestEventTypeName) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_test_events_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_test_events_request.go index e83c91250..4e1d8f0df 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_test_events_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_test_events_request.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -182,7 +182,6 @@ func (o CIAppTestEventsRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppTestEventsRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Filter *CIAppTestsQueryFilter `json:"filter,omitempty"` Options *CIAppQueryOptions `json:"options,omitempty"` @@ -190,12 +189,7 @@ func (o *CIAppTestEventsRequest) UnmarshalJSON(bytes []byte) (err error) { Sort *CIAppSort `json:"sort,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -203,42 +197,33 @@ func (o *CIAppTestEventsRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Sort; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Filter = all.Filter if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Options = all.Options if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Page = all.Page - o.Sort = all.Sort + if all.Sort != nil && !all.Sort.IsValid() { + hasInvalidField = true + } else { + o.Sort = all.Sort + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_test_events_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_test_events_response.go index 2510de3bd..4f0ac8a30 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_test_events_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_test_events_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o CIAppTestEventsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppTestEventsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []CIAppTestEvent `json:"data,omitempty"` Links *CIAppResponseLinks `json:"links,omitempty"` Meta *CIAppResponseMetadataWithPagination `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,26 +162,25 @@ func (o *CIAppTestEventsResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Data = all.Data if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Links = all.Links if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_test_level.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_test_level.go new file mode 100644 index 000000000..e5d11afb6 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_test_level.go @@ -0,0 +1,70 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "fmt" + + "github.com/goccy/go-json" +) + +// CIAppTestLevel Test run level. +type CIAppTestLevel string + +// List of CIAppTestLevel. +const ( + CIAPPTESTLEVEL_SESSION CIAppTestLevel = "session" + CIAPPTESTLEVEL_MODULE CIAppTestLevel = "module" + CIAPPTESTLEVEL_SUITE CIAppTestLevel = "suite" + CIAPPTESTLEVEL_TEST CIAppTestLevel = "test" +) + +var allowedCIAppTestLevelEnumValues = []CIAppTestLevel{ + CIAPPTESTLEVEL_SESSION, + CIAPPTESTLEVEL_MODULE, + CIAPPTESTLEVEL_SUITE, + CIAPPTESTLEVEL_TEST, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *CIAppTestLevel) GetAllowedValues() []CIAppTestLevel { + return allowedCIAppTestLevelEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *CIAppTestLevel) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = CIAppTestLevel(value) + return nil +} + +// NewCIAppTestLevelFromValue returns a pointer to a valid CIAppTestLevel +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewCIAppTestLevelFromValue(v string) (*CIAppTestLevel, error) { + ev := CIAppTestLevel(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for CIAppTestLevel: valid values are %v", v, allowedCIAppTestLevelEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v CIAppTestLevel) IsValid() bool { + for _, existing := range allowedCIAppTestLevelEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to CIAppTestLevel value. +func (v CIAppTestLevel) Ptr() *CIAppTestLevel { + return &v +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_tests_aggregate_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_tests_aggregate_request.go index 3fe4db5a7..f8c382729 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_tests_aggregate_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_tests_aggregate_request.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -182,7 +182,6 @@ func (o CIAppTestsAggregateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppTestsAggregateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Compute []CIAppCompute `json:"compute,omitempty"` Filter *CIAppTestsQueryFilter `json:"filter,omitempty"` @@ -190,12 +189,7 @@ func (o *CIAppTestsAggregateRequest) UnmarshalJSON(bytes []byte) (err error) { Options *CIAppQueryOptions `json:"options,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -203,27 +197,26 @@ func (o *CIAppTestsAggregateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Compute = all.Compute if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Filter = all.Filter o.GroupBy = all.GroupBy if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Options = all.Options + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_tests_aggregation_buckets_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_tests_aggregation_buckets_response.go index 89a19dadf..d3ac97a6c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_tests_aggregation_buckets_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_tests_aggregation_buckets_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o CIAppTestsAggregationBucketsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppTestsAggregationBucketsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Buckets []CIAppTestsBucketResponse `json:"buckets,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *CIAppTestsAggregationBucketsResponse) UnmarshalJSON(bytes []byte) (err return err } o.Buckets = all.Buckets + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_tests_analytics_aggregate_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_tests_analytics_aggregate_response.go index 70658cc71..9cbc1ba71 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_tests_analytics_aggregate_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_tests_analytics_aggregate_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -17,7 +17,7 @@ type CIAppTestsAnalyticsAggregateResponse struct { // Links attributes. Links *CIAppResponseLinks `json:"links,omitempty"` // The metadata associated with a request. - Meta *CIAppResponseMetadata `json:"meta,omitempty"` + Meta *CIAppResponseMetadataWithPagination `json:"meta,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{} @@ -97,9 +97,9 @@ func (o *CIAppTestsAnalyticsAggregateResponse) SetLinks(v CIAppResponseLinks) { } // GetMeta returns the Meta field value if set, zero value otherwise. -func (o *CIAppTestsAnalyticsAggregateResponse) GetMeta() CIAppResponseMetadata { +func (o *CIAppTestsAnalyticsAggregateResponse) GetMeta() CIAppResponseMetadataWithPagination { if o == nil || o.Meta == nil { - var ret CIAppResponseMetadata + var ret CIAppResponseMetadataWithPagination return ret } return *o.Meta @@ -107,7 +107,7 @@ func (o *CIAppTestsAnalyticsAggregateResponse) GetMeta() CIAppResponseMetadata { // GetMetaOk returns a tuple with the Meta field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *CIAppTestsAnalyticsAggregateResponse) GetMetaOk() (*CIAppResponseMetadata, bool) { +func (o *CIAppTestsAnalyticsAggregateResponse) GetMetaOk() (*CIAppResponseMetadataWithPagination, bool) { if o == nil || o.Meta == nil { return nil, false } @@ -119,8 +119,8 @@ func (o *CIAppTestsAnalyticsAggregateResponse) HasMeta() bool { return o != nil && o.Meta != nil } -// SetMeta gets a reference to the given CIAppResponseMetadata and assigns it to the Meta field. -func (o *CIAppTestsAnalyticsAggregateResponse) SetMeta(v CIAppResponseMetadata) { +// SetMeta gets a reference to the given CIAppResponseMetadataWithPagination and assigns it to the Meta field. +func (o *CIAppTestsAnalyticsAggregateResponse) SetMeta(v CIAppResponseMetadataWithPagination) { o.Meta = &v } @@ -148,19 +148,13 @@ func (o CIAppTestsAnalyticsAggregateResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppTestsAnalyticsAggregateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *CIAppTestsAggregationBucketsResponse `json:"data,omitempty"` Links *CIAppResponseLinks `json:"links,omitempty"` - Meta *CIAppResponseMetadata `json:"meta,omitempty"` + Meta *CIAppResponseMetadataWithPagination `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,33 +162,28 @@ func (o *CIAppTestsAnalyticsAggregateResponse) UnmarshalJSON(bytes []byte) (err } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Links = all.Links if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_tests_bucket_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_tests_bucket_response.go index 6f989a324..cfe0ccdb5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_tests_bucket_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_tests_bucket_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o CIAppTestsBucketResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppTestsBucketResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { By map[string]interface{} `json:"by,omitempty"` Computes map[string]CIAppAggregateBucketValue `json:"computes,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *CIAppTestsBucketResponse) UnmarshalJSON(bytes []byte) (err error) { } o.By = all.By o.Computes = all.Computes + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_tests_group_by.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_tests_group_by.go index 166474ece..bfd83661f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_tests_group_by.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_tests_group_by.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -247,7 +248,6 @@ func (o CIAppTestsGroupBy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppTestsGroupBy) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Facet *string `json:"facet"` Histogram *CIAppGroupByHistogram `json:"histogram,omitempty"` @@ -257,12 +257,7 @@ func (o *CIAppTestsGroupBy) UnmarshalJSON(bytes []byte) (err error) { Total *CIAppGroupByTotal `json:"total,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Facet == nil { return fmt.Errorf("required field facet missing") @@ -273,29 +268,28 @@ func (o *CIAppTestsGroupBy) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Facet = *all.Facet if all.Histogram != nil && all.Histogram.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Histogram = all.Histogram o.Limit = all.Limit o.Missing = all.Missing if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Sort = all.Sort o.Total = all.Total + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_tests_query_filter.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_tests_query_filter.go index ba3c26f3e..f29566f7b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_tests_query_filter.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_tests_query_filter.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -14,7 +14,7 @@ import ( type CIAppTestsQueryFilter struct { // The minimum time for the requested events; supports date, math, and regular timestamps (in milliseconds). From *string `json:"from,omitempty"` - // The search query following the Log search syntax. + // The search query following the CI Visibility Explorer search syntax. Query *string `json:"query,omitempty"` // The maximum time for the requested events, supports date, math, and regular timestamps (in milliseconds). To *string `json:"to,omitempty"` @@ -160,19 +160,13 @@ func (o CIAppTestsQueryFilter) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppTestsQueryFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { From *string `json:"from,omitempty"` Query *string `json:"query,omitempty"` To *string `json:"to,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -183,6 +177,7 @@ func (o *CIAppTestsQueryFilter) UnmarshalJSON(bytes []byte) (err error) { o.From = all.From o.Query = all.Query o.To = all.To + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_warning.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_warning.go index ef742761e..3fa0ce5af 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_warning.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ci_app_warning.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o CIAppWarning) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppWarning) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Code *string `json:"code,omitempty"` Detail *string `json:"detail,omitempty"` Title *string `json:"title,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *CIAppWarning) UnmarshalJSON(bytes []byte) (err error) { o.Code = all.Code o.Detail = all.Detail o.Title = all.Title + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_compliance_rule_options.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_compliance_rule_options.go index 9fb7179cc..f8b7198e9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_compliance_rule_options.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_compliance_rule_options.go @@ -5,14 +5,13 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // CloudConfigurationComplianceRuleOptions Options for cloud_configuration rules. // Fields `resourceType` and `regoRule` are mandatory when managing custom `cloud_configuration` rules. -// type CloudConfigurationComplianceRuleOptions struct { // Whether the rule is a complex one. // Must be set to true if `regoRule.resourceTypes` contains more than one item. Defaults to false. @@ -153,19 +152,13 @@ func (o CloudConfigurationComplianceRuleOptions) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CloudConfigurationComplianceRuleOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ComplexRule *bool `json:"complexRule,omitempty"` RegoRule *CloudConfigurationRegoRule `json:"regoRule,omitempty"` ResourceType *string `json:"resourceType,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -173,19 +166,22 @@ func (o *CloudConfigurationComplianceRuleOptions) UnmarshalJSON(bytes []byte) (e } else { return err } + + hasInvalidField := false o.ComplexRule = all.ComplexRule if all.RegoRule != nil && all.RegoRule.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.RegoRule = all.RegoRule o.ResourceType = all.ResourceType + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_rego_rule.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_rego_rule.go index fc787a95e..2cd3791e0 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_rego_rule.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_rego_rule.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o CloudConfigurationRegoRule) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CloudConfigurationRegoRule) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Policy *string `json:"policy"` ResourceTypes *[]string `json:"resourceTypes"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Policy == nil { return fmt.Errorf("required field policy missing") @@ -131,6 +126,7 @@ func (o *CloudConfigurationRegoRule) UnmarshalJSON(bytes []byte) (err error) { } o.Policy = *all.Policy o.ResourceTypes = *all.ResourceTypes + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_rule_case_create.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_rule_case_create.go index 72bb6b4c5..693472633 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_rule_case_create.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_rule_case_create.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o CloudConfigurationRuleCaseCreate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CloudConfigurationRuleCaseCreate) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Notifications []string `json:"notifications,omitempty"` Status *SecurityMonitoringRuleSeverity `json:"status"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Status == nil { return fmt.Errorf("required field status missing") @@ -132,19 +127,22 @@ func (o *CloudConfigurationRuleCaseCreate) UnmarshalJSON(bytes []byte) (err erro } else { return err } - if v := all.Status; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Notifications = all.Notifications - o.Status = *all.Status + if !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = *all.Status + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_rule_compliance_signal_options.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_rule_compliance_signal_options.go index 8aad1ad4b..e7baa1823 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_rule_compliance_signal_options.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_rule_compliance_signal_options.go @@ -5,13 +5,17 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // CloudConfigurationRuleComplianceSignalOptions How to generate compliance signals. Useful for cloud_configuration rules only. type CloudConfigurationRuleComplianceSignalOptions struct { + // The default activation status. + DefaultActivationStatus datadog.NullableBool `json:"defaultActivationStatus,omitempty"` + // The default group by fields. + DefaultGroupByFields datadog.NullableList[string] `json:"defaultGroupByFields,omitempty"` // Whether signals will be sent. UserActivationStatus datadog.NullableBool `json:"userActivationStatus,omitempty"` // Fields to use to group findings by when sending signals. @@ -38,6 +42,84 @@ func NewCloudConfigurationRuleComplianceSignalOptionsWithDefaults() *CloudConfig return &this } +// GetDefaultActivationStatus returns the DefaultActivationStatus field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CloudConfigurationRuleComplianceSignalOptions) GetDefaultActivationStatus() bool { + if o == nil || o.DefaultActivationStatus.Get() == nil { + var ret bool + return ret + } + return *o.DefaultActivationStatus.Get() +} + +// GetDefaultActivationStatusOk returns a tuple with the DefaultActivationStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *CloudConfigurationRuleComplianceSignalOptions) GetDefaultActivationStatusOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.DefaultActivationStatus.Get(), o.DefaultActivationStatus.IsSet() +} + +// HasDefaultActivationStatus returns a boolean if a field has been set. +func (o *CloudConfigurationRuleComplianceSignalOptions) HasDefaultActivationStatus() bool { + return o != nil && o.DefaultActivationStatus.IsSet() +} + +// SetDefaultActivationStatus gets a reference to the given datadog.NullableBool and assigns it to the DefaultActivationStatus field. +func (o *CloudConfigurationRuleComplianceSignalOptions) SetDefaultActivationStatus(v bool) { + o.DefaultActivationStatus.Set(&v) +} + +// SetDefaultActivationStatusNil sets the value for DefaultActivationStatus to be an explicit nil. +func (o *CloudConfigurationRuleComplianceSignalOptions) SetDefaultActivationStatusNil() { + o.DefaultActivationStatus.Set(nil) +} + +// UnsetDefaultActivationStatus ensures that no value is present for DefaultActivationStatus, not even an explicit nil. +func (o *CloudConfigurationRuleComplianceSignalOptions) UnsetDefaultActivationStatus() { + o.DefaultActivationStatus.Unset() +} + +// GetDefaultGroupByFields returns the DefaultGroupByFields field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CloudConfigurationRuleComplianceSignalOptions) GetDefaultGroupByFields() []string { + if o == nil || o.DefaultGroupByFields.Get() == nil { + var ret []string + return ret + } + return *o.DefaultGroupByFields.Get() +} + +// GetDefaultGroupByFieldsOk returns a tuple with the DefaultGroupByFields field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *CloudConfigurationRuleComplianceSignalOptions) GetDefaultGroupByFieldsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return o.DefaultGroupByFields.Get(), o.DefaultGroupByFields.IsSet() +} + +// HasDefaultGroupByFields returns a boolean if a field has been set. +func (o *CloudConfigurationRuleComplianceSignalOptions) HasDefaultGroupByFields() bool { + return o != nil && o.DefaultGroupByFields.IsSet() +} + +// SetDefaultGroupByFields gets a reference to the given datadog.NullableList[string] and assigns it to the DefaultGroupByFields field. +func (o *CloudConfigurationRuleComplianceSignalOptions) SetDefaultGroupByFields(v []string) { + o.DefaultGroupByFields.Set(&v) +} + +// SetDefaultGroupByFieldsNil sets the value for DefaultGroupByFields to be an explicit nil. +func (o *CloudConfigurationRuleComplianceSignalOptions) SetDefaultGroupByFieldsNil() { + o.DefaultGroupByFields.Set(nil) +} + +// UnsetDefaultGroupByFields ensures that no value is present for DefaultGroupByFields, not even an explicit nil. +func (o *CloudConfigurationRuleComplianceSignalOptions) UnsetDefaultGroupByFields() { + o.DefaultGroupByFields.Unset() +} + // GetUserActivationStatus returns the UserActivationStatus field value if set, zero value otherwise (both if not set or set to explicit null). func (o *CloudConfigurationRuleComplianceSignalOptions) GetUserActivationStatus() bool { if o == nil || o.UserActivationStatus.Get() == nil { @@ -122,6 +204,12 @@ func (o CloudConfigurationRuleComplianceSignalOptions) MarshalJSON() ([]byte, er if o.UnparsedObject != nil { return json.Marshal(o.UnparsedObject) } + if o.DefaultActivationStatus.IsSet() { + toSerialize["defaultActivationStatus"] = o.DefaultActivationStatus.Get() + } + if o.DefaultGroupByFields.IsSet() { + toSerialize["defaultGroupByFields"] = o.DefaultGroupByFields.Get() + } if o.UserActivationStatus.IsSet() { toSerialize["userActivationStatus"] = o.UserActivationStatus.Get() } @@ -137,27 +225,26 @@ func (o CloudConfigurationRuleComplianceSignalOptions) MarshalJSON() ([]byte, er // UnmarshalJSON deserializes the given payload. func (o *CloudConfigurationRuleComplianceSignalOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { - UserActivationStatus datadog.NullableBool `json:"userActivationStatus,omitempty"` - UserGroupByFields datadog.NullableList[string] `json:"userGroupByFields,omitempty"` + DefaultActivationStatus datadog.NullableBool `json:"defaultActivationStatus,omitempty"` + DefaultGroupByFields datadog.NullableList[string] `json:"defaultGroupByFields,omitempty"` + UserActivationStatus datadog.NullableBool `json:"userActivationStatus,omitempty"` + UserGroupByFields datadog.NullableList[string] `json:"userGroupByFields,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"userActivationStatus", "userGroupByFields"}) + datadog.DeleteKeys(additionalProperties, &[]string{"defaultActivationStatus", "defaultGroupByFields", "userActivationStatus", "userGroupByFields"}) } else { return err } + o.DefaultActivationStatus = all.DefaultActivationStatus + o.DefaultGroupByFields = all.DefaultGroupByFields o.UserActivationStatus = all.UserActivationStatus o.UserGroupByFields = all.UserGroupByFields + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_rule_create_payload.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_rule_create_payload.go index 3452110a4..e72913723 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_rule_create_payload.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_rule_create_payload.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -18,6 +19,8 @@ type CloudConfigurationRuleCreatePayload struct { Cases []CloudConfigurationRuleCaseCreate `json:"cases"` // How to generate compliance signals. Useful for cloud_configuration rules only. ComplianceSignalOptions CloudConfigurationRuleComplianceSignalOptions `json:"complianceSignalOptions"` + // Additional queries to filter matched events before they are processed. + Filters []SecurityMonitoringFilter `json:"filters,omitempty"` // Whether the rule is enabled. IsEnabled bool `json:"isEnabled"` // Message in markdown format for generated findings and signals. @@ -104,6 +107,34 @@ func (o *CloudConfigurationRuleCreatePayload) SetComplianceSignalOptions(v Cloud o.ComplianceSignalOptions = v } +// GetFilters returns the Filters field value if set, zero value otherwise. +func (o *CloudConfigurationRuleCreatePayload) GetFilters() []SecurityMonitoringFilter { + if o == nil || o.Filters == nil { + var ret []SecurityMonitoringFilter + return ret + } + return o.Filters +} + +// GetFiltersOk returns a tuple with the Filters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudConfigurationRuleCreatePayload) GetFiltersOk() (*[]SecurityMonitoringFilter, bool) { + if o == nil || o.Filters == nil { + return nil, false + } + return &o.Filters, true +} + +// HasFilters returns a boolean if a field has been set. +func (o *CloudConfigurationRuleCreatePayload) HasFilters() bool { + return o != nil && o.Filters != nil +} + +// SetFilters gets a reference to the given []SecurityMonitoringFilter and assigns it to the Filters field. +func (o *CloudConfigurationRuleCreatePayload) SetFilters(v []SecurityMonitoringFilter) { + o.Filters = v +} + // GetIsEnabled returns the IsEnabled field value. func (o *CloudConfigurationRuleCreatePayload) GetIsEnabled() bool { if o == nil { @@ -260,6 +291,9 @@ func (o CloudConfigurationRuleCreatePayload) MarshalJSON() ([]byte, error) { } toSerialize["cases"] = o.Cases toSerialize["complianceSignalOptions"] = o.ComplianceSignalOptions + if o.Filters != nil { + toSerialize["filters"] = o.Filters + } toSerialize["isEnabled"] = o.IsEnabled toSerialize["message"] = o.Message toSerialize["name"] = o.Name @@ -279,10 +313,10 @@ func (o CloudConfigurationRuleCreatePayload) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CloudConfigurationRuleCreatePayload) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Cases *[]CloudConfigurationRuleCaseCreate `json:"cases"` ComplianceSignalOptions *CloudConfigurationRuleComplianceSignalOptions `json:"complianceSignalOptions"` + Filters []SecurityMonitoringFilter `json:"filters,omitempty"` IsEnabled *bool `json:"isEnabled"` Message *string `json:"message"` Name *string `json:"name"` @@ -291,12 +325,7 @@ func (o *CloudConfigurationRuleCreatePayload) UnmarshalJSON(bytes []byte) (err e Type *CloudConfigurationRuleType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Cases == nil { return fmt.Errorf("required field cases missing") @@ -318,43 +347,39 @@ func (o *CloudConfigurationRuleCreatePayload) UnmarshalJSON(bytes []byte) (err e } 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"}) + datadog.DeleteKeys(additionalProperties, &[]string{"cases", "complianceSignalOptions", "filters", "isEnabled", "message", "name", "options", "tags", "type"}) } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Cases = *all.Cases if all.ComplianceSignalOptions.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ComplianceSignalOptions = *all.ComplianceSignalOptions + o.Filters = all.Filters 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Options = *all.Options o.Tags = all.Tags - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_rule_options.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_rule_options.go index c32c691b3..9eed43b5d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_rule_options.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_rule_options.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -79,17 +80,11 @@ func (o CloudConfigurationRuleOptions) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CloudConfigurationRuleOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ComplianceRuleOptions *CloudConfigurationComplianceRuleOptions `json:"complianceRuleOptions"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.ComplianceRuleOptions == nil { return fmt.Errorf("required field complianceRuleOptions missing") @@ -100,17 +95,20 @@ func (o *CloudConfigurationRuleOptions) UnmarshalJSON(bytes []byte) (err error) } else { return err } + + hasInvalidField := false if all.ComplianceRuleOptions.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ComplianceRuleOptions = *all.ComplianceRuleOptions + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_rule_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_rule_type.go index 4b591ce16..8d87cda11 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_rule_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_configuration_rule_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // CloudConfigurationRuleType The rule type. @@ -61,47 +62,3 @@ func (v CloudConfigurationRuleType) IsValid() bool { func (v CloudConfigurationRuleType) Ptr() *CloudConfigurationRuleType { return &v } - -// NullableCloudConfigurationRuleType handles when a null is used for CloudConfigurationRuleType. -type NullableCloudConfigurationRuleType struct { - value *CloudConfigurationRuleType - isSet bool -} - -// Get returns the associated value. -func (v NullableCloudConfigurationRuleType) Get() *CloudConfigurationRuleType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCloudConfigurationRuleType) Set(val *CloudConfigurationRuleType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCloudConfigurationRuleType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableCloudConfigurationRuleType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCloudConfigurationRuleType initializes the struct as if Set has been called. -func NewNullableCloudConfigurationRuleType(val *CloudConfigurationRuleType) *NullableCloudConfigurationRuleType { - return &NullableCloudConfigurationRuleType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCloudConfigurationRuleType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCloudConfigurationRuleType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_attributes.go index eabdeae85..fa70e7d53 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_attributes.go @@ -5,15 +5,19 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // CloudWorkloadSecurityAgentRuleAttributes A Cloud Workload Security Agent rule returned by the API. type CloudWorkloadSecurityAgentRuleAttributes struct { + // The version of the agent. + AgentConstraint *string `json:"agentConstraint,omitempty"` // The category of the Agent rule. Category *string `json:"category,omitempty"` + // The ID of the user who created the rule. + CreationAuthorUuId *string `json:"creationAuthorUuId,omitempty"` // When the Agent rule was created, timestamp in milliseconds. CreationDate *int64 `json:"creationDate,omitempty"` // The attributes of the user who created the Agent rule. @@ -28,6 +32,10 @@ type CloudWorkloadSecurityAgentRuleAttributes struct { Expression *string `json:"expression,omitempty"` // The name of the Agent rule. Name *string `json:"name,omitempty"` + // The ID of the user who updated the rule. + UpdateAuthorUuId *string `json:"updateAuthorUuId,omitempty"` + // Timestamp in milliseconds when the Agent rule was last updated. + UpdateDate *int64 `json:"updateDate,omitempty"` // When the Agent rule was last updated, timestamp in milliseconds. UpdatedAt *int64 `json:"updatedAt,omitempty"` // The attributes of the user who last updated the Agent rule. @@ -56,6 +64,34 @@ func NewCloudWorkloadSecurityAgentRuleAttributesWithDefaults() *CloudWorkloadSec return &this } +// GetAgentConstraint returns the AgentConstraint field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetAgentConstraint() string { + if o == nil || o.AgentConstraint == nil { + var ret string + return ret + } + return *o.AgentConstraint +} + +// GetAgentConstraintOk returns a tuple with the AgentConstraint field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetAgentConstraintOk() (*string, bool) { + if o == nil || o.AgentConstraint == nil { + return nil, false + } + return o.AgentConstraint, true +} + +// HasAgentConstraint returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) HasAgentConstraint() bool { + return o != nil && o.AgentConstraint != nil +} + +// SetAgentConstraint gets a reference to the given string and assigns it to the AgentConstraint field. +func (o *CloudWorkloadSecurityAgentRuleAttributes) SetAgentConstraint(v string) { + o.AgentConstraint = &v +} + // GetCategory returns the Category field value if set, zero value otherwise. func (o *CloudWorkloadSecurityAgentRuleAttributes) GetCategory() string { if o == nil || o.Category == nil { @@ -84,6 +120,34 @@ func (o *CloudWorkloadSecurityAgentRuleAttributes) SetCategory(v string) { o.Category = &v } +// GetCreationAuthorUuId returns the CreationAuthorUuId field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetCreationAuthorUuId() string { + if o == nil || o.CreationAuthorUuId == nil { + var ret string + return ret + } + return *o.CreationAuthorUuId +} + +// GetCreationAuthorUuIdOk returns a tuple with the CreationAuthorUuId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetCreationAuthorUuIdOk() (*string, bool) { + if o == nil || o.CreationAuthorUuId == nil { + return nil, false + } + return o.CreationAuthorUuId, true +} + +// HasCreationAuthorUuId returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) HasCreationAuthorUuId() bool { + return o != nil && o.CreationAuthorUuId != nil +} + +// SetCreationAuthorUuId gets a reference to the given string and assigns it to the CreationAuthorUuId field. +func (o *CloudWorkloadSecurityAgentRuleAttributes) SetCreationAuthorUuId(v string) { + o.CreationAuthorUuId = &v +} + // GetCreationDate returns the CreationDate field value if set, zero value otherwise. func (o *CloudWorkloadSecurityAgentRuleAttributes) GetCreationDate() int64 { if o == nil || o.CreationDate == nil { @@ -280,6 +344,62 @@ func (o *CloudWorkloadSecurityAgentRuleAttributes) SetName(v string) { o.Name = &v } +// GetUpdateAuthorUuId returns the UpdateAuthorUuId field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetUpdateAuthorUuId() string { + if o == nil || o.UpdateAuthorUuId == nil { + var ret string + return ret + } + return *o.UpdateAuthorUuId +} + +// GetUpdateAuthorUuIdOk returns a tuple with the UpdateAuthorUuId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetUpdateAuthorUuIdOk() (*string, bool) { + if o == nil || o.UpdateAuthorUuId == nil { + return nil, false + } + return o.UpdateAuthorUuId, true +} + +// HasUpdateAuthorUuId returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) HasUpdateAuthorUuId() bool { + return o != nil && o.UpdateAuthorUuId != nil +} + +// SetUpdateAuthorUuId gets a reference to the given string and assigns it to the UpdateAuthorUuId field. +func (o *CloudWorkloadSecurityAgentRuleAttributes) SetUpdateAuthorUuId(v string) { + o.UpdateAuthorUuId = &v +} + +// GetUpdateDate returns the UpdateDate field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetUpdateDate() int64 { + if o == nil || o.UpdateDate == nil { + var ret int64 + return ret + } + return *o.UpdateDate +} + +// GetUpdateDateOk returns a tuple with the UpdateDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetUpdateDateOk() (*int64, bool) { + if o == nil || o.UpdateDate == nil { + return nil, false + } + return o.UpdateDate, true +} + +// HasUpdateDate returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) HasUpdateDate() bool { + return o != nil && o.UpdateDate != nil +} + +// SetUpdateDate gets a reference to the given int64 and assigns it to the UpdateDate field. +func (o *CloudWorkloadSecurityAgentRuleAttributes) SetUpdateDate(v int64) { + o.UpdateDate = &v +} + // GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. func (o *CloudWorkloadSecurityAgentRuleAttributes) GetUpdatedAt() int64 { if o == nil || o.UpdatedAt == nil { @@ -370,9 +490,15 @@ func (o CloudWorkloadSecurityAgentRuleAttributes) MarshalJSON() ([]byte, error) if o.UnparsedObject != nil { return json.Marshal(o.UnparsedObject) } + if o.AgentConstraint != nil { + toSerialize["agentConstraint"] = o.AgentConstraint + } if o.Category != nil { toSerialize["category"] = o.Category } + if o.CreationAuthorUuId != nil { + toSerialize["creationAuthorUuId"] = o.CreationAuthorUuId + } if o.CreationDate != nil { toSerialize["creationDate"] = o.CreationDate } @@ -394,6 +520,12 @@ func (o CloudWorkloadSecurityAgentRuleAttributes) MarshalJSON() ([]byte, error) if o.Name != nil { toSerialize["name"] = o.Name } + if o.UpdateAuthorUuId != nil { + toSerialize["updateAuthorUuId"] = o.UpdateAuthorUuId + } + if o.UpdateDate != nil { + toSerialize["updateDate"] = o.UpdateDate + } if o.UpdatedAt != nil { toSerialize["updatedAt"] = o.UpdatedAt } @@ -412,42 +544,40 @@ func (o CloudWorkloadSecurityAgentRuleAttributes) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *CloudWorkloadSecurityAgentRuleAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { - Category *string `json:"category,omitempty"` - CreationDate *int64 `json:"creationDate,omitempty"` - Creator *CloudWorkloadSecurityAgentRuleCreatorAttributes `json:"creator,omitempty"` - DefaultRule *bool `json:"defaultRule,omitempty"` - Description *string `json:"description,omitempty"` - Enabled *bool `json:"enabled,omitempty"` - Expression *string `json:"expression,omitempty"` - Name *string `json:"name,omitempty"` - UpdatedAt *int64 `json:"updatedAt,omitempty"` - Updater *CloudWorkloadSecurityAgentRuleUpdaterAttributes `json:"updater,omitempty"` - Version *int64 `json:"version,omitempty"` + AgentConstraint *string `json:"agentConstraint,omitempty"` + Category *string `json:"category,omitempty"` + CreationAuthorUuId *string `json:"creationAuthorUuId,omitempty"` + CreationDate *int64 `json:"creationDate,omitempty"` + Creator *CloudWorkloadSecurityAgentRuleCreatorAttributes `json:"creator,omitempty"` + DefaultRule *bool `json:"defaultRule,omitempty"` + Description *string `json:"description,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Expression *string `json:"expression,omitempty"` + Name *string `json:"name,omitempty"` + UpdateAuthorUuId *string `json:"updateAuthorUuId,omitempty"` + UpdateDate *int64 `json:"updateDate,omitempty"` + UpdatedAt *int64 `json:"updatedAt,omitempty"` + Updater *CloudWorkloadSecurityAgentRuleUpdaterAttributes `json:"updater,omitempty"` + Version *int64 `json:"version,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"category", "creationDate", "creator", "defaultRule", "description", "enabled", "expression", "name", "updatedAt", "updater", "version"}) + datadog.DeleteKeys(additionalProperties, &[]string{"agentConstraint", "category", "creationAuthorUuId", "creationDate", "creator", "defaultRule", "description", "enabled", "expression", "name", "updateAuthorUuId", "updateDate", "updatedAt", "updater", "version"}) } else { return err } + + hasInvalidField := false + o.AgentConstraint = all.AgentConstraint o.Category = all.Category + o.CreationAuthorUuId = all.CreationAuthorUuId o.CreationDate = all.CreationDate if all.Creator != nil && all.Creator.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Creator = all.Creator o.DefaultRule = all.DefaultRule @@ -455,19 +585,22 @@ func (o *CloudWorkloadSecurityAgentRuleAttributes) UnmarshalJSON(bytes []byte) ( o.Enabled = all.Enabled o.Expression = all.Expression o.Name = all.Name + o.UpdateAuthorUuId = all.UpdateAuthorUuId + o.UpdateDate = all.UpdateDate o.UpdatedAt = all.UpdatedAt if all.Updater != nil && all.Updater.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Updater = all.Updater o.Version = all.Version + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_create_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_create_attributes.go index d5527c798..31d6d2417 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_create_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_create_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -170,7 +171,6 @@ func (o CloudWorkloadSecurityAgentRuleCreateAttributes) MarshalJSON() ([]byte, e // UnmarshalJSON deserializes the given payload. func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Description *string `json:"description,omitempty"` Enabled *bool `json:"enabled,omitempty"` @@ -178,12 +178,7 @@ func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) UnmarshalJSON(bytes []b Name *string `json:"name"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Expression == nil { return fmt.Errorf("required field expression missing") @@ -201,6 +196,7 @@ func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) UnmarshalJSON(bytes []b o.Enabled = all.Enabled o.Expression = *all.Expression o.Name = *all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_create_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_create_data.go index d29b5ea94..5eb5bf860 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_create_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_create_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o CloudWorkloadSecurityAgentRuleCreateData) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *CloudWorkloadSecurityAgentRuleCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *CloudWorkloadSecurityAgentRuleCreateAttributes `json:"attributes"` Type *CloudWorkloadSecurityAgentRuleType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -131,26 +126,25 @@ func (o *CloudWorkloadSecurityAgentRuleCreateData) UnmarshalJSON(bytes []byte) ( } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_create_request.go index ad63b84ac..8e8084919 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o CloudWorkloadSecurityAgentRuleCreateRequest) MarshalJSON() ([]byte, erro // UnmarshalJSON deserializes the given payload. func (o *CloudWorkloadSecurityAgentRuleCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *CloudWorkloadSecurityAgentRuleCreateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *CloudWorkloadSecurityAgentRuleCreateRequest) UnmarshalJSON(bytes []byte } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_creator_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_creator_attributes.go index df7c08c95..64f4ad27d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_creator_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_creator_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -126,18 +126,12 @@ func (o CloudWorkloadSecurityAgentRuleCreatorAttributes) MarshalJSON() ([]byte, // UnmarshalJSON deserializes the given payload. func (o *CloudWorkloadSecurityAgentRuleCreatorAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Handle *string `json:"handle,omitempty"` Name datadog.NullableString `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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -147,6 +141,7 @@ func (o *CloudWorkloadSecurityAgentRuleCreatorAttributes) UnmarshalJSON(bytes [] } o.Handle = all.Handle o.Name = all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_data.go index 1917ebb75..10e13a1b9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_data.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o CloudWorkloadSecurityAgentRuleData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CloudWorkloadSecurityAgentRuleData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *CloudWorkloadSecurityAgentRuleAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *CloudWorkloadSecurityAgentRuleType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *CloudWorkloadSecurityAgentRuleData) UnmarshalJSON(bytes []byte) (err er } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_response.go index 99c1d43e4..b53ea0822 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o CloudWorkloadSecurityAgentRuleResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CloudWorkloadSecurityAgentRuleResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *CloudWorkloadSecurityAgentRuleData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *CloudWorkloadSecurityAgentRuleResponse) UnmarshalJSON(bytes []byte) (er } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_type.go index cb1c5a11d..b45693c3c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // CloudWorkloadSecurityAgentRuleType The type of the resource. The value should always be `agent_rule`. @@ -61,47 +62,3 @@ func (v CloudWorkloadSecurityAgentRuleType) IsValid() bool { func (v CloudWorkloadSecurityAgentRuleType) Ptr() *CloudWorkloadSecurityAgentRuleType { return &v } - -// NullableCloudWorkloadSecurityAgentRuleType handles when a null is used for CloudWorkloadSecurityAgentRuleType. -type NullableCloudWorkloadSecurityAgentRuleType struct { - value *CloudWorkloadSecurityAgentRuleType - isSet bool -} - -// Get returns the associated value. -func (v NullableCloudWorkloadSecurityAgentRuleType) Get() *CloudWorkloadSecurityAgentRuleType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCloudWorkloadSecurityAgentRuleType) Set(val *CloudWorkloadSecurityAgentRuleType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCloudWorkloadSecurityAgentRuleType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableCloudWorkloadSecurityAgentRuleType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCloudWorkloadSecurityAgentRuleType initializes the struct as if Set has been called. -func NewNullableCloudWorkloadSecurityAgentRuleType(val *CloudWorkloadSecurityAgentRuleType) *NullableCloudWorkloadSecurityAgentRuleType { - return &NullableCloudWorkloadSecurityAgentRuleType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCloudWorkloadSecurityAgentRuleType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCloudWorkloadSecurityAgentRuleType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_update_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_update_attributes.go index 49e9525ff..b69a1cf0c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_update_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_update_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o CloudWorkloadSecurityAgentRuleUpdateAttributes) MarshalJSON() ([]byte, e // UnmarshalJSON deserializes the given payload. func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Description *string `json:"description,omitempty"` Enabled *bool `json:"enabled,omitempty"` Expression *string `json:"expression,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) UnmarshalJSON(bytes []b o.Description = all.Description o.Enabled = all.Enabled o.Expression = all.Expression + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_update_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_update_data.go index 0f3b03ade..3f42cd30a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_update_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_update_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o CloudWorkloadSecurityAgentRuleUpdateData) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *CloudWorkloadSecurityAgentRuleUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *CloudWorkloadSecurityAgentRuleUpdateAttributes `json:"attributes"` Type *CloudWorkloadSecurityAgentRuleType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -131,26 +126,25 @@ func (o *CloudWorkloadSecurityAgentRuleUpdateData) UnmarshalJSON(bytes []byte) ( } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_update_request.go index 95aa90595..9647685f1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o CloudWorkloadSecurityAgentRuleUpdateRequest) MarshalJSON() ([]byte, erro // UnmarshalJSON deserializes the given payload. func (o *CloudWorkloadSecurityAgentRuleUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *CloudWorkloadSecurityAgentRuleUpdateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *CloudWorkloadSecurityAgentRuleUpdateRequest) UnmarshalJSON(bytes []byte } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_updater_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_updater_attributes.go index 5eeea8ae2..75d795f1d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_updater_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rule_updater_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -126,18 +126,12 @@ func (o CloudWorkloadSecurityAgentRuleUpdaterAttributes) MarshalJSON() ([]byte, // UnmarshalJSON deserializes the given payload. func (o *CloudWorkloadSecurityAgentRuleUpdaterAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Handle *string `json:"handle,omitempty"` Name datadog.NullableString `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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -147,6 +141,7 @@ func (o *CloudWorkloadSecurityAgentRuleUpdaterAttributes) UnmarshalJSON(bytes [] } o.Handle = all.Handle o.Name = all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rules_list_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rules_list_response.go index 74da8f24a..c3579ea0e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rules_list_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloud_workload_security_agent_rules_list_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o CloudWorkloadSecurityAgentRulesListResponse) MarshalJSON() ([]byte, erro // UnmarshalJSON deserializes the given payload. func (o *CloudWorkloadSecurityAgentRulesListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []CloudWorkloadSecurityAgentRuleData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *CloudWorkloadSecurityAgentRulesListResponse) UnmarshalJSON(bytes []byte return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_create_request.go index aa4631bfe..363a55265 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o CloudflareAccountCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CloudflareAccountCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *CloudflareAccountCreateRequestData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *CloudflareAccountCreateRequest) UnmarshalJSON(bytes []byte) (err error) } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_create_request_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_create_request_attributes.go index 3a0de002d..5f278b4c3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_create_request_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_create_request_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -137,19 +138,13 @@ func (o CloudflareAccountCreateRequestAttributes) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *CloudflareAccountCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApiKey *string `json:"api_key"` Email *string `json:"email,omitempty"` Name *string `json:"name"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.ApiKey == nil { return fmt.Errorf("required field api_key missing") @@ -166,6 +161,7 @@ func (o *CloudflareAccountCreateRequestAttributes) UnmarshalJSON(bytes []byte) ( o.ApiKey = *all.ApiKey o.Email = all.Email o.Name = *all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_create_request_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_create_request_data.go index fb24e21c4..b9d9f4a55 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_create_request_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_create_request_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o CloudflareAccountCreateRequestData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CloudflareAccountCreateRequestData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *CloudflareAccountCreateRequestAttributes `json:"attributes"` Type *CloudflareAccountType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -131,26 +126,25 @@ func (o *CloudflareAccountCreateRequestData) UnmarshalJSON(bytes []byte) (err er } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_response.go index ca5f04d7b..dcc46396e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o CloudflareAccountResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CloudflareAccountResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *CloudflareAccountResponseData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *CloudflareAccountResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_response_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_response_attributes.go index 652484fc1..d2cd9f57d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_response_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_response_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o CloudflareAccountResponseAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CloudflareAccountResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Email *string `json:"email,omitempty"` Name *string `json:"name"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -134,6 +129,7 @@ func (o *CloudflareAccountResponseAttributes) UnmarshalJSON(bytes []byte) (err e } o.Email = all.Email o.Name = *all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_response_data.go index 247f5b3f1..b1ff5e59c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_response_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -133,19 +134,13 @@ func (o CloudflareAccountResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CloudflareAccountResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *CloudflareAccountResponseAttributes `json:"attributes"` Id *string `json:"id"` Type *CloudflareAccountType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -162,27 +157,26 @@ func (o *CloudflareAccountResponseData) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_type.go index eccf12af3..4c9883ae3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // CloudflareAccountType The JSON:API type for this API. Should always be `cloudflare-accounts`. @@ -61,47 +62,3 @@ func (v CloudflareAccountType) IsValid() bool { func (v CloudflareAccountType) Ptr() *CloudflareAccountType { return &v } - -// NullableCloudflareAccountType handles when a null is used for CloudflareAccountType. -type NullableCloudflareAccountType struct { - value *CloudflareAccountType - isSet bool -} - -// Get returns the associated value. -func (v NullableCloudflareAccountType) Get() *CloudflareAccountType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCloudflareAccountType) Set(val *CloudflareAccountType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCloudflareAccountType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableCloudflareAccountType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCloudflareAccountType initializes the struct as if Set has been called. -func NewNullableCloudflareAccountType(val *CloudflareAccountType) *NullableCloudflareAccountType { - return &NullableCloudflareAccountType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCloudflareAccountType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCloudflareAccountType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_update_request.go index 9e3fda47a..e56af2be5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o CloudflareAccountUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CloudflareAccountUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *CloudflareAccountUpdateRequestData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *CloudflareAccountUpdateRequest) UnmarshalJSON(bytes []byte) (err error) } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_update_request_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_update_request_attributes.go index b654206ae..eaa08b050 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_update_request_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_update_request_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o CloudflareAccountUpdateRequestAttributes) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *CloudflareAccountUpdateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApiKey *string `json:"api_key"` Email *string `json:"email,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.ApiKey == nil { return fmt.Errorf("required field api_key missing") @@ -134,6 +129,7 @@ func (o *CloudflareAccountUpdateRequestAttributes) UnmarshalJSON(bytes []byte) ( } o.ApiKey = *all.ApiKey o.Email = all.Email + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_update_request_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_update_request_data.go index 226121d93..028546586 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_update_request_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_account_update_request_data.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -119,18 +119,12 @@ func (o CloudflareAccountUpdateRequestData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CloudflareAccountUpdateRequestData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *CloudflareAccountUpdateRequestAttributes `json:"attributes,omitempty"` Type *CloudflareAccountType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -138,26 +132,25 @@ func (o *CloudflareAccountUpdateRequestData) UnmarshalJSON(bytes []byte) (err er } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_accounts_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_accounts_response.go index e75b54683..10a077487 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_accounts_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cloudflare_accounts_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o CloudflareAccountsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CloudflareAccountsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []CloudflareAccountResponseData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *CloudflareAccountsResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_create_request.go index 64ce1887c..d990cae6e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o ConfluentAccountCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentAccountCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *ConfluentAccountCreateRequestData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *ConfluentAccountCreateRequest) UnmarshalJSON(bytes []byte) (err error) } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_create_request_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_create_request_attributes.go index db123f894..b932dd768 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_create_request_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_create_request_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -170,7 +171,6 @@ func (o ConfluentAccountCreateRequestAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentAccountCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApiKey *string `json:"api_key"` ApiSecret *string `json:"api_secret"` @@ -178,12 +178,7 @@ func (o *ConfluentAccountCreateRequestAttributes) UnmarshalJSON(bytes []byte) (e Tags []string `json:"tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.ApiKey == nil { return fmt.Errorf("required field api_key missing") @@ -201,6 +196,7 @@ func (o *ConfluentAccountCreateRequestAttributes) UnmarshalJSON(bytes []byte) (e o.ApiSecret = *all.ApiSecret o.Resources = all.Resources o.Tags = all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_create_request_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_create_request_data.go index 1f5e6fec3..599566d6a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_create_request_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_create_request_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o ConfluentAccountCreateRequestData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentAccountCreateRequestData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *ConfluentAccountCreateRequestAttributes `json:"attributes"` Type *ConfluentAccountType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -131,26 +126,25 @@ func (o *ConfluentAccountCreateRequestData) UnmarshalJSON(bytes []byte) (err err } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_resource_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_resource_attributes.go index e052bd4cd..e23dfd341 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_resource_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_resource_attributes.go @@ -5,14 +5,17 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // ConfluentAccountResourceAttributes Attributes object for updating a Confluent resource. type ConfluentAccountResourceAttributes struct { + // Enable the `custom.consumer_lag_offset` metric, which contains extra metric tags. + EnableCustomMetrics *bool `json:"enable_custom_metrics,omitempty"` // The ID associated with a Confluent resource. Id *string `json:"id,omitempty"` // The resource type of the Resource. Can be `kafka`, `connector`, `ksql`, or `schema_registry`. @@ -30,6 +33,8 @@ type ConfluentAccountResourceAttributes struct { // will change when the set of required properties is changed. func NewConfluentAccountResourceAttributes(resourceType string) *ConfluentAccountResourceAttributes { this := ConfluentAccountResourceAttributes{} + var enableCustomMetrics bool = false + this.EnableCustomMetrics = &enableCustomMetrics this.ResourceType = resourceType return &this } @@ -39,9 +44,39 @@ func NewConfluentAccountResourceAttributes(resourceType string) *ConfluentAccoun // but it doesn't guarantee that properties required by API are set. func NewConfluentAccountResourceAttributesWithDefaults() *ConfluentAccountResourceAttributes { this := ConfluentAccountResourceAttributes{} + var enableCustomMetrics bool = false + this.EnableCustomMetrics = &enableCustomMetrics return &this } +// GetEnableCustomMetrics returns the EnableCustomMetrics field value if set, zero value otherwise. +func (o *ConfluentAccountResourceAttributes) GetEnableCustomMetrics() bool { + if o == nil || o.EnableCustomMetrics == nil { + var ret bool + return ret + } + return *o.EnableCustomMetrics +} + +// GetEnableCustomMetricsOk returns a tuple with the EnableCustomMetrics field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConfluentAccountResourceAttributes) GetEnableCustomMetricsOk() (*bool, bool) { + if o == nil || o.EnableCustomMetrics == nil { + return nil, false + } + return o.EnableCustomMetrics, true +} + +// HasEnableCustomMetrics returns a boolean if a field has been set. +func (o *ConfluentAccountResourceAttributes) HasEnableCustomMetrics() bool { + return o != nil && o.EnableCustomMetrics != nil +} + +// SetEnableCustomMetrics gets a reference to the given bool and assigns it to the EnableCustomMetrics field. +func (o *ConfluentAccountResourceAttributes) SetEnableCustomMetrics(v bool) { + o.EnableCustomMetrics = &v +} + // GetId returns the Id field value if set, zero value otherwise. func (o *ConfluentAccountResourceAttributes) GetId() string { if o == nil || o.Id == nil { @@ -127,6 +162,9 @@ func (o ConfluentAccountResourceAttributes) MarshalJSON() ([]byte, error) { if o.UnparsedObject != nil { return json.Marshal(o.UnparsedObject) } + if o.EnableCustomMetrics != nil { + toSerialize["enable_custom_metrics"] = o.EnableCustomMetrics + } if o.Id != nil { toSerialize["id"] = o.Id } @@ -143,32 +181,29 @@ func (o ConfluentAccountResourceAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentAccountResourceAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { - Id *string `json:"id,omitempty"` - ResourceType *string `json:"resource_type"` - Tags []string `json:"tags,omitempty"` + EnableCustomMetrics *bool `json:"enable_custom_metrics,omitempty"` + Id *string `json:"id,omitempty"` + ResourceType *string `json:"resource_type"` + Tags []string `json:"tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } 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"}) + datadog.DeleteKeys(additionalProperties, &[]string{"enable_custom_metrics", "id", "resource_type", "tags"}) } else { return err } + o.EnableCustomMetrics = all.EnableCustomMetrics o.Id = all.Id o.ResourceType = *all.ResourceType o.Tags = all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_response.go index 39bdc6f4d..5ae75ae50 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o ConfluentAccountResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentAccountResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *ConfluentAccountResponseData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *ConfluentAccountResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_response_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_response_attributes.go index 0fd3b9dc5..b06494bce 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_response_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_response_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -143,19 +144,13 @@ func (o ConfluentAccountResponseAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentAccountResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApiKey *string `json:"api_key"` Resources []ConfluentResourceResponseAttributes `json:"resources,omitempty"` Tags []string `json:"tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.ApiKey == nil { return fmt.Errorf("required field api_key missing") @@ -169,6 +164,7 @@ func (o *ConfluentAccountResponseAttributes) UnmarshalJSON(bytes []byte) (err er o.ApiKey = *all.ApiKey o.Resources = all.Resources o.Tags = all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_response_data.go index c44b3957b..b49eabac6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_response_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -133,19 +134,13 @@ func (o ConfluentAccountResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentAccountResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *ConfluentAccountResponseAttributes `json:"attributes"` Id *string `json:"id"` Type *ConfluentAccountType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -162,27 +157,26 @@ func (o *ConfluentAccountResponseData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_type.go index a1aaea7a3..4f1eb6f2d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ConfluentAccountType The JSON:API type for this API. Should always be `confluent-cloud-accounts`. @@ -61,47 +62,3 @@ func (v ConfluentAccountType) IsValid() bool { func (v ConfluentAccountType) Ptr() *ConfluentAccountType { return &v } - -// NullableConfluentAccountType handles when a null is used for ConfluentAccountType. -type NullableConfluentAccountType struct { - value *ConfluentAccountType - isSet bool -} - -// Get returns the associated value. -func (v NullableConfluentAccountType) Get() *ConfluentAccountType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableConfluentAccountType) Set(val *ConfluentAccountType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableConfluentAccountType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableConfluentAccountType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableConfluentAccountType initializes the struct as if Set has been called. -func NewNullableConfluentAccountType(val *ConfluentAccountType) *NullableConfluentAccountType { - return &NullableConfluentAccountType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableConfluentAccountType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableConfluentAccountType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_update_request.go index 99367f415..ca4af4233 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o ConfluentAccountUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentAccountUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *ConfluentAccountUpdateRequestData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *ConfluentAccountUpdateRequest) UnmarshalJSON(bytes []byte) (err error) } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_update_request_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_update_request_attributes.go index 5d8753a22..1e266959f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_update_request_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_update_request_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -137,19 +138,13 @@ func (o ConfluentAccountUpdateRequestAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentAccountUpdateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApiKey *string `json:"api_key"` ApiSecret *string `json:"api_secret"` Tags []string `json:"tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.ApiKey == nil { return fmt.Errorf("required field api_key missing") @@ -166,6 +161,7 @@ func (o *ConfluentAccountUpdateRequestAttributes) UnmarshalJSON(bytes []byte) (e o.ApiKey = *all.ApiKey o.ApiSecret = *all.ApiSecret o.Tags = all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_update_request_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_update_request_data.go index 72cc42c3c..d6b659dca 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_update_request_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_account_update_request_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o ConfluentAccountUpdateRequestData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentAccountUpdateRequestData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *ConfluentAccountUpdateRequestAttributes `json:"attributes"` Type *ConfluentAccountType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -131,26 +126,25 @@ func (o *ConfluentAccountUpdateRequestData) UnmarshalJSON(bytes []byte) (err err } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_accounts_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_accounts_response.go index b371a8002..2f385a399 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_accounts_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_accounts_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o ConfluentAccountsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentAccountsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []ConfluentAccountResponseData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *ConfluentAccountsResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_request.go index e118a15ee..c52543437 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o ConfluentResourceRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentResourceRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *ConfluentResourceRequestData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *ConfluentResourceRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_request_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_request_attributes.go index 1ac808749..56646ba91 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_request_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_request_attributes.go @@ -5,14 +5,17 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // ConfluentResourceRequestAttributes Attributes object for updating a Confluent resource. type ConfluentResourceRequestAttributes struct { + // Enable the `custom.consumer_lag_offset` metric, which contains extra metric tags. + EnableCustomMetrics *bool `json:"enable_custom_metrics,omitempty"` // The resource type of the Resource. Can be `kafka`, `connector`, `ksql`, or `schema_registry`. ResourceType string `json:"resource_type"` // A list of strings representing tags. Can be a single key, or key-value pairs separated by a colon. @@ -28,6 +31,8 @@ type ConfluentResourceRequestAttributes struct { // will change when the set of required properties is changed. func NewConfluentResourceRequestAttributes(resourceType string) *ConfluentResourceRequestAttributes { this := ConfluentResourceRequestAttributes{} + var enableCustomMetrics bool = false + this.EnableCustomMetrics = &enableCustomMetrics this.ResourceType = resourceType return &this } @@ -37,9 +42,39 @@ func NewConfluentResourceRequestAttributes(resourceType string) *ConfluentResour // but it doesn't guarantee that properties required by API are set. func NewConfluentResourceRequestAttributesWithDefaults() *ConfluentResourceRequestAttributes { this := ConfluentResourceRequestAttributes{} + var enableCustomMetrics bool = false + this.EnableCustomMetrics = &enableCustomMetrics return &this } +// GetEnableCustomMetrics returns the EnableCustomMetrics field value if set, zero value otherwise. +func (o *ConfluentResourceRequestAttributes) GetEnableCustomMetrics() bool { + if o == nil || o.EnableCustomMetrics == nil { + var ret bool + return ret + } + return *o.EnableCustomMetrics +} + +// GetEnableCustomMetricsOk returns a tuple with the EnableCustomMetrics field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConfluentResourceRequestAttributes) GetEnableCustomMetricsOk() (*bool, bool) { + if o == nil || o.EnableCustomMetrics == nil { + return nil, false + } + return o.EnableCustomMetrics, true +} + +// HasEnableCustomMetrics returns a boolean if a field has been set. +func (o *ConfluentResourceRequestAttributes) HasEnableCustomMetrics() bool { + return o != nil && o.EnableCustomMetrics != nil +} + +// SetEnableCustomMetrics gets a reference to the given bool and assigns it to the EnableCustomMetrics field. +func (o *ConfluentResourceRequestAttributes) SetEnableCustomMetrics(v bool) { + o.EnableCustomMetrics = &v +} + // GetResourceType returns the ResourceType field value. func (o *ConfluentResourceRequestAttributes) GetResourceType() string { if o == nil { @@ -97,6 +132,9 @@ func (o ConfluentResourceRequestAttributes) MarshalJSON() ([]byte, error) { if o.UnparsedObject != nil { return json.Marshal(o.UnparsedObject) } + if o.EnableCustomMetrics != nil { + toSerialize["enable_custom_metrics"] = o.EnableCustomMetrics + } toSerialize["resource_type"] = o.ResourceType if o.Tags != nil { toSerialize["tags"] = o.Tags @@ -110,30 +148,27 @@ func (o ConfluentResourceRequestAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentResourceRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { - ResourceType *string `json:"resource_type"` - Tags []string `json:"tags,omitempty"` + EnableCustomMetrics *bool `json:"enable_custom_metrics,omitempty"` + ResourceType *string `json:"resource_type"` + Tags []string `json:"tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } 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"}) + datadog.DeleteKeys(additionalProperties, &[]string{"enable_custom_metrics", "resource_type", "tags"}) } else { return err } + o.EnableCustomMetrics = all.EnableCustomMetrics o.ResourceType = *all.ResourceType o.Tags = all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_request_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_request_data.go index 40786dc5d..0c5d0f8a8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_request_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_request_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -133,19 +134,13 @@ func (o ConfluentResourceRequestData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentResourceRequestData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *ConfluentResourceRequestAttributes `json:"attributes"` Id *string `json:"id"` Type *ConfluentResourceType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -162,27 +157,26 @@ func (o *ConfluentResourceRequestData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_response.go index 3ffb0a709..5486c5335 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o ConfluentResourceResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentResourceResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *ConfluentResourceResponseData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *ConfluentResourceResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_response_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_response_attributes.go index 78725b991..859ca99ab 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_response_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_response_attributes.go @@ -5,14 +5,19 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // ConfluentResourceResponseAttributes Model representation of a Confluent Cloud resource. type ConfluentResourceResponseAttributes struct { + // Enable the `custom.consumer_lag_offset` metric, which contains extra metric tags. + EnableCustomMetrics *bool `json:"enable_custom_metrics,omitempty"` + // The ID associated with the Confluent resource. + Id *string `json:"id,omitempty"` // The resource type of the Resource. Can be `kafka`, `connector`, `ksql`, or `schema_registry`. ResourceType string `json:"resource_type"` // A list of strings representing tags. Can be a single key, or key-value pairs separated by a colon. @@ -28,6 +33,8 @@ type ConfluentResourceResponseAttributes struct { // will change when the set of required properties is changed. func NewConfluentResourceResponseAttributes(resourceType string) *ConfluentResourceResponseAttributes { this := ConfluentResourceResponseAttributes{} + var enableCustomMetrics bool = false + this.EnableCustomMetrics = &enableCustomMetrics this.ResourceType = resourceType return &this } @@ -37,9 +44,67 @@ func NewConfluentResourceResponseAttributes(resourceType string) *ConfluentResou // but it doesn't guarantee that properties required by API are set. func NewConfluentResourceResponseAttributesWithDefaults() *ConfluentResourceResponseAttributes { this := ConfluentResourceResponseAttributes{} + var enableCustomMetrics bool = false + this.EnableCustomMetrics = &enableCustomMetrics return &this } +// GetEnableCustomMetrics returns the EnableCustomMetrics field value if set, zero value otherwise. +func (o *ConfluentResourceResponseAttributes) GetEnableCustomMetrics() bool { + if o == nil || o.EnableCustomMetrics == nil { + var ret bool + return ret + } + return *o.EnableCustomMetrics +} + +// GetEnableCustomMetricsOk returns a tuple with the EnableCustomMetrics field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConfluentResourceResponseAttributes) GetEnableCustomMetricsOk() (*bool, bool) { + if o == nil || o.EnableCustomMetrics == nil { + return nil, false + } + return o.EnableCustomMetrics, true +} + +// HasEnableCustomMetrics returns a boolean if a field has been set. +func (o *ConfluentResourceResponseAttributes) HasEnableCustomMetrics() bool { + return o != nil && o.EnableCustomMetrics != nil +} + +// SetEnableCustomMetrics gets a reference to the given bool and assigns it to the EnableCustomMetrics field. +func (o *ConfluentResourceResponseAttributes) SetEnableCustomMetrics(v bool) { + o.EnableCustomMetrics = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *ConfluentResourceResponseAttributes) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConfluentResourceResponseAttributes) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *ConfluentResourceResponseAttributes) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ConfluentResourceResponseAttributes) SetId(v string) { + o.Id = &v +} + // GetResourceType returns the ResourceType field value. func (o *ConfluentResourceResponseAttributes) GetResourceType() string { if o == nil { @@ -97,6 +162,12 @@ func (o ConfluentResourceResponseAttributes) MarshalJSON() ([]byte, error) { if o.UnparsedObject != nil { return json.Marshal(o.UnparsedObject) } + if o.EnableCustomMetrics != nil { + toSerialize["enable_custom_metrics"] = o.EnableCustomMetrics + } + if o.Id != nil { + toSerialize["id"] = o.Id + } toSerialize["resource_type"] = o.ResourceType if o.Tags != nil { toSerialize["tags"] = o.Tags @@ -110,30 +181,29 @@ func (o ConfluentResourceResponseAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentResourceResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { - ResourceType *string `json:"resource_type"` - Tags []string `json:"tags,omitempty"` + EnableCustomMetrics *bool `json:"enable_custom_metrics,omitempty"` + Id *string `json:"id,omitempty"` + ResourceType *string `json:"resource_type"` + Tags []string `json:"tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } 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"}) + datadog.DeleteKeys(additionalProperties, &[]string{"enable_custom_metrics", "id", "resource_type", "tags"}) } else { return err } + o.EnableCustomMetrics = all.EnableCustomMetrics + o.Id = all.Id o.ResourceType = *all.ResourceType o.Tags = all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_response_data.go index 1b36b5656..6d9d1f509 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_response_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -133,19 +134,13 @@ func (o ConfluentResourceResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentResourceResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *ConfluentResourceResponseAttributes `json:"attributes"` Id *string `json:"id"` Type *ConfluentResourceType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -162,27 +157,26 @@ func (o *ConfluentResourceResponseData) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_type.go index b84242513..8ecb07db3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resource_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ConfluentResourceType The JSON:API type for this request. @@ -61,47 +62,3 @@ func (v ConfluentResourceType) IsValid() bool { func (v ConfluentResourceType) Ptr() *ConfluentResourceType { return &v } - -// NullableConfluentResourceType handles when a null is used for ConfluentResourceType. -type NullableConfluentResourceType struct { - value *ConfluentResourceType - isSet bool -} - -// Get returns the associated value. -func (v NullableConfluentResourceType) Get() *ConfluentResourceType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableConfluentResourceType) Set(val *ConfluentResourceType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableConfluentResourceType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableConfluentResourceType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableConfluentResourceType initializes the struct as if Set has been called. -func NewNullableConfluentResourceType(val *ConfluentResourceType) *NullableConfluentResourceType { - return &NullableConfluentResourceType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableConfluentResourceType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableConfluentResourceType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resources_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resources_response.go index e7174b934..6f6ca8264 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resources_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_confluent_resources_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o ConfluentResourcesResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentResourcesResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []ConfluentResourceResponseData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *ConfluentResourcesResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_content_encoding.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_content_encoding.go index 0fc4c9098..36aa83791 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_content_encoding.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_content_encoding.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ContentEncoding HTTP header used to compress the media-type. @@ -65,47 +66,3 @@ func (v ContentEncoding) IsValid() bool { func (v ContentEncoding) Ptr() *ContentEncoding { return &v } - -// NullableContentEncoding handles when a null is used for ContentEncoding. -type NullableContentEncoding struct { - value *ContentEncoding - isSet bool -} - -// Get returns the associated value. -func (v NullableContentEncoding) Get() *ContentEncoding { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableContentEncoding) Set(val *ContentEncoding) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableContentEncoding) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableContentEncoding) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableContentEncoding initializes the struct as if Set has been called. -func NewNullableContentEncoding(val *ContentEncoding) *NullableContentEncoding { - return &NullableContentEncoding{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableContentEncoding) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableContentEncoding) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cost_by_org.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cost_by_org.go index 4f0ade4ac..6874e8cb3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cost_by_org.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cost_by_org.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o CostByOrg) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CostByOrg) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *CostByOrgAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *CostByOrgType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *CostByOrg) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cost_by_org_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cost_by_org_attributes.go index 02dcabc1f..22dd96781 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cost_by_org_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cost_by_org_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -252,7 +253,6 @@ func (o CostByOrgAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CostByOrgAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Charges []ChargebackBreakdown `json:"charges,omitempty"` Date *time.Time `json:"date,omitempty"` @@ -262,12 +262,7 @@ func (o *CostByOrgAttributes) UnmarshalJSON(bytes []byte) (err error) { TotalCost *float64 `json:"total_cost,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -281,6 +276,7 @@ func (o *CostByOrgAttributes) UnmarshalJSON(bytes []byte) (err error) { o.PublicId = all.PublicId o.Region = all.Region o.TotalCost = all.TotalCost + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cost_by_org_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cost_by_org_response.go index 60bbcb1ce..b1ad81fa1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cost_by_org_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cost_by_org_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o CostByOrgResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CostByOrgResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []CostByOrg `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *CostByOrgResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cost_by_org_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cost_by_org_type.go index b15142907..9055cec1b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cost_by_org_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_cost_by_org_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // CostByOrgType Type of cost data. @@ -61,47 +62,3 @@ func (v CostByOrgType) IsValid() bool { func (v CostByOrgType) Ptr() *CostByOrgType { return &v } - -// NullableCostByOrgType handles when a null is used for CostByOrgType. -type NullableCostByOrgType struct { - value *CostByOrgType - isSet bool -} - -// Get returns the associated value. -func (v NullableCostByOrgType) Get() *CostByOrgType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCostByOrgType) Set(val *CostByOrgType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCostByOrgType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableCostByOrgType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCostByOrgType initializes the struct as if Set has been called. -func NewNullableCostByOrgType(val *CostByOrgType) *NullableCostByOrgType { - return &NullableCostByOrgType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCostByOrgType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCostByOrgType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_creator.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_creator.go index c3e0d87b1..6767029be 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_creator.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_creator.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -159,19 +159,13 @@ func (o Creator) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Creator) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Email *string `json:"email,omitempty"` Handle *string `json:"handle,omitempty"` Name datadog.NullableString `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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -182,6 +176,7 @@ func (o *Creator) UnmarshalJSON(bytes []byte) (err error) { o.Email = all.Email o.Handle = all.Handle o.Name = all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_add_items_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_add_items_request.go index a04beea7b..447b46a2d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_add_items_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_add_items_request.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o DashboardListAddItemsRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardListAddItemsRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Dashboards []DashboardListItemRequest `json:"dashboards,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *DashboardListAddItemsRequest) UnmarshalJSON(bytes []byte) (err error) { return err } o.Dashboards = all.Dashboards + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_add_items_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_add_items_response.go index 409f13eef..733e259c4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_add_items_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_add_items_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o DashboardListAddItemsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardListAddItemsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AddedDashboardsToList []DashboardListItemResponse `json:"added_dashboards_to_list,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *DashboardListAddItemsResponse) UnmarshalJSON(bytes []byte) (err error) return err } o.AddedDashboardsToList = all.AddedDashboardsToList + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_delete_items_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_delete_items_request.go index 35a77f39d..ac8941039 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_delete_items_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_delete_items_request.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o DashboardListDeleteItemsRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardListDeleteItemsRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Dashboards []DashboardListItemRequest `json:"dashboards,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *DashboardListDeleteItemsRequest) UnmarshalJSON(bytes []byte) (err error return err } o.Dashboards = all.Dashboards + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_delete_items_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_delete_items_response.go index 180310329..06065b8dc 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_delete_items_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_delete_items_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o DashboardListDeleteItemsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardListDeleteItemsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DeletedDashboardsFromList []DashboardListItemResponse `json:"deleted_dashboards_from_list,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *DashboardListDeleteItemsResponse) UnmarshalJSON(bytes []byte) (err erro return err } o.DeletedDashboardsFromList = all.DeletedDashboardsFromList + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_item.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_item.go index 754fc8ddd..96abcd7ba 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_item.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_item.go @@ -5,10 +5,11 @@ package datadogV2 import ( - "encoding/json" "fmt" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -22,6 +23,8 @@ type DashboardListItem struct { Icon datadog.NullableString `json:"icon,omitempty"` // ID of the dashboard. Id string `json:"id"` + // The short name of the integration. + IntegrationId datadog.NullableString `json:"integration_id,omitempty"` // Whether or not the dashboard is in the favorites. IsFavorite *bool `json:"is_favorite,omitempty"` // Whether or not the dashboard is read only. @@ -32,6 +35,8 @@ type DashboardListItem struct { Modified *time.Time `json:"modified,omitempty"` // Popularity of the dashboard. Popularity *int32 `json:"popularity,omitempty"` + // List of team names representing ownership of a dashboard. + Tags datadog.NullableList[string] `json:"tags,omitempty"` // Title of the dashboard. Title *string `json:"title,omitempty"` // The type of the dashboard. @@ -180,6 +185,45 @@ func (o *DashboardListItem) SetId(v string) { o.Id = v } +// GetIntegrationId returns the IntegrationId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DashboardListItem) GetIntegrationId() string { + if o == nil || o.IntegrationId.Get() == nil { + var ret string + return ret + } + return *o.IntegrationId.Get() +} + +// GetIntegrationIdOk returns a tuple with the IntegrationId field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *DashboardListItem) GetIntegrationIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.IntegrationId.Get(), o.IntegrationId.IsSet() +} + +// HasIntegrationId returns a boolean if a field has been set. +func (o *DashboardListItem) HasIntegrationId() bool { + return o != nil && o.IntegrationId.IsSet() +} + +// SetIntegrationId gets a reference to the given datadog.NullableString and assigns it to the IntegrationId field. +func (o *DashboardListItem) SetIntegrationId(v string) { + o.IntegrationId.Set(&v) +} + +// SetIntegrationIdNil sets the value for IntegrationId to be an explicit nil. +func (o *DashboardListItem) SetIntegrationIdNil() { + o.IntegrationId.Set(nil) +} + +// UnsetIntegrationId ensures that no value is present for IntegrationId, not even an explicit nil. +func (o *DashboardListItem) UnsetIntegrationId() { + o.IntegrationId.Unset() +} + // GetIsFavorite returns the IsFavorite field value if set, zero value otherwise. func (o *DashboardListItem) GetIsFavorite() bool { if o == nil || o.IsFavorite == nil { @@ -320,6 +364,45 @@ func (o *DashboardListItem) SetPopularity(v int32) { o.Popularity = &v } +// GetTags returns the Tags field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DashboardListItem) GetTags() []string { + if o == nil || o.Tags.Get() == nil { + var ret []string + return ret + } + return *o.Tags.Get() +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *DashboardListItem) GetTagsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return o.Tags.Get(), o.Tags.IsSet() +} + +// HasTags returns a boolean if a field has been set. +func (o *DashboardListItem) HasTags() bool { + return o != nil && o.Tags.IsSet() +} + +// SetTags gets a reference to the given datadog.NullableList[string] and assigns it to the Tags field. +func (o *DashboardListItem) SetTags(v []string) { + o.Tags.Set(&v) +} + +// SetTagsNil sets the value for Tags to be an explicit nil. +func (o *DashboardListItem) SetTagsNil() { + o.Tags.Set(nil) +} + +// UnsetTags ensures that no value is present for Tags, not even an explicit nil. +func (o *DashboardListItem) UnsetTags() { + o.Tags.Unset() +} + // GetTitle returns the Title field value if set, zero value otherwise. func (o *DashboardListItem) GetTitle() string { if o == nil || o.Title == nil { @@ -419,6 +502,9 @@ func (o DashboardListItem) MarshalJSON() ([]byte, error) { toSerialize["icon"] = o.Icon.Get() } toSerialize["id"] = o.Id + if o.IntegrationId.IsSet() { + toSerialize["integration_id"] = o.IntegrationId.Get() + } if o.IsFavorite != nil { toSerialize["is_favorite"] = o.IsFavorite } @@ -438,6 +524,9 @@ func (o DashboardListItem) MarshalJSON() ([]byte, error) { if o.Popularity != nil { toSerialize["popularity"] = o.Popularity } + if o.Tags.IsSet() { + toSerialize["tags"] = o.Tags.Get() + } if o.Title != nil { toSerialize["title"] = o.Title } @@ -454,28 +543,24 @@ func (o DashboardListItem) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardListItem) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { - Author *Creator `json:"author,omitempty"` - Created *time.Time `json:"created,omitempty"` - Icon datadog.NullableString `json:"icon,omitempty"` - 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"` - Url *string `json:"url,omitempty"` + Author *Creator `json:"author,omitempty"` + Created *time.Time `json:"created,omitempty"` + Icon datadog.NullableString `json:"icon,omitempty"` + Id *string `json:"id"` + IntegrationId datadog.NullableString `json:"integration_id,omitempty"` + 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"` + Tags datadog.NullableList[string] `json:"tags,omitempty"` + Title *string `json:"title,omitempty"` + Type *DashboardType `json:"type"` + Url *string `json:"url,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -485,40 +570,41 @@ func (o *DashboardListItem) UnmarshalJSON(bytes []byte) (err error) { } 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"}) + datadog.DeleteKeys(additionalProperties, &[]string{"author", "created", "icon", "id", "integration_id", "is_favorite", "is_read_only", "is_shared", "modified", "popularity", "tags", "title", "type", "url"}) } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Author != nil && all.Author.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Author = all.Author o.Created = all.Created o.Icon = all.Icon o.Id = *all.Id + o.IntegrationId = all.IntegrationId o.IsFavorite = all.IsFavorite o.IsReadOnly = all.IsReadOnly o.IsShared = all.IsShared o.Modified = all.Modified o.Popularity = all.Popularity + o.Tags = all.Tags o.Title = all.Title - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } o.Url = all.Url + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_item_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_item_request.go index 46ddbc43d..6ca035083 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_item_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_item_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o DashboardListItemRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardListItemRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id"` Type *DashboardType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -129,19 +124,22 @@ func (o *DashboardListItemRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_item_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_item_response.go index a27ba6192..d51d6477c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_item_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_item_response.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o DashboardListItemResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardListItemResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id"` Type *DashboardType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -129,19 +124,22 @@ func (o *DashboardListItemResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_items.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_items.go index 673469896..c556718d2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_items.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_items.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o DashboardListItems) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardListItems) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Dashboards *[]DashboardListItem `json:"dashboards"` Total *int64 `json:"total,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Dashboards == nil { return fmt.Errorf("required field dashboards missing") @@ -134,6 +129,7 @@ func (o *DashboardListItems) UnmarshalJSON(bytes []byte) (err error) { } o.Dashboards = *all.Dashboards o.Total = all.Total + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_update_items_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_update_items_request.go index 919674bff..53dd89ca1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_update_items_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_update_items_request.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o DashboardListUpdateItemsRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardListUpdateItemsRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Dashboards []DashboardListItemRequest `json:"dashboards,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *DashboardListUpdateItemsRequest) UnmarshalJSON(bytes []byte) (err error return err } o.Dashboards = all.Dashboards + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_update_items_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_update_items_response.go index 870c28066..d24cc6e77 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_update_items_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_list_update_items_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o DashboardListUpdateItemsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardListUpdateItemsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Dashboards []DashboardListItemResponse `json:"dashboards,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *DashboardListUpdateItemsResponse) UnmarshalJSON(bytes []byte) (err erro return err } o.Dashboards = all.Dashboards + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_type.go index 9fb91b3bd..1c70aceb3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_dashboard_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // DashboardType The type of the dashboard. @@ -69,47 +70,3 @@ func (v DashboardType) IsValid() bool { func (v DashboardType) Ptr() *DashboardType { return &v } - -// NullableDashboardType handles when a null is used for DashboardType. -type NullableDashboardType struct { - value *DashboardType - isSet bool -} - -// Get returns the associated value. -func (v NullableDashboardType) Get() *DashboardType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableDashboardType) Set(val *DashboardType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableDashboardType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableDashboardType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableDashboardType initializes the struct as if Set has been called. -func NewNullableDashboardType(val *DashboardType) *NullableDashboardType { - return &NullableDashboardType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableDashboardType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableDashboardType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_data_scalar_column.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_data_scalar_column.go index 4b6fea303..d5ffe3371 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_data_scalar_column.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_data_scalar_column.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -181,7 +181,6 @@ func (o DataScalarColumn) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DataScalarColumn) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Meta *ScalarMeta `json:"meta,omitempty"` Name *string `json:"name,omitempty"` @@ -189,12 +188,7 @@ func (o *DataScalarColumn) UnmarshalJSON(bytes []byte) (err error) { Values []float64 `json:"values,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -202,20 +196,23 @@ func (o *DataScalarColumn) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta o.Name = all.Name o.Type = all.Type o.Values = all.Values + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_detailed_finding.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_detailed_finding.go index fda859a8d..149391fdb 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_detailed_finding.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_detailed_finding.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o DetailedFinding) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DetailedFinding) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *DetailedFindingAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *DetailedFindingType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *DetailedFinding) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_detailed_finding_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_detailed_finding_attributes.go index d3fd47778..98efbbb80 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_detailed_finding_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_detailed_finding_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -412,7 +412,6 @@ func (o DetailedFindingAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DetailedFindingAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Evaluation *FindingEvaluation `json:"evaluation,omitempty"` EvaluationChangedAt *int64 `json:"evaluation_changed_at,omitempty"` @@ -427,12 +426,7 @@ func (o *DetailedFindingAttributes) UnmarshalJSON(bytes []byte) (err error) { Tags []string `json:"tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -440,31 +434,17 @@ func (o *DetailedFindingAttributes) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Evaluation; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Evaluation = all.Evaluation + + hasInvalidField := false + if all.Evaluation != nil && !all.Evaluation.IsValid() { + hasInvalidField = true + } else { + o.Evaluation = all.Evaluation + } o.EvaluationChangedAt = all.EvaluationChangedAt o.Message = all.Message if all.Mute != nil && all.Mute.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Mute = all.Mute o.Resource = all.Resource @@ -472,18 +452,23 @@ func (o *DetailedFindingAttributes) UnmarshalJSON(bytes []byte) (err error) { o.ResourceDiscoveryDate = all.ResourceDiscoveryDate o.ResourceType = all.ResourceType if all.Rule != nil && all.Rule.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Rule = all.Rule - o.Status = all.Status + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } o.Tags = all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_detailed_finding_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_detailed_finding_type.go index 75d88fa10..24554dcb7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_detailed_finding_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_detailed_finding_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // DetailedFindingType The JSON:API type for findings that have the message and resource configuration. @@ -61,47 +62,3 @@ func (v DetailedFindingType) IsValid() bool { func (v DetailedFindingType) Ptr() *DetailedFindingType { return &v } - -// NullableDetailedFindingType handles when a null is used for DetailedFindingType. -type NullableDetailedFindingType struct { - value *DetailedFindingType - isSet bool -} - -// Get returns the associated value. -func (v NullableDetailedFindingType) Get() *DetailedFindingType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableDetailedFindingType) Set(val *DetailedFindingType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableDetailedFindingType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableDetailedFindingType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableDetailedFindingType initializes the struct as if Set has been called. -func NewNullableDetailedFindingType(val *DetailedFindingType) *NullableDetailedFindingType { - return &NullableDetailedFindingType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableDetailedFindingType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableDetailedFindingType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_create_request.go new file mode 100644 index 000000000..e97e2f165 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_create_request.go @@ -0,0 +1,112 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "fmt" + + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeCreateRequest Request for creating a downtime. +type DowntimeCreateRequest struct { + // Object to create a downtime. + Data DowntimeCreateRequestData `json:"data"` + // 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{} +} + +// NewDowntimeCreateRequest instantiates a new DowntimeCreateRequest 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 NewDowntimeCreateRequest(data DowntimeCreateRequestData) *DowntimeCreateRequest { + this := DowntimeCreateRequest{} + this.Data = data + return &this +} + +// NewDowntimeCreateRequestWithDefaults instantiates a new DowntimeCreateRequest 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 NewDowntimeCreateRequestWithDefaults() *DowntimeCreateRequest { + this := DowntimeCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *DowntimeCreateRequest) GetData() DowntimeCreateRequestData { + if o == nil { + var ret DowntimeCreateRequestData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *DowntimeCreateRequest) GetDataOk() (*DowntimeCreateRequestData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *DowntimeCreateRequest) SetData(v DowntimeCreateRequestData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *DowntimeCreateRequestData `json:"data"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + 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 + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_create_request_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_create_request_attributes.go new file mode 100644 index 000000000..2e8b508bc --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_create_request_attributes.go @@ -0,0 +1,373 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "fmt" + + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeCreateRequestAttributes Downtime details. +type DowntimeCreateRequestAttributes struct { + // The timezone in which to display the downtime's start and end times in Datadog applications. This is not used + // as an offset for scheduling. + DisplayTimezone datadog.NullableString `json:"display_timezone,omitempty"` + // A message to include with notifications for this downtime. Email notifications can be sent to specific users + // by using the same `@username` notation as events. + Message datadog.NullableString `json:"message,omitempty"` + // Monitor identifier for the downtime. + MonitorIdentifier DowntimeMonitorIdentifier `json:"monitor_identifier"` + // If the first recovery notification during a downtime should be muted. + MuteFirstRecoveryNotification *bool `json:"mute_first_recovery_notification,omitempty"` + // States that will trigger a monitor notification when the `notify_end_types` action occurs. + NotifyEndStates []DowntimeNotifyEndStateTypes `json:"notify_end_states,omitempty"` + // Actions that will trigger a monitor notification if the downtime is in the `notify_end_types` state. + NotifyEndTypes []DowntimeNotifyEndStateActions `json:"notify_end_types,omitempty"` + // Schedule for the downtime. + Schedule *DowntimeScheduleCreateRequest `json:"schedule,omitempty"` + // The scope to which the downtime applies. Must follow the [common search syntax](https://docs.datadoghq.com/logs/explorer/search_syntax/). + Scope string `json:"scope"` + // 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{} +} + +// NewDowntimeCreateRequestAttributes instantiates a new DowntimeCreateRequestAttributes 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 NewDowntimeCreateRequestAttributes(monitorIdentifier DowntimeMonitorIdentifier, scope string) *DowntimeCreateRequestAttributes { + this := DowntimeCreateRequestAttributes{} + var displayTimezone string = "UTC" + this.DisplayTimezone = *datadog.NewNullableString(&displayTimezone) + this.MonitorIdentifier = monitorIdentifier + this.Scope = scope + return &this +} + +// NewDowntimeCreateRequestAttributesWithDefaults instantiates a new DowntimeCreateRequestAttributes 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 NewDowntimeCreateRequestAttributesWithDefaults() *DowntimeCreateRequestAttributes { + this := DowntimeCreateRequestAttributes{} + var displayTimezone string = "UTC" + this.DisplayTimezone = *datadog.NewNullableString(&displayTimezone) + return &this +} + +// GetDisplayTimezone returns the DisplayTimezone field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DowntimeCreateRequestAttributes) GetDisplayTimezone() string { + if o == nil || o.DisplayTimezone.Get() == nil { + var ret string + return ret + } + return *o.DisplayTimezone.Get() +} + +// GetDisplayTimezoneOk returns a tuple with the DisplayTimezone field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *DowntimeCreateRequestAttributes) GetDisplayTimezoneOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.DisplayTimezone.Get(), o.DisplayTimezone.IsSet() +} + +// HasDisplayTimezone returns a boolean if a field has been set. +func (o *DowntimeCreateRequestAttributes) HasDisplayTimezone() bool { + return o != nil && o.DisplayTimezone.IsSet() +} + +// SetDisplayTimezone gets a reference to the given datadog.NullableString and assigns it to the DisplayTimezone field. +func (o *DowntimeCreateRequestAttributes) SetDisplayTimezone(v string) { + o.DisplayTimezone.Set(&v) +} + +// SetDisplayTimezoneNil sets the value for DisplayTimezone to be an explicit nil. +func (o *DowntimeCreateRequestAttributes) SetDisplayTimezoneNil() { + o.DisplayTimezone.Set(nil) +} + +// UnsetDisplayTimezone ensures that no value is present for DisplayTimezone, not even an explicit nil. +func (o *DowntimeCreateRequestAttributes) UnsetDisplayTimezone() { + o.DisplayTimezone.Unset() +} + +// GetMessage returns the Message field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DowntimeCreateRequestAttributes) GetMessage() string { + if o == nil || o.Message.Get() == nil { + var ret string + return ret + } + return *o.Message.Get() +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *DowntimeCreateRequestAttributes) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Message.Get(), o.Message.IsSet() +} + +// HasMessage returns a boolean if a field has been set. +func (o *DowntimeCreateRequestAttributes) HasMessage() bool { + return o != nil && o.Message.IsSet() +} + +// SetMessage gets a reference to the given datadog.NullableString and assigns it to the Message field. +func (o *DowntimeCreateRequestAttributes) SetMessage(v string) { + o.Message.Set(&v) +} + +// SetMessageNil sets the value for Message to be an explicit nil. +func (o *DowntimeCreateRequestAttributes) SetMessageNil() { + o.Message.Set(nil) +} + +// UnsetMessage ensures that no value is present for Message, not even an explicit nil. +func (o *DowntimeCreateRequestAttributes) UnsetMessage() { + o.Message.Unset() +} + +// GetMonitorIdentifier returns the MonitorIdentifier field value. +func (o *DowntimeCreateRequestAttributes) GetMonitorIdentifier() DowntimeMonitorIdentifier { + if o == nil { + var ret DowntimeMonitorIdentifier + return ret + } + return o.MonitorIdentifier +} + +// GetMonitorIdentifierOk returns a tuple with the MonitorIdentifier field value +// and a boolean to check if the value has been set. +func (o *DowntimeCreateRequestAttributes) GetMonitorIdentifierOk() (*DowntimeMonitorIdentifier, bool) { + if o == nil { + return nil, false + } + return &o.MonitorIdentifier, true +} + +// SetMonitorIdentifier sets field value. +func (o *DowntimeCreateRequestAttributes) SetMonitorIdentifier(v DowntimeMonitorIdentifier) { + o.MonitorIdentifier = v +} + +// GetMuteFirstRecoveryNotification returns the MuteFirstRecoveryNotification field value if set, zero value otherwise. +func (o *DowntimeCreateRequestAttributes) GetMuteFirstRecoveryNotification() bool { + if o == nil || o.MuteFirstRecoveryNotification == nil { + var ret bool + return ret + } + return *o.MuteFirstRecoveryNotification +} + +// GetMuteFirstRecoveryNotificationOk returns a tuple with the MuteFirstRecoveryNotification field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeCreateRequestAttributes) GetMuteFirstRecoveryNotificationOk() (*bool, bool) { + if o == nil || o.MuteFirstRecoveryNotification == nil { + return nil, false + } + return o.MuteFirstRecoveryNotification, true +} + +// HasMuteFirstRecoveryNotification returns a boolean if a field has been set. +func (o *DowntimeCreateRequestAttributes) HasMuteFirstRecoveryNotification() bool { + return o != nil && o.MuteFirstRecoveryNotification != nil +} + +// SetMuteFirstRecoveryNotification gets a reference to the given bool and assigns it to the MuteFirstRecoveryNotification field. +func (o *DowntimeCreateRequestAttributes) SetMuteFirstRecoveryNotification(v bool) { + o.MuteFirstRecoveryNotification = &v +} + +// GetNotifyEndStates returns the NotifyEndStates field value if set, zero value otherwise. +func (o *DowntimeCreateRequestAttributes) GetNotifyEndStates() []DowntimeNotifyEndStateTypes { + if o == nil || o.NotifyEndStates == nil { + var ret []DowntimeNotifyEndStateTypes + return ret + } + return o.NotifyEndStates +} + +// GetNotifyEndStatesOk returns a tuple with the NotifyEndStates field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeCreateRequestAttributes) GetNotifyEndStatesOk() (*[]DowntimeNotifyEndStateTypes, bool) { + if o == nil || o.NotifyEndStates == nil { + return nil, false + } + return &o.NotifyEndStates, true +} + +// HasNotifyEndStates returns a boolean if a field has been set. +func (o *DowntimeCreateRequestAttributes) HasNotifyEndStates() bool { + return o != nil && o.NotifyEndStates != nil +} + +// SetNotifyEndStates gets a reference to the given []DowntimeNotifyEndStateTypes and assigns it to the NotifyEndStates field. +func (o *DowntimeCreateRequestAttributes) SetNotifyEndStates(v []DowntimeNotifyEndStateTypes) { + o.NotifyEndStates = v +} + +// GetNotifyEndTypes returns the NotifyEndTypes field value if set, zero value otherwise. +func (o *DowntimeCreateRequestAttributes) GetNotifyEndTypes() []DowntimeNotifyEndStateActions { + if o == nil || o.NotifyEndTypes == nil { + var ret []DowntimeNotifyEndStateActions + return ret + } + return o.NotifyEndTypes +} + +// GetNotifyEndTypesOk returns a tuple with the NotifyEndTypes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeCreateRequestAttributes) GetNotifyEndTypesOk() (*[]DowntimeNotifyEndStateActions, bool) { + if o == nil || o.NotifyEndTypes == nil { + return nil, false + } + return &o.NotifyEndTypes, true +} + +// HasNotifyEndTypes returns a boolean if a field has been set. +func (o *DowntimeCreateRequestAttributes) HasNotifyEndTypes() bool { + return o != nil && o.NotifyEndTypes != nil +} + +// SetNotifyEndTypes gets a reference to the given []DowntimeNotifyEndStateActions and assigns it to the NotifyEndTypes field. +func (o *DowntimeCreateRequestAttributes) SetNotifyEndTypes(v []DowntimeNotifyEndStateActions) { + o.NotifyEndTypes = v +} + +// GetSchedule returns the Schedule field value if set, zero value otherwise. +func (o *DowntimeCreateRequestAttributes) GetSchedule() DowntimeScheduleCreateRequest { + if o == nil || o.Schedule == nil { + var ret DowntimeScheduleCreateRequest + return ret + } + return *o.Schedule +} + +// GetScheduleOk returns a tuple with the Schedule field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeCreateRequestAttributes) GetScheduleOk() (*DowntimeScheduleCreateRequest, bool) { + if o == nil || o.Schedule == nil { + return nil, false + } + return o.Schedule, true +} + +// HasSchedule returns a boolean if a field has been set. +func (o *DowntimeCreateRequestAttributes) HasSchedule() bool { + return o != nil && o.Schedule != nil +} + +// SetSchedule gets a reference to the given DowntimeScheduleCreateRequest and assigns it to the Schedule field. +func (o *DowntimeCreateRequestAttributes) SetSchedule(v DowntimeScheduleCreateRequest) { + o.Schedule = &v +} + +// GetScope returns the Scope field value. +func (o *DowntimeCreateRequestAttributes) GetScope() string { + if o == nil { + var ret string + return ret + } + return o.Scope +} + +// GetScopeOk returns a tuple with the Scope field value +// and a boolean to check if the value has been set. +func (o *DowntimeCreateRequestAttributes) GetScopeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Scope, true +} + +// SetScope sets field value. +func (o *DowntimeCreateRequestAttributes) SetScope(v string) { + o.Scope = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeCreateRequestAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.DisplayTimezone.IsSet() { + toSerialize["display_timezone"] = o.DisplayTimezone.Get() + } + if o.Message.IsSet() { + toSerialize["message"] = o.Message.Get() + } + toSerialize["monitor_identifier"] = o.MonitorIdentifier + if o.MuteFirstRecoveryNotification != nil { + toSerialize["mute_first_recovery_notification"] = o.MuteFirstRecoveryNotification + } + if o.NotifyEndStates != nil { + toSerialize["notify_end_states"] = o.NotifyEndStates + } + if o.NotifyEndTypes != nil { + toSerialize["notify_end_types"] = o.NotifyEndTypes + } + if o.Schedule != nil { + toSerialize["schedule"] = o.Schedule + } + toSerialize["scope"] = o.Scope + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + DisplayTimezone datadog.NullableString `json:"display_timezone,omitempty"` + Message datadog.NullableString `json:"message,omitempty"` + MonitorIdentifier *DowntimeMonitorIdentifier `json:"monitor_identifier"` + MuteFirstRecoveryNotification *bool `json:"mute_first_recovery_notification,omitempty"` + NotifyEndStates []DowntimeNotifyEndStateTypes `json:"notify_end_states,omitempty"` + NotifyEndTypes []DowntimeNotifyEndStateActions `json:"notify_end_types,omitempty"` + Schedule *DowntimeScheduleCreateRequest `json:"schedule,omitempty"` + Scope *string `json:"scope"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + if all.MonitorIdentifier == nil { + return fmt.Errorf("required field monitor_identifier missing") + } + 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{"display_timezone", "message", "monitor_identifier", "mute_first_recovery_notification", "notify_end_states", "notify_end_types", "schedule", "scope"}) + } else { + return err + } + o.DisplayTimezone = all.DisplayTimezone + o.Message = all.Message + o.MonitorIdentifier = *all.MonitorIdentifier + o.MuteFirstRecoveryNotification = all.MuteFirstRecoveryNotification + o.NotifyEndStates = all.NotifyEndStates + o.NotifyEndTypes = all.NotifyEndTypes + o.Schedule = all.Schedule + o.Scope = *all.Scope + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_create_request_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_create_request_data.go new file mode 100644 index 000000000..56ed8add6 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_create_request_data.go @@ -0,0 +1,150 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "fmt" + + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeCreateRequestData Object to create a downtime. +type DowntimeCreateRequestData struct { + // Downtime details. + Attributes DowntimeCreateRequestAttributes `json:"attributes"` + // Downtime resource type. + Type DowntimeResourceType `json:"type"` + // 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{} +} + +// NewDowntimeCreateRequestData instantiates a new DowntimeCreateRequestData 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 NewDowntimeCreateRequestData(attributes DowntimeCreateRequestAttributes, typeVar DowntimeResourceType) *DowntimeCreateRequestData { + this := DowntimeCreateRequestData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewDowntimeCreateRequestDataWithDefaults instantiates a new DowntimeCreateRequestData 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 NewDowntimeCreateRequestDataWithDefaults() *DowntimeCreateRequestData { + this := DowntimeCreateRequestData{} + var typeVar DowntimeResourceType = DOWNTIMERESOURCETYPE_DOWNTIME + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *DowntimeCreateRequestData) GetAttributes() DowntimeCreateRequestAttributes { + if o == nil { + var ret DowntimeCreateRequestAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *DowntimeCreateRequestData) GetAttributesOk() (*DowntimeCreateRequestAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *DowntimeCreateRequestData) SetAttributes(v DowntimeCreateRequestAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *DowntimeCreateRequestData) GetType() DowntimeResourceType { + if o == nil { + var ret DowntimeResourceType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *DowntimeCreateRequestData) GetTypeOk() (*DowntimeResourceType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *DowntimeCreateRequestData) SetType(v DowntimeResourceType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeCreateRequestData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeCreateRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *DowntimeCreateRequestAttributes `json:"attributes"` + Type *DowntimeResourceType `json:"type"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + 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"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_included_monitor_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_included_monitor_type.go new file mode 100644 index 000000000..e5c51506b --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_included_monitor_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/goccy/go-json" +) + +// DowntimeIncludedMonitorType Monitor resource type. +type DowntimeIncludedMonitorType string + +// List of DowntimeIncludedMonitorType. +const ( + DOWNTIMEINCLUDEDMONITORTYPE_MONITORS DowntimeIncludedMonitorType = "monitors" +) + +var allowedDowntimeIncludedMonitorTypeEnumValues = []DowntimeIncludedMonitorType{ + DOWNTIMEINCLUDEDMONITORTYPE_MONITORS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *DowntimeIncludedMonitorType) GetAllowedValues() []DowntimeIncludedMonitorType { + return allowedDowntimeIncludedMonitorTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *DowntimeIncludedMonitorType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = DowntimeIncludedMonitorType(value) + return nil +} + +// NewDowntimeIncludedMonitorTypeFromValue returns a pointer to a valid DowntimeIncludedMonitorType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewDowntimeIncludedMonitorTypeFromValue(v string) (*DowntimeIncludedMonitorType, error) { + ev := DowntimeIncludedMonitorType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for DowntimeIncludedMonitorType: valid values are %v", v, allowedDowntimeIncludedMonitorTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v DowntimeIncludedMonitorType) IsValid() bool { + for _, existing := range allowedDowntimeIncludedMonitorTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DowntimeIncludedMonitorType value. +func (v DowntimeIncludedMonitorType) Ptr() *DowntimeIncludedMonitorType { + return &v +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_meta.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_meta.go new file mode 100644 index 000000000..a822add0b --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_meta.go @@ -0,0 +1,113 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeMeta Pagination metadata returned by the API. +type DowntimeMeta struct { + // Object containing the total filtered count. + Page *DowntimeMetaPage `json:"page,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{} +} + +// NewDowntimeMeta instantiates a new DowntimeMeta 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 NewDowntimeMeta() *DowntimeMeta { + this := DowntimeMeta{} + return &this +} + +// NewDowntimeMetaWithDefaults instantiates a new DowntimeMeta 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 NewDowntimeMetaWithDefaults() *DowntimeMeta { + this := DowntimeMeta{} + return &this +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *DowntimeMeta) GetPage() DowntimeMetaPage { + if o == nil || o.Page == nil { + var ret DowntimeMetaPage + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeMeta) GetPageOk() (*DowntimeMetaPage, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *DowntimeMeta) HasPage() bool { + return o != nil && o.Page != nil +} + +// SetPage gets a reference to the given DowntimeMetaPage and assigns it to the Page field. +func (o *DowntimeMeta) SetPage(v DowntimeMetaPage) { + o.Page = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeMeta) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeMeta) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Page *DowntimeMetaPage `json:"page,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"page"}) + } else { + return err + } + + hasInvalidField := false + if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Page = all.Page + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_meta_page.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_meta_page.go new file mode 100644 index 000000000..393e0e954 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_meta_page.go @@ -0,0 +1,104 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeMetaPage Object containing the total filtered count. +type DowntimeMetaPage struct { + // Total count of elements matched by the filter. + TotalFilteredCount *int64 `json:"total_filtered_count,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{} +} + +// NewDowntimeMetaPage instantiates a new DowntimeMetaPage 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 NewDowntimeMetaPage() *DowntimeMetaPage { + this := DowntimeMetaPage{} + return &this +} + +// NewDowntimeMetaPageWithDefaults instantiates a new DowntimeMetaPage 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 NewDowntimeMetaPageWithDefaults() *DowntimeMetaPage { + this := DowntimeMetaPage{} + return &this +} + +// GetTotalFilteredCount returns the TotalFilteredCount field value if set, zero value otherwise. +func (o *DowntimeMetaPage) GetTotalFilteredCount() int64 { + if o == nil || o.TotalFilteredCount == nil { + var ret int64 + return ret + } + return *o.TotalFilteredCount +} + +// GetTotalFilteredCountOk returns a tuple with the TotalFilteredCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeMetaPage) GetTotalFilteredCountOk() (*int64, bool) { + if o == nil || o.TotalFilteredCount == nil { + return nil, false + } + return o.TotalFilteredCount, true +} + +// HasTotalFilteredCount returns a boolean if a field has been set. +func (o *DowntimeMetaPage) HasTotalFilteredCount() bool { + return o != nil && o.TotalFilteredCount != nil +} + +// SetTotalFilteredCount gets a reference to the given int64 and assigns it to the TotalFilteredCount field. +func (o *DowntimeMetaPage) SetTotalFilteredCount(v int64) { + o.TotalFilteredCount = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeMetaPage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.TotalFilteredCount != nil { + toSerialize["total_filtered_count"] = o.TotalFilteredCount + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeMetaPage) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + TotalFilteredCount *int64 `json:"total_filtered_count,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"total_filtered_count"}) + } else { + return err + } + o.TotalFilteredCount = all.TotalFilteredCount + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_monitor_identifier.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_monitor_identifier.go new file mode 100644 index 000000000..08d87a015 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_monitor_identifier.go @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/goccy/go-json" +) + +// DowntimeMonitorIdentifier - Monitor identifier for the downtime. +type DowntimeMonitorIdentifier struct { + DowntimeMonitorIdentifierId *DowntimeMonitorIdentifierId + DowntimeMonitorIdentifierTags *DowntimeMonitorIdentifierTags + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// DowntimeMonitorIdentifierIdAsDowntimeMonitorIdentifier is a convenience function that returns DowntimeMonitorIdentifierId wrapped in DowntimeMonitorIdentifier. +func DowntimeMonitorIdentifierIdAsDowntimeMonitorIdentifier(v *DowntimeMonitorIdentifierId) DowntimeMonitorIdentifier { + return DowntimeMonitorIdentifier{DowntimeMonitorIdentifierId: v} +} + +// DowntimeMonitorIdentifierTagsAsDowntimeMonitorIdentifier is a convenience function that returns DowntimeMonitorIdentifierTags wrapped in DowntimeMonitorIdentifier. +func DowntimeMonitorIdentifierTagsAsDowntimeMonitorIdentifier(v *DowntimeMonitorIdentifierTags) DowntimeMonitorIdentifier { + return DowntimeMonitorIdentifier{DowntimeMonitorIdentifierTags: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *DowntimeMonitorIdentifier) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into DowntimeMonitorIdentifierId + err = json.Unmarshal(data, &obj.DowntimeMonitorIdentifierId) + if err == nil { + if obj.DowntimeMonitorIdentifierId != nil && obj.DowntimeMonitorIdentifierId.UnparsedObject == nil { + jsonDowntimeMonitorIdentifierId, _ := json.Marshal(obj.DowntimeMonitorIdentifierId) + if string(jsonDowntimeMonitorIdentifierId) == "{}" { // empty struct + obj.DowntimeMonitorIdentifierId = nil + } else { + match++ + } + } else { + obj.DowntimeMonitorIdentifierId = nil + } + } else { + obj.DowntimeMonitorIdentifierId = nil + } + + // try to unmarshal data into DowntimeMonitorIdentifierTags + err = json.Unmarshal(data, &obj.DowntimeMonitorIdentifierTags) + if err == nil { + if obj.DowntimeMonitorIdentifierTags != nil && obj.DowntimeMonitorIdentifierTags.UnparsedObject == nil { + jsonDowntimeMonitorIdentifierTags, _ := json.Marshal(obj.DowntimeMonitorIdentifierTags) + if string(jsonDowntimeMonitorIdentifierTags) == "{}" { // empty struct + obj.DowntimeMonitorIdentifierTags = nil + } else { + match++ + } + } else { + obj.DowntimeMonitorIdentifierTags = nil + } + } else { + obj.DowntimeMonitorIdentifierTags = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.DowntimeMonitorIdentifierId = nil + obj.DowntimeMonitorIdentifierTags = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj DowntimeMonitorIdentifier) MarshalJSON() ([]byte, error) { + if obj.DowntimeMonitorIdentifierId != nil { + return json.Marshal(&obj.DowntimeMonitorIdentifierId) + } + + if obj.DowntimeMonitorIdentifierTags != nil { + return json.Marshal(&obj.DowntimeMonitorIdentifierTags) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *DowntimeMonitorIdentifier) GetActualInstance() interface{} { + if obj.DowntimeMonitorIdentifierId != nil { + return obj.DowntimeMonitorIdentifierId + } + + if obj.DowntimeMonitorIdentifierTags != nil { + return obj.DowntimeMonitorIdentifierTags + } + + // all schemas are nil + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_monitor_identifier_id.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_monitor_identifier_id.go new file mode 100644 index 000000000..ac5c6187e --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_monitor_identifier_id.go @@ -0,0 +1,103 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "fmt" + + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeMonitorIdentifierId Object of the monitor identifier. +type DowntimeMonitorIdentifierId struct { + // ID of the monitor to prevent notifications. + MonitorId int64 `json:"monitor_id"` + // 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{} +} + +// NewDowntimeMonitorIdentifierId instantiates a new DowntimeMonitorIdentifierId 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 NewDowntimeMonitorIdentifierId(monitorId int64) *DowntimeMonitorIdentifierId { + this := DowntimeMonitorIdentifierId{} + this.MonitorId = monitorId + return &this +} + +// NewDowntimeMonitorIdentifierIdWithDefaults instantiates a new DowntimeMonitorIdentifierId 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 NewDowntimeMonitorIdentifierIdWithDefaults() *DowntimeMonitorIdentifierId { + this := DowntimeMonitorIdentifierId{} + return &this +} + +// GetMonitorId returns the MonitorId field value. +func (o *DowntimeMonitorIdentifierId) GetMonitorId() int64 { + if o == nil { + var ret int64 + return ret + } + return o.MonitorId +} + +// GetMonitorIdOk returns a tuple with the MonitorId field value +// and a boolean to check if the value has been set. +func (o *DowntimeMonitorIdentifierId) GetMonitorIdOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.MonitorId, true +} + +// SetMonitorId sets field value. +func (o *DowntimeMonitorIdentifierId) SetMonitorId(v int64) { + o.MonitorId = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeMonitorIdentifierId) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["monitor_id"] = o.MonitorId + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeMonitorIdentifierId) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + MonitorId *int64 `json:"monitor_id"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + if all.MonitorId == nil { + return fmt.Errorf("required field monitor_id missing") + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"monitor_id"}) + } else { + return err + } + o.MonitorId = *all.MonitorId + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_monitor_identifier_tags.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_monitor_identifier_tags.go new file mode 100644 index 000000000..c65013651 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_monitor_identifier_tags.go @@ -0,0 +1,106 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeMonitorIdentifierTags Object of the monitor tags. +type DowntimeMonitorIdentifierTags struct { + // A list of monitor tags. For example, tags that are applied directly to monitors, + // not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies. + // The resulting downtime applies to monitors that match **all** provided monitor tags. Setting `monitor_tags` + // to `[*]` configures the downtime to mute all monitors for the given scope. + MonitorTags []string `json:"monitor_tags"` + // 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{} +} + +// NewDowntimeMonitorIdentifierTags instantiates a new DowntimeMonitorIdentifierTags 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 NewDowntimeMonitorIdentifierTags(monitorTags []string) *DowntimeMonitorIdentifierTags { + this := DowntimeMonitorIdentifierTags{} + this.MonitorTags = monitorTags + return &this +} + +// NewDowntimeMonitorIdentifierTagsWithDefaults instantiates a new DowntimeMonitorIdentifierTags 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 NewDowntimeMonitorIdentifierTagsWithDefaults() *DowntimeMonitorIdentifierTags { + this := DowntimeMonitorIdentifierTags{} + return &this +} + +// GetMonitorTags returns the MonitorTags field value. +func (o *DowntimeMonitorIdentifierTags) GetMonitorTags() []string { + if o == nil { + var ret []string + return ret + } + return o.MonitorTags +} + +// GetMonitorTagsOk returns a tuple with the MonitorTags field value +// and a boolean to check if the value has been set. +func (o *DowntimeMonitorIdentifierTags) GetMonitorTagsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.MonitorTags, true +} + +// SetMonitorTags sets field value. +func (o *DowntimeMonitorIdentifierTags) SetMonitorTags(v []string) { + o.MonitorTags = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeMonitorIdentifierTags) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["monitor_tags"] = o.MonitorTags + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeMonitorIdentifierTags) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + MonitorTags *[]string `json:"monitor_tags"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + if all.MonitorTags == nil { + return fmt.Errorf("required field monitor_tags missing") + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"monitor_tags"}) + } else { + return err + } + o.MonitorTags = *all.MonitorTags + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_monitor_included_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_monitor_included_attributes.go new file mode 100644 index 000000000..1e793f829 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_monitor_included_attributes.go @@ -0,0 +1,104 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeMonitorIncludedAttributes Attributes of the monitor identified by the downtime. +type DowntimeMonitorIncludedAttributes struct { + // The name of the monitor identified by the downtime. + 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{} +} + +// NewDowntimeMonitorIncludedAttributes instantiates a new DowntimeMonitorIncludedAttributes 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 NewDowntimeMonitorIncludedAttributes() *DowntimeMonitorIncludedAttributes { + this := DowntimeMonitorIncludedAttributes{} + return &this +} + +// NewDowntimeMonitorIncludedAttributesWithDefaults instantiates a new DowntimeMonitorIncludedAttributes 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 NewDowntimeMonitorIncludedAttributesWithDefaults() *DowntimeMonitorIncludedAttributes { + this := DowntimeMonitorIncludedAttributes{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *DowntimeMonitorIncludedAttributes) 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 *DowntimeMonitorIncludedAttributes) 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 *DowntimeMonitorIncludedAttributes) 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 *DowntimeMonitorIncludedAttributes) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeMonitorIncludedAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + 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 *DowntimeMonitorIncludedAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Name *string `json:"name,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + 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 + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_monitor_included_item.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_monitor_included_item.go new file mode 100644 index 000000000..8d7d6f175 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_monitor_included_item.go @@ -0,0 +1,191 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeMonitorIncludedItem Information about the monitor identified by the downtime. +type DowntimeMonitorIncludedItem struct { + // Attributes of the monitor identified by the downtime. + Attributes *DowntimeMonitorIncludedAttributes `json:"attributes,omitempty"` + // ID of the monitor identified by the downtime. + Id *int64 `json:"id,omitempty"` + // Monitor resource type. + Type *DowntimeIncludedMonitorType `json:"type,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{} +} + +// NewDowntimeMonitorIncludedItem instantiates a new DowntimeMonitorIncludedItem 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 NewDowntimeMonitorIncludedItem() *DowntimeMonitorIncludedItem { + this := DowntimeMonitorIncludedItem{} + var typeVar DowntimeIncludedMonitorType = DOWNTIMEINCLUDEDMONITORTYPE_MONITORS + this.Type = &typeVar + return &this +} + +// NewDowntimeMonitorIncludedItemWithDefaults instantiates a new DowntimeMonitorIncludedItem 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 NewDowntimeMonitorIncludedItemWithDefaults() *DowntimeMonitorIncludedItem { + this := DowntimeMonitorIncludedItem{} + var typeVar DowntimeIncludedMonitorType = DOWNTIMEINCLUDEDMONITORTYPE_MONITORS + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *DowntimeMonitorIncludedItem) GetAttributes() DowntimeMonitorIncludedAttributes { + if o == nil || o.Attributes == nil { + var ret DowntimeMonitorIncludedAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeMonitorIncludedItem) GetAttributesOk() (*DowntimeMonitorIncludedAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *DowntimeMonitorIncludedItem) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given DowntimeMonitorIncludedAttributes and assigns it to the Attributes field. +func (o *DowntimeMonitorIncludedItem) SetAttributes(v DowntimeMonitorIncludedAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *DowntimeMonitorIncludedItem) GetId() int64 { + if o == nil || o.Id == nil { + var ret int64 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeMonitorIncludedItem) GetIdOk() (*int64, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *DowntimeMonitorIncludedItem) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *DowntimeMonitorIncludedItem) SetId(v int64) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *DowntimeMonitorIncludedItem) GetType() DowntimeIncludedMonitorType { + if o == nil || o.Type == nil { + var ret DowntimeIncludedMonitorType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeMonitorIncludedItem) GetTypeOk() (*DowntimeIncludedMonitorType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *DowntimeMonitorIncludedItem) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given DowntimeIncludedMonitorType and assigns it to the Type field. +func (o *DowntimeMonitorIncludedItem) SetType(v DowntimeIncludedMonitorType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeMonitorIncludedItem) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeMonitorIncludedItem) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *DowntimeMonitorIncludedAttributes `json:"attributes,omitempty"` + Id *int64 `json:"id,omitempty"` + Type *DowntimeIncludedMonitorType `json:"type,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_notify_end_state_actions.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_notify_end_state_actions.go new file mode 100644 index 000000000..d01dbf589 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_notify_end_state_actions.go @@ -0,0 +1,66 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "fmt" + + "github.com/goccy/go-json" +) + +// DowntimeNotifyEndStateActions Action that will trigger a monitor notification if the downtime is in the `notify_end_types` state. +type DowntimeNotifyEndStateActions string + +// List of DowntimeNotifyEndStateActions. +const ( + DOWNTIMENOTIFYENDSTATEACTIONS_CANCELED DowntimeNotifyEndStateActions = "canceled" + DOWNTIMENOTIFYENDSTATEACTIONS_EXPIRED DowntimeNotifyEndStateActions = "expired" +) + +var allowedDowntimeNotifyEndStateActionsEnumValues = []DowntimeNotifyEndStateActions{ + DOWNTIMENOTIFYENDSTATEACTIONS_CANCELED, + DOWNTIMENOTIFYENDSTATEACTIONS_EXPIRED, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *DowntimeNotifyEndStateActions) GetAllowedValues() []DowntimeNotifyEndStateActions { + return allowedDowntimeNotifyEndStateActionsEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *DowntimeNotifyEndStateActions) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = DowntimeNotifyEndStateActions(value) + return nil +} + +// NewDowntimeNotifyEndStateActionsFromValue returns a pointer to a valid DowntimeNotifyEndStateActions +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewDowntimeNotifyEndStateActionsFromValue(v string) (*DowntimeNotifyEndStateActions, error) { + ev := DowntimeNotifyEndStateActions(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for DowntimeNotifyEndStateActions: valid values are %v", v, allowedDowntimeNotifyEndStateActionsEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v DowntimeNotifyEndStateActions) IsValid() bool { + for _, existing := range allowedDowntimeNotifyEndStateActionsEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DowntimeNotifyEndStateActions value. +func (v DowntimeNotifyEndStateActions) Ptr() *DowntimeNotifyEndStateActions { + return &v +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_notify_end_state_types.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_notify_end_state_types.go new file mode 100644 index 000000000..79a710213 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_notify_end_state_types.go @@ -0,0 +1,68 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "fmt" + + "github.com/goccy/go-json" +) + +// DowntimeNotifyEndStateTypes State that will trigger a monitor notification when the `notify_end_types` action occurs. +type DowntimeNotifyEndStateTypes string + +// List of DowntimeNotifyEndStateTypes. +const ( + DOWNTIMENOTIFYENDSTATETYPES_ALERT DowntimeNotifyEndStateTypes = "alert" + DOWNTIMENOTIFYENDSTATETYPES_NO_DATA DowntimeNotifyEndStateTypes = "no data" + DOWNTIMENOTIFYENDSTATETYPES_WARN DowntimeNotifyEndStateTypes = "warn" +) + +var allowedDowntimeNotifyEndStateTypesEnumValues = []DowntimeNotifyEndStateTypes{ + DOWNTIMENOTIFYENDSTATETYPES_ALERT, + DOWNTIMENOTIFYENDSTATETYPES_NO_DATA, + DOWNTIMENOTIFYENDSTATETYPES_WARN, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *DowntimeNotifyEndStateTypes) GetAllowedValues() []DowntimeNotifyEndStateTypes { + return allowedDowntimeNotifyEndStateTypesEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *DowntimeNotifyEndStateTypes) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = DowntimeNotifyEndStateTypes(value) + return nil +} + +// NewDowntimeNotifyEndStateTypesFromValue returns a pointer to a valid DowntimeNotifyEndStateTypes +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewDowntimeNotifyEndStateTypesFromValue(v string) (*DowntimeNotifyEndStateTypes, error) { + ev := DowntimeNotifyEndStateTypes(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for DowntimeNotifyEndStateTypes: valid values are %v", v, allowedDowntimeNotifyEndStateTypesEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v DowntimeNotifyEndStateTypes) IsValid() bool { + for _, existing := range allowedDowntimeNotifyEndStateTypesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DowntimeNotifyEndStateTypes value. +func (v DowntimeNotifyEndStateTypes) Ptr() *DowntimeNotifyEndStateTypes { + return &v +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_relationships.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_relationships.go new file mode 100644 index 000000000..1490382b8 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_relationships.go @@ -0,0 +1,151 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeRelationships All relationships associated with downtime. +type DowntimeRelationships struct { + // The user who created the downtime. + CreatedBy *DowntimeRelationshipsCreatedBy `json:"created_by,omitempty"` + // The monitor identified by the downtime. + Monitor *DowntimeRelationshipsMonitor `json:"monitor,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{} +} + +// NewDowntimeRelationships instantiates a new DowntimeRelationships 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 NewDowntimeRelationships() *DowntimeRelationships { + this := DowntimeRelationships{} + return &this +} + +// NewDowntimeRelationshipsWithDefaults instantiates a new DowntimeRelationships 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 NewDowntimeRelationshipsWithDefaults() *DowntimeRelationships { + this := DowntimeRelationships{} + return &this +} + +// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. +func (o *DowntimeRelationships) GetCreatedBy() DowntimeRelationshipsCreatedBy { + if o == nil || o.CreatedBy == nil { + var ret DowntimeRelationshipsCreatedBy + return ret + } + return *o.CreatedBy +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeRelationships) GetCreatedByOk() (*DowntimeRelationshipsCreatedBy, bool) { + if o == nil || o.CreatedBy == nil { + return nil, false + } + return o.CreatedBy, true +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *DowntimeRelationships) HasCreatedBy() bool { + return o != nil && o.CreatedBy != nil +} + +// SetCreatedBy gets a reference to the given DowntimeRelationshipsCreatedBy and assigns it to the CreatedBy field. +func (o *DowntimeRelationships) SetCreatedBy(v DowntimeRelationshipsCreatedBy) { + o.CreatedBy = &v +} + +// GetMonitor returns the Monitor field value if set, zero value otherwise. +func (o *DowntimeRelationships) GetMonitor() DowntimeRelationshipsMonitor { + if o == nil || o.Monitor == nil { + var ret DowntimeRelationshipsMonitor + return ret + } + return *o.Monitor +} + +// GetMonitorOk returns a tuple with the Monitor field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeRelationships) GetMonitorOk() (*DowntimeRelationshipsMonitor, bool) { + if o == nil || o.Monitor == nil { + return nil, false + } + return o.Monitor, true +} + +// HasMonitor returns a boolean if a field has been set. +func (o *DowntimeRelationships) HasMonitor() bool { + return o != nil && o.Monitor != nil +} + +// SetMonitor gets a reference to the given DowntimeRelationshipsMonitor and assigns it to the Monitor field. +func (o *DowntimeRelationships) SetMonitor(v DowntimeRelationshipsMonitor) { + o.Monitor = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CreatedBy != nil { + toSerialize["created_by"] = o.CreatedBy + } + if o.Monitor != nil { + toSerialize["monitor"] = o.Monitor + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeRelationships) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CreatedBy *DowntimeRelationshipsCreatedBy `json:"created_by,omitempty"` + Monitor *DowntimeRelationshipsMonitor `json:"monitor,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"created_by", "monitor"}) + } else { + return err + } + + hasInvalidField := false + if all.CreatedBy != nil && all.CreatedBy.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.CreatedBy = all.CreatedBy + if all.Monitor != nil && all.Monitor.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Monitor = all.Monitor + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_relationships_created_by.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_relationships_created_by.go new file mode 100644 index 000000000..92939e49f --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_relationships_created_by.go @@ -0,0 +1,115 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeRelationshipsCreatedBy The user who created the downtime. +type DowntimeRelationshipsCreatedBy struct { + // Data for the user who created the downtime. + Data NullableDowntimeRelationshipsCreatedByData `json:"data,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{} +} + +// NewDowntimeRelationshipsCreatedBy instantiates a new DowntimeRelationshipsCreatedBy 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 NewDowntimeRelationshipsCreatedBy() *DowntimeRelationshipsCreatedBy { + this := DowntimeRelationshipsCreatedBy{} + return &this +} + +// NewDowntimeRelationshipsCreatedByWithDefaults instantiates a new DowntimeRelationshipsCreatedBy 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 NewDowntimeRelationshipsCreatedByWithDefaults() *DowntimeRelationshipsCreatedBy { + this := DowntimeRelationshipsCreatedBy{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DowntimeRelationshipsCreatedBy) GetData() DowntimeRelationshipsCreatedByData { + if o == nil || o.Data.Get() == nil { + var ret DowntimeRelationshipsCreatedByData + return ret + } + return *o.Data.Get() +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *DowntimeRelationshipsCreatedBy) GetDataOk() (*DowntimeRelationshipsCreatedByData, bool) { + if o == nil { + return nil, false + } + return o.Data.Get(), o.Data.IsSet() +} + +// HasData returns a boolean if a field has been set. +func (o *DowntimeRelationshipsCreatedBy) HasData() bool { + return o != nil && o.Data.IsSet() +} + +// SetData gets a reference to the given NullableDowntimeRelationshipsCreatedByData and assigns it to the Data field. +func (o *DowntimeRelationshipsCreatedBy) SetData(v DowntimeRelationshipsCreatedByData) { + o.Data.Set(&v) +} + +// SetDataNil sets the value for Data to be an explicit nil. +func (o *DowntimeRelationshipsCreatedBy) SetDataNil() { + o.Data.Set(nil) +} + +// UnsetData ensures that no value is present for Data, not even an explicit nil. +func (o *DowntimeRelationshipsCreatedBy) UnsetData() { + o.Data.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeRelationshipsCreatedBy) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data.IsSet() { + toSerialize["data"] = o.Data.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeRelationshipsCreatedBy) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data NullableDowntimeRelationshipsCreatedByData `json:"data,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + 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 + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_relationships_created_by_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_relationships_created_by_data.go new file mode 100644 index 000000000..dd22905b7 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_relationships_created_by_data.go @@ -0,0 +1,203 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeRelationshipsCreatedByData Data for the user who created the downtime. +type DowntimeRelationshipsCreatedByData struct { + // User ID of the downtime creator. + Id *string `json:"id,omitempty"` + // Users resource type. + Type *UsersType `json:"type,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{} +} + +// NewDowntimeRelationshipsCreatedByData instantiates a new DowntimeRelationshipsCreatedByData 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 NewDowntimeRelationshipsCreatedByData() *DowntimeRelationshipsCreatedByData { + this := DowntimeRelationshipsCreatedByData{} + var typeVar UsersType = USERSTYPE_USERS + this.Type = &typeVar + return &this +} + +// NewDowntimeRelationshipsCreatedByDataWithDefaults instantiates a new DowntimeRelationshipsCreatedByData 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 NewDowntimeRelationshipsCreatedByDataWithDefaults() *DowntimeRelationshipsCreatedByData { + this := DowntimeRelationshipsCreatedByData{} + var typeVar UsersType = USERSTYPE_USERS + this.Type = &typeVar + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *DowntimeRelationshipsCreatedByData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeRelationshipsCreatedByData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *DowntimeRelationshipsCreatedByData) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *DowntimeRelationshipsCreatedByData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *DowntimeRelationshipsCreatedByData) GetType() UsersType { + if o == nil || o.Type == nil { + var ret UsersType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeRelationshipsCreatedByData) GetTypeOk() (*UsersType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *DowntimeRelationshipsCreatedByData) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given UsersType and assigns it to the Type field. +func (o *DowntimeRelationshipsCreatedByData) SetType(v UsersType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeRelationshipsCreatedByData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeRelationshipsCreatedByData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *string `json:"id,omitempty"` + Type *UsersType `json:"type,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) + } else { + return err + } + + hasInvalidField := false + o.Id = all.Id + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} + +// NullableDowntimeRelationshipsCreatedByData handles when a null is used for DowntimeRelationshipsCreatedByData. +type NullableDowntimeRelationshipsCreatedByData struct { + value *DowntimeRelationshipsCreatedByData + isSet bool +} + +// Get returns the associated value. +func (v NullableDowntimeRelationshipsCreatedByData) Get() *DowntimeRelationshipsCreatedByData { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableDowntimeRelationshipsCreatedByData) Set(val *DowntimeRelationshipsCreatedByData) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableDowntimeRelationshipsCreatedByData) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableDowntimeRelationshipsCreatedByData) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableDowntimeRelationshipsCreatedByData initializes the struct as if Set has been called. +func NewNullableDowntimeRelationshipsCreatedByData(val *DowntimeRelationshipsCreatedByData) *NullableDowntimeRelationshipsCreatedByData { + return &NullableDowntimeRelationshipsCreatedByData{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableDowntimeRelationshipsCreatedByData) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableDowntimeRelationshipsCreatedByData) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_relationships_monitor.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_relationships_monitor.go new file mode 100644 index 000000000..783753997 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_relationships_monitor.go @@ -0,0 +1,115 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeRelationshipsMonitor The monitor identified by the downtime. +type DowntimeRelationshipsMonitor struct { + // Data for the monitor. + Data NullableDowntimeRelationshipsMonitorData `json:"data,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{} +} + +// NewDowntimeRelationshipsMonitor instantiates a new DowntimeRelationshipsMonitor 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 NewDowntimeRelationshipsMonitor() *DowntimeRelationshipsMonitor { + this := DowntimeRelationshipsMonitor{} + return &this +} + +// NewDowntimeRelationshipsMonitorWithDefaults instantiates a new DowntimeRelationshipsMonitor 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 NewDowntimeRelationshipsMonitorWithDefaults() *DowntimeRelationshipsMonitor { + this := DowntimeRelationshipsMonitor{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DowntimeRelationshipsMonitor) GetData() DowntimeRelationshipsMonitorData { + if o == nil || o.Data.Get() == nil { + var ret DowntimeRelationshipsMonitorData + return ret + } + return *o.Data.Get() +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *DowntimeRelationshipsMonitor) GetDataOk() (*DowntimeRelationshipsMonitorData, bool) { + if o == nil { + return nil, false + } + return o.Data.Get(), o.Data.IsSet() +} + +// HasData returns a boolean if a field has been set. +func (o *DowntimeRelationshipsMonitor) HasData() bool { + return o != nil && o.Data.IsSet() +} + +// SetData gets a reference to the given NullableDowntimeRelationshipsMonitorData and assigns it to the Data field. +func (o *DowntimeRelationshipsMonitor) SetData(v DowntimeRelationshipsMonitorData) { + o.Data.Set(&v) +} + +// SetDataNil sets the value for Data to be an explicit nil. +func (o *DowntimeRelationshipsMonitor) SetDataNil() { + o.Data.Set(nil) +} + +// UnsetData ensures that no value is present for Data, not even an explicit nil. +func (o *DowntimeRelationshipsMonitor) UnsetData() { + o.Data.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeRelationshipsMonitor) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data.IsSet() { + toSerialize["data"] = o.Data.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeRelationshipsMonitor) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data NullableDowntimeRelationshipsMonitorData `json:"data,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + 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 + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_relationships_monitor_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_relationships_monitor_data.go new file mode 100644 index 000000000..03b06cd30 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_relationships_monitor_data.go @@ -0,0 +1,203 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeRelationshipsMonitorData Data for the monitor. +type DowntimeRelationshipsMonitorData struct { + // Monitor ID of the downtime. + Id *int64 `json:"id,omitempty"` + // Monitor resource type. + Type *DowntimeIncludedMonitorType `json:"type,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{} +} + +// NewDowntimeRelationshipsMonitorData instantiates a new DowntimeRelationshipsMonitorData 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 NewDowntimeRelationshipsMonitorData() *DowntimeRelationshipsMonitorData { + this := DowntimeRelationshipsMonitorData{} + var typeVar DowntimeIncludedMonitorType = DOWNTIMEINCLUDEDMONITORTYPE_MONITORS + this.Type = &typeVar + return &this +} + +// NewDowntimeRelationshipsMonitorDataWithDefaults instantiates a new DowntimeRelationshipsMonitorData 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 NewDowntimeRelationshipsMonitorDataWithDefaults() *DowntimeRelationshipsMonitorData { + this := DowntimeRelationshipsMonitorData{} + var typeVar DowntimeIncludedMonitorType = DOWNTIMEINCLUDEDMONITORTYPE_MONITORS + this.Type = &typeVar + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *DowntimeRelationshipsMonitorData) GetId() int64 { + if o == nil || o.Id == nil { + var ret int64 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeRelationshipsMonitorData) GetIdOk() (*int64, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *DowntimeRelationshipsMonitorData) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *DowntimeRelationshipsMonitorData) SetId(v int64) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *DowntimeRelationshipsMonitorData) GetType() DowntimeIncludedMonitorType { + if o == nil || o.Type == nil { + var ret DowntimeIncludedMonitorType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeRelationshipsMonitorData) GetTypeOk() (*DowntimeIncludedMonitorType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *DowntimeRelationshipsMonitorData) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given DowntimeIncludedMonitorType and assigns it to the Type field. +func (o *DowntimeRelationshipsMonitorData) SetType(v DowntimeIncludedMonitorType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeRelationshipsMonitorData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeRelationshipsMonitorData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *int64 `json:"id,omitempty"` + Type *DowntimeIncludedMonitorType `json:"type,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) + } else { + return err + } + + hasInvalidField := false + o.Id = all.Id + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} + +// NullableDowntimeRelationshipsMonitorData handles when a null is used for DowntimeRelationshipsMonitorData. +type NullableDowntimeRelationshipsMonitorData struct { + value *DowntimeRelationshipsMonitorData + isSet bool +} + +// Get returns the associated value. +func (v NullableDowntimeRelationshipsMonitorData) Get() *DowntimeRelationshipsMonitorData { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableDowntimeRelationshipsMonitorData) Set(val *DowntimeRelationshipsMonitorData) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableDowntimeRelationshipsMonitorData) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableDowntimeRelationshipsMonitorData) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableDowntimeRelationshipsMonitorData initializes the struct as if Set has been called. +func NewNullableDowntimeRelationshipsMonitorData(val *DowntimeRelationshipsMonitorData) *NullableDowntimeRelationshipsMonitorData { + return &NullableDowntimeRelationshipsMonitorData{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableDowntimeRelationshipsMonitorData) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableDowntimeRelationshipsMonitorData) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_resource_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_resource_type.go new file mode 100644 index 000000000..b72c007d0 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_resource_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/goccy/go-json" +) + +// DowntimeResourceType Downtime resource type. +type DowntimeResourceType string + +// List of DowntimeResourceType. +const ( + DOWNTIMERESOURCETYPE_DOWNTIME DowntimeResourceType = "downtime" +) + +var allowedDowntimeResourceTypeEnumValues = []DowntimeResourceType{ + DOWNTIMERESOURCETYPE_DOWNTIME, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *DowntimeResourceType) GetAllowedValues() []DowntimeResourceType { + return allowedDowntimeResourceTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *DowntimeResourceType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = DowntimeResourceType(value) + return nil +} + +// NewDowntimeResourceTypeFromValue returns a pointer to a valid DowntimeResourceType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewDowntimeResourceTypeFromValue(v string) (*DowntimeResourceType, error) { + ev := DowntimeResourceType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for DowntimeResourceType: valid values are %v", v, allowedDowntimeResourceTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v DowntimeResourceType) IsValid() bool { + for _, existing := range allowedDowntimeResourceTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DowntimeResourceType value. +func (v DowntimeResourceType) Ptr() *DowntimeResourceType { + return &v +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_response.go new file mode 100644 index 000000000..dec67a5e6 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_response.go @@ -0,0 +1,151 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeResponse Downtiming gives you greater control over monitor notifications by +// allowing you to globally exclude scopes from alerting. +// Downtime settings, which can be scheduled with start and end times, +// prevent all alerting related to specified Datadog tags. +type DowntimeResponse struct { + // Downtime data. + Data *DowntimeResponseData `json:"data,omitempty"` + // Array of objects related to the downtime that the user requested. + Included []DowntimeResponseIncludedItem `json:"included,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{} +} + +// NewDowntimeResponse instantiates a new DowntimeResponse 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 NewDowntimeResponse() *DowntimeResponse { + this := DowntimeResponse{} + return &this +} + +// NewDowntimeResponseWithDefaults instantiates a new DowntimeResponse 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 NewDowntimeResponseWithDefaults() *DowntimeResponse { + this := DowntimeResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *DowntimeResponse) GetData() DowntimeResponseData { + if o == nil || o.Data == nil { + var ret DowntimeResponseData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeResponse) GetDataOk() (*DowntimeResponseData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *DowntimeResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given DowntimeResponseData and assigns it to the Data field. +func (o *DowntimeResponse) SetData(v DowntimeResponseData) { + o.Data = &v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *DowntimeResponse) GetIncluded() []DowntimeResponseIncludedItem { + if o == nil || o.Included == nil { + var ret []DowntimeResponseIncludedItem + return ret + } + return o.Included +} + +// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeResponse) GetIncludedOk() (*[]DowntimeResponseIncludedItem, bool) { + if o == nil || o.Included == nil { + return nil, false + } + return &o.Included, true +} + +// HasIncluded returns a boolean if a field has been set. +func (o *DowntimeResponse) HasIncluded() bool { + return o != nil && o.Included != nil +} + +// SetIncluded gets a reference to the given []DowntimeResponseIncludedItem and assigns it to the Included field. +func (o *DowntimeResponse) SetIncluded(v []DowntimeResponseIncludedItem) { + o.Included = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Included != nil { + toSerialize["included"] = o.Included + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *DowntimeResponseData `json:"data,omitempty"` + Included []DowntimeResponseIncludedItem `json:"included,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "included"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + o.Included = all.Included + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_response_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_response_attributes.go new file mode 100644 index 000000000..0e2a67129 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_response_attributes.go @@ -0,0 +1,550 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "time" + + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeResponseAttributes Downtime details. +type DowntimeResponseAttributes struct { + // Time that the downtime was canceled. + Canceled datadog.NullableTime `json:"canceled,omitempty"` + // Creation time of the downtime. + Created *time.Time `json:"created,omitempty"` + // The timezone in which to display the downtime's start and end times in Datadog applications. This is not used + // as an offset for scheduling. + DisplayTimezone datadog.NullableString `json:"display_timezone,omitempty"` + // A message to include with notifications for this downtime. Email notifications can be sent to specific users + // by using the same `@username` notation as events. + Message datadog.NullableString `json:"message,omitempty"` + // Time that the downtime was last modified. + Modified *time.Time `json:"modified,omitempty"` + // Monitor identifier for the downtime. + MonitorIdentifier *DowntimeMonitorIdentifier `json:"monitor_identifier,omitempty"` + // If the first recovery notification during a downtime should be muted. + MuteFirstRecoveryNotification *bool `json:"mute_first_recovery_notification,omitempty"` + // States that will trigger a monitor notification when the `notify_end_types` action occurs. + NotifyEndStates []DowntimeNotifyEndStateTypes `json:"notify_end_states,omitempty"` + // Actions that will trigger a monitor notification if the downtime is in the `notify_end_types` state. + NotifyEndTypes []DowntimeNotifyEndStateActions `json:"notify_end_types,omitempty"` + // The schedule that defines when the monitor starts, stops, and recurs. There are two types of schedules: + // one-time and recurring. Recurring schedules may have up to five RRULE-based recurrences. If no schedules are + // provided, the downtime will begin immediately and never end. + Schedule *DowntimeScheduleResponse `json:"schedule,omitempty"` + // The scope to which the downtime applies. Must follow the [common search syntax](https://docs.datadoghq.com/logs/explorer/search_syntax/). + Scope *string `json:"scope,omitempty"` + // The current status of the downtime. + Status *DowntimeStatus `json:"status,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{} +} + +// NewDowntimeResponseAttributes instantiates a new DowntimeResponseAttributes 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 NewDowntimeResponseAttributes() *DowntimeResponseAttributes { + this := DowntimeResponseAttributes{} + var displayTimezone string = "UTC" + this.DisplayTimezone = *datadog.NewNullableString(&displayTimezone) + return &this +} + +// NewDowntimeResponseAttributesWithDefaults instantiates a new DowntimeResponseAttributes 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 NewDowntimeResponseAttributesWithDefaults() *DowntimeResponseAttributes { + this := DowntimeResponseAttributes{} + var displayTimezone string = "UTC" + this.DisplayTimezone = *datadog.NewNullableString(&displayTimezone) + return &this +} + +// GetCanceled returns the Canceled field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DowntimeResponseAttributes) GetCanceled() time.Time { + if o == nil || o.Canceled.Get() == nil { + var ret time.Time + return ret + } + return *o.Canceled.Get() +} + +// GetCanceledOk returns a tuple with the Canceled field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *DowntimeResponseAttributes) GetCanceledOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.Canceled.Get(), o.Canceled.IsSet() +} + +// HasCanceled returns a boolean if a field has been set. +func (o *DowntimeResponseAttributes) HasCanceled() bool { + return o != nil && o.Canceled.IsSet() +} + +// SetCanceled gets a reference to the given datadog.NullableTime and assigns it to the Canceled field. +func (o *DowntimeResponseAttributes) SetCanceled(v time.Time) { + o.Canceled.Set(&v) +} + +// SetCanceledNil sets the value for Canceled to be an explicit nil. +func (o *DowntimeResponseAttributes) SetCanceledNil() { + o.Canceled.Set(nil) +} + +// UnsetCanceled ensures that no value is present for Canceled, not even an explicit nil. +func (o *DowntimeResponseAttributes) UnsetCanceled() { + o.Canceled.Unset() +} + +// GetCreated returns the Created field value if set, zero value otherwise. +func (o *DowntimeResponseAttributes) GetCreated() time.Time { + if o == nil || o.Created == nil { + var ret time.Time + return ret + } + return *o.Created +} + +// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeResponseAttributes) GetCreatedOk() (*time.Time, bool) { + if o == nil || o.Created == nil { + return nil, false + } + return o.Created, true +} + +// HasCreated returns a boolean if a field has been set. +func (o *DowntimeResponseAttributes) HasCreated() bool { + return o != nil && o.Created != nil +} + +// SetCreated gets a reference to the given time.Time and assigns it to the Created field. +func (o *DowntimeResponseAttributes) SetCreated(v time.Time) { + o.Created = &v +} + +// GetDisplayTimezone returns the DisplayTimezone field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DowntimeResponseAttributes) GetDisplayTimezone() string { + if o == nil || o.DisplayTimezone.Get() == nil { + var ret string + return ret + } + return *o.DisplayTimezone.Get() +} + +// GetDisplayTimezoneOk returns a tuple with the DisplayTimezone field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *DowntimeResponseAttributes) GetDisplayTimezoneOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.DisplayTimezone.Get(), o.DisplayTimezone.IsSet() +} + +// HasDisplayTimezone returns a boolean if a field has been set. +func (o *DowntimeResponseAttributes) HasDisplayTimezone() bool { + return o != nil && o.DisplayTimezone.IsSet() +} + +// SetDisplayTimezone gets a reference to the given datadog.NullableString and assigns it to the DisplayTimezone field. +func (o *DowntimeResponseAttributes) SetDisplayTimezone(v string) { + o.DisplayTimezone.Set(&v) +} + +// SetDisplayTimezoneNil sets the value for DisplayTimezone to be an explicit nil. +func (o *DowntimeResponseAttributes) SetDisplayTimezoneNil() { + o.DisplayTimezone.Set(nil) +} + +// UnsetDisplayTimezone ensures that no value is present for DisplayTimezone, not even an explicit nil. +func (o *DowntimeResponseAttributes) UnsetDisplayTimezone() { + o.DisplayTimezone.Unset() +} + +// GetMessage returns the Message field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DowntimeResponseAttributes) GetMessage() string { + if o == nil || o.Message.Get() == nil { + var ret string + return ret + } + return *o.Message.Get() +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *DowntimeResponseAttributes) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Message.Get(), o.Message.IsSet() +} + +// HasMessage returns a boolean if a field has been set. +func (o *DowntimeResponseAttributes) HasMessage() bool { + return o != nil && o.Message.IsSet() +} + +// SetMessage gets a reference to the given datadog.NullableString and assigns it to the Message field. +func (o *DowntimeResponseAttributes) SetMessage(v string) { + o.Message.Set(&v) +} + +// SetMessageNil sets the value for Message to be an explicit nil. +func (o *DowntimeResponseAttributes) SetMessageNil() { + o.Message.Set(nil) +} + +// UnsetMessage ensures that no value is present for Message, not even an explicit nil. +func (o *DowntimeResponseAttributes) UnsetMessage() { + o.Message.Unset() +} + +// GetModified returns the Modified field value if set, zero value otherwise. +func (o *DowntimeResponseAttributes) GetModified() time.Time { + if o == nil || o.Modified == nil { + var ret time.Time + return ret + } + return *o.Modified +} + +// GetModifiedOk returns a tuple with the Modified field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeResponseAttributes) GetModifiedOk() (*time.Time, bool) { + if o == nil || o.Modified == nil { + return nil, false + } + return o.Modified, true +} + +// HasModified returns a boolean if a field has been set. +func (o *DowntimeResponseAttributes) HasModified() bool { + return o != nil && o.Modified != nil +} + +// SetModified gets a reference to the given time.Time and assigns it to the Modified field. +func (o *DowntimeResponseAttributes) SetModified(v time.Time) { + o.Modified = &v +} + +// GetMonitorIdentifier returns the MonitorIdentifier field value if set, zero value otherwise. +func (o *DowntimeResponseAttributes) GetMonitorIdentifier() DowntimeMonitorIdentifier { + if o == nil || o.MonitorIdentifier == nil { + var ret DowntimeMonitorIdentifier + return ret + } + return *o.MonitorIdentifier +} + +// GetMonitorIdentifierOk returns a tuple with the MonitorIdentifier field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeResponseAttributes) GetMonitorIdentifierOk() (*DowntimeMonitorIdentifier, bool) { + if o == nil || o.MonitorIdentifier == nil { + return nil, false + } + return o.MonitorIdentifier, true +} + +// HasMonitorIdentifier returns a boolean if a field has been set. +func (o *DowntimeResponseAttributes) HasMonitorIdentifier() bool { + return o != nil && o.MonitorIdentifier != nil +} + +// SetMonitorIdentifier gets a reference to the given DowntimeMonitorIdentifier and assigns it to the MonitorIdentifier field. +func (o *DowntimeResponseAttributes) SetMonitorIdentifier(v DowntimeMonitorIdentifier) { + o.MonitorIdentifier = &v +} + +// GetMuteFirstRecoveryNotification returns the MuteFirstRecoveryNotification field value if set, zero value otherwise. +func (o *DowntimeResponseAttributes) GetMuteFirstRecoveryNotification() bool { + if o == nil || o.MuteFirstRecoveryNotification == nil { + var ret bool + return ret + } + return *o.MuteFirstRecoveryNotification +} + +// GetMuteFirstRecoveryNotificationOk returns a tuple with the MuteFirstRecoveryNotification field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeResponseAttributes) GetMuteFirstRecoveryNotificationOk() (*bool, bool) { + if o == nil || o.MuteFirstRecoveryNotification == nil { + return nil, false + } + return o.MuteFirstRecoveryNotification, true +} + +// HasMuteFirstRecoveryNotification returns a boolean if a field has been set. +func (o *DowntimeResponseAttributes) HasMuteFirstRecoveryNotification() bool { + return o != nil && o.MuteFirstRecoveryNotification != nil +} + +// SetMuteFirstRecoveryNotification gets a reference to the given bool and assigns it to the MuteFirstRecoveryNotification field. +func (o *DowntimeResponseAttributes) SetMuteFirstRecoveryNotification(v bool) { + o.MuteFirstRecoveryNotification = &v +} + +// GetNotifyEndStates returns the NotifyEndStates field value if set, zero value otherwise. +func (o *DowntimeResponseAttributes) GetNotifyEndStates() []DowntimeNotifyEndStateTypes { + if o == nil || o.NotifyEndStates == nil { + var ret []DowntimeNotifyEndStateTypes + return ret + } + return o.NotifyEndStates +} + +// GetNotifyEndStatesOk returns a tuple with the NotifyEndStates field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeResponseAttributes) GetNotifyEndStatesOk() (*[]DowntimeNotifyEndStateTypes, bool) { + if o == nil || o.NotifyEndStates == nil { + return nil, false + } + return &o.NotifyEndStates, true +} + +// HasNotifyEndStates returns a boolean if a field has been set. +func (o *DowntimeResponseAttributes) HasNotifyEndStates() bool { + return o != nil && o.NotifyEndStates != nil +} + +// SetNotifyEndStates gets a reference to the given []DowntimeNotifyEndStateTypes and assigns it to the NotifyEndStates field. +func (o *DowntimeResponseAttributes) SetNotifyEndStates(v []DowntimeNotifyEndStateTypes) { + o.NotifyEndStates = v +} + +// GetNotifyEndTypes returns the NotifyEndTypes field value if set, zero value otherwise. +func (o *DowntimeResponseAttributes) GetNotifyEndTypes() []DowntimeNotifyEndStateActions { + if o == nil || o.NotifyEndTypes == nil { + var ret []DowntimeNotifyEndStateActions + return ret + } + return o.NotifyEndTypes +} + +// GetNotifyEndTypesOk returns a tuple with the NotifyEndTypes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeResponseAttributes) GetNotifyEndTypesOk() (*[]DowntimeNotifyEndStateActions, bool) { + if o == nil || o.NotifyEndTypes == nil { + return nil, false + } + return &o.NotifyEndTypes, true +} + +// HasNotifyEndTypes returns a boolean if a field has been set. +func (o *DowntimeResponseAttributes) HasNotifyEndTypes() bool { + return o != nil && o.NotifyEndTypes != nil +} + +// SetNotifyEndTypes gets a reference to the given []DowntimeNotifyEndStateActions and assigns it to the NotifyEndTypes field. +func (o *DowntimeResponseAttributes) SetNotifyEndTypes(v []DowntimeNotifyEndStateActions) { + o.NotifyEndTypes = v +} + +// GetSchedule returns the Schedule field value if set, zero value otherwise. +func (o *DowntimeResponseAttributes) GetSchedule() DowntimeScheduleResponse { + if o == nil || o.Schedule == nil { + var ret DowntimeScheduleResponse + return ret + } + return *o.Schedule +} + +// GetScheduleOk returns a tuple with the Schedule field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeResponseAttributes) GetScheduleOk() (*DowntimeScheduleResponse, bool) { + if o == nil || o.Schedule == nil { + return nil, false + } + return o.Schedule, true +} + +// HasSchedule returns a boolean if a field has been set. +func (o *DowntimeResponseAttributes) HasSchedule() bool { + return o != nil && o.Schedule != nil +} + +// SetSchedule gets a reference to the given DowntimeScheduleResponse and assigns it to the Schedule field. +func (o *DowntimeResponseAttributes) SetSchedule(v DowntimeScheduleResponse) { + o.Schedule = &v +} + +// GetScope returns the Scope field value if set, zero value otherwise. +func (o *DowntimeResponseAttributes) GetScope() string { + if o == nil || o.Scope == nil { + var ret string + return ret + } + return *o.Scope +} + +// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeResponseAttributes) GetScopeOk() (*string, bool) { + if o == nil || o.Scope == nil { + return nil, false + } + return o.Scope, true +} + +// HasScope returns a boolean if a field has been set. +func (o *DowntimeResponseAttributes) HasScope() bool { + return o != nil && o.Scope != nil +} + +// SetScope gets a reference to the given string and assigns it to the Scope field. +func (o *DowntimeResponseAttributes) SetScope(v string) { + o.Scope = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *DowntimeResponseAttributes) GetStatus() DowntimeStatus { + if o == nil || o.Status == nil { + var ret DowntimeStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeResponseAttributes) GetStatusOk() (*DowntimeStatus, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *DowntimeResponseAttributes) HasStatus() bool { + return o != nil && o.Status != nil +} + +// SetStatus gets a reference to the given DowntimeStatus and assigns it to the Status field. +func (o *DowntimeResponseAttributes) SetStatus(v DowntimeStatus) { + o.Status = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Canceled.IsSet() { + toSerialize["canceled"] = o.Canceled.Get() + } + if o.Created != nil { + if o.Created.Nanosecond() == 0 { + toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.DisplayTimezone.IsSet() { + toSerialize["display_timezone"] = o.DisplayTimezone.Get() + } + if o.Message.IsSet() { + toSerialize["message"] = o.Message.Get() + } + if o.Modified != nil { + if o.Modified.Nanosecond() == 0 { + toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.MonitorIdentifier != nil { + toSerialize["monitor_identifier"] = o.MonitorIdentifier + } + if o.MuteFirstRecoveryNotification != nil { + toSerialize["mute_first_recovery_notification"] = o.MuteFirstRecoveryNotification + } + if o.NotifyEndStates != nil { + toSerialize["notify_end_states"] = o.NotifyEndStates + } + if o.NotifyEndTypes != nil { + toSerialize["notify_end_types"] = o.NotifyEndTypes + } + if o.Schedule != nil { + toSerialize["schedule"] = o.Schedule + } + if o.Scope != nil { + toSerialize["scope"] = o.Scope + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Canceled datadog.NullableTime `json:"canceled,omitempty"` + Created *time.Time `json:"created,omitempty"` + DisplayTimezone datadog.NullableString `json:"display_timezone,omitempty"` + Message datadog.NullableString `json:"message,omitempty"` + Modified *time.Time `json:"modified,omitempty"` + MonitorIdentifier *DowntimeMonitorIdentifier `json:"monitor_identifier,omitempty"` + MuteFirstRecoveryNotification *bool `json:"mute_first_recovery_notification,omitempty"` + NotifyEndStates []DowntimeNotifyEndStateTypes `json:"notify_end_states,omitempty"` + NotifyEndTypes []DowntimeNotifyEndStateActions `json:"notify_end_types,omitempty"` + Schedule *DowntimeScheduleResponse `json:"schedule,omitempty"` + Scope *string `json:"scope,omitempty"` + Status *DowntimeStatus `json:"status,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"canceled", "created", "display_timezone", "message", "modified", "monitor_identifier", "mute_first_recovery_notification", "notify_end_states", "notify_end_types", "schedule", "scope", "status"}) + } else { + return err + } + + hasInvalidField := false + o.Canceled = all.Canceled + o.Created = all.Created + o.DisplayTimezone = all.DisplayTimezone + o.Message = all.Message + o.Modified = all.Modified + o.MonitorIdentifier = all.MonitorIdentifier + o.MuteFirstRecoveryNotification = all.MuteFirstRecoveryNotification + o.NotifyEndStates = all.NotifyEndStates + o.NotifyEndTypes = all.NotifyEndTypes + o.Schedule = all.Schedule + o.Scope = all.Scope + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_response_data.go new file mode 100644 index 000000000..b61df3d9b --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_response_data.go @@ -0,0 +1,229 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeResponseData Downtime data. +type DowntimeResponseData struct { + // Downtime details. + Attributes *DowntimeResponseAttributes `json:"attributes,omitempty"` + // The downtime ID. + Id *string `json:"id,omitempty"` + // All relationships associated with downtime. + Relationships *DowntimeRelationships `json:"relationships,omitempty"` + // Downtime resource type. + Type *DowntimeResourceType `json:"type,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{} +} + +// NewDowntimeResponseData instantiates a new DowntimeResponseData 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 NewDowntimeResponseData() *DowntimeResponseData { + this := DowntimeResponseData{} + var typeVar DowntimeResourceType = DOWNTIMERESOURCETYPE_DOWNTIME + this.Type = &typeVar + return &this +} + +// NewDowntimeResponseDataWithDefaults instantiates a new DowntimeResponseData 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 NewDowntimeResponseDataWithDefaults() *DowntimeResponseData { + this := DowntimeResponseData{} + var typeVar DowntimeResourceType = DOWNTIMERESOURCETYPE_DOWNTIME + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *DowntimeResponseData) GetAttributes() DowntimeResponseAttributes { + if o == nil || o.Attributes == nil { + var ret DowntimeResponseAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeResponseData) GetAttributesOk() (*DowntimeResponseAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *DowntimeResponseData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given DowntimeResponseAttributes and assigns it to the Attributes field. +func (o *DowntimeResponseData) SetAttributes(v DowntimeResponseAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *DowntimeResponseData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeResponseData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *DowntimeResponseData) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *DowntimeResponseData) SetId(v string) { + o.Id = &v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *DowntimeResponseData) GetRelationships() DowntimeRelationships { + if o == nil || o.Relationships == nil { + var ret DowntimeRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeResponseData) GetRelationshipsOk() (*DowntimeRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *DowntimeResponseData) HasRelationships() bool { + return o != nil && o.Relationships != nil +} + +// SetRelationships gets a reference to the given DowntimeRelationships and assigns it to the Relationships field. +func (o *DowntimeResponseData) SetRelationships(v DowntimeRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *DowntimeResponseData) GetType() DowntimeResourceType { + if o == nil || o.Type == nil { + var ret DowntimeResourceType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeResponseData) GetTypeOk() (*DowntimeResourceType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *DowntimeResponseData) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given DowntimeResourceType and assigns it to the Type field. +func (o *DowntimeResponseData) SetType(v DowntimeResourceType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *DowntimeResponseAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Relationships *DowntimeRelationships `json:"relationships,omitempty"` + Type *DowntimeResourceType `json:"type,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = all.Relationships + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_response_included_item.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_response_included_item.go new file mode 100644 index 000000000..39f40f7ad --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_response_included_item.go @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/goccy/go-json" +) + +// DowntimeResponseIncludedItem - An object related to a downtime. +type DowntimeResponseIncludedItem struct { + User *User + DowntimeMonitorIncludedItem *DowntimeMonitorIncludedItem + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// UserAsDowntimeResponseIncludedItem is a convenience function that returns User wrapped in DowntimeResponseIncludedItem. +func UserAsDowntimeResponseIncludedItem(v *User) DowntimeResponseIncludedItem { + return DowntimeResponseIncludedItem{User: v} +} + +// DowntimeMonitorIncludedItemAsDowntimeResponseIncludedItem is a convenience function that returns DowntimeMonitorIncludedItem wrapped in DowntimeResponseIncludedItem. +func DowntimeMonitorIncludedItemAsDowntimeResponseIncludedItem(v *DowntimeMonitorIncludedItem) DowntimeResponseIncludedItem { + return DowntimeResponseIncludedItem{DowntimeMonitorIncludedItem: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *DowntimeResponseIncludedItem) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into User + err = json.Unmarshal(data, &obj.User) + if err == nil { + if obj.User != nil && obj.User.UnparsedObject == nil { + jsonUser, _ := json.Marshal(obj.User) + if string(jsonUser) == "{}" { // empty struct + obj.User = nil + } else { + match++ + } + } else { + obj.User = nil + } + } else { + obj.User = nil + } + + // try to unmarshal data into DowntimeMonitorIncludedItem + err = json.Unmarshal(data, &obj.DowntimeMonitorIncludedItem) + if err == nil { + if obj.DowntimeMonitorIncludedItem != nil && obj.DowntimeMonitorIncludedItem.UnparsedObject == nil { + jsonDowntimeMonitorIncludedItem, _ := json.Marshal(obj.DowntimeMonitorIncludedItem) + if string(jsonDowntimeMonitorIncludedItem) == "{}" { // empty struct + obj.DowntimeMonitorIncludedItem = nil + } else { + match++ + } + } else { + obj.DowntimeMonitorIncludedItem = nil + } + } else { + obj.DowntimeMonitorIncludedItem = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.User = nil + obj.DowntimeMonitorIncludedItem = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj DowntimeResponseIncludedItem) MarshalJSON() ([]byte, error) { + if obj.User != nil { + return json.Marshal(&obj.User) + } + + if obj.DowntimeMonitorIncludedItem != nil { + return json.Marshal(&obj.DowntimeMonitorIncludedItem) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *DowntimeResponseIncludedItem) GetActualInstance() interface{} { + if obj.User != nil { + return obj.User + } + + if obj.DowntimeMonitorIncludedItem != nil { + return obj.DowntimeMonitorIncludedItem + } + + // all schemas are nil + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_create_request.go new file mode 100644 index 000000000..892006caf --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_create_request.go @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/goccy/go-json" +) + +// DowntimeScheduleCreateRequest - Schedule for the downtime. +type DowntimeScheduleCreateRequest struct { + DowntimeScheduleRecurrencesCreateRequest *DowntimeScheduleRecurrencesCreateRequest + DowntimeScheduleOneTimeCreateUpdateRequest *DowntimeScheduleOneTimeCreateUpdateRequest + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// DowntimeScheduleRecurrencesCreateRequestAsDowntimeScheduleCreateRequest is a convenience function that returns DowntimeScheduleRecurrencesCreateRequest wrapped in DowntimeScheduleCreateRequest. +func DowntimeScheduleRecurrencesCreateRequestAsDowntimeScheduleCreateRequest(v *DowntimeScheduleRecurrencesCreateRequest) DowntimeScheduleCreateRequest { + return DowntimeScheduleCreateRequest{DowntimeScheduleRecurrencesCreateRequest: v} +} + +// DowntimeScheduleOneTimeCreateUpdateRequestAsDowntimeScheduleCreateRequest is a convenience function that returns DowntimeScheduleOneTimeCreateUpdateRequest wrapped in DowntimeScheduleCreateRequest. +func DowntimeScheduleOneTimeCreateUpdateRequestAsDowntimeScheduleCreateRequest(v *DowntimeScheduleOneTimeCreateUpdateRequest) DowntimeScheduleCreateRequest { + return DowntimeScheduleCreateRequest{DowntimeScheduleOneTimeCreateUpdateRequest: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *DowntimeScheduleCreateRequest) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into DowntimeScheduleRecurrencesCreateRequest + err = json.Unmarshal(data, &obj.DowntimeScheduleRecurrencesCreateRequest) + if err == nil { + if obj.DowntimeScheduleRecurrencesCreateRequest != nil && obj.DowntimeScheduleRecurrencesCreateRequest.UnparsedObject == nil { + jsonDowntimeScheduleRecurrencesCreateRequest, _ := json.Marshal(obj.DowntimeScheduleRecurrencesCreateRequest) + if string(jsonDowntimeScheduleRecurrencesCreateRequest) == "{}" { // empty struct + obj.DowntimeScheduleRecurrencesCreateRequest = nil + } else { + match++ + } + } else { + obj.DowntimeScheduleRecurrencesCreateRequest = nil + } + } else { + obj.DowntimeScheduleRecurrencesCreateRequest = nil + } + + // try to unmarshal data into DowntimeScheduleOneTimeCreateUpdateRequest + err = json.Unmarshal(data, &obj.DowntimeScheduleOneTimeCreateUpdateRequest) + if err == nil { + if obj.DowntimeScheduleOneTimeCreateUpdateRequest != nil && obj.DowntimeScheduleOneTimeCreateUpdateRequest.UnparsedObject == nil { + jsonDowntimeScheduleOneTimeCreateUpdateRequest, _ := json.Marshal(obj.DowntimeScheduleOneTimeCreateUpdateRequest) + if string(jsonDowntimeScheduleOneTimeCreateUpdateRequest) == "{}" { // empty struct + obj.DowntimeScheduleOneTimeCreateUpdateRequest = nil + } else { + match++ + } + } else { + obj.DowntimeScheduleOneTimeCreateUpdateRequest = nil + } + } else { + obj.DowntimeScheduleOneTimeCreateUpdateRequest = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.DowntimeScheduleRecurrencesCreateRequest = nil + obj.DowntimeScheduleOneTimeCreateUpdateRequest = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj DowntimeScheduleCreateRequest) MarshalJSON() ([]byte, error) { + if obj.DowntimeScheduleRecurrencesCreateRequest != nil { + return json.Marshal(&obj.DowntimeScheduleRecurrencesCreateRequest) + } + + if obj.DowntimeScheduleOneTimeCreateUpdateRequest != nil { + return json.Marshal(&obj.DowntimeScheduleOneTimeCreateUpdateRequest) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *DowntimeScheduleCreateRequest) GetActualInstance() interface{} { + if obj.DowntimeScheduleRecurrencesCreateRequest != nil { + return obj.DowntimeScheduleRecurrencesCreateRequest + } + + if obj.DowntimeScheduleOneTimeCreateUpdateRequest != nil { + return obj.DowntimeScheduleOneTimeCreateUpdateRequest + } + + // all schemas are nil + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_current_downtime_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_current_downtime_response.go new file mode 100644 index 000000000..318e0fdb5 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_current_downtime_response.go @@ -0,0 +1,158 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "time" + + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeScheduleCurrentDowntimeResponse The most recent actual start and end dates for a recurring downtime. For a canceled downtime, +// this is the previously occurring downtime. For active downtimes, this is the ongoing downtime, and for scheduled +// downtimes it is the upcoming downtime. +type DowntimeScheduleCurrentDowntimeResponse struct { + // The end of the current downtime. + End datadog.NullableTime `json:"end,omitempty"` + // The start of the current downtime. + Start *time.Time `json:"start,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{} +} + +// NewDowntimeScheduleCurrentDowntimeResponse instantiates a new DowntimeScheduleCurrentDowntimeResponse 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 NewDowntimeScheduleCurrentDowntimeResponse() *DowntimeScheduleCurrentDowntimeResponse { + this := DowntimeScheduleCurrentDowntimeResponse{} + return &this +} + +// NewDowntimeScheduleCurrentDowntimeResponseWithDefaults instantiates a new DowntimeScheduleCurrentDowntimeResponse 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 NewDowntimeScheduleCurrentDowntimeResponseWithDefaults() *DowntimeScheduleCurrentDowntimeResponse { + this := DowntimeScheduleCurrentDowntimeResponse{} + return &this +} + +// GetEnd returns the End field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DowntimeScheduleCurrentDowntimeResponse) GetEnd() time.Time { + if o == nil || o.End.Get() == nil { + var ret time.Time + return ret + } + return *o.End.Get() +} + +// GetEndOk returns a tuple with the End field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *DowntimeScheduleCurrentDowntimeResponse) GetEndOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.End.Get(), o.End.IsSet() +} + +// HasEnd returns a boolean if a field has been set. +func (o *DowntimeScheduleCurrentDowntimeResponse) HasEnd() bool { + return o != nil && o.End.IsSet() +} + +// SetEnd gets a reference to the given datadog.NullableTime and assigns it to the End field. +func (o *DowntimeScheduleCurrentDowntimeResponse) SetEnd(v time.Time) { + o.End.Set(&v) +} + +// SetEndNil sets the value for End to be an explicit nil. +func (o *DowntimeScheduleCurrentDowntimeResponse) SetEndNil() { + o.End.Set(nil) +} + +// UnsetEnd ensures that no value is present for End, not even an explicit nil. +func (o *DowntimeScheduleCurrentDowntimeResponse) UnsetEnd() { + o.End.Unset() +} + +// GetStart returns the Start field value if set, zero value otherwise. +func (o *DowntimeScheduleCurrentDowntimeResponse) GetStart() time.Time { + if o == nil || o.Start == nil { + var ret time.Time + return ret + } + return *o.Start +} + +// GetStartOk returns a tuple with the Start field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeScheduleCurrentDowntimeResponse) GetStartOk() (*time.Time, bool) { + if o == nil || o.Start == nil { + return nil, false + } + return o.Start, true +} + +// HasStart returns a boolean if a field has been set. +func (o *DowntimeScheduleCurrentDowntimeResponse) HasStart() bool { + return o != nil && o.Start != nil +} + +// SetStart gets a reference to the given time.Time and assigns it to the Start field. +func (o *DowntimeScheduleCurrentDowntimeResponse) SetStart(v time.Time) { + o.Start = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeScheduleCurrentDowntimeResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.End.IsSet() { + toSerialize["end"] = o.End.Get() + } + if o.Start != nil { + if o.Start.Nanosecond() == 0 { + toSerialize["start"] = o.Start.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["start"] = o.Start.Format("2006-01-02T15:04:05.000Z07:00") + } + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeScheduleCurrentDowntimeResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + End datadog.NullableTime `json:"end,omitempty"` + Start *time.Time `json:"start,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"end", "start"}) + } else { + return err + } + o.End = all.End + o.Start = all.Start + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_one_time_create_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_one_time_create_update_request.go new file mode 100644 index 000000000..61ebfe477 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_one_time_create_update_request.go @@ -0,0 +1,165 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "time" + + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeScheduleOneTimeCreateUpdateRequest A one-time downtime definition. +type DowntimeScheduleOneTimeCreateUpdateRequest struct { + // ISO-8601 Datetime to end the downtime. Must include a UTC offset of zero. If not provided, the + // downtime continues forever. + End datadog.NullableTime `json:"end,omitempty"` + // ISO-8601 Datetime to start the downtime. Must include a UTC offset of zero. If not provided, the + // downtime starts the moment it is created. + Start datadog.NullableTime `json:"start,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{} +} + +// NewDowntimeScheduleOneTimeCreateUpdateRequest instantiates a new DowntimeScheduleOneTimeCreateUpdateRequest 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 NewDowntimeScheduleOneTimeCreateUpdateRequest() *DowntimeScheduleOneTimeCreateUpdateRequest { + this := DowntimeScheduleOneTimeCreateUpdateRequest{} + return &this +} + +// NewDowntimeScheduleOneTimeCreateUpdateRequestWithDefaults instantiates a new DowntimeScheduleOneTimeCreateUpdateRequest 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 NewDowntimeScheduleOneTimeCreateUpdateRequestWithDefaults() *DowntimeScheduleOneTimeCreateUpdateRequest { + this := DowntimeScheduleOneTimeCreateUpdateRequest{} + return &this +} + +// GetEnd returns the End field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DowntimeScheduleOneTimeCreateUpdateRequest) GetEnd() time.Time { + if o == nil || o.End.Get() == nil { + var ret time.Time + return ret + } + return *o.End.Get() +} + +// GetEndOk returns a tuple with the End field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *DowntimeScheduleOneTimeCreateUpdateRequest) GetEndOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.End.Get(), o.End.IsSet() +} + +// HasEnd returns a boolean if a field has been set. +func (o *DowntimeScheduleOneTimeCreateUpdateRequest) HasEnd() bool { + return o != nil && o.End.IsSet() +} + +// SetEnd gets a reference to the given datadog.NullableTime and assigns it to the End field. +func (o *DowntimeScheduleOneTimeCreateUpdateRequest) SetEnd(v time.Time) { + o.End.Set(&v) +} + +// SetEndNil sets the value for End to be an explicit nil. +func (o *DowntimeScheduleOneTimeCreateUpdateRequest) SetEndNil() { + o.End.Set(nil) +} + +// UnsetEnd ensures that no value is present for End, not even an explicit nil. +func (o *DowntimeScheduleOneTimeCreateUpdateRequest) UnsetEnd() { + o.End.Unset() +} + +// GetStart returns the Start field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DowntimeScheduleOneTimeCreateUpdateRequest) GetStart() time.Time { + if o == nil || o.Start.Get() == nil { + var ret time.Time + return ret + } + return *o.Start.Get() +} + +// GetStartOk returns a tuple with the Start field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *DowntimeScheduleOneTimeCreateUpdateRequest) GetStartOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.Start.Get(), o.Start.IsSet() +} + +// HasStart returns a boolean if a field has been set. +func (o *DowntimeScheduleOneTimeCreateUpdateRequest) HasStart() bool { + return o != nil && o.Start.IsSet() +} + +// SetStart gets a reference to the given datadog.NullableTime and assigns it to the Start field. +func (o *DowntimeScheduleOneTimeCreateUpdateRequest) SetStart(v time.Time) { + o.Start.Set(&v) +} + +// SetStartNil sets the value for Start to be an explicit nil. +func (o *DowntimeScheduleOneTimeCreateUpdateRequest) SetStartNil() { + o.Start.Set(nil) +} + +// UnsetStart ensures that no value is present for Start, not even an explicit nil. +func (o *DowntimeScheduleOneTimeCreateUpdateRequest) UnsetStart() { + o.Start.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeScheduleOneTimeCreateUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.End.IsSet() { + toSerialize["end"] = o.End.Get() + } + if o.Start.IsSet() { + toSerialize["start"] = o.Start.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeScheduleOneTimeCreateUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + End datadog.NullableTime `json:"end,omitempty"` + Start datadog.NullableTime `json:"start,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"end", "start"}) + } else { + return err + } + o.End = all.End + o.Start = all.Start + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_one_time_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_one_time_response.go new file mode 100644 index 000000000..532d80136 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_one_time_response.go @@ -0,0 +1,154 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + "time" + + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeScheduleOneTimeResponse A one-time downtime definition. +type DowntimeScheduleOneTimeResponse struct { + // ISO-8601 Datetime to end the downtime. + End datadog.NullableTime `json:"end,omitempty"` + // ISO-8601 Datetime to start the downtime. + Start time.Time `json:"start"` + // 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{} +} + +// NewDowntimeScheduleOneTimeResponse instantiates a new DowntimeScheduleOneTimeResponse 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 NewDowntimeScheduleOneTimeResponse(start time.Time) *DowntimeScheduleOneTimeResponse { + this := DowntimeScheduleOneTimeResponse{} + this.Start = start + return &this +} + +// NewDowntimeScheduleOneTimeResponseWithDefaults instantiates a new DowntimeScheduleOneTimeResponse 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 NewDowntimeScheduleOneTimeResponseWithDefaults() *DowntimeScheduleOneTimeResponse { + this := DowntimeScheduleOneTimeResponse{} + return &this +} + +// GetEnd returns the End field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DowntimeScheduleOneTimeResponse) GetEnd() time.Time { + if o == nil || o.End.Get() == nil { + var ret time.Time + return ret + } + return *o.End.Get() +} + +// GetEndOk returns a tuple with the End field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *DowntimeScheduleOneTimeResponse) GetEndOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.End.Get(), o.End.IsSet() +} + +// HasEnd returns a boolean if a field has been set. +func (o *DowntimeScheduleOneTimeResponse) HasEnd() bool { + return o != nil && o.End.IsSet() +} + +// SetEnd gets a reference to the given datadog.NullableTime and assigns it to the End field. +func (o *DowntimeScheduleOneTimeResponse) SetEnd(v time.Time) { + o.End.Set(&v) +} + +// SetEndNil sets the value for End to be an explicit nil. +func (o *DowntimeScheduleOneTimeResponse) SetEndNil() { + o.End.Set(nil) +} + +// UnsetEnd ensures that no value is present for End, not even an explicit nil. +func (o *DowntimeScheduleOneTimeResponse) UnsetEnd() { + o.End.Unset() +} + +// GetStart returns the Start field value. +func (o *DowntimeScheduleOneTimeResponse) GetStart() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.Start +} + +// GetStartOk returns a tuple with the Start field value +// and a boolean to check if the value has been set. +func (o *DowntimeScheduleOneTimeResponse) GetStartOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Start, true +} + +// SetStart sets field value. +func (o *DowntimeScheduleOneTimeResponse) SetStart(v time.Time) { + o.Start = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeScheduleOneTimeResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.End.IsSet() { + toSerialize["end"] = o.End.Get() + } + if o.Start.Nanosecond() == 0 { + toSerialize["start"] = o.Start.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["start"] = o.Start.Format("2006-01-02T15:04:05.000Z07:00") + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeScheduleOneTimeResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + End datadog.NullableTime `json:"end,omitempty"` + Start *time.Time `json:"start"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + 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", "start"}) + } else { + return err + } + o.End = all.End + o.Start = *all.Start + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_recurrence_create_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_recurrence_create_update_request.go new file mode 100644 index 000000000..0690debe8 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_recurrence_create_update_request.go @@ -0,0 +1,187 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "fmt" + + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeScheduleRecurrenceCreateUpdateRequest An object defining the recurrence of the downtime. +type DowntimeScheduleRecurrenceCreateUpdateRequest struct { + // The length of the downtime. Must begin with an integer and end with one of 'm', 'h', d', or 'w'. + Duration string `json:"duration"` + // The `RRULE` standard for defining recurring events. + // For example, to have a recurring event on the first day of each month, set the type to `rrule` and set the `FREQ` to `MONTHLY` and `BYMONTHDAY` to `1`. + // Most common `rrule` options from the [iCalendar Spec](https://tools.ietf.org/html/rfc5545) are supported. + // + // **Note**: Attributes specifying the duration in `RRULE` are not supported (for example, `DTSTART`, `DTEND`, `DURATION`). + // More examples available in this [downtime guide](https://docs.datadoghq.com/monitors/guide/suppress-alert-with-downtimes/?tab=api). + Rrule string `json:"rrule"` + // ISO-8601 Datetime to start the downtime. Must not include a UTC offset. If not provided, the + // downtime starts the moment it is created. + Start datadog.NullableString `json:"start,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{} +} + +// NewDowntimeScheduleRecurrenceCreateUpdateRequest instantiates a new DowntimeScheduleRecurrenceCreateUpdateRequest 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 NewDowntimeScheduleRecurrenceCreateUpdateRequest(duration string, rrule string) *DowntimeScheduleRecurrenceCreateUpdateRequest { + this := DowntimeScheduleRecurrenceCreateUpdateRequest{} + this.Duration = duration + this.Rrule = rrule + return &this +} + +// NewDowntimeScheduleRecurrenceCreateUpdateRequestWithDefaults instantiates a new DowntimeScheduleRecurrenceCreateUpdateRequest 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 NewDowntimeScheduleRecurrenceCreateUpdateRequestWithDefaults() *DowntimeScheduleRecurrenceCreateUpdateRequest { + this := DowntimeScheduleRecurrenceCreateUpdateRequest{} + return &this +} + +// GetDuration returns the Duration field value. +func (o *DowntimeScheduleRecurrenceCreateUpdateRequest) GetDuration() string { + if o == nil { + var ret string + return ret + } + return o.Duration +} + +// GetDurationOk returns a tuple with the Duration field value +// and a boolean to check if the value has been set. +func (o *DowntimeScheduleRecurrenceCreateUpdateRequest) GetDurationOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Duration, true +} + +// SetDuration sets field value. +func (o *DowntimeScheduleRecurrenceCreateUpdateRequest) SetDuration(v string) { + o.Duration = v +} + +// GetRrule returns the Rrule field value. +func (o *DowntimeScheduleRecurrenceCreateUpdateRequest) GetRrule() string { + if o == nil { + var ret string + return ret + } + return o.Rrule +} + +// GetRruleOk returns a tuple with the Rrule field value +// and a boolean to check if the value has been set. +func (o *DowntimeScheduleRecurrenceCreateUpdateRequest) GetRruleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Rrule, true +} + +// SetRrule sets field value. +func (o *DowntimeScheduleRecurrenceCreateUpdateRequest) SetRrule(v string) { + o.Rrule = v +} + +// GetStart returns the Start field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DowntimeScheduleRecurrenceCreateUpdateRequest) GetStart() string { + if o == nil || o.Start.Get() == nil { + var ret string + return ret + } + return *o.Start.Get() +} + +// GetStartOk returns a tuple with the Start field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *DowntimeScheduleRecurrenceCreateUpdateRequest) GetStartOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Start.Get(), o.Start.IsSet() +} + +// HasStart returns a boolean if a field has been set. +func (o *DowntimeScheduleRecurrenceCreateUpdateRequest) HasStart() bool { + return o != nil && o.Start.IsSet() +} + +// SetStart gets a reference to the given datadog.NullableString and assigns it to the Start field. +func (o *DowntimeScheduleRecurrenceCreateUpdateRequest) SetStart(v string) { + o.Start.Set(&v) +} + +// SetStartNil sets the value for Start to be an explicit nil. +func (o *DowntimeScheduleRecurrenceCreateUpdateRequest) SetStartNil() { + o.Start.Set(nil) +} + +// UnsetStart ensures that no value is present for Start, not even an explicit nil. +func (o *DowntimeScheduleRecurrenceCreateUpdateRequest) UnsetStart() { + o.Start.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeScheduleRecurrenceCreateUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["duration"] = o.Duration + toSerialize["rrule"] = o.Rrule + if o.Start.IsSet() { + toSerialize["start"] = o.Start.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeScheduleRecurrenceCreateUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Duration *string `json:"duration"` + Rrule *string `json:"rrule"` + Start datadog.NullableString `json:"start,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Duration == nil { + return fmt.Errorf("required field duration missing") + } + if all.Rrule == nil { + return fmt.Errorf("required field rrule missing") + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"duration", "rrule", "start"}) + } else { + return err + } + o.Duration = *all.Duration + o.Rrule = *all.Rrule + o.Start = all.Start + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_recurrence_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_recurrence_response.go new file mode 100644 index 000000000..d39d6b26f --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_recurrence_response.go @@ -0,0 +1,180 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeScheduleRecurrenceResponse An RRULE-based recurring downtime. +type DowntimeScheduleRecurrenceResponse struct { + // The length of the downtime. Must begin with an integer and end with one of 'm', 'h', d', or 'w'. + Duration *string `json:"duration,omitempty"` + // The `RRULE` standard for defining recurring events. + // For example, to have a recurring event on the first day of each month, set the type to `rrule` and set the `FREQ` to `MONTHLY` and `BYMONTHDAY` to `1`. + // Most common `rrule` options from the [iCalendar Spec](https://tools.ietf.org/html/rfc5545) are supported. + // + // **Note**: Attributes specifying the duration in `RRULE` are not supported (for example, `DTSTART`, `DTEND`, `DURATION`). + // More examples available in this [downtime guide](https://docs.datadoghq.com/monitors/guide/suppress-alert-with-downtimes/?tab=api). + Rrule *string `json:"rrule,omitempty"` + // ISO-8601 Datetime to start the downtime. Must not include a UTC offset. If not provided, the + // downtime starts the moment it is created. + Start *string `json:"start,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{} +} + +// NewDowntimeScheduleRecurrenceResponse instantiates a new DowntimeScheduleRecurrenceResponse 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 NewDowntimeScheduleRecurrenceResponse() *DowntimeScheduleRecurrenceResponse { + this := DowntimeScheduleRecurrenceResponse{} + return &this +} + +// NewDowntimeScheduleRecurrenceResponseWithDefaults instantiates a new DowntimeScheduleRecurrenceResponse 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 NewDowntimeScheduleRecurrenceResponseWithDefaults() *DowntimeScheduleRecurrenceResponse { + this := DowntimeScheduleRecurrenceResponse{} + return &this +} + +// GetDuration returns the Duration field value if set, zero value otherwise. +func (o *DowntimeScheduleRecurrenceResponse) GetDuration() string { + if o == nil || o.Duration == nil { + var ret string + return ret + } + return *o.Duration +} + +// GetDurationOk returns a tuple with the Duration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeScheduleRecurrenceResponse) GetDurationOk() (*string, bool) { + if o == nil || o.Duration == nil { + return nil, false + } + return o.Duration, true +} + +// HasDuration returns a boolean if a field has been set. +func (o *DowntimeScheduleRecurrenceResponse) HasDuration() bool { + return o != nil && o.Duration != nil +} + +// SetDuration gets a reference to the given string and assigns it to the Duration field. +func (o *DowntimeScheduleRecurrenceResponse) SetDuration(v string) { + o.Duration = &v +} + +// GetRrule returns the Rrule field value if set, zero value otherwise. +func (o *DowntimeScheduleRecurrenceResponse) GetRrule() string { + if o == nil || o.Rrule == nil { + var ret string + return ret + } + return *o.Rrule +} + +// GetRruleOk returns a tuple with the Rrule field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeScheduleRecurrenceResponse) GetRruleOk() (*string, bool) { + if o == nil || o.Rrule == nil { + return nil, false + } + return o.Rrule, true +} + +// HasRrule returns a boolean if a field has been set. +func (o *DowntimeScheduleRecurrenceResponse) HasRrule() bool { + return o != nil && o.Rrule != nil +} + +// SetRrule gets a reference to the given string and assigns it to the Rrule field. +func (o *DowntimeScheduleRecurrenceResponse) SetRrule(v string) { + o.Rrule = &v +} + +// GetStart returns the Start field value if set, zero value otherwise. +func (o *DowntimeScheduleRecurrenceResponse) GetStart() string { + if o == nil || o.Start == nil { + var ret string + return ret + } + return *o.Start +} + +// GetStartOk returns a tuple with the Start field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeScheduleRecurrenceResponse) GetStartOk() (*string, bool) { + if o == nil || o.Start == nil { + return nil, false + } + return o.Start, true +} + +// HasStart returns a boolean if a field has been set. +func (o *DowntimeScheduleRecurrenceResponse) HasStart() bool { + return o != nil && o.Start != nil +} + +// SetStart gets a reference to the given string and assigns it to the Start field. +func (o *DowntimeScheduleRecurrenceResponse) SetStart(v string) { + o.Start = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeScheduleRecurrenceResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Duration != nil { + toSerialize["duration"] = o.Duration + } + if o.Rrule != nil { + toSerialize["rrule"] = o.Rrule + } + if o.Start != nil { + toSerialize["start"] = o.Start + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeScheduleRecurrenceResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Duration *string `json:"duration,omitempty"` + Rrule *string `json:"rrule,omitempty"` + Start *string `json:"start,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"duration", "rrule", "start"}) + } else { + return err + } + o.Duration = all.Duration + o.Rrule = all.Rrule + o.Start = all.Start + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_recurrences_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_recurrences_create_request.go new file mode 100644 index 000000000..5d33f35f6 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_recurrences_create_request.go @@ -0,0 +1,142 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "fmt" + + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeScheduleRecurrencesCreateRequest A recurring downtime schedule definition. +type DowntimeScheduleRecurrencesCreateRequest struct { + // A list of downtime recurrences. + Recurrences []DowntimeScheduleRecurrenceCreateUpdateRequest `json:"recurrences"` + // The timezone in which to schedule the downtime. + Timezone *string `json:"timezone,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{} +} + +// NewDowntimeScheduleRecurrencesCreateRequest instantiates a new DowntimeScheduleRecurrencesCreateRequest 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 NewDowntimeScheduleRecurrencesCreateRequest(recurrences []DowntimeScheduleRecurrenceCreateUpdateRequest) *DowntimeScheduleRecurrencesCreateRequest { + this := DowntimeScheduleRecurrencesCreateRequest{} + this.Recurrences = recurrences + var timezone string = "UTC" + this.Timezone = &timezone + return &this +} + +// NewDowntimeScheduleRecurrencesCreateRequestWithDefaults instantiates a new DowntimeScheduleRecurrencesCreateRequest 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 NewDowntimeScheduleRecurrencesCreateRequestWithDefaults() *DowntimeScheduleRecurrencesCreateRequest { + this := DowntimeScheduleRecurrencesCreateRequest{} + var timezone string = "UTC" + this.Timezone = &timezone + return &this +} + +// GetRecurrences returns the Recurrences field value. +func (o *DowntimeScheduleRecurrencesCreateRequest) GetRecurrences() []DowntimeScheduleRecurrenceCreateUpdateRequest { + if o == nil { + var ret []DowntimeScheduleRecurrenceCreateUpdateRequest + return ret + } + return o.Recurrences +} + +// GetRecurrencesOk returns a tuple with the Recurrences field value +// and a boolean to check if the value has been set. +func (o *DowntimeScheduleRecurrencesCreateRequest) GetRecurrencesOk() (*[]DowntimeScheduleRecurrenceCreateUpdateRequest, bool) { + if o == nil { + return nil, false + } + return &o.Recurrences, true +} + +// SetRecurrences sets field value. +func (o *DowntimeScheduleRecurrencesCreateRequest) SetRecurrences(v []DowntimeScheduleRecurrenceCreateUpdateRequest) { + o.Recurrences = v +} + +// GetTimezone returns the Timezone field value if set, zero value otherwise. +func (o *DowntimeScheduleRecurrencesCreateRequest) GetTimezone() string { + if o == nil || o.Timezone == nil { + var ret string + return ret + } + return *o.Timezone +} + +// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeScheduleRecurrencesCreateRequest) GetTimezoneOk() (*string, bool) { + if o == nil || o.Timezone == nil { + return nil, false + } + return o.Timezone, true +} + +// HasTimezone returns a boolean if a field has been set. +func (o *DowntimeScheduleRecurrencesCreateRequest) HasTimezone() bool { + return o != nil && o.Timezone != nil +} + +// SetTimezone gets a reference to the given string and assigns it to the Timezone field. +func (o *DowntimeScheduleRecurrencesCreateRequest) SetTimezone(v string) { + o.Timezone = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeScheduleRecurrencesCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["recurrences"] = o.Recurrences + if o.Timezone != nil { + toSerialize["timezone"] = o.Timezone + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeScheduleRecurrencesCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Recurrences *[]DowntimeScheduleRecurrenceCreateUpdateRequest `json:"recurrences"` + Timezone *string `json:"timezone,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Recurrences == nil { + return fmt.Errorf("required field recurrences missing") + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"recurrences", "timezone"}) + } else { + return err + } + o.Recurrences = *all.Recurrences + o.Timezone = all.Timezone + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_recurrences_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_recurrences_response.go new file mode 100644 index 000000000..5129ba0ea --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_recurrences_response.go @@ -0,0 +1,189 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "fmt" + + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeScheduleRecurrencesResponse A recurring downtime schedule definition. +type DowntimeScheduleRecurrencesResponse struct { + // The most recent actual start and end dates for a recurring downtime. For a canceled downtime, + // this is the previously occurring downtime. For active downtimes, this is the ongoing downtime, and for scheduled + // downtimes it is the upcoming downtime. + CurrentDowntime *DowntimeScheduleCurrentDowntimeResponse `json:"current_downtime,omitempty"` + // A list of downtime recurrences. + Recurrences []DowntimeScheduleRecurrenceResponse `json:"recurrences"` + // The timezone in which to schedule the downtime. This affects recurring start and end dates. + // Must match `display_timezone`. + Timezone *string `json:"timezone,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{} +} + +// NewDowntimeScheduleRecurrencesResponse instantiates a new DowntimeScheduleRecurrencesResponse 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 NewDowntimeScheduleRecurrencesResponse(recurrences []DowntimeScheduleRecurrenceResponse) *DowntimeScheduleRecurrencesResponse { + this := DowntimeScheduleRecurrencesResponse{} + this.Recurrences = recurrences + var timezone string = "UTC" + this.Timezone = &timezone + return &this +} + +// NewDowntimeScheduleRecurrencesResponseWithDefaults instantiates a new DowntimeScheduleRecurrencesResponse 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 NewDowntimeScheduleRecurrencesResponseWithDefaults() *DowntimeScheduleRecurrencesResponse { + this := DowntimeScheduleRecurrencesResponse{} + var timezone string = "UTC" + this.Timezone = &timezone + return &this +} + +// GetCurrentDowntime returns the CurrentDowntime field value if set, zero value otherwise. +func (o *DowntimeScheduleRecurrencesResponse) GetCurrentDowntime() DowntimeScheduleCurrentDowntimeResponse { + if o == nil || o.CurrentDowntime == nil { + var ret DowntimeScheduleCurrentDowntimeResponse + return ret + } + return *o.CurrentDowntime +} + +// GetCurrentDowntimeOk returns a tuple with the CurrentDowntime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeScheduleRecurrencesResponse) GetCurrentDowntimeOk() (*DowntimeScheduleCurrentDowntimeResponse, bool) { + if o == nil || o.CurrentDowntime == nil { + return nil, false + } + return o.CurrentDowntime, true +} + +// HasCurrentDowntime returns a boolean if a field has been set. +func (o *DowntimeScheduleRecurrencesResponse) HasCurrentDowntime() bool { + return o != nil && o.CurrentDowntime != nil +} + +// SetCurrentDowntime gets a reference to the given DowntimeScheduleCurrentDowntimeResponse and assigns it to the CurrentDowntime field. +func (o *DowntimeScheduleRecurrencesResponse) SetCurrentDowntime(v DowntimeScheduleCurrentDowntimeResponse) { + o.CurrentDowntime = &v +} + +// GetRecurrences returns the Recurrences field value. +func (o *DowntimeScheduleRecurrencesResponse) GetRecurrences() []DowntimeScheduleRecurrenceResponse { + if o == nil { + var ret []DowntimeScheduleRecurrenceResponse + return ret + } + return o.Recurrences +} + +// GetRecurrencesOk returns a tuple with the Recurrences field value +// and a boolean to check if the value has been set. +func (o *DowntimeScheduleRecurrencesResponse) GetRecurrencesOk() (*[]DowntimeScheduleRecurrenceResponse, bool) { + if o == nil { + return nil, false + } + return &o.Recurrences, true +} + +// SetRecurrences sets field value. +func (o *DowntimeScheduleRecurrencesResponse) SetRecurrences(v []DowntimeScheduleRecurrenceResponse) { + o.Recurrences = v +} + +// GetTimezone returns the Timezone field value if set, zero value otherwise. +func (o *DowntimeScheduleRecurrencesResponse) GetTimezone() string { + if o == nil || o.Timezone == nil { + var ret string + return ret + } + return *o.Timezone +} + +// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeScheduleRecurrencesResponse) GetTimezoneOk() (*string, bool) { + if o == nil || o.Timezone == nil { + return nil, false + } + return o.Timezone, true +} + +// HasTimezone returns a boolean if a field has been set. +func (o *DowntimeScheduleRecurrencesResponse) HasTimezone() bool { + return o != nil && o.Timezone != nil +} + +// SetTimezone gets a reference to the given string and assigns it to the Timezone field. +func (o *DowntimeScheduleRecurrencesResponse) SetTimezone(v string) { + o.Timezone = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeScheduleRecurrencesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CurrentDowntime != nil { + toSerialize["current_downtime"] = o.CurrentDowntime + } + toSerialize["recurrences"] = o.Recurrences + if o.Timezone != nil { + toSerialize["timezone"] = o.Timezone + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeScheduleRecurrencesResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CurrentDowntime *DowntimeScheduleCurrentDowntimeResponse `json:"current_downtime,omitempty"` + Recurrences *[]DowntimeScheduleRecurrenceResponse `json:"recurrences"` + Timezone *string `json:"timezone,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Recurrences == nil { + return fmt.Errorf("required field recurrences missing") + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"current_downtime", "recurrences", "timezone"}) + } else { + return err + } + + hasInvalidField := false + if all.CurrentDowntime != nil && all.CurrentDowntime.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.CurrentDowntime = all.CurrentDowntime + o.Recurrences = *all.Recurrences + o.Timezone = all.Timezone + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_recurrences_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_recurrences_update_request.go new file mode 100644 index 000000000..894c1fee8 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_recurrences_update_request.go @@ -0,0 +1,143 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeScheduleRecurrencesUpdateRequest A recurring downtime schedule definition. +type DowntimeScheduleRecurrencesUpdateRequest struct { + // A list of downtime recurrences. + Recurrences []DowntimeScheduleRecurrenceCreateUpdateRequest `json:"recurrences,omitempty"` + // The timezone in which to schedule the downtime. + Timezone *string `json:"timezone,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{} +} + +// NewDowntimeScheduleRecurrencesUpdateRequest instantiates a new DowntimeScheduleRecurrencesUpdateRequest 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 NewDowntimeScheduleRecurrencesUpdateRequest() *DowntimeScheduleRecurrencesUpdateRequest { + this := DowntimeScheduleRecurrencesUpdateRequest{} + var timezone string = "UTC" + this.Timezone = &timezone + return &this +} + +// NewDowntimeScheduleRecurrencesUpdateRequestWithDefaults instantiates a new DowntimeScheduleRecurrencesUpdateRequest 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 NewDowntimeScheduleRecurrencesUpdateRequestWithDefaults() *DowntimeScheduleRecurrencesUpdateRequest { + this := DowntimeScheduleRecurrencesUpdateRequest{} + var timezone string = "UTC" + this.Timezone = &timezone + return &this +} + +// GetRecurrences returns the Recurrences field value if set, zero value otherwise. +func (o *DowntimeScheduleRecurrencesUpdateRequest) GetRecurrences() []DowntimeScheduleRecurrenceCreateUpdateRequest { + if o == nil || o.Recurrences == nil { + var ret []DowntimeScheduleRecurrenceCreateUpdateRequest + return ret + } + return o.Recurrences +} + +// GetRecurrencesOk returns a tuple with the Recurrences field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeScheduleRecurrencesUpdateRequest) GetRecurrencesOk() (*[]DowntimeScheduleRecurrenceCreateUpdateRequest, bool) { + if o == nil || o.Recurrences == nil { + return nil, false + } + return &o.Recurrences, true +} + +// HasRecurrences returns a boolean if a field has been set. +func (o *DowntimeScheduleRecurrencesUpdateRequest) HasRecurrences() bool { + return o != nil && o.Recurrences != nil +} + +// SetRecurrences gets a reference to the given []DowntimeScheduleRecurrenceCreateUpdateRequest and assigns it to the Recurrences field. +func (o *DowntimeScheduleRecurrencesUpdateRequest) SetRecurrences(v []DowntimeScheduleRecurrenceCreateUpdateRequest) { + o.Recurrences = v +} + +// GetTimezone returns the Timezone field value if set, zero value otherwise. +func (o *DowntimeScheduleRecurrencesUpdateRequest) GetTimezone() string { + if o == nil || o.Timezone == nil { + var ret string + return ret + } + return *o.Timezone +} + +// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeScheduleRecurrencesUpdateRequest) GetTimezoneOk() (*string, bool) { + if o == nil || o.Timezone == nil { + return nil, false + } + return o.Timezone, true +} + +// HasTimezone returns a boolean if a field has been set. +func (o *DowntimeScheduleRecurrencesUpdateRequest) HasTimezone() bool { + return o != nil && o.Timezone != nil +} + +// SetTimezone gets a reference to the given string and assigns it to the Timezone field. +func (o *DowntimeScheduleRecurrencesUpdateRequest) SetTimezone(v string) { + o.Timezone = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeScheduleRecurrencesUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Recurrences != nil { + toSerialize["recurrences"] = o.Recurrences + } + if o.Timezone != nil { + toSerialize["timezone"] = o.Timezone + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeScheduleRecurrencesUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Recurrences []DowntimeScheduleRecurrenceCreateUpdateRequest `json:"recurrences,omitempty"` + Timezone *string `json:"timezone,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"recurrences", "timezone"}) + } else { + return err + } + o.Recurrences = all.Recurrences + o.Timezone = all.Timezone + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_response.go new file mode 100644 index 000000000..1ea10e4aa --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_response.go @@ -0,0 +1,107 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" +) + +// DowntimeScheduleResponse - The schedule that defines when the monitor starts, stops, and recurs. There are two types of schedules: +// one-time and recurring. Recurring schedules may have up to five RRULE-based recurrences. If no schedules are +// provided, the downtime will begin immediately and never end. +type DowntimeScheduleResponse struct { + DowntimeScheduleRecurrencesResponse *DowntimeScheduleRecurrencesResponse + DowntimeScheduleOneTimeResponse *DowntimeScheduleOneTimeResponse + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// DowntimeScheduleRecurrencesResponseAsDowntimeScheduleResponse is a convenience function that returns DowntimeScheduleRecurrencesResponse wrapped in DowntimeScheduleResponse. +func DowntimeScheduleRecurrencesResponseAsDowntimeScheduleResponse(v *DowntimeScheduleRecurrencesResponse) DowntimeScheduleResponse { + return DowntimeScheduleResponse{DowntimeScheduleRecurrencesResponse: v} +} + +// DowntimeScheduleOneTimeResponseAsDowntimeScheduleResponse is a convenience function that returns DowntimeScheduleOneTimeResponse wrapped in DowntimeScheduleResponse. +func DowntimeScheduleOneTimeResponseAsDowntimeScheduleResponse(v *DowntimeScheduleOneTimeResponse) DowntimeScheduleResponse { + return DowntimeScheduleResponse{DowntimeScheduleOneTimeResponse: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *DowntimeScheduleResponse) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into DowntimeScheduleRecurrencesResponse + err = json.Unmarshal(data, &obj.DowntimeScheduleRecurrencesResponse) + if err == nil { + if obj.DowntimeScheduleRecurrencesResponse != nil && obj.DowntimeScheduleRecurrencesResponse.UnparsedObject == nil { + jsonDowntimeScheduleRecurrencesResponse, _ := json.Marshal(obj.DowntimeScheduleRecurrencesResponse) + if string(jsonDowntimeScheduleRecurrencesResponse) == "{}" { // empty struct + obj.DowntimeScheduleRecurrencesResponse = nil + } else { + match++ + } + } else { + obj.DowntimeScheduleRecurrencesResponse = nil + } + } else { + obj.DowntimeScheduleRecurrencesResponse = nil + } + + // try to unmarshal data into DowntimeScheduleOneTimeResponse + err = json.Unmarshal(data, &obj.DowntimeScheduleOneTimeResponse) + if err == nil { + if obj.DowntimeScheduleOneTimeResponse != nil && obj.DowntimeScheduleOneTimeResponse.UnparsedObject == nil { + jsonDowntimeScheduleOneTimeResponse, _ := json.Marshal(obj.DowntimeScheduleOneTimeResponse) + if string(jsonDowntimeScheduleOneTimeResponse) == "{}" { // empty struct + obj.DowntimeScheduleOneTimeResponse = nil + } else { + match++ + } + } else { + obj.DowntimeScheduleOneTimeResponse = nil + } + } else { + obj.DowntimeScheduleOneTimeResponse = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.DowntimeScheduleRecurrencesResponse = nil + obj.DowntimeScheduleOneTimeResponse = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj DowntimeScheduleResponse) MarshalJSON() ([]byte, error) { + if obj.DowntimeScheduleRecurrencesResponse != nil { + return json.Marshal(&obj.DowntimeScheduleRecurrencesResponse) + } + + if obj.DowntimeScheduleOneTimeResponse != nil { + return json.Marshal(&obj.DowntimeScheduleOneTimeResponse) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *DowntimeScheduleResponse) GetActualInstance() interface{} { + if obj.DowntimeScheduleRecurrencesResponse != nil { + return obj.DowntimeScheduleRecurrencesResponse + } + + if obj.DowntimeScheduleOneTimeResponse != nil { + return obj.DowntimeScheduleOneTimeResponse + } + + // all schemas are nil + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_update_request.go new file mode 100644 index 000000000..48db62c82 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_schedule_update_request.go @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/goccy/go-json" +) + +// DowntimeScheduleUpdateRequest - Schedule for the downtime. +type DowntimeScheduleUpdateRequest struct { + DowntimeScheduleRecurrencesUpdateRequest *DowntimeScheduleRecurrencesUpdateRequest + DowntimeScheduleOneTimeCreateUpdateRequest *DowntimeScheduleOneTimeCreateUpdateRequest + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// DowntimeScheduleRecurrencesUpdateRequestAsDowntimeScheduleUpdateRequest is a convenience function that returns DowntimeScheduleRecurrencesUpdateRequest wrapped in DowntimeScheduleUpdateRequest. +func DowntimeScheduleRecurrencesUpdateRequestAsDowntimeScheduleUpdateRequest(v *DowntimeScheduleRecurrencesUpdateRequest) DowntimeScheduleUpdateRequest { + return DowntimeScheduleUpdateRequest{DowntimeScheduleRecurrencesUpdateRequest: v} +} + +// DowntimeScheduleOneTimeCreateUpdateRequestAsDowntimeScheduleUpdateRequest is a convenience function that returns DowntimeScheduleOneTimeCreateUpdateRequest wrapped in DowntimeScheduleUpdateRequest. +func DowntimeScheduleOneTimeCreateUpdateRequestAsDowntimeScheduleUpdateRequest(v *DowntimeScheduleOneTimeCreateUpdateRequest) DowntimeScheduleUpdateRequest { + return DowntimeScheduleUpdateRequest{DowntimeScheduleOneTimeCreateUpdateRequest: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *DowntimeScheduleUpdateRequest) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into DowntimeScheduleRecurrencesUpdateRequest + err = json.Unmarshal(data, &obj.DowntimeScheduleRecurrencesUpdateRequest) + if err == nil { + if obj.DowntimeScheduleRecurrencesUpdateRequest != nil && obj.DowntimeScheduleRecurrencesUpdateRequest.UnparsedObject == nil { + jsonDowntimeScheduleRecurrencesUpdateRequest, _ := json.Marshal(obj.DowntimeScheduleRecurrencesUpdateRequest) + if string(jsonDowntimeScheduleRecurrencesUpdateRequest) == "{}" { // empty struct + obj.DowntimeScheduleRecurrencesUpdateRequest = nil + } else { + match++ + } + } else { + obj.DowntimeScheduleRecurrencesUpdateRequest = nil + } + } else { + obj.DowntimeScheduleRecurrencesUpdateRequest = nil + } + + // try to unmarshal data into DowntimeScheduleOneTimeCreateUpdateRequest + err = json.Unmarshal(data, &obj.DowntimeScheduleOneTimeCreateUpdateRequest) + if err == nil { + if obj.DowntimeScheduleOneTimeCreateUpdateRequest != nil && obj.DowntimeScheduleOneTimeCreateUpdateRequest.UnparsedObject == nil { + jsonDowntimeScheduleOneTimeCreateUpdateRequest, _ := json.Marshal(obj.DowntimeScheduleOneTimeCreateUpdateRequest) + if string(jsonDowntimeScheduleOneTimeCreateUpdateRequest) == "{}" { // empty struct + obj.DowntimeScheduleOneTimeCreateUpdateRequest = nil + } else { + match++ + } + } else { + obj.DowntimeScheduleOneTimeCreateUpdateRequest = nil + } + } else { + obj.DowntimeScheduleOneTimeCreateUpdateRequest = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.DowntimeScheduleRecurrencesUpdateRequest = nil + obj.DowntimeScheduleOneTimeCreateUpdateRequest = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj DowntimeScheduleUpdateRequest) MarshalJSON() ([]byte, error) { + if obj.DowntimeScheduleRecurrencesUpdateRequest != nil { + return json.Marshal(&obj.DowntimeScheduleRecurrencesUpdateRequest) + } + + if obj.DowntimeScheduleOneTimeCreateUpdateRequest != nil { + return json.Marshal(&obj.DowntimeScheduleOneTimeCreateUpdateRequest) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *DowntimeScheduleUpdateRequest) GetActualInstance() interface{} { + if obj.DowntimeScheduleRecurrencesUpdateRequest != nil { + return obj.DowntimeScheduleRecurrencesUpdateRequest + } + + if obj.DowntimeScheduleOneTimeCreateUpdateRequest != nil { + return obj.DowntimeScheduleOneTimeCreateUpdateRequest + } + + // all schemas are nil + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_status.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_status.go new file mode 100644 index 000000000..ebe243b8d --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_status.go @@ -0,0 +1,70 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "fmt" + + "github.com/goccy/go-json" +) + +// DowntimeStatus The current status of the downtime. +type DowntimeStatus string + +// List of DowntimeStatus. +const ( + DOWNTIMESTATUS_ACTIVE DowntimeStatus = "active" + DOWNTIMESTATUS_CANCELED DowntimeStatus = "canceled" + DOWNTIMESTATUS_ENDED DowntimeStatus = "ended" + DOWNTIMESTATUS_SCHEDULED DowntimeStatus = "scheduled" +) + +var allowedDowntimeStatusEnumValues = []DowntimeStatus{ + DOWNTIMESTATUS_ACTIVE, + DOWNTIMESTATUS_CANCELED, + DOWNTIMESTATUS_ENDED, + DOWNTIMESTATUS_SCHEDULED, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *DowntimeStatus) GetAllowedValues() []DowntimeStatus { + return allowedDowntimeStatusEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *DowntimeStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = DowntimeStatus(value) + return nil +} + +// NewDowntimeStatusFromValue returns a pointer to a valid DowntimeStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewDowntimeStatusFromValue(v string) (*DowntimeStatus, error) { + ev := DowntimeStatus(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for DowntimeStatus: valid values are %v", v, allowedDowntimeStatusEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v DowntimeStatus) IsValid() bool { + for _, existing := range allowedDowntimeStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DowntimeStatus value. +func (v DowntimeStatus) Ptr() *DowntimeStatus { + return &v +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_update_request.go new file mode 100644 index 000000000..5a9ff5443 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_update_request.go @@ -0,0 +1,112 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "fmt" + + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeUpdateRequest Request for editing a downtime. +type DowntimeUpdateRequest struct { + // Object to update a downtime. + Data DowntimeUpdateRequestData `json:"data"` + // 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{} +} + +// NewDowntimeUpdateRequest instantiates a new DowntimeUpdateRequest 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 NewDowntimeUpdateRequest(data DowntimeUpdateRequestData) *DowntimeUpdateRequest { + this := DowntimeUpdateRequest{} + this.Data = data + return &this +} + +// NewDowntimeUpdateRequestWithDefaults instantiates a new DowntimeUpdateRequest 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 NewDowntimeUpdateRequestWithDefaults() *DowntimeUpdateRequest { + this := DowntimeUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *DowntimeUpdateRequest) GetData() DowntimeUpdateRequestData { + if o == nil { + var ret DowntimeUpdateRequestData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *DowntimeUpdateRequest) GetDataOk() (*DowntimeUpdateRequestData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *DowntimeUpdateRequest) SetData(v DowntimeUpdateRequestData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *DowntimeUpdateRequestData `json:"data"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + 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 + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_update_request_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_update_request_attributes.go new file mode 100644 index 000000000..5d32cbb9a --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_update_request_attributes.go @@ -0,0 +1,377 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DowntimeUpdateRequestAttributes Attributes of the downtime to update. +type DowntimeUpdateRequestAttributes struct { + // The timezone in which to display the downtime's start and end times in Datadog applications. This is not used + // as an offset for scheduling. + DisplayTimezone datadog.NullableString `json:"display_timezone,omitempty"` + // A message to include with notifications for this downtime. Email notifications can be sent to specific users + // by using the same `@username` notation as events. + Message datadog.NullableString `json:"message,omitempty"` + // Monitor identifier for the downtime. + MonitorIdentifier *DowntimeMonitorIdentifier `json:"monitor_identifier,omitempty"` + // If the first recovery notification during a downtime should be muted. + MuteFirstRecoveryNotification *bool `json:"mute_first_recovery_notification,omitempty"` + // States that will trigger a monitor notification when the `notify_end_types` action occurs. + NotifyEndStates []DowntimeNotifyEndStateTypes `json:"notify_end_states,omitempty"` + // Actions that will trigger a monitor notification if the downtime is in the `notify_end_types` state. + NotifyEndTypes []DowntimeNotifyEndStateActions `json:"notify_end_types,omitempty"` + // Schedule for the downtime. + Schedule *DowntimeScheduleUpdateRequest `json:"schedule,omitempty"` + // The scope to which the downtime applies. Must follow the [common search syntax](https://docs.datadoghq.com/logs/explorer/search_syntax/). + Scope *string `json:"scope,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{} +} + +// NewDowntimeUpdateRequestAttributes instantiates a new DowntimeUpdateRequestAttributes 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 NewDowntimeUpdateRequestAttributes() *DowntimeUpdateRequestAttributes { + this := DowntimeUpdateRequestAttributes{} + var displayTimezone string = "UTC" + this.DisplayTimezone = *datadog.NewNullableString(&displayTimezone) + return &this +} + +// NewDowntimeUpdateRequestAttributesWithDefaults instantiates a new DowntimeUpdateRequestAttributes 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 NewDowntimeUpdateRequestAttributesWithDefaults() *DowntimeUpdateRequestAttributes { + this := DowntimeUpdateRequestAttributes{} + var displayTimezone string = "UTC" + this.DisplayTimezone = *datadog.NewNullableString(&displayTimezone) + return &this +} + +// GetDisplayTimezone returns the DisplayTimezone field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DowntimeUpdateRequestAttributes) GetDisplayTimezone() string { + if o == nil || o.DisplayTimezone.Get() == nil { + var ret string + return ret + } + return *o.DisplayTimezone.Get() +} + +// GetDisplayTimezoneOk returns a tuple with the DisplayTimezone field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *DowntimeUpdateRequestAttributes) GetDisplayTimezoneOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.DisplayTimezone.Get(), o.DisplayTimezone.IsSet() +} + +// HasDisplayTimezone returns a boolean if a field has been set. +func (o *DowntimeUpdateRequestAttributes) HasDisplayTimezone() bool { + return o != nil && o.DisplayTimezone.IsSet() +} + +// SetDisplayTimezone gets a reference to the given datadog.NullableString and assigns it to the DisplayTimezone field. +func (o *DowntimeUpdateRequestAttributes) SetDisplayTimezone(v string) { + o.DisplayTimezone.Set(&v) +} + +// SetDisplayTimezoneNil sets the value for DisplayTimezone to be an explicit nil. +func (o *DowntimeUpdateRequestAttributes) SetDisplayTimezoneNil() { + o.DisplayTimezone.Set(nil) +} + +// UnsetDisplayTimezone ensures that no value is present for DisplayTimezone, not even an explicit nil. +func (o *DowntimeUpdateRequestAttributes) UnsetDisplayTimezone() { + o.DisplayTimezone.Unset() +} + +// GetMessage returns the Message field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DowntimeUpdateRequestAttributes) GetMessage() string { + if o == nil || o.Message.Get() == nil { + var ret string + return ret + } + return *o.Message.Get() +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *DowntimeUpdateRequestAttributes) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Message.Get(), o.Message.IsSet() +} + +// HasMessage returns a boolean if a field has been set. +func (o *DowntimeUpdateRequestAttributes) HasMessage() bool { + return o != nil && o.Message.IsSet() +} + +// SetMessage gets a reference to the given datadog.NullableString and assigns it to the Message field. +func (o *DowntimeUpdateRequestAttributes) SetMessage(v string) { + o.Message.Set(&v) +} + +// SetMessageNil sets the value for Message to be an explicit nil. +func (o *DowntimeUpdateRequestAttributes) SetMessageNil() { + o.Message.Set(nil) +} + +// UnsetMessage ensures that no value is present for Message, not even an explicit nil. +func (o *DowntimeUpdateRequestAttributes) UnsetMessage() { + o.Message.Unset() +} + +// GetMonitorIdentifier returns the MonitorIdentifier field value if set, zero value otherwise. +func (o *DowntimeUpdateRequestAttributes) GetMonitorIdentifier() DowntimeMonitorIdentifier { + if o == nil || o.MonitorIdentifier == nil { + var ret DowntimeMonitorIdentifier + return ret + } + return *o.MonitorIdentifier +} + +// GetMonitorIdentifierOk returns a tuple with the MonitorIdentifier field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeUpdateRequestAttributes) GetMonitorIdentifierOk() (*DowntimeMonitorIdentifier, bool) { + if o == nil || o.MonitorIdentifier == nil { + return nil, false + } + return o.MonitorIdentifier, true +} + +// HasMonitorIdentifier returns a boolean if a field has been set. +func (o *DowntimeUpdateRequestAttributes) HasMonitorIdentifier() bool { + return o != nil && o.MonitorIdentifier != nil +} + +// SetMonitorIdentifier gets a reference to the given DowntimeMonitorIdentifier and assigns it to the MonitorIdentifier field. +func (o *DowntimeUpdateRequestAttributes) SetMonitorIdentifier(v DowntimeMonitorIdentifier) { + o.MonitorIdentifier = &v +} + +// GetMuteFirstRecoveryNotification returns the MuteFirstRecoveryNotification field value if set, zero value otherwise. +func (o *DowntimeUpdateRequestAttributes) GetMuteFirstRecoveryNotification() bool { + if o == nil || o.MuteFirstRecoveryNotification == nil { + var ret bool + return ret + } + return *o.MuteFirstRecoveryNotification +} + +// GetMuteFirstRecoveryNotificationOk returns a tuple with the MuteFirstRecoveryNotification field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeUpdateRequestAttributes) GetMuteFirstRecoveryNotificationOk() (*bool, bool) { + if o == nil || o.MuteFirstRecoveryNotification == nil { + return nil, false + } + return o.MuteFirstRecoveryNotification, true +} + +// HasMuteFirstRecoveryNotification returns a boolean if a field has been set. +func (o *DowntimeUpdateRequestAttributes) HasMuteFirstRecoveryNotification() bool { + return o != nil && o.MuteFirstRecoveryNotification != nil +} + +// SetMuteFirstRecoveryNotification gets a reference to the given bool and assigns it to the MuteFirstRecoveryNotification field. +func (o *DowntimeUpdateRequestAttributes) SetMuteFirstRecoveryNotification(v bool) { + o.MuteFirstRecoveryNotification = &v +} + +// GetNotifyEndStates returns the NotifyEndStates field value if set, zero value otherwise. +func (o *DowntimeUpdateRequestAttributes) GetNotifyEndStates() []DowntimeNotifyEndStateTypes { + if o == nil || o.NotifyEndStates == nil { + var ret []DowntimeNotifyEndStateTypes + return ret + } + return o.NotifyEndStates +} + +// GetNotifyEndStatesOk returns a tuple with the NotifyEndStates field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeUpdateRequestAttributes) GetNotifyEndStatesOk() (*[]DowntimeNotifyEndStateTypes, bool) { + if o == nil || o.NotifyEndStates == nil { + return nil, false + } + return &o.NotifyEndStates, true +} + +// HasNotifyEndStates returns a boolean if a field has been set. +func (o *DowntimeUpdateRequestAttributes) HasNotifyEndStates() bool { + return o != nil && o.NotifyEndStates != nil +} + +// SetNotifyEndStates gets a reference to the given []DowntimeNotifyEndStateTypes and assigns it to the NotifyEndStates field. +func (o *DowntimeUpdateRequestAttributes) SetNotifyEndStates(v []DowntimeNotifyEndStateTypes) { + o.NotifyEndStates = v +} + +// GetNotifyEndTypes returns the NotifyEndTypes field value if set, zero value otherwise. +func (o *DowntimeUpdateRequestAttributes) GetNotifyEndTypes() []DowntimeNotifyEndStateActions { + if o == nil || o.NotifyEndTypes == nil { + var ret []DowntimeNotifyEndStateActions + return ret + } + return o.NotifyEndTypes +} + +// GetNotifyEndTypesOk returns a tuple with the NotifyEndTypes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeUpdateRequestAttributes) GetNotifyEndTypesOk() (*[]DowntimeNotifyEndStateActions, bool) { + if o == nil || o.NotifyEndTypes == nil { + return nil, false + } + return &o.NotifyEndTypes, true +} + +// HasNotifyEndTypes returns a boolean if a field has been set. +func (o *DowntimeUpdateRequestAttributes) HasNotifyEndTypes() bool { + return o != nil && o.NotifyEndTypes != nil +} + +// SetNotifyEndTypes gets a reference to the given []DowntimeNotifyEndStateActions and assigns it to the NotifyEndTypes field. +func (o *DowntimeUpdateRequestAttributes) SetNotifyEndTypes(v []DowntimeNotifyEndStateActions) { + o.NotifyEndTypes = v +} + +// GetSchedule returns the Schedule field value if set, zero value otherwise. +func (o *DowntimeUpdateRequestAttributes) GetSchedule() DowntimeScheduleUpdateRequest { + if o == nil || o.Schedule == nil { + var ret DowntimeScheduleUpdateRequest + return ret + } + return *o.Schedule +} + +// GetScheduleOk returns a tuple with the Schedule field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeUpdateRequestAttributes) GetScheduleOk() (*DowntimeScheduleUpdateRequest, bool) { + if o == nil || o.Schedule == nil { + return nil, false + } + return o.Schedule, true +} + +// HasSchedule returns a boolean if a field has been set. +func (o *DowntimeUpdateRequestAttributes) HasSchedule() bool { + return o != nil && o.Schedule != nil +} + +// SetSchedule gets a reference to the given DowntimeScheduleUpdateRequest and assigns it to the Schedule field. +func (o *DowntimeUpdateRequestAttributes) SetSchedule(v DowntimeScheduleUpdateRequest) { + o.Schedule = &v +} + +// GetScope returns the Scope field value if set, zero value otherwise. +func (o *DowntimeUpdateRequestAttributes) GetScope() string { + if o == nil || o.Scope == nil { + var ret string + return ret + } + return *o.Scope +} + +// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeUpdateRequestAttributes) GetScopeOk() (*string, bool) { + if o == nil || o.Scope == nil { + return nil, false + } + return o.Scope, true +} + +// HasScope returns a boolean if a field has been set. +func (o *DowntimeUpdateRequestAttributes) HasScope() bool { + return o != nil && o.Scope != nil +} + +// SetScope gets a reference to the given string and assigns it to the Scope field. +func (o *DowntimeUpdateRequestAttributes) SetScope(v string) { + o.Scope = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeUpdateRequestAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.DisplayTimezone.IsSet() { + toSerialize["display_timezone"] = o.DisplayTimezone.Get() + } + if o.Message.IsSet() { + toSerialize["message"] = o.Message.Get() + } + if o.MonitorIdentifier != nil { + toSerialize["monitor_identifier"] = o.MonitorIdentifier + } + if o.MuteFirstRecoveryNotification != nil { + toSerialize["mute_first_recovery_notification"] = o.MuteFirstRecoveryNotification + } + if o.NotifyEndStates != nil { + toSerialize["notify_end_states"] = o.NotifyEndStates + } + if o.NotifyEndTypes != nil { + toSerialize["notify_end_types"] = o.NotifyEndTypes + } + if o.Schedule != nil { + toSerialize["schedule"] = o.Schedule + } + if o.Scope != nil { + toSerialize["scope"] = o.Scope + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeUpdateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + DisplayTimezone datadog.NullableString `json:"display_timezone,omitempty"` + Message datadog.NullableString `json:"message,omitempty"` + MonitorIdentifier *DowntimeMonitorIdentifier `json:"monitor_identifier,omitempty"` + MuteFirstRecoveryNotification *bool `json:"mute_first_recovery_notification,omitempty"` + NotifyEndStates []DowntimeNotifyEndStateTypes `json:"notify_end_states,omitempty"` + NotifyEndTypes []DowntimeNotifyEndStateActions `json:"notify_end_types,omitempty"` + Schedule *DowntimeScheduleUpdateRequest `json:"schedule,omitempty"` + Scope *string `json:"scope,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"display_timezone", "message", "monitor_identifier", "mute_first_recovery_notification", "notify_end_states", "notify_end_types", "schedule", "scope"}) + } else { + return err + } + o.DisplayTimezone = all.DisplayTimezone + o.Message = all.Message + o.MonitorIdentifier = all.MonitorIdentifier + o.MuteFirstRecoveryNotification = all.MuteFirstRecoveryNotification + o.NotifyEndStates = all.NotifyEndStates + o.NotifyEndTypes = all.NotifyEndTypes + o.Schedule = all.Schedule + o.Scope = all.Scope + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_update_request_data.go similarity index 59% rename from vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_data.go rename to vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_update_request_data.go index f1a4d3008..5c84fb175 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_downtime_update_request_data.go @@ -5,51 +5,52 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// TeamData A team -type TeamData struct { - // Team attributes - Attributes TeamAttributes `json:"attributes"` - // The team's identifier +// DowntimeUpdateRequestData Object to update a downtime. +type DowntimeUpdateRequestData struct { + // Attributes of the downtime to update. + Attributes DowntimeUpdateRequestAttributes `json:"attributes"` + // ID of this downtime. Id string `json:"id"` - // Team type - Type TeamType `json:"type"` + // Downtime resource type. + Type DowntimeResourceType `json:"type"` // 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{} } -// NewTeamData instantiates a new TeamData object. +// NewDowntimeUpdateRequestData instantiates a new DowntimeUpdateRequestData 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 NewTeamData(attributes TeamAttributes, id string, typeVar TeamType) *TeamData { - this := TeamData{} +func NewDowntimeUpdateRequestData(attributes DowntimeUpdateRequestAttributes, id string, typeVar DowntimeResourceType) *DowntimeUpdateRequestData { + this := DowntimeUpdateRequestData{} this.Attributes = attributes this.Id = id this.Type = typeVar return &this } -// NewTeamDataWithDefaults instantiates a new TeamData object. +// NewDowntimeUpdateRequestDataWithDefaults instantiates a new DowntimeUpdateRequestData 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 NewTeamDataWithDefaults() *TeamData { - this := TeamData{} - var typeVar TeamType = TEAMTYPE_TEAM +func NewDowntimeUpdateRequestDataWithDefaults() *DowntimeUpdateRequestData { + this := DowntimeUpdateRequestData{} + var typeVar DowntimeResourceType = DOWNTIMERESOURCETYPE_DOWNTIME this.Type = typeVar return &this } // GetAttributes returns the Attributes field value. -func (o *TeamData) GetAttributes() TeamAttributes { +func (o *DowntimeUpdateRequestData) GetAttributes() DowntimeUpdateRequestAttributes { if o == nil { - var ret TeamAttributes + var ret DowntimeUpdateRequestAttributes return ret } return o.Attributes @@ -57,7 +58,7 @@ func (o *TeamData) GetAttributes() TeamAttributes { // GetAttributesOk returns a tuple with the Attributes field value // and a boolean to check if the value has been set. -func (o *TeamData) GetAttributesOk() (*TeamAttributes, bool) { +func (o *DowntimeUpdateRequestData) GetAttributesOk() (*DowntimeUpdateRequestAttributes, bool) { if o == nil { return nil, false } @@ -65,12 +66,12 @@ func (o *TeamData) GetAttributesOk() (*TeamAttributes, bool) { } // SetAttributes sets field value. -func (o *TeamData) SetAttributes(v TeamAttributes) { +func (o *DowntimeUpdateRequestData) SetAttributes(v DowntimeUpdateRequestAttributes) { o.Attributes = v } // GetId returns the Id field value. -func (o *TeamData) GetId() string { +func (o *DowntimeUpdateRequestData) GetId() string { if o == nil { var ret string return ret @@ -80,7 +81,7 @@ func (o *TeamData) GetId() string { // GetIdOk returns a tuple with the Id field value // and a boolean to check if the value has been set. -func (o *TeamData) GetIdOk() (*string, bool) { +func (o *DowntimeUpdateRequestData) GetIdOk() (*string, bool) { if o == nil { return nil, false } @@ -88,14 +89,14 @@ func (o *TeamData) GetIdOk() (*string, bool) { } // SetId sets field value. -func (o *TeamData) SetId(v string) { +func (o *DowntimeUpdateRequestData) SetId(v string) { o.Id = v } // GetType returns the Type field value. -func (o *TeamData) GetType() TeamType { +func (o *DowntimeUpdateRequestData) GetType() DowntimeResourceType { if o == nil { - var ret TeamType + var ret DowntimeResourceType return ret } return o.Type @@ -103,7 +104,7 @@ func (o *TeamData) GetType() TeamType { // GetTypeOk returns a tuple with the Type field value // and a boolean to check if the value has been set. -func (o *TeamData) GetTypeOk() (*TeamType, bool) { +func (o *DowntimeUpdateRequestData) GetTypeOk() (*DowntimeResourceType, bool) { if o == nil { return nil, false } @@ -111,12 +112,12 @@ func (o *TeamData) GetTypeOk() (*TeamType, bool) { } // SetType sets field value. -func (o *TeamData) SetType(v TeamType) { +func (o *DowntimeUpdateRequestData) SetType(v DowntimeResourceType) { o.Type = v } // MarshalJSON serializes the struct using spec logic. -func (o TeamData) MarshalJSON() ([]byte, error) { +func (o DowntimeUpdateRequestData) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.UnparsedObject != nil { return json.Marshal(o.UnparsedObject) @@ -132,20 +133,14 @@ func (o TeamData) MarshalJSON() ([]byte, error) { } // UnmarshalJSON deserializes the given payload. -func (o *TeamData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} +func (o *DowntimeUpdateRequestData) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Attributes *TeamAttributes `json:"attributes"` - Id *string `json:"id"` - Type *TeamType `json:"type"` + Attributes *DowntimeUpdateRequestAttributes `json:"attributes"` + Id *string `json:"id"` + Type *DowntimeResourceType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -162,27 +157,26 @@ func (o *TeamData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event.go index 43f1a6129..83c8b63ef 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -181,7 +181,6 @@ func (o Event) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Event) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` @@ -189,12 +188,7 @@ func (o *Event) UnmarshalJSON(bytes []byte) (err error) { Type *string `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,6 +200,7 @@ func (o *Event) UnmarshalJSON(bytes []byte) (err error) { o.Name = all.Name o.SourceId = all.SourceId o.Type = all.Type + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event_attributes.go index 4fd7b7abf..d2c2d3167 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -726,7 +726,6 @@ func (o EventAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AggregationKey *string `json:"aggregation_key,omitempty"` DateHappened *int64 `json:"date_happened,omitempty"` @@ -749,12 +748,7 @@ func (o *EventAttributes) UnmarshalJSON(bytes []byte) (err error) { Title *string `json:"title,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -762,51 +756,46 @@ func (o *EventAttributes) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Priority; v.Get() != nil && !v.Get().IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.AggregationKey = all.AggregationKey o.DateHappened = all.DateHappened o.DeviceName = all.DeviceName o.Duration = all.Duration o.EventObject = all.EventObject if all.Evt != nil && all.Evt.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Evt = all.Evt o.Hostname = all.Hostname o.Monitor = all.Monitor o.MonitorGroups = all.MonitorGroups o.MonitorId = all.MonitorId - o.Priority = all.Priority + if all.Priority.Get() != nil && !all.Priority.Get().IsValid() { + hasInvalidField = true + } else { + o.Priority = all.Priority + } o.RelatedEventId = all.RelatedEventId o.Service = all.Service o.SourceTypeName = all.SourceTypeName o.Sourcecategory = all.Sourcecategory - o.Status = all.Status + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } o.Tags = all.Tags o.Timestamp = all.Timestamp o.Title = all.Title + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event_priority.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event_priority.go index 1587dcb8c..4efc8b080 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event_priority.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event_priority.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // EventPriority The priority of the event's monitor. For example, `normal` or `low`. diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event_response.go index 9b60003b5..3c0d9ac25 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o EventResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *EventResponseAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *EventType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *EventResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event_response_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event_response_attributes.go index b7c4b021d..6028fd3ea 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event_response_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event_response_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -15,6 +16,8 @@ import ( type EventResponseAttributes struct { // Object description of attributes from your event. Attributes *EventAttributes `json:"attributes,omitempty"` + // The message of the event. + Message *string `json:"message,omitempty"` // An array of tags associated with the event. Tags []string `json:"tags,omitempty"` // The timestamp of the event. @@ -69,6 +72,34 @@ func (o *EventResponseAttributes) SetAttributes(v EventAttributes) { o.Attributes = &v } +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *EventResponseAttributes) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventResponseAttributes) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *EventResponseAttributes) HasMessage() bool { + return o != nil && o.Message != nil +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *EventResponseAttributes) SetMessage(v string) { + o.Message = &v +} + // GetTags returns the Tags field value if set, zero value otherwise. func (o *EventResponseAttributes) GetTags() []string { if o == nil || o.Tags == nil { @@ -134,6 +165,9 @@ func (o EventResponseAttributes) MarshalJSON() ([]byte, error) { if o.Attributes != nil { toSerialize["attributes"] = o.Attributes } + if o.Message != nil { + toSerialize["message"] = o.Message + } if o.Tags != nil { toSerialize["tags"] = o.Tags } @@ -153,39 +187,38 @@ func (o EventResponseAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *EventAttributes `json:"attributes,omitempty"` + Message *string `json:"message,omitempty"` Tags []string `json:"tags,omitempty"` Timestamp *time.Time `json:"timestamp,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "tags", "timestamp"}) + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "message", "tags", "timestamp"}) } else { return err } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes + o.Message = all.Message o.Tags = all.Tags o.Timestamp = all.Timestamp + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event_status_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event_status_type.go index 3aa3f46e7..ff9c9c2ee 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event_status_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event_status_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // EventStatusType If an alert event is enabled, its status is one of the following: @@ -77,47 +78,3 @@ func (v EventStatusType) IsValid() bool { func (v EventStatusType) Ptr() *EventStatusType { return &v } - -// NullableEventStatusType handles when a null is used for EventStatusType. -type NullableEventStatusType struct { - value *EventStatusType - isSet bool -} - -// Get returns the associated value. -func (v NullableEventStatusType) Get() *EventStatusType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableEventStatusType) Set(val *EventStatusType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableEventStatusType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableEventStatusType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableEventStatusType initializes the struct as if Set has been called. -func NewNullableEventStatusType(val *EventStatusType) *NullableEventStatusType { - return &NullableEventStatusType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableEventStatusType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableEventStatusType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event_type.go index 830841310..39165817e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_event_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // EventType Type of the event. @@ -61,47 +62,3 @@ func (v EventType) IsValid() bool { func (v EventType) Ptr() *EventType { return &v } - -// NullableEventType handles when a null is used for EventType. -type NullableEventType struct { - value *EventType - isSet bool -} - -// Get returns the associated value. -func (v NullableEventType) Get() *EventType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableEventType) Set(val *EventType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableEventType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableEventType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableEventType initializes the struct as if Set has been called. -func NewNullableEventType(val *EventType) *NullableEventType { - return &NullableEventType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableEventType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableEventType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_aggregation.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_aggregation.go index fff73ddd8..885623221 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_aggregation.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_aggregation.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // EventsAggregation The type of aggregation that can be performed on events-based queries. @@ -81,47 +82,3 @@ func (v EventsAggregation) IsValid() bool { func (v EventsAggregation) Ptr() *EventsAggregation { return &v } - -// NullableEventsAggregation handles when a null is used for EventsAggregation. -type NullableEventsAggregation struct { - value *EventsAggregation - isSet bool -} - -// Get returns the associated value. -func (v NullableEventsAggregation) Get() *EventsAggregation { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableEventsAggregation) Set(val *EventsAggregation) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableEventsAggregation) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableEventsAggregation) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableEventsAggregation initializes the struct as if Set has been called. -func NewNullableEventsAggregation(val *EventsAggregation) *NullableEventsAggregation { - return &NullableEventsAggregation{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableEventsAggregation) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableEventsAggregation) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_compute.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_compute.go index 039a5dcae..7d8f2fc8e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_compute.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_compute.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -145,19 +146,13 @@ func (o EventsCompute) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventsCompute) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregation *EventsAggregation `json:"aggregation"` Interval *int64 `json:"interval,omitempty"` Metric *string `json:"metric,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Aggregation == nil { return fmt.Errorf("required field aggregation missing") @@ -168,20 +163,23 @@ func (o *EventsCompute) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Aggregation; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if !all.Aggregation.IsValid() { + hasInvalidField = true + } else { + o.Aggregation = *all.Aggregation } - o.Aggregation = *all.Aggregation o.Interval = all.Interval o.Metric = all.Metric + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_data_source.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_data_source.go index eafcdaba1..2cf99b68a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_data_source.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_data_source.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // EventsDataSource A data source that is powered by the Events Platform. @@ -63,47 +64,3 @@ func (v EventsDataSource) IsValid() bool { func (v EventsDataSource) Ptr() *EventsDataSource { return &v } - -// NullableEventsDataSource handles when a null is used for EventsDataSource. -type NullableEventsDataSource struct { - value *EventsDataSource - isSet bool -} - -// Get returns the associated value. -func (v NullableEventsDataSource) Get() *EventsDataSource { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableEventsDataSource) Set(val *EventsDataSource) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableEventsDataSource) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableEventsDataSource) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableEventsDataSource initializes the struct as if Set has been called. -func NewNullableEventsDataSource(val *EventsDataSource) *NullableEventsDataSource { - return &NullableEventsDataSource{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableEventsDataSource) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableEventsDataSource) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_group_by.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_group_by.go index 2789eb637..1c463afeb 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_group_by.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_group_by.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -143,19 +144,13 @@ func (o EventsGroupBy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventsGroupBy) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Facet *string `json:"facet"` Limit *int32 `json:"limit,omitempty"` Sort *EventsGroupBySort `json:"sort,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Facet == nil { return fmt.Errorf("required field facet missing") @@ -166,19 +161,22 @@ func (o *EventsGroupBy) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Facet = *all.Facet o.Limit = all.Limit if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Sort = all.Sort + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_group_by_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_group_by_sort.go index 0a83ee4e3..b075b51e8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_group_by_sort.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_group_by_sort.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -15,7 +16,7 @@ import ( type EventsGroupBySort struct { // The type of aggregation that can be performed on events-based queries. Aggregation EventsAggregation `json:"aggregation"` - // Metric whose calculated value should be used to define the sort order of a query's results. + // The metric's calculated value which should be used to define the sort order of a query's results. Metric *string `json:"metric,omitempty"` // Direction of sort. Order *QuerySortOrder `json:"order,omitempty"` @@ -182,7 +183,6 @@ func (o EventsGroupBySort) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventsGroupBySort) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregation *EventsAggregation `json:"aggregation"` Metric *string `json:"metric,omitempty"` @@ -190,12 +190,7 @@ func (o *EventsGroupBySort) UnmarshalJSON(bytes []byte) (err error) { Type *EventsSortType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Aggregation == nil { return fmt.Errorf("required field aggregation missing") @@ -206,37 +201,32 @@ func (o *EventsGroupBySort) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Aggregation; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Order; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregation = *all.Aggregation + + hasInvalidField := false + if !all.Aggregation.IsValid() { + hasInvalidField = true + } else { + o.Aggregation = *all.Aggregation + } o.Metric = all.Metric - o.Order = all.Order - o.Type = all.Type + if all.Order != nil && !all.Order.IsValid() { + hasInvalidField = true + } else { + o.Order = all.Order + } + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_list_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_list_request.go index 8f8543326..ce34d3de5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_list_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_list_request.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -182,7 +182,6 @@ func (o EventsListRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventsListRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Filter *EventsQueryFilter `json:"filter,omitempty"` Options *EventsQueryOptions `json:"options,omitempty"` @@ -190,12 +189,7 @@ func (o *EventsListRequest) UnmarshalJSON(bytes []byte) (err error) { Sort *EventsSort `json:"sort,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -203,42 +197,33 @@ func (o *EventsListRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Sort; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Filter = all.Filter if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Options = all.Options if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Page = all.Page - o.Sort = all.Sort + if all.Sort != nil && !all.Sort.IsValid() { + hasInvalidField = true + } else { + o.Sort = all.Sort + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_list_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_list_response.go index ae030e3da..e486b8089 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_list_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_list_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o EventsListResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventsListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []EventResponse `json:"data,omitempty"` Links *EventsListResponseLinks `json:"links,omitempty"` Meta *EventsResponseMetadata `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,26 +162,25 @@ func (o *EventsListResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Data = all.Data if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Links = all.Links if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_list_response_links.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_list_response_links.go index de52373ee..c86965bdf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_list_response_links.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_list_response_links.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -83,17 +83,11 @@ func (o EventsListResponseLinks) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventsListResponseLinks) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Next *string `json:"next,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -102,6 +96,7 @@ func (o *EventsListResponseLinks) UnmarshalJSON(bytes []byte) (err error) { return err } o.Next = all.Next + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_query_filter.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_query_filter.go index c3300b1ba..69876d95b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_query_filter.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_query_filter.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -160,19 +160,13 @@ func (o EventsQueryFilter) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventsQueryFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { From *string `json:"from,omitempty"` Query *string `json:"query,omitempty"` To *string `json:"to,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -183,6 +177,7 @@ func (o *EventsQueryFilter) UnmarshalJSON(bytes []byte) (err error) { o.From = all.From o.Query = all.Query o.To = all.To + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_query_options.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_query_options.go index 449f3a457..039039955 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_query_options.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_query_options.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -120,18 +120,12 @@ func (o EventsQueryOptions) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventsQueryOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { TimeOffset *int64 `json:"timeOffset,omitempty"` Timezone *string `json:"timezone,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -141,6 +135,7 @@ func (o *EventsQueryOptions) UnmarshalJSON(bytes []byte) (err error) { } o.TimeOffset = all.TimeOffset o.Timezone = all.Timezone + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_request_page.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_request_page.go index 81f635682..40f437dd1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_request_page.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_request_page.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -119,18 +119,12 @@ func (o EventsRequestPage) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventsRequestPage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Cursor *string `json:"cursor,omitempty"` Limit *int32 `json:"limit,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -140,6 +134,7 @@ func (o *EventsRequestPage) UnmarshalJSON(bytes []byte) (err error) { } o.Cursor = all.Cursor o.Limit = all.Limit + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_response_metadata.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_response_metadata.go index 3051c7105..3b66f0849 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_response_metadata.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_response_metadata.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -18,6 +18,8 @@ type EventsResponseMetadata struct { Page *EventsResponseMetadataPage `json:"page,omitempty"` // The identifier of the request. RequestId *string `json:"request_id,omitempty"` + // The request status. + Status *string `json:"status,omitempty"` // A list of warnings (non-fatal errors) encountered. Partial results might be returned if // warnings are present in the response. Warnings []EventsWarning `json:"warnings,omitempty"` @@ -127,6 +129,34 @@ func (o *EventsResponseMetadata) SetRequestId(v string) { o.RequestId = &v } +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *EventsResponseMetadata) GetStatus() string { + if o == nil || o.Status == nil { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventsResponseMetadata) GetStatusOk() (*string, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *EventsResponseMetadata) HasStatus() bool { + return o != nil && o.Status != nil +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *EventsResponseMetadata) SetStatus(v string) { + o.Status = &v +} + // GetWarnings returns the Warnings field value if set, zero value otherwise. func (o *EventsResponseMetadata) GetWarnings() []EventsWarning { if o == nil || o.Warnings == nil { @@ -170,6 +200,9 @@ func (o EventsResponseMetadata) MarshalJSON() ([]byte, error) { if o.RequestId != nil { toSerialize["request_id"] = o.RequestId } + if o.Status != nil { + toSerialize["status"] = o.Status + } if o.Warnings != nil { toSerialize["warnings"] = o.Warnings } @@ -182,41 +215,40 @@ func (o EventsResponseMetadata) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventsResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Elapsed *int64 `json:"elapsed,omitempty"` Page *EventsResponseMetadataPage `json:"page,omitempty"` RequestId *string `json:"request_id,omitempty"` + Status *string `json:"status,omitempty"` Warnings []EventsWarning `json:"warnings,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"elapsed", "page", "request_id", "warnings"}) + datadog.DeleteKeys(additionalProperties, &[]string{"elapsed", "page", "request_id", "status", "warnings"}) } else { return err } + + hasInvalidField := false o.Elapsed = all.Elapsed if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Page = all.Page o.RequestId = all.RequestId + o.Status = all.Status o.Warnings = all.Warnings + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_response_metadata_page.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_response_metadata_page.go index d6afeeb72..d9f335037 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_response_metadata_page.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_response_metadata_page.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -83,17 +83,11 @@ func (o EventsResponseMetadataPage) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventsResponseMetadataPage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { After *string `json:"after,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -102,6 +96,7 @@ func (o *EventsResponseMetadataPage) UnmarshalJSON(bytes []byte) (err error) { return err } o.After = all.After + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_scalar_query.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_scalar_query.go index 24c5e0692..69fa0e848 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_scalar_query.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_scalar_query.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -238,7 +239,6 @@ func (o EventsScalarQuery) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventsScalarQuery) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Compute *EventsCompute `json:"compute"` DataSource *EventsDataSource `json:"data_source"` @@ -248,12 +248,7 @@ func (o *EventsScalarQuery) UnmarshalJSON(bytes []byte) (err error) { Search *EventsSearch `json:"search,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Compute == nil { return fmt.Errorf("required field compute missing") @@ -267,37 +262,32 @@ func (o *EventsScalarQuery) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.DataSource; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Compute.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Compute = *all.Compute - o.DataSource = *all.DataSource + if !all.DataSource.IsValid() { + hasInvalidField = true + } else { + o.DataSource = *all.DataSource + } o.GroupBy = all.GroupBy o.Indexes = all.Indexes o.Name = all.Name if all.Search != nil && all.Search.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Search = all.Search + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_search.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_search.go index 500c3e35e..439768461 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_search.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_search.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o EventsSearch) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventsSearch) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Query *string `json:"query,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *EventsSearch) UnmarshalJSON(bytes []byte) (err error) { return err } o.Query = all.Query + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_sort.go index 31537f955..b7fba5d3e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_sort.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_sort.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // EventsSort The sort parameters when querying events. @@ -63,47 +64,3 @@ func (v EventsSort) IsValid() bool { func (v EventsSort) Ptr() *EventsSort { return &v } - -// NullableEventsSort handles when a null is used for EventsSort. -type NullableEventsSort struct { - value *EventsSort - isSet bool -} - -// Get returns the associated value. -func (v NullableEventsSort) Get() *EventsSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableEventsSort) Set(val *EventsSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableEventsSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableEventsSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableEventsSort initializes the struct as if Set has been called. -func NewNullableEventsSort(val *EventsSort) *NullableEventsSort { - return &NullableEventsSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableEventsSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableEventsSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_sort_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_sort_type.go index efbfd803c..cd67f578b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_sort_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_sort_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // EventsSortType The type of sort to use on the calculated value. @@ -63,47 +64,3 @@ func (v EventsSortType) IsValid() bool { func (v EventsSortType) Ptr() *EventsSortType { return &v } - -// NullableEventsSortType handles when a null is used for EventsSortType. -type NullableEventsSortType struct { - value *EventsSortType - isSet bool -} - -// Get returns the associated value. -func (v NullableEventsSortType) Get() *EventsSortType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableEventsSortType) Set(val *EventsSortType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableEventsSortType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableEventsSortType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableEventsSortType initializes the struct as if Set has been called. -func NewNullableEventsSortType(val *EventsSortType) *NullableEventsSortType { - return &NullableEventsSortType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableEventsSortType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableEventsSortType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_timeseries_query.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_timeseries_query.go index 2fd948a8c..cf120b8b1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_timeseries_query.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_timeseries_query.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -238,7 +239,6 @@ func (o EventsTimeseriesQuery) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventsTimeseriesQuery) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Compute *EventsCompute `json:"compute"` DataSource *EventsDataSource `json:"data_source"` @@ -248,12 +248,7 @@ func (o *EventsTimeseriesQuery) UnmarshalJSON(bytes []byte) (err error) { Search *EventsSearch `json:"search,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Compute == nil { return fmt.Errorf("required field compute missing") @@ -267,37 +262,32 @@ func (o *EventsTimeseriesQuery) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.DataSource; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Compute.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Compute = *all.Compute - o.DataSource = *all.DataSource + if !all.DataSource.IsValid() { + hasInvalidField = true + } else { + o.DataSource = *all.DataSource + } o.GroupBy = all.GroupBy o.Indexes = all.Indexes o.Name = all.Name if all.Search != nil && all.Search.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Search = all.Search + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_warning.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_warning.go index ef4da426f..fa57202ee 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_warning.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_events_warning.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o EventsWarning) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventsWarning) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Code *string `json:"code,omitempty"` Detail *string `json:"detail,omitempty"` Title *string `json:"title,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *EventsWarning) UnmarshalJSON(bytes []byte) (err error) { o.Code = all.Code o.Detail = all.Detail o.Title = all.Title + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_accoun_response_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_accoun_response_attributes.go index b72007404..274477c89 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_accoun_response_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_accoun_response_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o FastlyAccounResponseAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FastlyAccounResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Name *string `json:"name"` Services []FastlyService `json:"services,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -134,6 +129,7 @@ func (o *FastlyAccounResponseAttributes) UnmarshalJSON(bytes []byte) (err error) } o.Name = *all.Name o.Services = all.Services + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_create_request.go index 0e64efc22..6b0a774c6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o FastlyAccountCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FastlyAccountCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *FastlyAccountCreateRequestData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *FastlyAccountCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_create_request_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_create_request_attributes.go index 717046727..cd1d4f72a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_create_request_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_create_request_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -137,19 +138,13 @@ func (o FastlyAccountCreateRequestAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FastlyAccountCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApiKey *string `json:"api_key"` Name *string `json:"name"` Services []FastlyService `json:"services,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.ApiKey == nil { return fmt.Errorf("required field api_key missing") @@ -166,6 +161,7 @@ func (o *FastlyAccountCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err o.ApiKey = *all.ApiKey o.Name = *all.Name o.Services = all.Services + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_create_request_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_create_request_data.go index 6b56c068c..7e63df768 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_create_request_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_create_request_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o FastlyAccountCreateRequestData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FastlyAccountCreateRequestData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *FastlyAccountCreateRequestAttributes `json:"attributes"` Type *FastlyAccountType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -131,26 +126,25 @@ func (o *FastlyAccountCreateRequestData) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_response.go index 3d889faad..16db02c21 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o FastlyAccountResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FastlyAccountResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *FastlyAccountResponseData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *FastlyAccountResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_response_data.go index 9a46d34c4..e5e9d7a7e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_response_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -133,19 +134,13 @@ func (o FastlyAccountResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FastlyAccountResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *FastlyAccounResponseAttributes `json:"attributes"` Id *string `json:"id"` Type *FastlyAccountType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -162,27 +157,26 @@ func (o *FastlyAccountResponseData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_type.go index 672e018c3..5bfeafec9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // FastlyAccountType The JSON:API type for this API. Should always be `fastly-accounts`. @@ -61,47 +62,3 @@ func (v FastlyAccountType) IsValid() bool { func (v FastlyAccountType) Ptr() *FastlyAccountType { return &v } - -// NullableFastlyAccountType handles when a null is used for FastlyAccountType. -type NullableFastlyAccountType struct { - value *FastlyAccountType - isSet bool -} - -// Get returns the associated value. -func (v NullableFastlyAccountType) Get() *FastlyAccountType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFastlyAccountType) Set(val *FastlyAccountType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFastlyAccountType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFastlyAccountType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFastlyAccountType initializes the struct as if Set has been called. -func NewNullableFastlyAccountType(val *FastlyAccountType) *NullableFastlyAccountType { - return &NullableFastlyAccountType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFastlyAccountType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFastlyAccountType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_update_request.go index 8dcb0054d..ae67d8b88 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o FastlyAccountUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FastlyAccountUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *FastlyAccountUpdateRequestData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *FastlyAccountUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_update_request_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_update_request_attributes.go index 282376471..8d452ee1c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_update_request_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_update_request_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o FastlyAccountUpdateRequestAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FastlyAccountUpdateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApiKey *string `json:"api_key,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *FastlyAccountUpdateRequestAttributes) UnmarshalJSON(bytes []byte) (err return err } o.ApiKey = all.ApiKey + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_update_request_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_update_request_data.go index de429cf6f..382742e95 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_update_request_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_account_update_request_data.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -119,18 +119,12 @@ func (o FastlyAccountUpdateRequestData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FastlyAccountUpdateRequestData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *FastlyAccountUpdateRequestAttributes `json:"attributes,omitempty"` Type *FastlyAccountType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -138,26 +132,25 @@ func (o *FastlyAccountUpdateRequestData) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_accounts_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_accounts_response.go index 3489810c0..5c97ae67e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_accounts_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_accounts_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o FastlyAccountsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FastlyAccountsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []FastlyAccountResponseData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *FastlyAccountsResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_service.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_service.go index c034d8529..743592504 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_service.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_service.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o FastlyService) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FastlyService) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id"` Tags []string `json:"tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -134,6 +129,7 @@ func (o *FastlyService) UnmarshalJSON(bytes []byte) (err error) { } o.Id = *all.Id o.Tags = all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_service_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_service_attributes.go index 81467a9da..f86afe86a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_service_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_service_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o FastlyServiceAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FastlyServiceAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Tags []string `json:"tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *FastlyServiceAttributes) UnmarshalJSON(bytes []byte) (err error) { return err } o.Tags = all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_service_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_service_data.go index b3ff9593b..980f993cd 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_service_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_service_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -139,19 +140,13 @@ func (o FastlyServiceData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FastlyServiceData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *FastlyServiceAttributes `json:"attributes,omitempty"` Id *string `json:"id"` Type *FastlyServiceType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -165,27 +160,26 @@ func (o *FastlyServiceData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_service_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_service_request.go index 7febe13e6..e9585a3db 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_service_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_service_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o FastlyServiceRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FastlyServiceRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *FastlyServiceData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *FastlyServiceRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_service_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_service_response.go index 5b5d0d27e..17f8c9020 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_service_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_service_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o FastlyServiceResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FastlyServiceResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *FastlyServiceData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *FastlyServiceResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_service_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_service_type.go index 8f484660f..3bea1f146 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_service_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_service_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // FastlyServiceType The JSON:API type for this API. Should always be `fastly-services`. @@ -61,47 +62,3 @@ func (v FastlyServiceType) IsValid() bool { func (v FastlyServiceType) Ptr() *FastlyServiceType { return &v } - -// NullableFastlyServiceType handles when a null is used for FastlyServiceType. -type NullableFastlyServiceType struct { - value *FastlyServiceType - isSet bool -} - -// Get returns the associated value. -func (v NullableFastlyServiceType) Get() *FastlyServiceType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFastlyServiceType) Set(val *FastlyServiceType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFastlyServiceType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFastlyServiceType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFastlyServiceType initializes the struct as if Set has been called. -func NewNullableFastlyServiceType(val *FastlyServiceType) *NullableFastlyServiceType { - return &NullableFastlyServiceType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFastlyServiceType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFastlyServiceType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_services_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_services_response.go index 6b2456a45..17a1f6e33 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_services_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_fastly_services_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o FastlyServicesResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FastlyServicesResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []FastlyServiceResponse `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *FastlyServicesResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding.go index 347cb5281..d3eb1a01f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o Finding) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Finding) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *FindingAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *FindingType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *Finding) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_attributes.go index 6fbea4f4e..0ce07e8cb 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -346,7 +346,6 @@ func (o FindingAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FindingAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Evaluation *FindingEvaluation `json:"evaluation,omitempty"` EvaluationChangedAt *int64 `json:"evaluation_changed_at,omitempty"` @@ -359,12 +358,7 @@ func (o *FindingAttributes) UnmarshalJSON(bytes []byte) (err error) { Tags []string `json:"tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -372,48 +366,39 @@ func (o *FindingAttributes) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Evaluation; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Evaluation = all.Evaluation + + hasInvalidField := false + if all.Evaluation != nil && !all.Evaluation.IsValid() { + hasInvalidField = true + } else { + o.Evaluation = all.Evaluation + } o.EvaluationChangedAt = all.EvaluationChangedAt if all.Mute != nil && all.Mute.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Mute = all.Mute o.Resource = all.Resource o.ResourceDiscoveryDate = all.ResourceDiscoveryDate o.ResourceType = all.ResourceType if all.Rule != nil && all.Rule.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Rule = all.Rule - o.Status = all.Status + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } o.Tags = all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_evaluation.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_evaluation.go index 862506483..62ad8c8d9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_evaluation.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_evaluation.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // FindingEvaluation The evaluation of the finding. @@ -63,47 +64,3 @@ func (v FindingEvaluation) IsValid() bool { func (v FindingEvaluation) Ptr() *FindingEvaluation { return &v } - -// NullableFindingEvaluation handles when a null is used for FindingEvaluation. -type NullableFindingEvaluation struct { - value *FindingEvaluation - isSet bool -} - -// Get returns the associated value. -func (v NullableFindingEvaluation) Get() *FindingEvaluation { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFindingEvaluation) Set(val *FindingEvaluation) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFindingEvaluation) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFindingEvaluation) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFindingEvaluation initializes the struct as if Set has been called. -func NewNullableFindingEvaluation(val *FindingEvaluation) *NullableFindingEvaluation { - return &NullableFindingEvaluation{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFindingEvaluation) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFindingEvaluation) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_mute.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_mute.go index f47921545..ddd55f85e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_mute.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_mute.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // FindingMute Information about the mute status of this finding. @@ -240,7 +240,6 @@ func (o FindingMute) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FindingMute) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Description *string `json:"description,omitempty"` ExpirationDate *int64 `json:"expiration_date,omitempty"` @@ -250,27 +249,24 @@ func (o *FindingMute) UnmarshalJSON(bytes []byte) (err error) { Uuid *string `json:"uuid,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Reason; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } + + hasInvalidField := false o.Description = all.Description o.ExpirationDate = all.ExpirationDate o.Muted = all.Muted - o.Reason = all.Reason + if all.Reason != nil && !all.Reason.IsValid() { + hasInvalidField = true + } else { + o.Reason = all.Reason + } o.StartDate = all.StartDate o.Uuid = all.Uuid + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_mute_reason.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_mute_reason.go index aa993dcc3..d19057bac 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_mute_reason.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_mute_reason.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // FindingMuteReason The reason why this finding is muted or unmuted. @@ -73,47 +74,3 @@ func (v FindingMuteReason) IsValid() bool { func (v FindingMuteReason) Ptr() *FindingMuteReason { return &v } - -// NullableFindingMuteReason handles when a null is used for FindingMuteReason. -type NullableFindingMuteReason struct { - value *FindingMuteReason - isSet bool -} - -// Get returns the associated value. -func (v NullableFindingMuteReason) Get() *FindingMuteReason { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFindingMuteReason) Set(val *FindingMuteReason) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFindingMuteReason) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFindingMuteReason) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFindingMuteReason initializes the struct as if Set has been called. -func NewNullableFindingMuteReason(val *FindingMuteReason) *NullableFindingMuteReason { - return &NullableFindingMuteReason{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFindingMuteReason) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFindingMuteReason) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_rule.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_rule.go index 3410ced4c..683f93ae6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_rule.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_rule.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // FindingRule The rule that triggered this finding. @@ -108,18 +108,12 @@ func (o FindingRule) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FindingRule) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id,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 + return json.Unmarshal(bytes, &o.UnparsedObject) } o.Id = all.Id o.Name = all.Name diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_status.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_status.go index 57e4ea59d..b8dad14aa 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_status.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_status.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // FindingStatus The status of the finding. @@ -69,47 +70,3 @@ func (v FindingStatus) IsValid() bool { func (v FindingStatus) Ptr() *FindingStatus { return &v } - -// NullableFindingStatus handles when a null is used for FindingStatus. -type NullableFindingStatus struct { - value *FindingStatus - isSet bool -} - -// Get returns the associated value. -func (v NullableFindingStatus) Get() *FindingStatus { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFindingStatus) Set(val *FindingStatus) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFindingStatus) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFindingStatus) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFindingStatus initializes the struct as if Set has been called. -func NewNullableFindingStatus(val *FindingStatus) *NullableFindingStatus { - return &NullableFindingStatus{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFindingStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFindingStatus) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_type.go index 783412225..634293227 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_finding_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // FindingType The JSON:API type for findings. @@ -61,47 +62,3 @@ func (v FindingType) IsValid() bool { func (v FindingType) Ptr() *FindingType { return &v } - -// NullableFindingType handles when a null is used for FindingType. -type NullableFindingType struct { - value *FindingType - isSet bool -} - -// Get returns the associated value. -func (v NullableFindingType) Get() *FindingType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFindingType) Set(val *FindingType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFindingType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFindingType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFindingType initializes the struct as if Set has been called. -func NewNullableFindingType(val *FindingType) *NullableFindingType { - return &NullableFindingType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFindingType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFindingType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_formula_limit.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_formula_limit.go index b7dd9bccd..fc6f1327c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_formula_limit.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_formula_limit.go @@ -5,12 +5,13 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // FormulaLimit Message for specifying limits to the number of values returned by a query. +// This limit is only for scalar queries and has no effect on timeseries queries. type FormulaLimit struct { // The number of results to which to limit. Count *int32 `json:"count,omitempty"` @@ -119,18 +120,12 @@ func (o FormulaLimit) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FormulaLimit) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Count *int32 `json:"count,omitempty"` Order *QuerySortOrder `json:"order,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -138,19 +133,22 @@ func (o *FormulaLimit) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Order; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Count = all.Count - o.Order = all.Order + if all.Order != nil && !all.Order.IsValid() { + hasInvalidField = true + } else { + o.Order = all.Order + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_full_api_key.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_full_api_key.go index 85d1c72ef..f3c9d1277 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_full_api_key.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_full_api_key.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -185,7 +185,6 @@ func (o FullAPIKey) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FullAPIKey) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *FullAPIKeyAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` @@ -193,12 +192,7 @@ func (o *FullAPIKey) UnmarshalJSON(bytes []byte) (err error) { Type *APIKeysType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,35 +200,30 @@ func (o *FullAPIKey) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_full_api_key_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_full_api_key_attributes.go index 7ecb7f9e3..cfc52c75d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_full_api_key_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_full_api_key_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -214,7 +214,6 @@ func (o FullAPIKeyAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FullAPIKeyAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CreatedAt *string `json:"created_at,omitempty"` Key *string `json:"key,omitempty"` @@ -223,12 +222,7 @@ func (o *FullAPIKeyAttributes) UnmarshalJSON(bytes []byte) (err error) { 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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -241,6 +235,7 @@ func (o *FullAPIKeyAttributes) UnmarshalJSON(bytes []byte) (err error) { o.Last4 = all.Last4 o.ModifiedAt = all.ModifiedAt o.Name = all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_full_application_key.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_full_application_key.go index 6d007082d..2f9714fa7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_full_application_key.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_full_application_key.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -185,7 +185,6 @@ func (o FullApplicationKey) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FullApplicationKey) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *FullApplicationKeyAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` @@ -193,12 +192,7 @@ func (o *FullApplicationKey) UnmarshalJSON(bytes []byte) (err error) { Type *ApplicationKeysType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,35 +200,30 @@ func (o *FullApplicationKey) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_full_application_key_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_full_application_key_attributes.go index 2238a80a9..2310e03a0 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_full_application_key_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_full_application_key_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -20,7 +20,7 @@ type FullApplicationKeyAttributes struct { Last4 *string `json:"last4,omitempty"` // Name of the application key. Name *string `json:"name,omitempty"` - // Array of scopes to grant the application key. This feature is in private beta, please contact Datadog support to enable scopes for your application keys. + // Array of scopes to grant the application key. Scopes datadog.NullableList[string] `json:"scopes,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` @@ -225,7 +225,6 @@ func (o FullApplicationKeyAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FullApplicationKeyAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CreatedAt *string `json:"created_at,omitempty"` Key *string `json:"key,omitempty"` @@ -234,12 +233,7 @@ func (o *FullApplicationKeyAttributes) UnmarshalJSON(bytes []byte) (err error) { Scopes datadog.NullableList[string] `json:"scopes,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -252,6 +246,7 @@ func (o *FullApplicationKeyAttributes) UnmarshalJSON(bytes []byte) (err error) { o.Last4 = all.Last4 o.Name = all.Name o.Scopes = all.Scopes + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcp_service_account_meta.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcp_service_account_meta.go index 353163179..f9c884175 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcp_service_account_meta.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcp_service_account_meta.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o GCPServiceAccountMeta) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *GCPServiceAccountMeta) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AccessibleProjects []string `json:"accessible_projects,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *GCPServiceAccountMeta) UnmarshalJSON(bytes []byte) (err error) { return err } o.AccessibleProjects = all.AccessibleProjects + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcp_service_account_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcp_service_account_type.go index aa7efb53c..b1a9684bc 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcp_service_account_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcp_service_account_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // GCPServiceAccountType The type of account. @@ -61,47 +62,3 @@ func (v GCPServiceAccountType) IsValid() bool { func (v GCPServiceAccountType) Ptr() *GCPServiceAccountType { return &v } - -// NullableGCPServiceAccountType handles when a null is used for GCPServiceAccountType. -type NullableGCPServiceAccountType struct { - value *GCPServiceAccountType - isSet bool -} - -// Get returns the associated value. -func (v NullableGCPServiceAccountType) Get() *GCPServiceAccountType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableGCPServiceAccountType) Set(val *GCPServiceAccountType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableGCPServiceAccountType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableGCPServiceAccountType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableGCPServiceAccountType initializes the struct as if Set has been called. -func NewNullableGCPServiceAccountType(val *GCPServiceAccountType) *NullableGCPServiceAccountType { - return &NullableGCPServiceAccountType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableGCPServiceAccountType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableGCPServiceAccountType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_delegate_account.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_delegate_account.go index 503cd754d..c51b004ee 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_delegate_account.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_delegate_account.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o GCPSTSDelegateAccount) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *GCPSTSDelegateAccount) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *GCPSTSDelegateAccountAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *GCPSTSDelegateAccountType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *GCPSTSDelegateAccount) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_delegate_account_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_delegate_account_attributes.go index 7b7e6085a..c4796d072 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_delegate_account_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_delegate_account_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o GCPSTSDelegateAccountAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *GCPSTSDelegateAccountAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DelegateAccountEmail *string `json:"delegate_account_email,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *GCPSTSDelegateAccountAttributes) UnmarshalJSON(bytes []byte) (err error return err } o.DelegateAccountEmail = all.DelegateAccountEmail + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_delegate_account_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_delegate_account_response.go index e4bdb1e55..b5aabf137 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_delegate_account_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_delegate_account_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o GCPSTSDelegateAccountResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *GCPSTSDelegateAccountResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *GCPSTSDelegateAccount `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *GCPSTSDelegateAccountResponse) UnmarshalJSON(bytes []byte) (err error) } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_delegate_account_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_delegate_account_type.go index a65356e1a..5293bf535 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_delegate_account_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_delegate_account_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // GCPSTSDelegateAccountType The type of account. @@ -61,47 +62,3 @@ func (v GCPSTSDelegateAccountType) IsValid() bool { func (v GCPSTSDelegateAccountType) Ptr() *GCPSTSDelegateAccountType { return &v } - -// NullableGCPSTSDelegateAccountType handles when a null is used for GCPSTSDelegateAccountType. -type NullableGCPSTSDelegateAccountType struct { - value *GCPSTSDelegateAccountType - isSet bool -} - -// Get returns the associated value. -func (v NullableGCPSTSDelegateAccountType) Get() *GCPSTSDelegateAccountType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableGCPSTSDelegateAccountType) Set(val *GCPSTSDelegateAccountType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableGCPSTSDelegateAccountType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableGCPSTSDelegateAccountType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableGCPSTSDelegateAccountType initializes the struct as if Set has been called. -func NewNullableGCPSTSDelegateAccountType(val *GCPSTSDelegateAccountType) *NullableGCPSTSDelegateAccountType { - return &NullableGCPSTSDelegateAccountType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableGCPSTSDelegateAccountType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableGCPSTSDelegateAccountType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account.go index 55fabe68f..3e935d877 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -185,7 +185,6 @@ func (o GCPSTSServiceAccount) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *GCPSTSServiceAccount) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *GCPSTSServiceAccountAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` @@ -193,12 +192,7 @@ func (o *GCPSTSServiceAccount) UnmarshalJSON(bytes []byte) (err error) { Type *GCPServiceAccountType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,35 +200,30 @@ func (o *GCPSTSServiceAccount) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account_attributes.go index 789ac0009..7d093bec5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -181,7 +181,6 @@ func (o GCPSTSServiceAccountAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *GCPSTSServiceAccountAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Automute *bool `json:"automute,omitempty"` ClientEmail *string `json:"client_email,omitempty"` @@ -189,12 +188,7 @@ func (o *GCPSTSServiceAccountAttributes) UnmarshalJSON(bytes []byte) (err error) IsCspmEnabled *bool `json:"is_cspm_enabled,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,6 +200,7 @@ func (o *GCPSTSServiceAccountAttributes) UnmarshalJSON(bytes []byte) (err error) o.ClientEmail = all.ClientEmail o.HostFilters = all.HostFilters o.IsCspmEnabled = all.IsCspmEnabled + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account_create_request.go index c1dc5236e..3f079804f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account_create_request.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o GCPSTSServiceAccountCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *GCPSTSServiceAccountCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *GCPSTSServiceAccountData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *GCPSTSServiceAccountCreateRequest) UnmarshalJSON(bytes []byte) (err err } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account_data.go index a0821d067..a7f3e96a4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account_data.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -119,18 +119,12 @@ func (o GCPSTSServiceAccountData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *GCPSTSServiceAccountData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *GCPSTSServiceAccountAttributes `json:"attributes,omitempty"` Type *GCPServiceAccountType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -138,26 +132,25 @@ func (o *GCPSTSServiceAccountData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account_response.go index 0f8fb8cda..146a31b19 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o GCPSTSServiceAccountResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *GCPSTSServiceAccountResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *GCPSTSServiceAccount `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *GCPSTSServiceAccountResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account_update_request.go index 11cd62e24..9a1d051f1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account_update_request.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o GCPSTSServiceAccountUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *GCPSTSServiceAccountUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *GCPSTSServiceAccountUpdateRequestData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *GCPSTSServiceAccountUpdateRequest) UnmarshalJSON(bytes []byte) (err err } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account_update_request_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account_update_request_data.go index 0786bb9ac..4fc669db8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account_update_request_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_account_update_request_data.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o GCPSTSServiceAccountUpdateRequestData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *GCPSTSServiceAccountUpdateRequestData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *GCPSTSServiceAccountAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *GCPServiceAccountType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *GCPSTSServiceAccountUpdateRequestData) UnmarshalJSON(bytes []byte) (err } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_accounts_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_accounts_response.go index d9b636af7..18d5e2f0d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_accounts_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_gcpsts_service_accounts_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o GCPSTSServiceAccountsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *GCPSTSServiceAccountsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []GCPSTSServiceAccount `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *GCPSTSServiceAccountsResponse) UnmarshalJSON(bytes []byte) (err error) return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_get_finding_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_get_finding_response.go index ed5d531f3..7488126dc 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_get_finding_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_get_finding_response.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o GetFindingResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *GetFindingResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *DetailedFinding `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *GetFindingResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_get_team_memberships_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_get_team_memberships_sort.go index 51c60af12..3b3ed17d2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_get_team_memberships_sort.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_get_team_memberships_sort.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // GetTeamMembershipsSort Specifies the order of returned team memberships @@ -75,47 +76,3 @@ func (v GetTeamMembershipsSort) IsValid() bool { func (v GetTeamMembershipsSort) Ptr() *GetTeamMembershipsSort { return &v } - -// NullableGetTeamMembershipsSort handles when a null is used for GetTeamMembershipsSort. -type NullableGetTeamMembershipsSort struct { - value *GetTeamMembershipsSort - isSet bool -} - -// Get returns the associated value. -func (v NullableGetTeamMembershipsSort) Get() *GetTeamMembershipsSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableGetTeamMembershipsSort) Set(val *GetTeamMembershipsSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableGetTeamMembershipsSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableGetTeamMembershipsSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableGetTeamMembershipsSort initializes the struct as if Set has been called. -func NewNullableGetTeamMembershipsSort(val *GetTeamMembershipsSort) *NullableGetTeamMembershipsSort { - return &NullableGetTeamMembershipsSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableGetTeamMembershipsSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableGetTeamMembershipsSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_group_scalar_column.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_group_scalar_column.go index efae87b49..c6543e917 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_group_scalar_column.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_group_scalar_column.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o GroupScalarColumn) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *GroupScalarColumn) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Name *string `json:"name,omitempty"` Type *string `json:"type,omitempty"` Values [][]string `json:"values,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *GroupScalarColumn) UnmarshalJSON(bytes []byte) (err error) { o.Name = all.Name o.Type = all.Type o.Values = all.Values + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage.go index c0069bd1b..6489d7acd 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o HourlyUsage) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HourlyUsage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *HourlyUsageAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *UsageTimeSeriesType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *HourlyUsage) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage_attributes.go index a2e639d15..2a6044706 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -252,7 +253,6 @@ func (o HourlyUsageAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HourlyUsageAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Measurements []HourlyUsageMeasurement `json:"measurements,omitempty"` OrgName *string `json:"org_name,omitempty"` @@ -262,12 +262,7 @@ func (o *HourlyUsageAttributes) UnmarshalJSON(bytes []byte) (err error) { Timestamp *time.Time `json:"timestamp,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -281,6 +276,7 @@ func (o *HourlyUsageAttributes) UnmarshalJSON(bytes []byte) (err error) { o.PublicId = all.PublicId o.Region = all.Region o.Timestamp = all.Timestamp + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage_measurement.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage_measurement.go index 32b78c725..97b9e7d31 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage_measurement.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage_measurement.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -126,18 +126,12 @@ func (o HourlyUsageMeasurement) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HourlyUsageMeasurement) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { UsageType *string `json:"usage_type,omitempty"` Value datadog.NullableInt64 `json:"value,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -147,6 +141,7 @@ func (o *HourlyUsageMeasurement) UnmarshalJSON(bytes []byte) (err error) { } o.UsageType = all.UsageType o.Value = all.Value + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage_metadata.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage_metadata.go index 137614e20..f9e97905a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage_metadata.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage_metadata.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o HourlyUsageMetadata) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HourlyUsageMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Pagination *HourlyUsagePagination `json:"pagination,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *HourlyUsageMetadata) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Pagination != nil && all.Pagination.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Pagination = all.Pagination + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage_pagination.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage_pagination.go index af9b625ee..b0057cac8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage_pagination.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage_pagination.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -93,17 +93,11 @@ func (o HourlyUsagePagination) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HourlyUsagePagination) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { NextRecordId datadog.NullableString `json:"next_record_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -112,6 +106,7 @@ func (o *HourlyUsagePagination) UnmarshalJSON(bytes []byte) (err error) { return err } o.NextRecordId = all.NextRecordId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage_response.go index 8fc93128c..b201da5e6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o HourlyUsageResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HourlyUsageResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []HourlyUsage `json:"data,omitempty"` Meta *HourlyUsageMetadata `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *HourlyUsageResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Data = all.Data if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage_type.go index f62c63c21..a9806cb9e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_hourly_usage_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // HourlyUsageType Usage type that is being measured. @@ -65,47 +66,3 @@ func (v HourlyUsageType) IsValid() bool { func (v HourlyUsageType) Ptr() *HourlyUsageType { return &v } - -// NullableHourlyUsageType handles when a null is used for HourlyUsageType. -type NullableHourlyUsageType struct { - value *HourlyUsageType - isSet bool -} - -// Get returns the associated value. -func (v NullableHourlyUsageType) Get() *HourlyUsageType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableHourlyUsageType) Set(val *HourlyUsageType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableHourlyUsageType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableHourlyUsageType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableHourlyUsageType initializes the struct as if Set has been called. -func NewNullableHourlyUsageType(val *HourlyUsageType) *NullableHourlyUsageType { - return &NullableHourlyUsageType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableHourlyUsageType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableHourlyUsageType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_http_log_error.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_http_log_error.go index ac9fba352..2d56b50c3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_http_log_error.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_http_log_error.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o HTTPLogError) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HTTPLogError) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Detail *string `json:"detail,omitempty"` Status *string `json:"status,omitempty"` Title *string `json:"title,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *HTTPLogError) UnmarshalJSON(bytes []byte) (err error) { o.Detail = all.Detail o.Status = all.Status o.Title = all.Title + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_http_log_errors.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_http_log_errors.go index e066d8743..0d474f504 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_http_log_errors.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_http_log_errors.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o HTTPLogErrors) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HTTPLogErrors) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Errors []HTTPLogError `json:"errors,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *HTTPLogErrors) UnmarshalJSON(bytes []byte) (err error) { return err } o.Errors = all.Errors + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_http_log_item.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_http_log_item.go index 15c11c4dc..413526b03 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_http_log_item.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_http_log_item.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -215,7 +216,6 @@ func (o HTTPLogItem) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HTTPLogItem) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Ddsource *string `json:"ddsource,omitempty"` Ddtags *string `json:"ddtags,omitempty"` @@ -224,12 +224,7 @@ func (o *HTTPLogItem) UnmarshalJSON(bytes []byte) (err error) { Service *string `json:"service,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Message == nil { return fmt.Errorf("required field message missing") @@ -245,6 +240,7 @@ func (o *HTTPLogItem) UnmarshalJSON(bytes []byte) (err error) { o.Hostname = all.Hostname o.Message = *all.Message o.Service = all.Service + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_httpci_app_error.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_httpci_app_error.go index 75fd89d56..aa4bec910 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_httpci_app_error.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_httpci_app_error.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o HTTPCIAppError) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HTTPCIAppError) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Detail *string `json:"detail,omitempty"` Status *string `json:"status,omitempty"` Title *string `json:"title,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *HTTPCIAppError) UnmarshalJSON(bytes []byte) (err error) { o.Detail = all.Detail o.Status = all.Status o.Title = all.Title + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_httpci_app_errors.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_httpci_app_errors.go index 2a02a8981..8264287a3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_httpci_app_errors.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_httpci_app_errors.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o HTTPCIAppErrors) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HTTPCIAppErrors) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Errors []HTTPCIAppError `json:"errors,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *HTTPCIAppErrors) UnmarshalJSON(bytes []byte) (err error) { return err } o.Errors = all.Errors + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_id_p_metadata_form_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_id_p_metadata_form_data.go index 82d70a304..8d253fbb4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_id_p_metadata_form_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_id_p_metadata_form_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "os" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -83,17 +84,11 @@ func (o IdPMetadataFormData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IdPMetadataFormData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IdpFile **os.File `json:"idp_file,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -102,6 +97,7 @@ func (o *IdPMetadataFormData) UnmarshalJSON(bytes []byte) (err error) { return err } o.IdpFile = all.IdpFile + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_attachment_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_attachment_type.go index d828e1b1f..6ce313056 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_attachment_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_attachment_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // IncidentAttachmentAttachmentType The type of the incident attachment attributes. @@ -63,47 +64,3 @@ func (v IncidentAttachmentAttachmentType) IsValid() bool { func (v IncidentAttachmentAttachmentType) Ptr() *IncidentAttachmentAttachmentType { return &v } - -// NullableIncidentAttachmentAttachmentType handles when a null is used for IncidentAttachmentAttachmentType. -type NullableIncidentAttachmentAttachmentType struct { - value *IncidentAttachmentAttachmentType - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentAttachmentAttachmentType) Get() *IncidentAttachmentAttachmentType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentAttachmentAttachmentType) Set(val *IncidentAttachmentAttachmentType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentAttachmentAttachmentType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentAttachmentAttachmentType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentAttachmentAttachmentType initializes the struct as if Set has been called. -func NewNullableIncidentAttachmentAttachmentType(val *IncidentAttachmentAttachmentType) *NullableIncidentAttachmentAttachmentType { - return &NullableIncidentAttachmentAttachmentType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentAttachmentAttachmentType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentAttachmentAttachmentType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_attributes.go index f0f96a9cc..bd4dc9bf8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // IncidentAttachmentAttributes - The attributes object for an attachment. @@ -103,53 +103,3 @@ func (obj *IncidentAttachmentAttributes) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableIncidentAttachmentAttributes handles when a null is used for IncidentAttachmentAttributes. -type NullableIncidentAttachmentAttributes struct { - value *IncidentAttachmentAttributes - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentAttachmentAttributes) Get() *IncidentAttachmentAttributes { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentAttachmentAttributes) Set(val *IncidentAttachmentAttributes) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentAttachmentAttributes) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableIncidentAttachmentAttributes) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentAttachmentAttributes initializes the struct as if Set has been called. -func NewNullableIncidentAttachmentAttributes(val *IncidentAttachmentAttributes) *NullableIncidentAttachmentAttributes { - return &NullableIncidentAttachmentAttributes{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentAttachmentAttributes) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentAttachmentAttributes) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_data.go index 1c6ddbf70..d4dc84758 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -160,7 +161,6 @@ func (o IncidentAttachmentData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentAttachmentData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *IncidentAttachmentAttributes `json:"attributes"` Id *string `json:"id"` @@ -168,12 +168,7 @@ func (o *IncidentAttachmentData) UnmarshalJSON(bytes []byte) (err error) { Type *IncidentAttachmentType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -193,28 +188,27 @@ func (o *IncidentAttachmentData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Attributes = *all.Attributes o.Id = *all.Id if all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = *all.Relationships - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_link_attachment_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_link_attachment_type.go index 415825420..7dcda78cf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_link_attachment_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_link_attachment_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // IncidentAttachmentLinkAttachmentType The type of link attachment attributes. @@ -61,47 +62,3 @@ func (v IncidentAttachmentLinkAttachmentType) IsValid() bool { func (v IncidentAttachmentLinkAttachmentType) Ptr() *IncidentAttachmentLinkAttachmentType { return &v } - -// NullableIncidentAttachmentLinkAttachmentType handles when a null is used for IncidentAttachmentLinkAttachmentType. -type NullableIncidentAttachmentLinkAttachmentType struct { - value *IncidentAttachmentLinkAttachmentType - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentAttachmentLinkAttachmentType) Get() *IncidentAttachmentLinkAttachmentType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentAttachmentLinkAttachmentType) Set(val *IncidentAttachmentLinkAttachmentType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentAttachmentLinkAttachmentType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentAttachmentLinkAttachmentType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentAttachmentLinkAttachmentType initializes the struct as if Set has been called. -func NewNullableIncidentAttachmentLinkAttachmentType(val *IncidentAttachmentLinkAttachmentType) *NullableIncidentAttachmentLinkAttachmentType { - return &NullableIncidentAttachmentLinkAttachmentType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentAttachmentLinkAttachmentType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentAttachmentLinkAttachmentType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_link_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_link_attributes.go index f6d630fb7..baaf8143b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_link_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_link_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o IncidentAttachmentLinkAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentAttachmentLinkAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attachment *IncidentAttachmentLinkAttributesAttachmentObject `json:"attachment"` AttachmentType *IncidentAttachmentLinkAttachmentType `json:"attachment_type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attachment == nil { return fmt.Errorf("required field attachment missing") @@ -131,26 +126,25 @@ func (o *IncidentAttachmentLinkAttributes) UnmarshalJSON(bytes []byte) (err erro } else { return err } - if v := all.AttachmentType; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attachment.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attachment = *all.Attachment - o.AttachmentType = *all.AttachmentType + if !all.AttachmentType.IsValid() { + hasInvalidField = true + } else { + o.AttachmentType = *all.AttachmentType + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_link_attributes_attachment_object.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_link_attributes_attachment_object.go index 70344b48f..7b15c385b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_link_attributes_attachment_object.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_link_attributes_attachment_object.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o IncidentAttachmentLinkAttributesAttachmentObject) MarshalJSON() ([]byte, // UnmarshalJSON deserializes the given payload. func (o *IncidentAttachmentLinkAttributesAttachmentObject) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DocumentUrl *string `json:"documentUrl"` Title *string `json:"title"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.DocumentUrl == nil { return fmt.Errorf("required field documentUrl missing") @@ -131,6 +126,7 @@ func (o *IncidentAttachmentLinkAttributesAttachmentObject) UnmarshalJSON(bytes [ } o.DocumentUrl = *all.DocumentUrl o.Title = *all.Title + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_postmortem_attachment_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_postmortem_attachment_type.go index e76cec31c..e1f35846f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_postmortem_attachment_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_postmortem_attachment_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // IncidentAttachmentPostmortemAttachmentType The type of postmortem attachment attributes. @@ -61,47 +62,3 @@ func (v IncidentAttachmentPostmortemAttachmentType) IsValid() bool { func (v IncidentAttachmentPostmortemAttachmentType) Ptr() *IncidentAttachmentPostmortemAttachmentType { return &v } - -// NullableIncidentAttachmentPostmortemAttachmentType handles when a null is used for IncidentAttachmentPostmortemAttachmentType. -type NullableIncidentAttachmentPostmortemAttachmentType struct { - value *IncidentAttachmentPostmortemAttachmentType - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentAttachmentPostmortemAttachmentType) Get() *IncidentAttachmentPostmortemAttachmentType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentAttachmentPostmortemAttachmentType) Set(val *IncidentAttachmentPostmortemAttachmentType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentAttachmentPostmortemAttachmentType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentAttachmentPostmortemAttachmentType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentAttachmentPostmortemAttachmentType initializes the struct as if Set has been called. -func NewNullableIncidentAttachmentPostmortemAttachmentType(val *IncidentAttachmentPostmortemAttachmentType) *NullableIncidentAttachmentPostmortemAttachmentType { - return &NullableIncidentAttachmentPostmortemAttachmentType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentAttachmentPostmortemAttachmentType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentAttachmentPostmortemAttachmentType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_postmortem_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_postmortem_attributes.go index ea690ae8e..8591ba047 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_postmortem_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_postmortem_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o IncidentAttachmentPostmortemAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentAttachmentPostmortemAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attachment *IncidentAttachmentsPostmortemAttributesAttachmentObject `json:"attachment"` AttachmentType *IncidentAttachmentPostmortemAttachmentType `json:"attachment_type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attachment == nil { return fmt.Errorf("required field attachment missing") @@ -131,26 +126,25 @@ func (o *IncidentAttachmentPostmortemAttributes) UnmarshalJSON(bytes []byte) (er } else { return err } - if v := all.AttachmentType; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attachment.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attachment = *all.Attachment - o.AttachmentType = *all.AttachmentType + if !all.AttachmentType.IsValid() { + hasInvalidField = true + } else { + o.AttachmentType = *all.AttachmentType + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_related_object.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_related_object.go index f88b456df..49109081e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_related_object.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_related_object.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // IncidentAttachmentRelatedObject The object related to an incident attachment. @@ -61,47 +62,3 @@ func (v IncidentAttachmentRelatedObject) IsValid() bool { func (v IncidentAttachmentRelatedObject) Ptr() *IncidentAttachmentRelatedObject { return &v } - -// NullableIncidentAttachmentRelatedObject handles when a null is used for IncidentAttachmentRelatedObject. -type NullableIncidentAttachmentRelatedObject struct { - value *IncidentAttachmentRelatedObject - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentAttachmentRelatedObject) Get() *IncidentAttachmentRelatedObject { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentAttachmentRelatedObject) Set(val *IncidentAttachmentRelatedObject) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentAttachmentRelatedObject) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentAttachmentRelatedObject) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentAttachmentRelatedObject initializes the struct as if Set has been called. -func NewNullableIncidentAttachmentRelatedObject(val *IncidentAttachmentRelatedObject) *NullableIncidentAttachmentRelatedObject { - return &NullableIncidentAttachmentRelatedObject{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentAttachmentRelatedObject) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentAttachmentRelatedObject) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_relationships.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_relationships.go index 3672d9eb0..a4655a329 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_relationships.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_relationships.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o IncidentAttachmentRelationships) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentAttachmentRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { LastModifiedByUser *RelationshipToUser `json:"last_modified_by_user,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *IncidentAttachmentRelationships) UnmarshalJSON(bytes []byte) (err error } else { return err } + + hasInvalidField := false if all.LastModifiedByUser != nil && all.LastModifiedByUser.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LastModifiedByUser = all.LastModifiedByUser + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_type.go index c09cb7025..7575275a5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // IncidentAttachmentType The incident attachment resource type. @@ -61,47 +62,3 @@ func (v IncidentAttachmentType) IsValid() bool { func (v IncidentAttachmentType) Ptr() *IncidentAttachmentType { return &v } - -// NullableIncidentAttachmentType handles when a null is used for IncidentAttachmentType. -type NullableIncidentAttachmentType struct { - value *IncidentAttachmentType - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentAttachmentType) Get() *IncidentAttachmentType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentAttachmentType) Set(val *IncidentAttachmentType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentAttachmentType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentAttachmentType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentAttachmentType initializes the struct as if Set has been called. -func NewNullableIncidentAttachmentType(val *IncidentAttachmentType) *NullableIncidentAttachmentType { - return &NullableIncidentAttachmentType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentAttachmentType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentAttachmentType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_update_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_update_attributes.go index e96fdb236..4eca98259 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_update_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_update_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // IncidentAttachmentUpdateAttributes - Incident attachment attributes. @@ -103,53 +103,3 @@ func (obj *IncidentAttachmentUpdateAttributes) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableIncidentAttachmentUpdateAttributes handles when a null is used for IncidentAttachmentUpdateAttributes. -type NullableIncidentAttachmentUpdateAttributes struct { - value *IncidentAttachmentUpdateAttributes - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentAttachmentUpdateAttributes) Get() *IncidentAttachmentUpdateAttributes { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentAttachmentUpdateAttributes) Set(val *IncidentAttachmentUpdateAttributes) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentAttachmentUpdateAttributes) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableIncidentAttachmentUpdateAttributes) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentAttachmentUpdateAttributes initializes the struct as if Set has been called. -func NewNullableIncidentAttachmentUpdateAttributes(val *IncidentAttachmentUpdateAttributes) *NullableIncidentAttachmentUpdateAttributes { - return &NullableIncidentAttachmentUpdateAttributes{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentAttachmentUpdateAttributes) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentAttachmentUpdateAttributes) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_update_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_update_data.go index fa69d0c84..d65b961cb 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_update_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_update_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -145,19 +146,13 @@ func (o IncidentAttachmentUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentAttachmentUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *IncidentAttachmentUpdateAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *IncidentAttachmentType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -168,20 +163,23 @@ func (o *IncidentAttachmentUpdateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Attributes = all.Attributes o.Id = all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_update_request.go index b342e368e..a69b4a5a0 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -80,17 +81,11 @@ func (o IncidentAttachmentUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentAttachmentUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *[]IncidentAttachmentUpdateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -102,6 +97,7 @@ func (o *IncidentAttachmentUpdateRequest) UnmarshalJSON(bytes []byte) (err error return err } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_update_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_update_response.go index f1736588f..910740a21 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_update_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachment_update_response.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -111,18 +112,12 @@ func (o IncidentAttachmentUpdateResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentAttachmentUpdateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *[]IncidentAttachmentData `json:"data"` Included []IncidentAttachmentsResponseIncludedItem `json:"included,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -135,6 +130,7 @@ func (o *IncidentAttachmentUpdateResponse) UnmarshalJSON(bytes []byte) (err erro } o.Data = *all.Data o.Included = all.Included + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachments_postmortem_attributes_attachment_object.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachments_postmortem_attributes_attachment_object.go index 85bfa9a36..8f3d2dfcf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachments_postmortem_attributes_attachment_object.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachments_postmortem_attributes_attachment_object.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o IncidentAttachmentsPostmortemAttributesAttachmentObject) MarshalJSON() ( // UnmarshalJSON deserializes the given payload. func (o *IncidentAttachmentsPostmortemAttributesAttachmentObject) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DocumentUrl *string `json:"documentUrl"` Title *string `json:"title"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.DocumentUrl == nil { return fmt.Errorf("required field documentUrl missing") @@ -131,6 +126,7 @@ func (o *IncidentAttachmentsPostmortemAttributesAttachmentObject) UnmarshalJSON( } o.DocumentUrl = *all.DocumentUrl o.Title = *all.Title + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachments_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachments_response.go index 62ec36d2b..692d10ca1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachments_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachments_response.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o IncidentAttachmentsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentAttachmentsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *[]IncidentAttachmentData `json:"data"` Included []IncidentAttachmentsResponseIncludedItem `json:"included,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -134,6 +129,7 @@ func (o *IncidentAttachmentsResponse) UnmarshalJSON(bytes []byte) (err error) { } o.Data = *all.Data o.Included = all.Included + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachments_response_included_item.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachments_response_included_item.go index 146e27431..4acf89bb4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachments_response_included_item.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_attachments_response_included_item.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // IncidentAttachmentsResponseIncludedItem - An object related to an attachment that is included in the response. @@ -71,53 +71,3 @@ func (obj *IncidentAttachmentsResponseIncludedItem) GetActualInstance() interfac // all schemas are nil return nil } - -// NullableIncidentAttachmentsResponseIncludedItem handles when a null is used for IncidentAttachmentsResponseIncludedItem. -type NullableIncidentAttachmentsResponseIncludedItem struct { - value *IncidentAttachmentsResponseIncludedItem - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentAttachmentsResponseIncludedItem) Get() *IncidentAttachmentsResponseIncludedItem { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentAttachmentsResponseIncludedItem) Set(val *IncidentAttachmentsResponseIncludedItem) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentAttachmentsResponseIncludedItem) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableIncidentAttachmentsResponseIncludedItem) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentAttachmentsResponseIncludedItem initializes the struct as if Set has been called. -func NewNullableIncidentAttachmentsResponseIncludedItem(val *IncidentAttachmentsResponseIncludedItem) *NullableIncidentAttachmentsResponseIncludedItem { - return &NullableIncidentAttachmentsResponseIncludedItem{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentAttachmentsResponseIncludedItem) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentAttachmentsResponseIncludedItem) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_create_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_create_attributes.go index 0b47bb9c8..223b6dac1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_create_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_create_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -236,7 +237,6 @@ func (o IncidentCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CustomerImpactScope *string `json:"customer_impact_scope,omitempty"` CustomerImpacted *bool `json:"customer_impacted"` @@ -246,12 +246,7 @@ func (o *IncidentCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { Title *string `json:"title"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.CustomerImpacted == nil { return fmt.Errorf("required field customer_impacted missing") @@ -271,6 +266,7 @@ func (o *IncidentCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { o.InitialCells = all.InitialCells o.NotificationHandles = all.NotificationHandles o.Title = *all.Title + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_create_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_create_data.go index a3217b708..a9b1fe582 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_create_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_create_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -139,19 +140,13 @@ func (o IncidentCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *IncidentCreateAttributes `json:"attributes"` Relationships *IncidentCreateRelationships `json:"relationships,omitempty"` Type *IncidentType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -165,34 +160,29 @@ func (o *IncidentCreateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_create_relationships.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_create_relationships.go index f7fd0cb58..32c009f38 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_create_relationships.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_create_relationships.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o IncidentCreateRelationships) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentCreateRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CommanderUser *NullableRelationshipToUser `json:"commander_user"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.CommanderUser == nil { return fmt.Errorf("required field commander_user missing") @@ -98,17 +93,20 @@ func (o *IncidentCreateRelationships) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.CommanderUser.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.CommanderUser = *all.CommanderUser + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_create_request.go index 474a8e042..1197b2d91 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o IncidentCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *IncidentCreateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *IncidentCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_field_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_field_attributes.go index 6a396cda0..22daa825e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_field_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_field_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // IncidentFieldAttributes - Dynamic fields for which selections can be made, with field names as keys. @@ -103,53 +103,3 @@ func (obj *IncidentFieldAttributes) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableIncidentFieldAttributes handles when a null is used for IncidentFieldAttributes. -type NullableIncidentFieldAttributes struct { - value *IncidentFieldAttributes - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentFieldAttributes) Get() *IncidentFieldAttributes { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentFieldAttributes) Set(val *IncidentFieldAttributes) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentFieldAttributes) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableIncidentFieldAttributes) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentFieldAttributes initializes the struct as if Set has been called. -func NewNullableIncidentFieldAttributes(val *IncidentFieldAttributes) *NullableIncidentFieldAttributes { - return &NullableIncidentFieldAttributes{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentFieldAttributes) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentFieldAttributes) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_field_attributes_multiple_value.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_field_attributes_multiple_value.go index b1b80983a..4188d95e9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_field_attributes_multiple_value.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_field_attributes_multiple_value.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -130,18 +130,12 @@ func (o IncidentFieldAttributesMultipleValue) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentFieldAttributesMultipleValue) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Type *IncidentFieldAttributesValueType `json:"type,omitempty"` Value datadog.NullableList[string] `json:"value,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -149,19 +143,22 @@ func (o *IncidentFieldAttributesMultipleValue) UnmarshalJSON(bytes []byte) (err } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type } - o.Type = all.Type o.Value = all.Value + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_field_attributes_single_value.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_field_attributes_single_value.go index e18fb97f9..43b68da9b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_field_attributes_single_value.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_field_attributes_single_value.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -130,18 +130,12 @@ func (o IncidentFieldAttributesSingleValue) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentFieldAttributesSingleValue) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Type *IncidentFieldAttributesSingleValueType `json:"type,omitempty"` Value datadog.NullableString `json:"value,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -149,19 +143,22 @@ func (o *IncidentFieldAttributesSingleValue) UnmarshalJSON(bytes []byte) (err er } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type } - o.Type = all.Type o.Value = all.Value + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_field_attributes_single_value_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_field_attributes_single_value_type.go index 6a6b6888b..06abeef2b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_field_attributes_single_value_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_field_attributes_single_value_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // IncidentFieldAttributesSingleValueType Type of the single value field definitions. @@ -63,47 +64,3 @@ func (v IncidentFieldAttributesSingleValueType) IsValid() bool { func (v IncidentFieldAttributesSingleValueType) Ptr() *IncidentFieldAttributesSingleValueType { return &v } - -// NullableIncidentFieldAttributesSingleValueType handles when a null is used for IncidentFieldAttributesSingleValueType. -type NullableIncidentFieldAttributesSingleValueType struct { - value *IncidentFieldAttributesSingleValueType - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentFieldAttributesSingleValueType) Get() *IncidentFieldAttributesSingleValueType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentFieldAttributesSingleValueType) Set(val *IncidentFieldAttributesSingleValueType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentFieldAttributesSingleValueType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentFieldAttributesSingleValueType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentFieldAttributesSingleValueType initializes the struct as if Set has been called. -func NewNullableIncidentFieldAttributesSingleValueType(val *IncidentFieldAttributesSingleValueType) *NullableIncidentFieldAttributesSingleValueType { - return &NullableIncidentFieldAttributesSingleValueType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentFieldAttributesSingleValueType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentFieldAttributesSingleValueType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_field_attributes_value_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_field_attributes_value_type.go index cd70615b1..2e751fd08 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_field_attributes_value_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_field_attributes_value_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // IncidentFieldAttributesValueType Type of the multiple value field definitions. @@ -67,47 +68,3 @@ func (v IncidentFieldAttributesValueType) IsValid() bool { func (v IncidentFieldAttributesValueType) Ptr() *IncidentFieldAttributesValueType { return &v } - -// NullableIncidentFieldAttributesValueType handles when a null is used for IncidentFieldAttributesValueType. -type NullableIncidentFieldAttributesValueType struct { - value *IncidentFieldAttributesValueType - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentFieldAttributesValueType) Get() *IncidentFieldAttributesValueType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentFieldAttributesValueType) Set(val *IncidentFieldAttributesValueType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentFieldAttributesValueType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentFieldAttributesValueType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentFieldAttributesValueType initializes the struct as if Set has been called. -func NewNullableIncidentFieldAttributesValueType(val *IncidentFieldAttributesValueType) *NullableIncidentFieldAttributesValueType { - return &NullableIncidentFieldAttributesValueType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentFieldAttributesValueType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentFieldAttributesValueType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_attributes.go index 308a5c945..9d4352f60 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -173,7 +174,6 @@ func (o IncidentIntegrationMetadataAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentIntegrationMetadataAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IncidentId *string `json:"incident_id,omitempty"` IntegrationType *int32 `json:"integration_type"` @@ -181,12 +181,7 @@ func (o *IncidentIntegrationMetadataAttributes) UnmarshalJSON(bytes []byte) (err Status *int32 `json:"status,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.IntegrationType == nil { return fmt.Errorf("required field integration_type missing") @@ -204,6 +199,7 @@ func (o *IncidentIntegrationMetadataAttributes) UnmarshalJSON(bytes []byte) (err o.IntegrationType = *all.IntegrationType o.Metadata = *all.Metadata o.Status = all.Status + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_create_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_create_data.go index a4233f6d1..5ee1aa901 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_create_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_create_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o IncidentIntegrationMetadataCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentIntegrationMetadataCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *IncidentIntegrationMetadataAttributes `json:"attributes"` Type *IncidentIntegrationMetadataType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -131,26 +126,25 @@ func (o *IncidentIntegrationMetadataCreateData) UnmarshalJSON(bytes []byte) (err } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_create_request.go index 38da2316b..e4ce68f3b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o IncidentIntegrationMetadataCreateRequest) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *IncidentIntegrationMetadataCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *IncidentIntegrationMetadataCreateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *IncidentIntegrationMetadataCreateRequest) UnmarshalJSON(bytes []byte) ( } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_list_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_list_response.go index d755fab8f..a3333fadf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_list_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_list_response.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -143,19 +144,13 @@ func (o IncidentIntegrationMetadataListResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentIntegrationMetadataListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *[]IncidentIntegrationMetadataResponseData `json:"data"` Included []IncidentIntegrationMetadataResponseIncludedItem `json:"included,omitempty"` Meta *IncidentResponseMeta `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -166,19 +161,22 @@ func (o *IncidentIntegrationMetadataListResponse) UnmarshalJSON(bytes []byte) (e } else { return err } + + hasInvalidField := false o.Data = *all.Data o.Included = all.Included if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_metadata.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_metadata.go index 31611678d..73c963bfe 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_metadata.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_metadata.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // IncidentIntegrationMetadataMetadata - Incident integration metadata's metadata attribute. @@ -103,53 +103,3 @@ func (obj *IncidentIntegrationMetadataMetadata) GetActualInstance() interface{} // all schemas are nil return nil } - -// NullableIncidentIntegrationMetadataMetadata handles when a null is used for IncidentIntegrationMetadataMetadata. -type NullableIncidentIntegrationMetadataMetadata struct { - value *IncidentIntegrationMetadataMetadata - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentIntegrationMetadataMetadata) Get() *IncidentIntegrationMetadataMetadata { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentIntegrationMetadataMetadata) Set(val *IncidentIntegrationMetadataMetadata) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentIntegrationMetadataMetadata) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableIncidentIntegrationMetadataMetadata) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentIntegrationMetadataMetadata initializes the struct as if Set has been called. -func NewNullableIncidentIntegrationMetadataMetadata(val *IncidentIntegrationMetadataMetadata) *NullableIncidentIntegrationMetadataMetadata { - return &NullableIncidentIntegrationMetadataMetadata{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentIntegrationMetadataMetadata) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentIntegrationMetadataMetadata) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_patch_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_patch_data.go index 75919de30..5961333dd 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_patch_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_patch_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o IncidentIntegrationMetadataPatchData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentIntegrationMetadataPatchData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *IncidentIntegrationMetadataAttributes `json:"attributes"` Type *IncidentIntegrationMetadataType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -131,26 +126,25 @@ func (o *IncidentIntegrationMetadataPatchData) UnmarshalJSON(bytes []byte) (err } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_patch_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_patch_request.go index dbc78d3e4..c8da2d958 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_patch_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_patch_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o IncidentIntegrationMetadataPatchRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentIntegrationMetadataPatchRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *IncidentIntegrationMetadataPatchData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *IncidentIntegrationMetadataPatchRequest) UnmarshalJSON(bytes []byte) (e } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_response.go index 4e09f245d..17d49aab8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_response.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o IncidentIntegrationMetadataResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentIntegrationMetadataResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *IncidentIntegrationMetadataResponseData `json:"data"` Included []IncidentIntegrationMetadataResponseIncludedItem `json:"included,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -132,18 +127,21 @@ func (o *IncidentIntegrationMetadataResponse) UnmarshalJSON(bytes []byte) (err e } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data o.Included = all.Included + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_response_data.go index 2443a3cd1..c6559a961 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_response_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -139,19 +140,13 @@ func (o IncidentIntegrationMetadataResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentIntegrationMetadataResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *IncidentIntegrationMetadataAttributes `json:"attributes,omitempty"` Id *string `json:"id"` Type *IncidentIntegrationMetadataType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -165,27 +160,26 @@ func (o *IncidentIntegrationMetadataResponseData) UnmarshalJSON(bytes []byte) (e } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_response_included_item.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_response_included_item.go index c903e352c..f2c350294 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_response_included_item.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_response_included_item.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // IncidentIntegrationMetadataResponseIncludedItem - An object related to an incident integration metadata that is included in the response. @@ -71,53 +71,3 @@ func (obj *IncidentIntegrationMetadataResponseIncludedItem) GetActualInstance() // all schemas are nil return nil } - -// NullableIncidentIntegrationMetadataResponseIncludedItem handles when a null is used for IncidentIntegrationMetadataResponseIncludedItem. -type NullableIncidentIntegrationMetadataResponseIncludedItem struct { - value *IncidentIntegrationMetadataResponseIncludedItem - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentIntegrationMetadataResponseIncludedItem) Get() *IncidentIntegrationMetadataResponseIncludedItem { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentIntegrationMetadataResponseIncludedItem) Set(val *IncidentIntegrationMetadataResponseIncludedItem) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentIntegrationMetadataResponseIncludedItem) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableIncidentIntegrationMetadataResponseIncludedItem) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentIntegrationMetadataResponseIncludedItem initializes the struct as if Set has been called. -func NewNullableIncidentIntegrationMetadataResponseIncludedItem(val *IncidentIntegrationMetadataResponseIncludedItem) *NullableIncidentIntegrationMetadataResponseIncludedItem { - return &NullableIncidentIntegrationMetadataResponseIncludedItem{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentIntegrationMetadataResponseIncludedItem) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentIntegrationMetadataResponseIncludedItem) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_type.go index 96d0acc48..f76ef973b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_integration_metadata_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // IncidentIntegrationMetadataType Integration metadata resource type. @@ -61,47 +62,3 @@ func (v IncidentIntegrationMetadataType) IsValid() bool { func (v IncidentIntegrationMetadataType) Ptr() *IncidentIntegrationMetadataType { return &v } - -// NullableIncidentIntegrationMetadataType handles when a null is used for IncidentIntegrationMetadataType. -type NullableIncidentIntegrationMetadataType struct { - value *IncidentIntegrationMetadataType - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentIntegrationMetadataType) Get() *IncidentIntegrationMetadataType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentIntegrationMetadataType) Set(val *IncidentIntegrationMetadataType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentIntegrationMetadataType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentIntegrationMetadataType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentIntegrationMetadataType initializes the struct as if Set has been called. -func NewNullableIncidentIntegrationMetadataType(val *IncidentIntegrationMetadataType) *NullableIncidentIntegrationMetadataType { - return &NullableIncidentIntegrationMetadataType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentIntegrationMetadataType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentIntegrationMetadataType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_notification_handle.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_notification_handle.go index 73feac114..fe91ea454 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_notification_handle.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_notification_handle.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o IncidentNotificationHandle) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentNotificationHandle) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DisplayName *string `json:"display_name,omitempty"` Handle *string `json:"handle,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *IncidentNotificationHandle) UnmarshalJSON(bytes []byte) (err error) { } o.DisplayName = all.DisplayName o.Handle = all.Handle + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_postmortem_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_postmortem_type.go index 1dea6e447..9629b455d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_postmortem_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_postmortem_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // IncidentPostmortemType Incident postmortem resource type. @@ -61,47 +62,3 @@ func (v IncidentPostmortemType) IsValid() bool { func (v IncidentPostmortemType) Ptr() *IncidentPostmortemType { return &v } - -// NullableIncidentPostmortemType handles when a null is used for IncidentPostmortemType. -type NullableIncidentPostmortemType struct { - value *IncidentPostmortemType - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentPostmortemType) Get() *IncidentPostmortemType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentPostmortemType) Set(val *IncidentPostmortemType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentPostmortemType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentPostmortemType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentPostmortemType initializes the struct as if Set has been called. -func NewNullableIncidentPostmortemType(val *IncidentPostmortemType) *NullableIncidentPostmortemType { - return &NullableIncidentPostmortemType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentPostmortemType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentPostmortemType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_related_object.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_related_object.go index b68a972a4..83ffe0f0e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_related_object.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_related_object.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // IncidentRelatedObject Object related to an incident. @@ -63,47 +64,3 @@ func (v IncidentRelatedObject) IsValid() bool { func (v IncidentRelatedObject) Ptr() *IncidentRelatedObject { return &v } - -// NullableIncidentRelatedObject handles when a null is used for IncidentRelatedObject. -type NullableIncidentRelatedObject struct { - value *IncidentRelatedObject - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentRelatedObject) Get() *IncidentRelatedObject { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentRelatedObject) Set(val *IncidentRelatedObject) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentRelatedObject) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentRelatedObject) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentRelatedObject initializes the struct as if Set has been called. -func NewNullableIncidentRelatedObject(val *IncidentRelatedObject) *NullableIncidentRelatedObject { - return &NullableIncidentRelatedObject{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentRelatedObject) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentRelatedObject) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response.go index 9c5cf2035..024581809 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o IncidentResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *IncidentResponseData `json:"data"` Included []IncidentResponseIncludedItem `json:"included,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -132,18 +127,21 @@ func (o *IncidentResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data o.Included = all.Included + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response_attributes.go index 0d5ad63b2..8b52965d9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response_attributes.go @@ -5,10 +5,11 @@ package datadogV2 import ( - "encoding/json" "fmt" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -672,7 +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{}{} all := struct { Created *time.Time `json:"created,omitempty"` CustomerImpactDuration *int64 `json:"customer_impact_duration,omitempty"` @@ -693,12 +693,7 @@ func (o *IncidentResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { Title *string `json:"title"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Title == nil { return fmt.Errorf("required field title missing") @@ -726,6 +721,7 @@ func (o *IncidentResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { o.TimeToRepair = all.TimeToRepair o.TimeToResolve = all.TimeToResolve o.Title = *all.Title + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response_data.go index cd870f504..c20cd0d4b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -172,7 +173,6 @@ func (o IncidentResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *IncidentResponseAttributes `json:"attributes,omitempty"` Id *string `json:"id"` @@ -180,12 +180,7 @@ func (o *IncidentResponseData) UnmarshalJSON(bytes []byte) (err error) { Type *IncidentType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -199,35 +194,30 @@ func (o *IncidentResponseData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response_included_item.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response_included_item.go index 7d7fa353e..ce0cacaa4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response_included_item.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response_included_item.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // IncidentResponseIncludedItem - An object related to an incident that is included in the response. @@ -103,53 +103,3 @@ func (obj *IncidentResponseIncludedItem) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableIncidentResponseIncludedItem handles when a null is used for IncidentResponseIncludedItem. -type NullableIncidentResponseIncludedItem struct { - value *IncidentResponseIncludedItem - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentResponseIncludedItem) Get() *IncidentResponseIncludedItem { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentResponseIncludedItem) Set(val *IncidentResponseIncludedItem) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentResponseIncludedItem) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableIncidentResponseIncludedItem) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentResponseIncludedItem initializes the struct as if Set has been called. -func NewNullableIncidentResponseIncludedItem(val *IncidentResponseIncludedItem) *NullableIncidentResponseIncludedItem { - return &NullableIncidentResponseIncludedItem{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentResponseIncludedItem) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentResponseIncludedItem) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response_meta.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response_meta.go index b11744cab..cd092e62a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response_meta.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response_meta.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o IncidentResponseMeta) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentResponseMeta) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Pagination *IncidentResponseMetaPagination `json:"pagination,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *IncidentResponseMeta) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Pagination != nil && all.Pagination.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Pagination = all.Pagination + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response_meta_pagination.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response_meta_pagination.go index 80ba8908d..0341c6d81 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response_meta_pagination.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response_meta_pagination.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o IncidentResponseMetaPagination) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentResponseMetaPagination) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { NextOffset *int64 `json:"next_offset,omitempty"` Offset *int64 `json:"offset,omitempty"` Size *int64 `json:"size,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *IncidentResponseMetaPagination) UnmarshalJSON(bytes []byte) (err error) o.NextOffset = all.NextOffset o.Offset = all.Offset o.Size = all.Size + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response_relationships.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response_relationships.go index 6dfd2237a..f9368b771 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response_relationships.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_response_relationships.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -214,7 +214,6 @@ func (o IncidentResponseRelationships) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentResponseRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attachments *RelationshipToIncidentAttachment `json:"attachments,omitempty"` CommanderUser *NullableRelationshipToUser `json:"commander_user,omitempty"` @@ -223,12 +222,7 @@ func (o *IncidentResponseRelationships) UnmarshalJSON(bytes []byte) (err error) LastModifiedByUser *RelationshipToUser `json:"last_modified_by_user,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -236,49 +230,36 @@ func (o *IncidentResponseRelationships) UnmarshalJSON(bytes []byte) (err error) } else { return err } + + hasInvalidField := false if all.Attachments != nil && all.Attachments.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attachments = all.Attachments if all.CommanderUser != nil && all.CommanderUser.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.CommanderUser = all.CommanderUser if all.CreatedByUser != nil && all.CreatedByUser.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.CreatedByUser = all.CreatedByUser if all.Integrations != nil && all.Integrations.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Integrations = all.Integrations if all.LastModifiedByUser != nil && all.LastModifiedByUser.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LastModifiedByUser = all.LastModifiedByUser + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response.go index 6c3fe1938..2117b3ddd 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -143,19 +144,13 @@ func (o IncidentSearchResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentSearchResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *IncidentSearchResponseData `json:"data"` Included []IncidentResponseIncludedItem `json:"included,omitempty"` Meta *IncidentSearchResponseMeta `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -166,26 +161,25 @@ func (o *IncidentSearchResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data o.Included = all.Included if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_attributes.go index 9dbe9ceb0..83ef6721e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -131,19 +132,13 @@ func (o IncidentSearchResponseAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentSearchResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Facets *IncidentSearchResponseFacetsData `json:"facets"` Incidents *[]IncidentSearchResponseIncidentsData `json:"incidents"` Total *int32 `json:"total"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Facets == nil { return fmt.Errorf("required field facets missing") @@ -160,19 +155,22 @@ func (o *IncidentSearchResponseAttributes) UnmarshalJSON(bytes []byte) (err erro } else { return err } + + hasInvalidField := false if all.Facets.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Facets = *all.Facets o.Incidents = *all.Incidents o.Total = *all.Total + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_data.go index c44867f97..5d453fc77 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_data.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -119,18 +119,12 @@ func (o IncidentSearchResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentSearchResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *IncidentSearchResponseAttributes `json:"attributes,omitempty"` Type *IncidentSearchResultsType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -138,26 +132,25 @@ func (o *IncidentSearchResponseData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_facets_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_facets_data.go index 259cdebfd..fcc7b80c8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_facets_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_facets_data.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -412,7 +412,6 @@ func (o IncidentSearchResponseFacetsData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentSearchResponseFacetsData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Commander []IncidentSearchResponseUserFacetData `json:"commander,omitempty"` CreatedBy []IncidentSearchResponseUserFacetData `json:"created_by,omitempty"` @@ -427,12 +426,7 @@ func (o *IncidentSearchResponseFacetsData) UnmarshalJSON(bytes []byte) (err erro TimeToResolve []IncidentSearchResponseNumericFacetData `json:"time_to_resolve,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -451,6 +445,7 @@ func (o *IncidentSearchResponseFacetsData) UnmarshalJSON(bytes []byte) (err erro o.State = all.State o.TimeToRepair = all.TimeToRepair o.TimeToResolve = all.TimeToResolve + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_field_facet_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_field_facet_data.go index 107307b10..c9a1b352f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_field_facet_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_field_facet_data.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o IncidentSearchResponseFieldFacetData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentSearchResponseFieldFacetData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Count *int32 `json:"count,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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *IncidentSearchResponseFieldFacetData) UnmarshalJSON(bytes []byte) (err } o.Count = all.Count o.Name = all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_incidents_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_incidents_data.go index 63087d248..c8384f0a6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_incidents_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_incidents_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o IncidentSearchResponseIncidentsData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentSearchResponseIncidentsData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *IncidentResponseData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *IncidentSearchResponseIncidentsData) UnmarshalJSON(bytes []byte) (err e } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_meta.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_meta.go index 912a5cdd7..093f863e2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_meta.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_meta.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o IncidentSearchResponseMeta) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentSearchResponseMeta) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Pagination *IncidentResponseMetaPagination `json:"pagination,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *IncidentSearchResponseMeta) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Pagination != nil && all.Pagination.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Pagination = all.Pagination + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_numeric_facet_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_numeric_facet_data.go index e8610429a..7407ac8a0 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_numeric_facet_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_numeric_facet_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o IncidentSearchResponseNumericFacetData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentSearchResponseNumericFacetData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregates *IncidentSearchResponseNumericFacetDataAggregates `json:"aggregates"` Name *string `json:"name"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Aggregates == nil { return fmt.Errorf("required field aggregates missing") @@ -129,18 +124,21 @@ func (o *IncidentSearchResponseNumericFacetData) UnmarshalJSON(bytes []byte) (er } else { return err } + + hasInvalidField := false if all.Aggregates.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Aggregates = *all.Aggregates o.Name = *all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_numeric_facet_data_aggregates.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_numeric_facet_data_aggregates.go index fc7a2e025..8cb8ae7a9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_numeric_facet_data_aggregates.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_numeric_facet_data_aggregates.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -137,18 +137,12 @@ func (o IncidentSearchResponseNumericFacetDataAggregates) MarshalJSON() ([]byte, // UnmarshalJSON deserializes the given payload. func (o *IncidentSearchResponseNumericFacetDataAggregates) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Max datadog.NullableFloat64 `json:"max,omitempty"` Min datadog.NullableFloat64 `json:"min,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -158,6 +152,7 @@ func (o *IncidentSearchResponseNumericFacetDataAggregates) UnmarshalJSON(bytes [ } o.Max = all.Max o.Min = all.Min + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_property_field_facet_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_property_field_facet_data.go index cf18337b2..9a0c5bf52 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_property_field_facet_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_property_field_facet_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -137,19 +138,13 @@ func (o IncidentSearchResponsePropertyFieldFacetData) MarshalJSON() ([]byte, err // UnmarshalJSON deserializes the given payload. func (o *IncidentSearchResponsePropertyFieldFacetData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregates *IncidentSearchResponseNumericFacetDataAggregates `json:"aggregates,omitempty"` Facets *[]IncidentSearchResponseFieldFacetData `json:"facets"` Name *string `json:"name"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Facets == nil { return fmt.Errorf("required field facets missing") @@ -163,19 +158,22 @@ func (o *IncidentSearchResponsePropertyFieldFacetData) UnmarshalJSON(bytes []byt } else { return err } + + hasInvalidField := false if all.Aggregates != nil && all.Aggregates.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Aggregates = all.Aggregates o.Facets = *all.Facets o.Name = *all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_user_facet_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_user_facet_data.go index 4192cfb6d..fd8f841a3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_user_facet_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_response_user_facet_data.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -214,7 +214,6 @@ func (o IncidentSearchResponseUserFacetData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentSearchResponseUserFacetData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Count *int32 `json:"count,omitempty"` Email *string `json:"email,omitempty"` @@ -223,12 +222,7 @@ func (o *IncidentSearchResponseUserFacetData) UnmarshalJSON(bytes []byte) (err e Uuid *string `json:"uuid,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -241,6 +235,7 @@ func (o *IncidentSearchResponseUserFacetData) UnmarshalJSON(bytes []byte) (err e o.Handle = all.Handle o.Name = all.Name o.Uuid = all.Uuid + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_results_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_results_type.go index 725b9ce80..257b84d12 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_results_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_results_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // IncidentSearchResultsType Incident search result type. @@ -61,47 +62,3 @@ func (v IncidentSearchResultsType) IsValid() bool { func (v IncidentSearchResultsType) Ptr() *IncidentSearchResultsType { return &v } - -// NullableIncidentSearchResultsType handles when a null is used for IncidentSearchResultsType. -type NullableIncidentSearchResultsType struct { - value *IncidentSearchResultsType - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentSearchResultsType) Get() *IncidentSearchResultsType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentSearchResultsType) Set(val *IncidentSearchResultsType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentSearchResultsType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentSearchResultsType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentSearchResultsType initializes the struct as if Set has been called. -func NewNullableIncidentSearchResultsType(val *IncidentSearchResultsType) *NullableIncidentSearchResultsType { - return &NullableIncidentSearchResultsType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentSearchResultsType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentSearchResultsType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_sort_order.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_sort_order.go index af69dbf1e..a1fd59243 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_sort_order.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_search_sort_order.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // IncidentSearchSortOrder The ways searched incidents can be sorted. @@ -63,47 +64,3 @@ func (v IncidentSearchSortOrder) IsValid() bool { func (v IncidentSearchSortOrder) Ptr() *IncidentSearchSortOrder { return &v } - -// NullableIncidentSearchSortOrder handles when a null is used for IncidentSearchSortOrder. -type NullableIncidentSearchSortOrder struct { - value *IncidentSearchSortOrder - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentSearchSortOrder) Get() *IncidentSearchSortOrder { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentSearchSortOrder) Set(val *IncidentSearchSortOrder) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentSearchSortOrder) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentSearchSortOrder) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentSearchSortOrder initializes the struct as if Set has been called. -func NewNullableIncidentSearchSortOrder(val *IncidentSearchSortOrder) *NullableIncidentSearchSortOrder { - return &NullableIncidentSearchSortOrder{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentSearchSortOrder) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentSearchSortOrder) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_create_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_create_attributes.go index e03df447d..2f068df4b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_create_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_create_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o IncidentServiceCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentServiceCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Name *string `json:"name"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -99,6 +94,7 @@ func (o *IncidentServiceCreateAttributes) UnmarshalJSON(bytes []byte) (err error return err } o.Name = *all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_create_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_create_data.go index 3b4a22914..b0a4cedfd 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_create_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_create_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -145,19 +146,13 @@ func (o IncidentServiceCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentServiceCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *IncidentServiceCreateAttributes `json:"attributes,omitempty"` Relationships *IncidentServiceRelationships `json:"relationships,omitempty"` Type *IncidentServiceType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -168,34 +163,29 @@ func (o *IncidentServiceCreateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_create_request.go index ddb9d475a..f51c9cae9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o IncidentServiceCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentServiceCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *IncidentServiceCreateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *IncidentServiceCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_included_items.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_included_items.go index d5a62d80c..11f2cbabb 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_included_items.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_included_items.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // IncidentServiceIncludedItems - An object related to an incident service which is present in the included payload. @@ -71,53 +71,3 @@ func (obj *IncidentServiceIncludedItems) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableIncidentServiceIncludedItems handles when a null is used for IncidentServiceIncludedItems. -type NullableIncidentServiceIncludedItems struct { - value *IncidentServiceIncludedItems - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentServiceIncludedItems) Get() *IncidentServiceIncludedItems { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentServiceIncludedItems) Set(val *IncidentServiceIncludedItems) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentServiceIncludedItems) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableIncidentServiceIncludedItems) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentServiceIncludedItems initializes the struct as if Set has been called. -func NewNullableIncidentServiceIncludedItems(val *IncidentServiceIncludedItems) *NullableIncidentServiceIncludedItems { - return &NullableIncidentServiceIncludedItems{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentServiceIncludedItems) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentServiceIncludedItems) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_relationships.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_relationships.go index 634bdd0bb..de9beff1b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_relationships.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_relationships.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o IncidentServiceRelationships) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentServiceRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CreatedBy *RelationshipToUser `json:"created_by,omitempty"` LastModifiedBy *RelationshipToUser `json:"last_modified_by,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,25 +128,24 @@ func (o *IncidentServiceRelationships) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.CreatedBy != nil && all.CreatedBy.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.CreatedBy = all.CreatedBy if all.LastModifiedBy != nil && all.LastModifiedBy.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LastModifiedBy = all.LastModifiedBy + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_response.go index a05465ee9..9d330088d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_response.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o IncidentServiceResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentServiceResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *IncidentServiceResponseData `json:"data"` Included []IncidentServiceIncludedItems `json:"included,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -132,18 +127,21 @@ func (o *IncidentServiceResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data o.Included = all.Included + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_response_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_response_attributes.go index 00fbafe02..b2c4b7573 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_response_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_response_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -157,19 +158,13 @@ func (o IncidentServiceResponseAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentServiceResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Created *time.Time `json:"created,omitempty"` Modified *time.Time `json:"modified,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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -180,6 +175,7 @@ func (o *IncidentServiceResponseAttributes) UnmarshalJSON(bytes []byte) (err err o.Created = all.Created o.Modified = all.Modified o.Name = all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_response_data.go index fd8f0b490..36708a56e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_response_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -172,7 +173,6 @@ func (o IncidentServiceResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentServiceResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *IncidentServiceResponseAttributes `json:"attributes,omitempty"` Id *string `json:"id"` @@ -180,12 +180,7 @@ func (o *IncidentServiceResponseData) UnmarshalJSON(bytes []byte) (err error) { Type *IncidentServiceType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -199,35 +194,30 @@ func (o *IncidentServiceResponseData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_type.go index 92f1efd5d..8af633c36 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // IncidentServiceType Incident service resource type. @@ -61,47 +62,3 @@ func (v IncidentServiceType) IsValid() bool { func (v IncidentServiceType) Ptr() *IncidentServiceType { return &v } - -// NullableIncidentServiceType handles when a null is used for IncidentServiceType. -type NullableIncidentServiceType struct { - value *IncidentServiceType - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentServiceType) Get() *IncidentServiceType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentServiceType) Set(val *IncidentServiceType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentServiceType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentServiceType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentServiceType initializes the struct as if Set has been called. -func NewNullableIncidentServiceType(val *IncidentServiceType) *NullableIncidentServiceType { - return &NullableIncidentServiceType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentServiceType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentServiceType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_update_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_update_attributes.go index 373080072..ff079ef7d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_update_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_update_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o IncidentServiceUpdateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentServiceUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Name *string `json:"name"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -99,6 +94,7 @@ func (o *IncidentServiceUpdateAttributes) UnmarshalJSON(bytes []byte) (err error return err } o.Name = *all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_update_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_update_data.go index d923b77a1..72da0f9eb 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_update_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_update_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -178,7 +179,6 @@ func (o IncidentServiceUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentServiceUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *IncidentServiceUpdateAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` @@ -186,12 +186,7 @@ func (o *IncidentServiceUpdateData) UnmarshalJSON(bytes []byte) (err error) { Type *IncidentServiceType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -202,35 +197,30 @@ func (o *IncidentServiceUpdateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_update_request.go index 035ed45da..76b8315f8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_service_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o IncidentServiceUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentServiceUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *IncidentServiceUpdateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *IncidentServiceUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_services_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_services_response.go index 8d272c4a0..3b1432c63 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_services_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_services_response.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -143,19 +144,13 @@ func (o IncidentServicesResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentServicesResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *[]IncidentServiceResponseData `json:"data"` Included []IncidentServiceIncludedItems `json:"included,omitempty"` Meta *IncidentResponseMeta `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -166,19 +161,22 @@ func (o *IncidentServicesResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Data = *all.Data o.Included = all.Included if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_create_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_create_attributes.go index 769285808..cff8ecbb5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_create_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_create_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o IncidentTeamCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTeamCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Name *string `json:"name"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -99,6 +94,7 @@ func (o *IncidentTeamCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { return err } o.Name = *all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_create_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_create_data.go index 95f661584..b786ea90e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_create_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_create_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -145,19 +146,13 @@ func (o IncidentTeamCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTeamCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *IncidentTeamCreateAttributes `json:"attributes,omitempty"` Relationships *IncidentTeamRelationships `json:"relationships,omitempty"` Type *IncidentTeamType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -168,34 +163,29 @@ func (o *IncidentTeamCreateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_create_request.go index 2e62f8418..0be963156 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o IncidentTeamCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTeamCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *IncidentTeamCreateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *IncidentTeamCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_included_items.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_included_items.go index 5c8652eac..b29bc6402 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_included_items.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_included_items.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // IncidentTeamIncludedItems - An object related to an incident team which is present in the included payload. @@ -71,53 +71,3 @@ func (obj *IncidentTeamIncludedItems) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableIncidentTeamIncludedItems handles when a null is used for IncidentTeamIncludedItems. -type NullableIncidentTeamIncludedItems struct { - value *IncidentTeamIncludedItems - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentTeamIncludedItems) Get() *IncidentTeamIncludedItems { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentTeamIncludedItems) Set(val *IncidentTeamIncludedItems) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentTeamIncludedItems) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableIncidentTeamIncludedItems) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentTeamIncludedItems initializes the struct as if Set has been called. -func NewNullableIncidentTeamIncludedItems(val *IncidentTeamIncludedItems) *NullableIncidentTeamIncludedItems { - return &NullableIncidentTeamIncludedItems{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentTeamIncludedItems) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentTeamIncludedItems) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_relationships.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_relationships.go index de6060111..33f7697d7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_relationships.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_relationships.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o IncidentTeamRelationships) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTeamRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CreatedBy *RelationshipToUser `json:"created_by,omitempty"` LastModifiedBy *RelationshipToUser `json:"last_modified_by,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,25 +128,24 @@ func (o *IncidentTeamRelationships) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.CreatedBy != nil && all.CreatedBy.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.CreatedBy = all.CreatedBy if all.LastModifiedBy != nil && all.LastModifiedBy.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.LastModifiedBy = all.LastModifiedBy + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_response.go index a6d279c23..d8cd79486 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_response.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o IncidentTeamResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTeamResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *IncidentTeamResponseData `json:"data"` Included []IncidentTeamIncludedItems `json:"included,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -132,18 +127,21 @@ func (o *IncidentTeamResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data o.Included = all.Included + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_response_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_response_attributes.go index 1810df259..03ee44e0d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_response_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_response_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -157,19 +158,13 @@ func (o IncidentTeamResponseAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTeamResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Created *time.Time `json:"created,omitempty"` Modified *time.Time `json:"modified,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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -180,6 +175,7 @@ func (o *IncidentTeamResponseAttributes) UnmarshalJSON(bytes []byte) (err error) o.Created = all.Created o.Modified = all.Modified o.Name = all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_response_data.go index da87f4b87..e71fe2552 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_response_data.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -185,7 +185,6 @@ func (o IncidentTeamResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTeamResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *IncidentTeamResponseAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` @@ -193,12 +192,7 @@ func (o *IncidentTeamResponseData) UnmarshalJSON(bytes []byte) (err error) { Type *IncidentTeamType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,35 +200,30 @@ func (o *IncidentTeamResponseData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_type.go index f980bcb0a..26a65a462 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // IncidentTeamType Incident Team resource type. @@ -61,47 +62,3 @@ func (v IncidentTeamType) IsValid() bool { func (v IncidentTeamType) Ptr() *IncidentTeamType { return &v } - -// NullableIncidentTeamType handles when a null is used for IncidentTeamType. -type NullableIncidentTeamType struct { - value *IncidentTeamType - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentTeamType) Get() *IncidentTeamType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentTeamType) Set(val *IncidentTeamType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentTeamType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentTeamType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentTeamType initializes the struct as if Set has been called. -func NewNullableIncidentTeamType(val *IncidentTeamType) *NullableIncidentTeamType { - return &NullableIncidentTeamType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentTeamType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentTeamType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_update_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_update_attributes.go index 30603ca50..dbeb67951 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_update_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_update_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o IncidentTeamUpdateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTeamUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Name *string `json:"name"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -99,6 +94,7 @@ func (o *IncidentTeamUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { return err } o.Name = *all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_update_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_update_data.go index a41f154ba..861004e51 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_update_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_update_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -178,7 +179,6 @@ func (o IncidentTeamUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTeamUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *IncidentTeamUpdateAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` @@ -186,12 +186,7 @@ func (o *IncidentTeamUpdateData) UnmarshalJSON(bytes []byte) (err error) { Type *IncidentTeamType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -202,35 +197,30 @@ func (o *IncidentTeamUpdateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_update_request.go index ed46b1dda..695401803 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_team_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o IncidentTeamUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTeamUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *IncidentTeamUpdateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *IncidentTeamUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_teams_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_teams_response.go index b053e9a5d..648437493 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_teams_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_teams_response.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -143,19 +144,13 @@ func (o IncidentTeamsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTeamsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *[]IncidentTeamResponseData `json:"data"` Included []IncidentTeamIncludedItems `json:"included,omitempty"` Meta *IncidentResponseMeta `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -166,19 +161,22 @@ func (o *IncidentTeamsResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Data = *all.Data o.Included = all.Included if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_timeline_cell_create_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_timeline_cell_create_attributes.go index 26178d3cc..132397290 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_timeline_cell_create_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_timeline_cell_create_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // IncidentTimelineCellCreateAttributes - The timeline cell's attributes for a create request. @@ -71,53 +71,3 @@ func (obj *IncidentTimelineCellCreateAttributes) GetActualInstance() interface{} // all schemas are nil return nil } - -// NullableIncidentTimelineCellCreateAttributes handles when a null is used for IncidentTimelineCellCreateAttributes. -type NullableIncidentTimelineCellCreateAttributes struct { - value *IncidentTimelineCellCreateAttributes - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentTimelineCellCreateAttributes) Get() *IncidentTimelineCellCreateAttributes { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentTimelineCellCreateAttributes) Set(val *IncidentTimelineCellCreateAttributes) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentTimelineCellCreateAttributes) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableIncidentTimelineCellCreateAttributes) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentTimelineCellCreateAttributes initializes the struct as if Set has been called. -func NewNullableIncidentTimelineCellCreateAttributes(val *IncidentTimelineCellCreateAttributes) *NullableIncidentTimelineCellCreateAttributes { - return &NullableIncidentTimelineCellCreateAttributes{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentTimelineCellCreateAttributes) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentTimelineCellCreateAttributes) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_timeline_cell_markdown_content_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_timeline_cell_markdown_content_type.go index 3df5a357c..3e80aca17 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_timeline_cell_markdown_content_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_timeline_cell_markdown_content_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // IncidentTimelineCellMarkdownContentType Type of the Markdown timeline cell. @@ -61,47 +62,3 @@ func (v IncidentTimelineCellMarkdownContentType) IsValid() bool { func (v IncidentTimelineCellMarkdownContentType) Ptr() *IncidentTimelineCellMarkdownContentType { return &v } - -// NullableIncidentTimelineCellMarkdownContentType handles when a null is used for IncidentTimelineCellMarkdownContentType. -type NullableIncidentTimelineCellMarkdownContentType struct { - value *IncidentTimelineCellMarkdownContentType - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentTimelineCellMarkdownContentType) Get() *IncidentTimelineCellMarkdownContentType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentTimelineCellMarkdownContentType) Set(val *IncidentTimelineCellMarkdownContentType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentTimelineCellMarkdownContentType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentTimelineCellMarkdownContentType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentTimelineCellMarkdownContentType initializes the struct as if Set has been called. -func NewNullableIncidentTimelineCellMarkdownContentType(val *IncidentTimelineCellMarkdownContentType) *NullableIncidentTimelineCellMarkdownContentType { - return &NullableIncidentTimelineCellMarkdownContentType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentTimelineCellMarkdownContentType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentTimelineCellMarkdownContentType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_timeline_cell_markdown_create_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_timeline_cell_markdown_create_attributes.go index bce788df8..461489954 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_timeline_cell_markdown_create_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_timeline_cell_markdown_create_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -143,19 +144,13 @@ func (o IncidentTimelineCellMarkdownCreateAttributes) MarshalJSON() ([]byte, err // UnmarshalJSON deserializes the given payload. func (o *IncidentTimelineCellMarkdownCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CellType *IncidentTimelineCellMarkdownContentType `json:"cell_type"` Content *IncidentTimelineCellMarkdownCreateAttributesContent `json:"content"` Important *bool `json:"important,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.CellType == nil { return fmt.Errorf("required field cell_type missing") @@ -169,27 +164,26 @@ func (o *IncidentTimelineCellMarkdownCreateAttributes) UnmarshalJSON(bytes []byt } else { return err } - if v := all.CellType; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if !all.CellType.IsValid() { + hasInvalidField = true + } else { + o.CellType = *all.CellType } - o.CellType = *all.CellType if all.Content.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Content = *all.Content o.Important = all.Important + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_timeline_cell_markdown_create_attributes_content.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_timeline_cell_markdown_create_attributes_content.go index cfa61d578..2188916a0 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_timeline_cell_markdown_create_attributes_content.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_timeline_cell_markdown_create_attributes_content.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o IncidentTimelineCellMarkdownCreateAttributesContent) MarshalJSON() ([]by // UnmarshalJSON deserializes the given payload. func (o *IncidentTimelineCellMarkdownCreateAttributesContent) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Content *string `json:"content,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *IncidentTimelineCellMarkdownCreateAttributesContent) UnmarshalJSON(byte return err } o.Content = all.Content + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_anonymous_assignee.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_anonymous_assignee.go index 4a295966b..201c559c1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_anonymous_assignee.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_anonymous_assignee.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -160,7 +161,6 @@ func (o IncidentTodoAnonymousAssignee) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTodoAnonymousAssignee) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Icon *string `json:"icon"` Id *string `json:"id"` @@ -168,12 +168,7 @@ func (o *IncidentTodoAnonymousAssignee) UnmarshalJSON(bytes []byte) (err error) Source *IncidentTodoAnonymousAssigneeSource `json:"source"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Icon == nil { return fmt.Errorf("required field icon missing") @@ -193,21 +188,24 @@ func (o *IncidentTodoAnonymousAssignee) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.Source; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Icon = *all.Icon o.Id = *all.Id o.Name = *all.Name - o.Source = *all.Source + if !all.Source.IsValid() { + hasInvalidField = true + } else { + o.Source = *all.Source + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_anonymous_assignee_source.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_anonymous_assignee_source.go index fd58389b7..b668d78d4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_anonymous_assignee_source.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_anonymous_assignee_source.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // IncidentTodoAnonymousAssigneeSource The source of the anonymous assignee. @@ -63,47 +64,3 @@ func (v IncidentTodoAnonymousAssigneeSource) IsValid() bool { func (v IncidentTodoAnonymousAssigneeSource) Ptr() *IncidentTodoAnonymousAssigneeSource { return &v } - -// NullableIncidentTodoAnonymousAssigneeSource handles when a null is used for IncidentTodoAnonymousAssigneeSource. -type NullableIncidentTodoAnonymousAssigneeSource struct { - value *IncidentTodoAnonymousAssigneeSource - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentTodoAnonymousAssigneeSource) Get() *IncidentTodoAnonymousAssigneeSource { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentTodoAnonymousAssigneeSource) Set(val *IncidentTodoAnonymousAssigneeSource) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentTodoAnonymousAssigneeSource) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentTodoAnonymousAssigneeSource) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentTodoAnonymousAssigneeSource initializes the struct as if Set has been called. -func NewNullableIncidentTodoAnonymousAssigneeSource(val *IncidentTodoAnonymousAssigneeSource) *NullableIncidentTodoAnonymousAssigneeSource { - return &NullableIncidentTodoAnonymousAssigneeSource{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentTodoAnonymousAssigneeSource) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentTodoAnonymousAssigneeSource) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_assignee.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_assignee.go index 819bfb91e..6c801905a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_assignee.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_assignee.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // IncidentTodoAssignee - A todo assignee. @@ -103,53 +103,3 @@ func (obj *IncidentTodoAssignee) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableIncidentTodoAssignee handles when a null is used for IncidentTodoAssignee. -type NullableIncidentTodoAssignee struct { - value *IncidentTodoAssignee - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentTodoAssignee) Get() *IncidentTodoAssignee { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentTodoAssignee) Set(val *IncidentTodoAssignee) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentTodoAssignee) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableIncidentTodoAssignee) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentTodoAssignee initializes the struct as if Set has been called. -func NewNullableIncidentTodoAssignee(val *IncidentTodoAssignee) *NullableIncidentTodoAssignee { - return &NullableIncidentTodoAssignee{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentTodoAssignee) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentTodoAssignee) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_attributes.go index da1e6fade..89675a479 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -225,7 +226,6 @@ func (o IncidentTodoAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTodoAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Assignees *[]IncidentTodoAssignee `json:"assignees"` Completed datadog.NullableString `json:"completed,omitempty"` @@ -234,12 +234,7 @@ func (o *IncidentTodoAttributes) UnmarshalJSON(bytes []byte) (err error) { IncidentId *string `json:"incident_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Assignees == nil { return fmt.Errorf("required field assignees missing") @@ -258,6 +253,7 @@ func (o *IncidentTodoAttributes) UnmarshalJSON(bytes []byte) (err error) { o.Content = *all.Content o.DueDate = all.DueDate o.IncidentId = all.IncidentId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_create_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_create_data.go index fb4d8a6dc..cf47e38aa 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_create_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_create_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o IncidentTodoCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTodoCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *IncidentTodoAttributes `json:"attributes"` Type *IncidentTodoType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -131,26 +126,25 @@ func (o *IncidentTodoCreateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_create_request.go index 892cc5ffd..cb1db82b2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o IncidentTodoCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTodoCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *IncidentTodoCreateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *IncidentTodoCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_list_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_list_response.go index 7c4cfa0b1..daee31616 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_list_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_list_response.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -143,19 +144,13 @@ func (o IncidentTodoListResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTodoListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *[]IncidentTodoResponseData `json:"data"` Included []IncidentTodoResponseIncludedItem `json:"included,omitempty"` Meta *IncidentResponseMeta `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -166,19 +161,22 @@ func (o *IncidentTodoListResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Data = *all.Data o.Included = all.Included if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_patch_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_patch_data.go index 0a50ed5c3..9ebd7a179 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_patch_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_patch_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o IncidentTodoPatchData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTodoPatchData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *IncidentTodoAttributes `json:"attributes"` Type *IncidentTodoType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -131,26 +126,25 @@ func (o *IncidentTodoPatchData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_patch_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_patch_request.go index ce5bfca96..5cfd93aa5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_patch_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_patch_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o IncidentTodoPatchRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTodoPatchRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *IncidentTodoPatchData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *IncidentTodoPatchRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_response.go index d5fe9c5dc..d1a8eb9ce 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_response.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o IncidentTodoResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTodoResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *IncidentTodoResponseData `json:"data"` Included []IncidentTodoResponseIncludedItem `json:"included,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -132,18 +127,21 @@ func (o *IncidentTodoResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data o.Included = all.Included + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_response_data.go index dcce359a7..943414da8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_response_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -139,19 +140,13 @@ func (o IncidentTodoResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTodoResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *IncidentTodoAttributes `json:"attributes,omitempty"` Id *string `json:"id"` Type *IncidentTodoType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -165,27 +160,26 @@ func (o *IncidentTodoResponseData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_response_included_item.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_response_included_item.go index 6e876cf0f..6bc0b0d60 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_response_included_item.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_response_included_item.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // IncidentTodoResponseIncludedItem - An object related to an incident todo that is included in the response. @@ -71,53 +71,3 @@ func (obj *IncidentTodoResponseIncludedItem) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableIncidentTodoResponseIncludedItem handles when a null is used for IncidentTodoResponseIncludedItem. -type NullableIncidentTodoResponseIncludedItem struct { - value *IncidentTodoResponseIncludedItem - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentTodoResponseIncludedItem) Get() *IncidentTodoResponseIncludedItem { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentTodoResponseIncludedItem) Set(val *IncidentTodoResponseIncludedItem) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentTodoResponseIncludedItem) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableIncidentTodoResponseIncludedItem) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentTodoResponseIncludedItem initializes the struct as if Set has been called. -func NewNullableIncidentTodoResponseIncludedItem(val *IncidentTodoResponseIncludedItem) *NullableIncidentTodoResponseIncludedItem { - return &NullableIncidentTodoResponseIncludedItem{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentTodoResponseIncludedItem) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentTodoResponseIncludedItem) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_type.go index 5b54f4081..9a76a56be 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_todo_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // IncidentTodoType Todo resource type. @@ -61,47 +62,3 @@ func (v IncidentTodoType) IsValid() bool { func (v IncidentTodoType) Ptr() *IncidentTodoType { return &v } - -// NullableIncidentTodoType handles when a null is used for IncidentTodoType. -type NullableIncidentTodoType struct { - value *IncidentTodoType - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentTodoType) Get() *IncidentTodoType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentTodoType) Set(val *IncidentTodoType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentTodoType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentTodoType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentTodoType initializes the struct as if Set has been called. -func NewNullableIncidentTodoType(val *IncidentTodoType) *NullableIncidentTodoType { - return &NullableIncidentTodoType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentTodoType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentTodoType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_type.go index f14207ba9..1b8607afb 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // IncidentType Incident resource type. @@ -61,47 +62,3 @@ func (v IncidentType) IsValid() bool { func (v IncidentType) Ptr() *IncidentType { return &v } - -// NullableIncidentType handles when a null is used for IncidentType. -type NullableIncidentType struct { - value *IncidentType - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentType) Get() *IncidentType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentType) Set(val *IncidentType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentType initializes the struct as if Set has been called. -func NewNullableIncidentType(val *IncidentType) *NullableIncidentType { - return &NullableIncidentType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_update_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_update_attributes.go index bf906eb8e..418c94fa6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_update_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_update_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -347,7 +348,6 @@ func (o IncidentUpdateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CustomerImpactEnd datadog.NullableTime `json:"customer_impact_end,omitempty"` CustomerImpactScope *string `json:"customer_impact_scope,omitempty"` @@ -359,12 +359,7 @@ func (o *IncidentUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { Title *string `json:"title,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -380,6 +375,7 @@ func (o *IncidentUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { o.Fields = all.Fields o.NotificationHandles = all.NotificationHandles o.Title = all.Title + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_update_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_update_data.go index 2fd3f7727..df8dcf139 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_update_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_update_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -172,7 +173,6 @@ func (o IncidentUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *IncidentUpdateAttributes `json:"attributes,omitempty"` Id *string `json:"id"` @@ -180,12 +180,7 @@ func (o *IncidentUpdateData) UnmarshalJSON(bytes []byte) (err error) { Type *IncidentType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -199,35 +194,30 @@ func (o *IncidentUpdateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_update_relationships.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_update_relationships.go index be9f8dd65..9f9accd32 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_update_relationships.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_update_relationships.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o IncidentUpdateRelationships) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentUpdateRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CommanderUser *NullableRelationshipToUser `json:"commander_user,omitempty"` Integrations *RelationshipToIncidentIntegrationMetadatas `json:"integrations,omitempty"` Postmortem *RelationshipToIncidentPostmortem `json:"postmortem,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,33 +162,28 @@ func (o *IncidentUpdateRelationships) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.CommanderUser != nil && all.CommanderUser.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.CommanderUser = all.CommanderUser if all.Integrations != nil && all.Integrations.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Integrations = all.Integrations if all.Postmortem != nil && all.Postmortem.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Postmortem = all.Postmortem + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_update_request.go index 57ef84a49..43c199651 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incident_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o IncidentUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *IncidentUpdateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *IncidentUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incidents_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incidents_response.go index cbd500039..95041d74a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incidents_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_incidents_response.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -143,19 +144,13 @@ func (o IncidentsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *[]IncidentResponseData `json:"data"` Included []IncidentResponseIncludedItem `json:"included,omitempty"` Meta *IncidentResponseMeta `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -166,19 +161,22 @@ func (o *IncidentsResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Data = *all.Data o.Included = all.Included if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_intake_payload_accepted.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_intake_payload_accepted.go index a40a64ab3..dcf31df5d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_intake_payload_accepted.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_intake_payload_accepted.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o IntakePayloadAccepted) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IntakePayloadAccepted) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Errors []string `json:"errors,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *IntakePayloadAccepted) UnmarshalJSON(bytes []byte) (err error) { return err } o.Errors = all.Errors + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_attributes.go index dc6efc339..d5ae6ad84 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o IPAllowlistAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IPAllowlistAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Enabled *bool `json:"enabled,omitempty"` Entries []IPAllowlistEntry `json:"entries,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *IPAllowlistAttributes) UnmarshalJSON(bytes []byte) (err error) { } o.Enabled = all.Enabled o.Entries = all.Entries + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_data.go index 15ac663c6..53fdf317e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -145,19 +146,13 @@ func (o IPAllowlistData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IPAllowlistData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *IPAllowlistAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *IPAllowlistType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -168,27 +163,26 @@ func (o *IPAllowlistData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_entry.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_entry.go index 05812e1e1..1583d0414 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_entry.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_entry.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o IPAllowlistEntry) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IPAllowlistEntry) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *IPAllowlistEntryData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *IPAllowlistEntry) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_entry_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_entry_attributes.go index 84f2a6047..28db60ec6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_entry_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_entry_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -190,7 +191,6 @@ func (o IPAllowlistEntryAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IPAllowlistEntryAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CidrBlock *string `json:"cidr_block,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` @@ -198,12 +198,7 @@ func (o *IPAllowlistEntryAttributes) UnmarshalJSON(bytes []byte) (err error) { Note *string `json:"note,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -215,6 +210,7 @@ func (o *IPAllowlistEntryAttributes) UnmarshalJSON(bytes []byte) (err error) { o.CreatedAt = all.CreatedAt o.ModifiedAt = all.ModifiedAt o.Note = all.Note + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_entry_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_entry_data.go index b30c21657..875edba72 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_entry_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_entry_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -145,19 +146,13 @@ func (o IPAllowlistEntryData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IPAllowlistEntryData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *IPAllowlistEntryAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *IPAllowlistEntryType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -168,27 +163,26 @@ func (o *IPAllowlistEntryData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_entry_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_entry_type.go index 5457c9872..7f7745991 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_entry_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_entry_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // IPAllowlistEntryType IP allowlist Entry type. @@ -61,47 +62,3 @@ func (v IPAllowlistEntryType) IsValid() bool { func (v IPAllowlistEntryType) Ptr() *IPAllowlistEntryType { return &v } - -// NullableIPAllowlistEntryType handles when a null is used for IPAllowlistEntryType. -type NullableIPAllowlistEntryType struct { - value *IPAllowlistEntryType - isSet bool -} - -// Get returns the associated value. -func (v NullableIPAllowlistEntryType) Get() *IPAllowlistEntryType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIPAllowlistEntryType) Set(val *IPAllowlistEntryType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIPAllowlistEntryType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIPAllowlistEntryType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIPAllowlistEntryType initializes the struct as if Set has been called. -func NewNullableIPAllowlistEntryType(val *IPAllowlistEntryType) *NullableIPAllowlistEntryType { - return &NullableIPAllowlistEntryType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIPAllowlistEntryType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIPAllowlistEntryType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_response.go index 3c92b8721..164fe6552 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o IPAllowlistResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IPAllowlistResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *IPAllowlistData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *IPAllowlistResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_type.go index 71df65308..f1d4a230c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // IPAllowlistType IP allowlist type. @@ -61,47 +62,3 @@ func (v IPAllowlistType) IsValid() bool { func (v IPAllowlistType) Ptr() *IPAllowlistType { return &v } - -// NullableIPAllowlistType handles when a null is used for IPAllowlistType. -type NullableIPAllowlistType struct { - value *IPAllowlistType - isSet bool -} - -// Get returns the associated value. -func (v NullableIPAllowlistType) Get() *IPAllowlistType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIPAllowlistType) Set(val *IPAllowlistType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIPAllowlistType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIPAllowlistType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIPAllowlistType initializes the struct as if Set has been called. -func NewNullableIPAllowlistType(val *IPAllowlistType) *NullableIPAllowlistType { - return &NullableIPAllowlistType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIPAllowlistType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIPAllowlistType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_update_request.go index 1d29cd7bf..d992f12f9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_ip_allowlist_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o IPAllowlistUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IPAllowlistUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *IPAllowlistData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *IPAllowlistUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_jira_integration_metadata.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_jira_integration_metadata.go index 9b18164ec..02972e347 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_jira_integration_metadata.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_jira_integration_metadata.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o JiraIntegrationMetadata) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *JiraIntegrationMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Issues *[]JiraIntegrationMetadataIssuesItem `json:"issues"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Issues == nil { return fmt.Errorf("required field issues missing") @@ -99,6 +94,7 @@ func (o *JiraIntegrationMetadata) UnmarshalJSON(bytes []byte) (err error) { return err } o.Issues = *all.Issues + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_jira_integration_metadata_issues_item.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_jira_integration_metadata_issues_item.go index 538a4ccd3..1db5ca3f1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_jira_integration_metadata_issues_item.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_jira_integration_metadata_issues_item.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -203,7 +204,6 @@ func (o JiraIntegrationMetadataIssuesItem) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *JiraIntegrationMetadataIssuesItem) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Account *string `json:"account"` IssueKey *string `json:"issue_key,omitempty"` @@ -212,12 +212,7 @@ func (o *JiraIntegrationMetadataIssuesItem) UnmarshalJSON(bytes []byte) (err err RedirectUrl *string `json:"redirect_url,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Account == nil { return fmt.Errorf("required field account missing") @@ -236,6 +231,7 @@ func (o *JiraIntegrationMetadataIssuesItem) UnmarshalJSON(bytes []byte) (err err o.IssuetypeId = all.IssuetypeId o.ProjectKey = *all.ProjectKey o.RedirectUrl = all.RedirectUrl + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_jsonapi_error_item.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_jsonapi_error_item.go index 31ef3c443..93941f8cc 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_jsonapi_error_item.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_jsonapi_error_item.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o JSONAPIErrorItem) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *JSONAPIErrorItem) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Detail *string `json:"detail,omitempty"` Status *string `json:"status,omitempty"` Title *string `json:"title,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *JSONAPIErrorItem) UnmarshalJSON(bytes []byte) (err error) { o.Detail = all.Detail o.Status = all.Status o.Title = all.Title + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_jsonapi_error_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_jsonapi_error_response.go index 6f3773a19..afd6c0762 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_jsonapi_error_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_jsonapi_error_response.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o JSONAPIErrorResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *JSONAPIErrorResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Errors *[]JSONAPIErrorItem `json:"errors"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Errors == nil { return fmt.Errorf("required field errors missing") @@ -99,6 +94,7 @@ func (o *JSONAPIErrorResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Errors = *all.Errors + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_application_keys_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_application_keys_response.go index 3da872246..2e5e351b2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_application_keys_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_application_keys_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o ListApplicationKeysResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ListApplicationKeysResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []PartialApplicationKey `json:"data,omitempty"` Included []ApplicationKeyResponseIncludedItem `json:"included,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *ListApplicationKeysResponse) UnmarshalJSON(bytes []byte) (err error) { } o.Data = all.Data o.Included = all.Included + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_downtimes_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_downtimes_response.go new file mode 100644 index 000000000..511768684 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_downtimes_response.go @@ -0,0 +1,183 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// ListDowntimesResponse Response for retrieving all downtimes. +type ListDowntimesResponse struct { + // An array of downtimes. + Data []DowntimeResponseData `json:"data,omitempty"` + // Array of objects related to the downtimes. + Included []DowntimeResponseIncludedItem `json:"included,omitempty"` + // Pagination metadata returned by the API. + Meta *DowntimeMeta `json:"meta,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{} +} + +// NewListDowntimesResponse instantiates a new ListDowntimesResponse 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 NewListDowntimesResponse() *ListDowntimesResponse { + this := ListDowntimesResponse{} + return &this +} + +// NewListDowntimesResponseWithDefaults instantiates a new ListDowntimesResponse 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 NewListDowntimesResponseWithDefaults() *ListDowntimesResponse { + this := ListDowntimesResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *ListDowntimesResponse) GetData() []DowntimeResponseData { + if o == nil || o.Data == nil { + var ret []DowntimeResponseData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListDowntimesResponse) GetDataOk() (*[]DowntimeResponseData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *ListDowntimesResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given []DowntimeResponseData and assigns it to the Data field. +func (o *ListDowntimesResponse) SetData(v []DowntimeResponseData) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *ListDowntimesResponse) GetIncluded() []DowntimeResponseIncludedItem { + if o == nil || o.Included == nil { + var ret []DowntimeResponseIncludedItem + return ret + } + return o.Included +} + +// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListDowntimesResponse) GetIncludedOk() (*[]DowntimeResponseIncludedItem, bool) { + if o == nil || o.Included == nil { + return nil, false + } + return &o.Included, true +} + +// HasIncluded returns a boolean if a field has been set. +func (o *ListDowntimesResponse) HasIncluded() bool { + return o != nil && o.Included != nil +} + +// SetIncluded gets a reference to the given []DowntimeResponseIncludedItem and assigns it to the Included field. +func (o *ListDowntimesResponse) SetIncluded(v []DowntimeResponseIncludedItem) { + o.Included = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *ListDowntimesResponse) GetMeta() DowntimeMeta { + if o == nil || o.Meta == nil { + var ret DowntimeMeta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListDowntimesResponse) GetMetaOk() (*DowntimeMeta, bool) { + if o == nil || o.Meta == nil { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *ListDowntimesResponse) HasMeta() bool { + return o != nil && o.Meta != nil +} + +// SetMeta gets a reference to the given DowntimeMeta and assigns it to the Meta field. +func (o *ListDowntimesResponse) SetMeta(v DowntimeMeta) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ListDowntimesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Included != nil { + toSerialize["included"] = o.Included + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ListDowntimesResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data []DowntimeResponseData `json:"data,omitempty"` + Included []DowntimeResponseIncludedItem `json:"included,omitempty"` + Meta *DowntimeMeta `json:"meta,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "included", "meta"}) + } else { + return err + } + + hasInvalidField := false + o.Data = all.Data + o.Included = all.Included + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Meta = all.Meta + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_findings_meta.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_findings_meta.go index 9ae9cf4b2..5a0d0b16e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_findings_meta.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_findings_meta.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // ListFindingsMeta Metadata for pagination. @@ -108,28 +108,24 @@ func (o ListFindingsMeta) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ListFindingsMeta) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Page *ListFindingsPage `json:"page,omitempty"` SnapshotTimestamp *int64 `json:"snapshot_timestamp,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } + + hasInvalidField := false if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Page = all.Page o.SnapshotTimestamp = all.SnapshotTimestamp + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_findings_page.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_findings_page.go index 5ba0c8616..9f5ab90ad 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_findings_page.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_findings_page.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // ListFindingsPage Pagination and findings count information. @@ -108,18 +108,12 @@ func (o ListFindingsPage) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ListFindingsPage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Cursor *string `json:"cursor,omitempty"` TotalFilteredCount *int64 `json:"total_filtered_count,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } o.Cursor = all.Cursor o.TotalFilteredCount = all.TotalFilteredCount diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_findings_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_findings_response.go index b2a164059..c5b5aaed7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_findings_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_findings_response.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o ListFindingsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ListFindingsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *[]Finding `json:"data"` Meta *ListFindingsMeta `json:"meta"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -129,18 +124,21 @@ func (o *ListFindingsResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Data = *all.Data if all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = *all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_teams_include.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_teams_include.go index e67ba3fe8..cbe5abb67 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_teams_include.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_teams_include.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ListTeamsInclude Included related resources optionally requested. @@ -63,47 +64,3 @@ func (v ListTeamsInclude) IsValid() bool { func (v ListTeamsInclude) Ptr() *ListTeamsInclude { return &v } - -// NullableListTeamsInclude handles when a null is used for ListTeamsInclude. -type NullableListTeamsInclude struct { - value *ListTeamsInclude - isSet bool -} - -// Get returns the associated value. -func (v NullableListTeamsInclude) Get() *ListTeamsInclude { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableListTeamsInclude) Set(val *ListTeamsInclude) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableListTeamsInclude) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableListTeamsInclude) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableListTeamsInclude initializes the struct as if Set has been called. -func NewNullableListTeamsInclude(val *ListTeamsInclude) *NullableListTeamsInclude { - return &NullableListTeamsInclude{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableListTeamsInclude) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableListTeamsInclude) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_teams_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_teams_sort.go index 1b5915950..06c1e8c46 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_teams_sort.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_list_teams_sort.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ListTeamsSort Specifies the order of the returned teams @@ -67,47 +68,3 @@ func (v ListTeamsSort) IsValid() bool { func (v ListTeamsSort) Ptr() *ListTeamsSort { return &v } - -// NullableListTeamsSort handles when a null is used for ListTeamsSort. -type NullableListTeamsSort struct { - value *ListTeamsSort - isSet bool -} - -// Get returns the associated value. -func (v NullableListTeamsSort) Get() *ListTeamsSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableListTeamsSort) Set(val *ListTeamsSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableListTeamsSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableListTeamsSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableListTeamsSort initializes the struct as if Set has been called. -func NewNullableListTeamsSort(val *ListTeamsSort) *NullableListTeamsSort { - return &NullableListTeamsSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableListTeamsSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableListTeamsSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_log.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_log.go index 1c4cfa018..62ca1bcca 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_log.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_log.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o Log) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Log) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *LogAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *LogType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *Log) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_log_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_log_attributes.go index eaea0ef60..25f0b8c97 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_log_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_log_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -289,7 +290,6 @@ func (o LogAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes map[string]interface{} `json:"attributes,omitempty"` Host *string `json:"host,omitempty"` @@ -300,12 +300,7 @@ func (o *LogAttributes) UnmarshalJSON(bytes []byte) (err error) { Timestamp *time.Time `json:"timestamp,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -320,6 +315,7 @@ func (o *LogAttributes) UnmarshalJSON(bytes []byte) (err error) { o.Status = all.Status o.Tags = all.Tags o.Timestamp = all.Timestamp + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_log_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_log_type.go index d4db0d7e6..582bd9a5a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_log_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_log_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogType Type of the event. @@ -61,47 +62,3 @@ func (v LogType) IsValid() bool { func (v LogType) Ptr() *LogType { return &v } - -// NullableLogType handles when a null is used for LogType. -type NullableLogType struct { - value *LogType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogType) Get() *LogType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogType) Set(val *LogType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogType initializes the struct as if Set has been called. -func NewNullableLogType(val *LogType) *NullableLogType { - return &NullableLogType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_bucket.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_bucket.go index 867af1538..8ac6c0b2d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_bucket.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_bucket.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o LogsAggregateBucket) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsAggregateBucket) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { By map[string]interface{} `json:"by,omitempty"` Computes map[string]LogsAggregateBucketValue `json:"computes,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *LogsAggregateBucket) UnmarshalJSON(bytes []byte) (err error) { } o.By = all.By o.Computes = all.Computes + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_bucket_value.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_bucket_value.go index 098e26e5a..250525e9e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_bucket_value.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_bucket_value.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // LogsAggregateBucketValue - A bucket value, can be either a timeseries or a single value @@ -135,53 +135,3 @@ func (obj *LogsAggregateBucketValue) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableLogsAggregateBucketValue handles when a null is used for LogsAggregateBucketValue. -type NullableLogsAggregateBucketValue struct { - value *LogsAggregateBucketValue - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsAggregateBucketValue) Get() *LogsAggregateBucketValue { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsAggregateBucketValue) Set(val *LogsAggregateBucketValue) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsAggregateBucketValue) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableLogsAggregateBucketValue) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsAggregateBucketValue initializes the struct as if Set has been called. -func NewNullableLogsAggregateBucketValue(val *LogsAggregateBucketValue) *NullableLogsAggregateBucketValue { - return &NullableLogsAggregateBucketValue{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsAggregateBucketValue) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsAggregateBucketValue) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_bucket_value_timeseries.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_bucket_value_timeseries.go index 988263b7f..1bd2e7681 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_bucket_value_timeseries.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_bucket_value_timeseries.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // LogsAggregateBucketValueTimeseries A timeseries array @@ -47,5 +47,17 @@ func (o LogsAggregateBucketValueTimeseries) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsAggregateBucketValueTimeseries) UnmarshalJSON(bytes []byte) (err error) { - return json.Unmarshal(bytes, &o.Items) + if err = json.Unmarshal(bytes, &o.Items); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + if o.Items != nil && len(o.Items) > 0 { + for _, v := range o.Items { + if v.UnparsedObject != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + } + } + + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_bucket_value_timeseries_point.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_bucket_value_timeseries_point.go index 0e647be9e..1f94269c3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_bucket_value_timeseries_point.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_bucket_value_timeseries_point.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o LogsAggregateBucketValueTimeseriesPoint) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsAggregateBucketValueTimeseriesPoint) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Time *string `json:"time,omitempty"` Value *float64 `json:"value,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *LogsAggregateBucketValueTimeseriesPoint) UnmarshalJSON(bytes []byte) (e } o.Time = all.Time o.Value = all.Value + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_request.go index a3754287d..db5725544 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_request.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -19,7 +19,7 @@ type LogsAggregateRequest struct { // The rules for the group by GroupBy []LogsGroupBy `json:"group_by,omitempty"` // Global query options that are used during the query. - // Note: You should only supply timezone or time offset but not both otherwise the query will fail. + // Note: you should supply either timezone or time offset, but not both. Otherwise, the query will fail. Options *LogsQueryOptions `json:"options,omitempty"` // Paging settings Page *LogsAggregateRequestPage `json:"page,omitempty"` @@ -215,7 +215,6 @@ func (o LogsAggregateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsAggregateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Compute []LogsCompute `json:"compute,omitempty"` Filter *LogsQueryFilter `json:"filter,omitempty"` @@ -224,12 +223,7 @@ func (o *LogsAggregateRequest) UnmarshalJSON(bytes []byte) (err error) { Page *LogsAggregateRequestPage `json:"page,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -237,35 +231,30 @@ func (o *LogsAggregateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Compute = all.Compute if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Filter = all.Filter o.GroupBy = all.GroupBy if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Options = all.Options if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Page = all.Page + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_request_page.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_request_page.go index 09cc45cbf..7787482ae 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_request_page.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_request_page.go @@ -5,14 +5,14 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // LogsAggregateRequestPage Paging settings type LogsAggregateRequestPage struct { - // The returned paging point to use to get the next results + // The returned paging point to use to get the next results. Note: at most 1000 results can be paged. Cursor *string `json:"cursor,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` @@ -82,17 +82,11 @@ func (o LogsAggregateRequestPage) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsAggregateRequestPage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Cursor *string `json:"cursor,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *LogsAggregateRequestPage) UnmarshalJSON(bytes []byte) (err error) { return err } o.Cursor = all.Cursor + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_response.go index 6951da703..efd1d0170 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o LogsAggregateResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsAggregateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *LogsAggregateResponseData `json:"data,omitempty"` Meta *LogsResponseMetadata `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,25 +128,24 @@ func (o *LogsAggregateResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_response_data.go index 44bce2bd9..acb2dcd0c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_response_data.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o LogsAggregateResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsAggregateResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Buckets []LogsAggregateBucket `json:"buckets,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *LogsAggregateResponseData) UnmarshalJSON(bytes []byte) (err error) { return err } o.Buckets = all.Buckets + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_response_status.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_response_status.go index 98ff9a41f..a9f99c613 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_response_status.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_response_status.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsAggregateResponseStatus The status of the response @@ -63,47 +64,3 @@ func (v LogsAggregateResponseStatus) IsValid() bool { func (v LogsAggregateResponseStatus) Ptr() *LogsAggregateResponseStatus { return &v } - -// NullableLogsAggregateResponseStatus handles when a null is used for LogsAggregateResponseStatus. -type NullableLogsAggregateResponseStatus struct { - value *LogsAggregateResponseStatus - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsAggregateResponseStatus) Get() *LogsAggregateResponseStatus { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsAggregateResponseStatus) Set(val *LogsAggregateResponseStatus) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsAggregateResponseStatus) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsAggregateResponseStatus) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsAggregateResponseStatus initializes the struct as if Set has been called. -func NewNullableLogsAggregateResponseStatus(val *LogsAggregateResponseStatus) *NullableLogsAggregateResponseStatus { - return &NullableLogsAggregateResponseStatus{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsAggregateResponseStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsAggregateResponseStatus) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_sort.go index 70f9d5986..86600b981 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_sort.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_sort.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -185,7 +185,6 @@ func (o LogsAggregateSort) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsAggregateSort) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregation *LogsAggregationFunction `json:"aggregation,omitempty"` Metric *string `json:"metric,omitempty"` @@ -193,12 +192,7 @@ func (o *LogsAggregateSort) UnmarshalJSON(bytes []byte) (err error) { Type *LogsAggregateSortType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,37 +200,32 @@ func (o *LogsAggregateSort) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Aggregation; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Order; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregation = all.Aggregation + + hasInvalidField := false + if all.Aggregation != nil && !all.Aggregation.IsValid() { + hasInvalidField = true + } else { + o.Aggregation = all.Aggregation + } o.Metric = all.Metric - o.Order = all.Order - o.Type = all.Type + if all.Order != nil && !all.Order.IsValid() { + hasInvalidField = true + } else { + o.Order = all.Order + } + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_sort_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_sort_type.go index 7ce51197c..4ae1dad8d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_sort_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregate_sort_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsAggregateSortType The type of sorting algorithm @@ -63,47 +64,3 @@ func (v LogsAggregateSortType) IsValid() bool { func (v LogsAggregateSortType) Ptr() *LogsAggregateSortType { return &v } - -// NullableLogsAggregateSortType handles when a null is used for LogsAggregateSortType. -type NullableLogsAggregateSortType struct { - value *LogsAggregateSortType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsAggregateSortType) Get() *LogsAggregateSortType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsAggregateSortType) Set(val *LogsAggregateSortType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsAggregateSortType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsAggregateSortType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsAggregateSortType initializes the struct as if Set has been called. -func NewNullableLogsAggregateSortType(val *LogsAggregateSortType) *NullableLogsAggregateSortType { - return &NullableLogsAggregateSortType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsAggregateSortType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsAggregateSortType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregation_function.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregation_function.go index 80bd5aed7..aae0f48b8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregation_function.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_aggregation_function.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsAggregationFunction An aggregation function @@ -83,47 +84,3 @@ func (v LogsAggregationFunction) IsValid() bool { func (v LogsAggregationFunction) Ptr() *LogsAggregationFunction { return &v } - -// NullableLogsAggregationFunction handles when a null is used for LogsAggregationFunction. -type NullableLogsAggregationFunction struct { - value *LogsAggregationFunction - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsAggregationFunction) Get() *LogsAggregationFunction { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsAggregationFunction) Set(val *LogsAggregationFunction) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsAggregationFunction) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsAggregationFunction) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsAggregationFunction initializes the struct as if Set has been called. -func NewNullableLogsAggregationFunction(val *LogsAggregationFunction) *NullableLogsAggregationFunction { - return &NullableLogsAggregationFunction{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsAggregationFunction) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsAggregationFunction) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive.go index 5359a68a3..373c01d89 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o LogsArchive) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchive) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *LogsArchiveDefinition `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *LogsArchive) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_attributes.go index 2888f0429..4969c0516 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -281,7 +282,6 @@ func (o LogsArchiveAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchiveAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Destination NullableLogsArchiveDestination `json:"destination"` IncludeTags *bool `json:"include_tags,omitempty"` @@ -292,12 +292,7 @@ func (o *LogsArchiveAttributes) UnmarshalJSON(bytes []byte) (err error) { State *LogsArchiveState `json:"state,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if !all.Destination.IsSet() { return fmt.Errorf("required field destination missing") @@ -314,24 +309,27 @@ func (o *LogsArchiveAttributes) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.State; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Destination = all.Destination o.IncludeTags = all.IncludeTags o.Name = *all.Name o.Query = *all.Query o.RehydrationMaxScanSizeInGb = all.RehydrationMaxScanSizeInGb o.RehydrationTags = all.RehydrationTags - o.State = all.State + if all.State != nil && !all.State.IsValid() { + hasInvalidField = true + } else { + o.State = all.State + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_create_request.go index 8f4eed7c8..2c9b90719 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_create_request.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o LogsArchiveCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchiveCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *LogsArchiveCreateRequestDefinition `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *LogsArchiveCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_create_request_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_create_request_attributes.go index df332cfd2..2aecf2c29 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_create_request_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_create_request_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -246,7 +247,6 @@ func (o LogsArchiveCreateRequestAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchiveCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Destination *LogsArchiveCreateRequestDestination `json:"destination"` IncludeTags *bool `json:"include_tags,omitempty"` @@ -256,12 +256,7 @@ func (o *LogsArchiveCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err er RehydrationTags []string `json:"rehydration_tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Destination == nil { return fmt.Errorf("required field destination missing") @@ -284,6 +279,7 @@ func (o *LogsArchiveCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err er o.Query = *all.Query o.RehydrationMaxScanSizeInGb = all.RehydrationMaxScanSizeInGb o.RehydrationTags = all.RehydrationTags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_create_request_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_create_request_definition.go index 505287210..ff91753eb 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_create_request_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_create_request_definition.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -112,18 +113,12 @@ func (o LogsArchiveCreateRequestDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchiveCreateRequestDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *LogsArchiveCreateRequestAttributes `json:"attributes,omitempty"` Type *string `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -134,18 +129,21 @@ func (o *LogsArchiveCreateRequestDefinition) UnmarshalJSON(bytes []byte) (err er } else { return err } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Type = *all.Type + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_create_request_destination.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_create_request_destination.go index 22a6825a7..336cd4805 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_create_request_destination.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_create_request_destination.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // LogsArchiveCreateRequestDestination - An archive's destination. @@ -135,53 +135,3 @@ func (obj *LogsArchiveCreateRequestDestination) GetActualInstance() interface{} // all schemas are nil return nil } - -// NullableLogsArchiveCreateRequestDestination handles when a null is used for LogsArchiveCreateRequestDestination. -type NullableLogsArchiveCreateRequestDestination struct { - value *LogsArchiveCreateRequestDestination - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsArchiveCreateRequestDestination) Get() *LogsArchiveCreateRequestDestination { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsArchiveCreateRequestDestination) Set(val *LogsArchiveCreateRequestDestination) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsArchiveCreateRequestDestination) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableLogsArchiveCreateRequestDestination) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsArchiveCreateRequestDestination initializes the struct as if Set has been called. -func NewNullableLogsArchiveCreateRequestDestination(val *LogsArchiveCreateRequestDestination) *NullableLogsArchiveCreateRequestDestination { - return &NullableLogsArchiveCreateRequestDestination{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsArchiveCreateRequestDestination) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsArchiveCreateRequestDestination) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_definition.go index 31c8cd214..cca9c341d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_definition.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -143,19 +144,13 @@ func (o LogsArchiveDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchiveDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *LogsArchiveAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *string `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -166,19 +161,22 @@ func (o *LogsArchiveDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id o.Type = *all.Type + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination.go index eb7ea266b..5f4e31ca8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // LogsArchiveDestination - An archive's destination. diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination_azure.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination_azure.go index 789131756..3335a1bbd 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination_azure.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination_azure.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -226,7 +227,6 @@ func (o LogsArchiveDestinationAzure) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchiveDestinationAzure) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Container *string `json:"container"` Integration *LogsArchiveIntegrationAzure `json:"integration"` @@ -236,12 +236,7 @@ func (o *LogsArchiveDestinationAzure) UnmarshalJSON(bytes []byte) (err error) { Type *LogsArchiveDestinationAzureType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Container == nil { return fmt.Errorf("required field container missing") @@ -261,30 +256,29 @@ func (o *LogsArchiveDestinationAzure) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Container = *all.Container if all.Integration.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Integration = *all.Integration o.Path = all.Path o.Region = all.Region o.StorageAccount = *all.StorageAccount - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination_azure_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination_azure_type.go index ad452ded0..ec21ba795 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination_azure_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination_azure_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsArchiveDestinationAzureType Type of the Azure archive destination. @@ -61,47 +62,3 @@ func (v LogsArchiveDestinationAzureType) IsValid() bool { func (v LogsArchiveDestinationAzureType) Ptr() *LogsArchiveDestinationAzureType { return &v } - -// NullableLogsArchiveDestinationAzureType handles when a null is used for LogsArchiveDestinationAzureType. -type NullableLogsArchiveDestinationAzureType struct { - value *LogsArchiveDestinationAzureType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsArchiveDestinationAzureType) Get() *LogsArchiveDestinationAzureType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsArchiveDestinationAzureType) Set(val *LogsArchiveDestinationAzureType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsArchiveDestinationAzureType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsArchiveDestinationAzureType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsArchiveDestinationAzureType initializes the struct as if Set has been called. -func NewNullableLogsArchiveDestinationAzureType(val *LogsArchiveDestinationAzureType) *NullableLogsArchiveDestinationAzureType { - return &NullableLogsArchiveDestinationAzureType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsArchiveDestinationAzureType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsArchiveDestinationAzureType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination_gcs.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination_gcs.go index 8b0052ba8..c1fdaeb30 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination_gcs.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination_gcs.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -166,7 +167,6 @@ func (o LogsArchiveDestinationGCS) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchiveDestinationGCS) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Bucket *string `json:"bucket"` Integration *LogsArchiveIntegrationGCS `json:"integration"` @@ -174,12 +174,7 @@ func (o *LogsArchiveDestinationGCS) UnmarshalJSON(bytes []byte) (err error) { Type *LogsArchiveDestinationGCSType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Bucket == nil { return fmt.Errorf("required field bucket missing") @@ -196,28 +191,27 @@ func (o *LogsArchiveDestinationGCS) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Bucket = *all.Bucket if all.Integration.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Integration = *all.Integration o.Path = all.Path - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination_gcs_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination_gcs_type.go index c591f9b66..a36210f41 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination_gcs_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination_gcs_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsArchiveDestinationGCSType Type of the GCS archive destination. @@ -61,47 +62,3 @@ func (v LogsArchiveDestinationGCSType) IsValid() bool { func (v LogsArchiveDestinationGCSType) Ptr() *LogsArchiveDestinationGCSType { return &v } - -// NullableLogsArchiveDestinationGCSType handles when a null is used for LogsArchiveDestinationGCSType. -type NullableLogsArchiveDestinationGCSType struct { - value *LogsArchiveDestinationGCSType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsArchiveDestinationGCSType) Get() *LogsArchiveDestinationGCSType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsArchiveDestinationGCSType) Set(val *LogsArchiveDestinationGCSType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsArchiveDestinationGCSType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsArchiveDestinationGCSType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsArchiveDestinationGCSType initializes the struct as if Set has been called. -func NewNullableLogsArchiveDestinationGCSType(val *LogsArchiveDestinationGCSType) *NullableLogsArchiveDestinationGCSType { - return &NullableLogsArchiveDestinationGCSType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsArchiveDestinationGCSType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsArchiveDestinationGCSType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination_s3.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination_s3.go index 039c2660e..eef6df233 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination_s3.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination_s3.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -166,7 +167,6 @@ func (o LogsArchiveDestinationS3) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchiveDestinationS3) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Bucket *string `json:"bucket"` Integration *LogsArchiveIntegrationS3 `json:"integration"` @@ -174,12 +174,7 @@ func (o *LogsArchiveDestinationS3) UnmarshalJSON(bytes []byte) (err error) { Type *LogsArchiveDestinationS3Type `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Bucket == nil { return fmt.Errorf("required field bucket missing") @@ -196,28 +191,27 @@ func (o *LogsArchiveDestinationS3) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Bucket = *all.Bucket if all.Integration.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Integration = *all.Integration o.Path = all.Path - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination_s3_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination_s3_type.go index ad97b8a00..3bcb6e2fd 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination_s3_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_destination_s3_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsArchiveDestinationS3Type Type of the S3 archive destination. @@ -61,47 +62,3 @@ func (v LogsArchiveDestinationS3Type) IsValid() bool { func (v LogsArchiveDestinationS3Type) Ptr() *LogsArchiveDestinationS3Type { return &v } - -// NullableLogsArchiveDestinationS3Type handles when a null is used for LogsArchiveDestinationS3Type. -type NullableLogsArchiveDestinationS3Type struct { - value *LogsArchiveDestinationS3Type - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsArchiveDestinationS3Type) Get() *LogsArchiveDestinationS3Type { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsArchiveDestinationS3Type) Set(val *LogsArchiveDestinationS3Type) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsArchiveDestinationS3Type) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsArchiveDestinationS3Type) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsArchiveDestinationS3Type initializes the struct as if Set has been called. -func NewNullableLogsArchiveDestinationS3Type(val *LogsArchiveDestinationS3Type) *NullableLogsArchiveDestinationS3Type { - return &NullableLogsArchiveDestinationS3Type{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsArchiveDestinationS3Type) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsArchiveDestinationS3Type) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_integration_azure.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_integration_azure.go index a09b9cada..d9461faaa 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_integration_azure.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_integration_azure.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o LogsArchiveIntegrationAzure) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchiveIntegrationAzure) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ClientId *string `json:"client_id"` TenantId *string `json:"tenant_id"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.ClientId == nil { return fmt.Errorf("required field client_id missing") @@ -131,6 +126,7 @@ func (o *LogsArchiveIntegrationAzure) UnmarshalJSON(bytes []byte) (err error) { } o.ClientId = *all.ClientId o.TenantId = *all.TenantId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_integration_gcs.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_integration_gcs.go index a6f98893f..89c79ca51 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_integration_gcs.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_integration_gcs.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o LogsArchiveIntegrationGCS) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchiveIntegrationGCS) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ClientEmail *string `json:"client_email"` ProjectId *string `json:"project_id"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.ClientEmail == nil { return fmt.Errorf("required field client_email missing") @@ -131,6 +126,7 @@ func (o *LogsArchiveIntegrationGCS) UnmarshalJSON(bytes []byte) (err error) { } o.ClientEmail = *all.ClientEmail o.ProjectId = *all.ProjectId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_integration_s3.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_integration_s3.go index db8935c12..c852e551a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_integration_s3.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_integration_s3.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o LogsArchiveIntegrationS3) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchiveIntegrationS3) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AccountId *string `json:"account_id"` RoleName *string `json:"role_name"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.AccountId == nil { return fmt.Errorf("required field account_id missing") @@ -131,6 +126,7 @@ func (o *LogsArchiveIntegrationS3) UnmarshalJSON(bytes []byte) (err error) { } o.AccountId = *all.AccountId o.RoleName = *all.RoleName + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_order.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_order.go index 924410480..831e284f1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_order.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_order.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o LogsArchiveOrder) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchiveOrder) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *LogsArchiveOrderDefinition `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *LogsArchiveOrder) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_order_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_order_attributes.go index 82996c48a..672c49de9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_order_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_order_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -78,17 +79,11 @@ func (o LogsArchiveOrderAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchiveOrderAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ArchiveIds *[]string `json:"archive_ids"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.ArchiveIds == nil { return fmt.Errorf("required field archive_ids missing") @@ -100,6 +95,7 @@ func (o *LogsArchiveOrderAttributes) UnmarshalJSON(bytes []byte) (err error) { return err } o.ArchiveIds = *all.ArchiveIds + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_order_definition.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_order_definition.go index 2e36e6d22..845d0db60 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_order_definition.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_order_definition.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o LogsArchiveOrderDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchiveOrderDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *LogsArchiveOrderAttributes `json:"attributes"` Type *LogsArchiveOrderDefinitionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -131,26 +126,25 @@ func (o *LogsArchiveOrderDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_order_definition_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_order_definition_type.go index a936d3502..748b00b8f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_order_definition_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_order_definition_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsArchiveOrderDefinitionType Type of the archive order definition. @@ -61,47 +62,3 @@ func (v LogsArchiveOrderDefinitionType) IsValid() bool { func (v LogsArchiveOrderDefinitionType) Ptr() *LogsArchiveOrderDefinitionType { return &v } - -// NullableLogsArchiveOrderDefinitionType handles when a null is used for LogsArchiveOrderDefinitionType. -type NullableLogsArchiveOrderDefinitionType struct { - value *LogsArchiveOrderDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsArchiveOrderDefinitionType) Get() *LogsArchiveOrderDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsArchiveOrderDefinitionType) Set(val *LogsArchiveOrderDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsArchiveOrderDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsArchiveOrderDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsArchiveOrderDefinitionType initializes the struct as if Set has been called. -func NewNullableLogsArchiveOrderDefinitionType(val *LogsArchiveOrderDefinitionType) *NullableLogsArchiveOrderDefinitionType { - return &NullableLogsArchiveOrderDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsArchiveOrderDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsArchiveOrderDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_state.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_state.go index 2f19b7287..881d33d78 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_state.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archive_state.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsArchiveState The state of the archive. @@ -67,47 +68,3 @@ func (v LogsArchiveState) IsValid() bool { func (v LogsArchiveState) Ptr() *LogsArchiveState { return &v } - -// NullableLogsArchiveState handles when a null is used for LogsArchiveState. -type NullableLogsArchiveState struct { - value *LogsArchiveState - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsArchiveState) Get() *LogsArchiveState { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsArchiveState) Set(val *LogsArchiveState) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsArchiveState) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsArchiveState) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsArchiveState initializes the struct as if Set has been called. -func NewNullableLogsArchiveState(val *LogsArchiveState) *NullableLogsArchiveState { - return &NullableLogsArchiveState{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsArchiveState) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsArchiveState) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archives.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archives.go index 7a548c56b..97fd3894d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archives.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_archives.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o LogsArchives) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchives) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []LogsArchiveDefinition `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *LogsArchives) UnmarshalJSON(bytes []byte) (err error) { return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_compute.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_compute.go index 46d818c62..6648d058f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_compute.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_compute.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -181,7 +182,6 @@ func (o LogsCompute) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsCompute) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregation *LogsAggregationFunction `json:"aggregation"` Interval *string `json:"interval,omitempty"` @@ -189,12 +189,7 @@ func (o *LogsCompute) UnmarshalJSON(bytes []byte) (err error) { Type *LogsComputeType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Aggregation == nil { return fmt.Errorf("required field aggregation missing") @@ -205,29 +200,28 @@ func (o *LogsCompute) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Aggregation; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregation = *all.Aggregation + + hasInvalidField := false + if !all.Aggregation.IsValid() { + hasInvalidField = true + } else { + o.Aggregation = *all.Aggregation + } o.Interval = all.Interval o.Metric = all.Metric - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_compute_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_compute_type.go index ae8008fb8..265e3fe67 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_compute_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_compute_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsComputeType The type of compute @@ -63,47 +64,3 @@ func (v LogsComputeType) IsValid() bool { func (v LogsComputeType) Ptr() *LogsComputeType { return &v } - -// NullableLogsComputeType handles when a null is used for LogsComputeType. -type NullableLogsComputeType struct { - value *LogsComputeType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsComputeType) Get() *LogsComputeType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsComputeType) Set(val *LogsComputeType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsComputeType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsComputeType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsComputeType initializes the struct as if Set has been called. -func NewNullableLogsComputeType(val *LogsComputeType) *NullableLogsComputeType { - return &NullableLogsComputeType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsComputeType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsComputeType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_group_by.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_group_by.go index 3cb083999..446f6bf82 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_group_by.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_group_by.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -16,9 +17,10 @@ type LogsGroupBy struct { // The name of the facet to use (required) Facet string `json:"facet"` // Used to perform a histogram computation (only for measure facets). - // Note: At most 100 buckets are allowed, the number of buckets is (max - min)/interval. + // Note: at most 100 buckets are allowed, the number of buckets is (max - min)/interval. Histogram *LogsGroupByHistogram `json:"histogram,omitempty"` - // The maximum buckets to return for this group by + // The maximum buckets to return for this group by. Note: at most 10000 buckets are allowed. + // If grouping by multiple facets, the product of limits must not exceed 10000. Limit *int64 `json:"limit,omitempty"` // The value to use for logs that don't have the facet used to group by Missing *LogsGroupByMissing `json:"missing,omitempty"` @@ -247,7 +249,6 @@ func (o LogsGroupBy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsGroupBy) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Facet *string `json:"facet"` Histogram *LogsGroupByHistogram `json:"histogram,omitempty"` @@ -257,12 +258,7 @@ func (o *LogsGroupBy) UnmarshalJSON(bytes []byte) (err error) { Total *LogsGroupByTotal `json:"total,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Facet == nil { return fmt.Errorf("required field facet missing") @@ -273,29 +269,28 @@ func (o *LogsGroupBy) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Facet = *all.Facet if all.Histogram != nil && all.Histogram.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Histogram = all.Histogram o.Limit = all.Limit o.Missing = all.Missing if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Sort = all.Sort o.Total = all.Total + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_group_by_histogram.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_group_by_histogram.go index 037b9fc1e..bba55ac3d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_group_by_histogram.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_group_by_histogram.go @@ -5,14 +5,15 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // LogsGroupByHistogram Used to perform a histogram computation (only for measure facets). -// Note: At most 100 buckets are allowed, the number of buckets is (max - min)/interval. +// Note: at most 100 buckets are allowed, the number of buckets is (max - min)/interval. type LogsGroupByHistogram struct { // The bin size of the histogram buckets Interval float64 `json:"interval"` @@ -134,19 +135,13 @@ func (o LogsGroupByHistogram) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsGroupByHistogram) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Interval *float64 `json:"interval"` Max *float64 `json:"max"` Min *float64 `json:"min"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Interval == nil { return fmt.Errorf("required field interval missing") @@ -166,6 +161,7 @@ func (o *LogsGroupByHistogram) UnmarshalJSON(bytes []byte) (err error) { o.Interval = *all.Interval o.Max = *all.Max o.Min = *all.Min + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_group_by_missing.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_group_by_missing.go index 36e68758f..85502ffb1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_group_by_missing.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_group_by_missing.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // LogsGroupByMissing - The value to use for logs that don't have the facet used to group by @@ -103,53 +103,3 @@ func (obj *LogsGroupByMissing) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableLogsGroupByMissing handles when a null is used for LogsGroupByMissing. -type NullableLogsGroupByMissing struct { - value *LogsGroupByMissing - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsGroupByMissing) Get() *LogsGroupByMissing { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsGroupByMissing) Set(val *LogsGroupByMissing) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsGroupByMissing) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableLogsGroupByMissing) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsGroupByMissing initializes the struct as if Set has been called. -func NewNullableLogsGroupByMissing(val *LogsGroupByMissing) *NullableLogsGroupByMissing { - return &NullableLogsGroupByMissing{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsGroupByMissing) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsGroupByMissing) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_group_by_total.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_group_by_total.go index 17c7c2da2..d4bd93fcd 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_group_by_total.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_group_by_total.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // LogsGroupByTotal - A resulting object to put the given computes in over all the matching records. @@ -135,53 +135,3 @@ func (obj *LogsGroupByTotal) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableLogsGroupByTotal handles when a null is used for LogsGroupByTotal. -type NullableLogsGroupByTotal struct { - value *LogsGroupByTotal - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsGroupByTotal) Get() *LogsGroupByTotal { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsGroupByTotal) Set(val *LogsGroupByTotal) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsGroupByTotal) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableLogsGroupByTotal) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsGroupByTotal initializes the struct as if Set has been called. -func NewNullableLogsGroupByTotal(val *LogsGroupByTotal) *NullableLogsGroupByTotal { - return &NullableLogsGroupByTotal{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsGroupByTotal) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsGroupByTotal) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_list_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_list_request.go index 532b93512..565fa0bfe 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_list_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_list_request.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -15,7 +15,7 @@ type LogsListRequest struct { // The search and filter query settings Filter *LogsQueryFilter `json:"filter,omitempty"` // Global query options that are used during the query. - // Note: You should only supply timezone or time offset but not both otherwise the query will fail. + // Note: you should supply either timezone or time offset, but not both. Otherwise, the query will fail. Options *LogsQueryOptions `json:"options,omitempty"` // Paging attributes for listing logs. Page *LogsListRequestPage `json:"page,omitempty"` @@ -182,7 +182,6 @@ func (o LogsListRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsListRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Filter *LogsQueryFilter `json:"filter,omitempty"` Options *LogsQueryOptions `json:"options,omitempty"` @@ -190,12 +189,7 @@ func (o *LogsListRequest) UnmarshalJSON(bytes []byte) (err error) { Sort *LogsSort `json:"sort,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -203,42 +197,33 @@ func (o *LogsListRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Sort; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Filter = all.Filter if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Options = all.Options if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Page = all.Page - o.Sort = all.Sort + if all.Sort != nil && !all.Sort.IsValid() { + hasInvalidField = true + } else { + o.Sort = all.Sort + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_list_request_page.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_list_request_page.go index 8612e1781..61e91c3f3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_list_request_page.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_list_request_page.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -119,18 +119,12 @@ func (o LogsListRequestPage) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsListRequestPage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Cursor *string `json:"cursor,omitempty"` Limit *int32 `json:"limit,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -140,6 +134,7 @@ func (o *LogsListRequestPage) UnmarshalJSON(bytes []byte) (err error) { } o.Cursor = all.Cursor o.Limit = all.Limit + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_list_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_list_response.go index 609da8073..d0282ce1e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_list_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_list_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o LogsListResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []Log `json:"data,omitempty"` Links *LogsListResponseLinks `json:"links,omitempty"` Meta *LogsResponseMetadata `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,26 +162,25 @@ func (o *LogsListResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Data = all.Data if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Links = all.Links if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_list_response_links.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_list_response_links.go index 3792fc8ef..8ab5b3baf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_list_response_links.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_list_response_links.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -83,17 +83,11 @@ func (o LogsListResponseLinks) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsListResponseLinks) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Next *string `json:"next,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -102,6 +96,7 @@ func (o *LogsListResponseLinks) UnmarshalJSON(bytes []byte) (err error) { return err } o.Next = all.Next + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_compute.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_compute.go index 90c37a947..32a3728af 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_compute.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_compute.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -144,19 +145,13 @@ func (o LogsMetricCompute) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsMetricCompute) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AggregationType *LogsMetricComputeAggregationType `json:"aggregation_type"` IncludePercentiles *bool `json:"include_percentiles,omitempty"` Path *string `json:"path,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.AggregationType == nil { return fmt.Errorf("required field aggregation_type missing") @@ -167,20 +162,23 @@ func (o *LogsMetricCompute) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.AggregationType; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if !all.AggregationType.IsValid() { + hasInvalidField = true + } else { + o.AggregationType = *all.AggregationType } - o.AggregationType = *all.AggregationType o.IncludePercentiles = all.IncludePercentiles o.Path = all.Path + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_compute_aggregation_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_compute_aggregation_type.go index ffa3f0dd2..0ba5361d0 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_compute_aggregation_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_compute_aggregation_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsMetricComputeAggregationType The type of aggregation to use. @@ -63,47 +64,3 @@ func (v LogsMetricComputeAggregationType) IsValid() bool { func (v LogsMetricComputeAggregationType) Ptr() *LogsMetricComputeAggregationType { return &v } - -// NullableLogsMetricComputeAggregationType handles when a null is used for LogsMetricComputeAggregationType. -type NullableLogsMetricComputeAggregationType struct { - value *LogsMetricComputeAggregationType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsMetricComputeAggregationType) Get() *LogsMetricComputeAggregationType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsMetricComputeAggregationType) Set(val *LogsMetricComputeAggregationType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsMetricComputeAggregationType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsMetricComputeAggregationType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsMetricComputeAggregationType initializes the struct as if Set has been called. -func NewNullableLogsMetricComputeAggregationType(val *LogsMetricComputeAggregationType) *NullableLogsMetricComputeAggregationType { - return &NullableLogsMetricComputeAggregationType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsMetricComputeAggregationType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsMetricComputeAggregationType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_create_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_create_attributes.go index f1f693617..9d1923e33 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_create_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_create_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -143,19 +144,13 @@ func (o LogsMetricCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsMetricCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Compute *LogsMetricCompute `json:"compute"` Filter *LogsMetricFilter `json:"filter,omitempty"` GroupBy []LogsMetricGroupBy `json:"group_by,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Compute == nil { return fmt.Errorf("required field compute missing") @@ -166,26 +161,25 @@ func (o *LogsMetricCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Compute.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Compute = *all.Compute if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Filter = all.Filter o.GroupBy = all.GroupBy + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_create_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_create_data.go index 44e51fd3c..e976d984a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_create_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_create_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -133,19 +134,13 @@ func (o LogsMetricCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsMetricCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *LogsMetricCreateAttributes `json:"attributes"` Id *string `json:"id"` Type *LogsMetricType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -162,27 +157,26 @@ func (o *LogsMetricCreateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_create_request.go index a806b42cc..de37388b7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o LogsMetricCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsMetricCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *LogsMetricCreateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *LogsMetricCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_filter.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_filter.go index 6f7c23263..04e82d579 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_filter.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_filter.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -86,17 +86,11 @@ func (o LogsMetricFilter) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsMetricFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Query *string `json:"query,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -105,6 +99,7 @@ func (o *LogsMetricFilter) UnmarshalJSON(bytes []byte) (err error) { return err } o.Query = all.Query + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_group_by.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_group_by.go index ad70a1cbe..27d364bf9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_group_by.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_group_by.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o LogsMetricGroupBy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsMetricGroupBy) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Path *string `json:"path"` TagName *string `json:"tag_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 + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Path == nil { return fmt.Errorf("required field path missing") @@ -134,6 +129,7 @@ func (o *LogsMetricGroupBy) UnmarshalJSON(bytes []byte) (err error) { } o.Path = *all.Path o.TagName = all.TagName + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response.go index 8e5303945..b2834085f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o LogsMetricResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsMetricResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *LogsMetricResponseData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *LogsMetricResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response_attributes.go index 7aa95bbd1..10463e519 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o LogsMetricResponseAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsMetricResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Compute *LogsMetricResponseCompute `json:"compute,omitempty"` Filter *LogsMetricResponseFilter `json:"filter,omitempty"` GroupBy []LogsMetricResponseGroupBy `json:"group_by,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,26 +162,25 @@ func (o *LogsMetricResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Compute != nil && all.Compute.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Compute = all.Compute if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Filter = all.Filter o.GroupBy = all.GroupBy + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response_compute.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response_compute.go index 1426c391e..21e58a3cb 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response_compute.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response_compute.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -149,19 +149,13 @@ func (o LogsMetricResponseCompute) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsMetricResponseCompute) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AggregationType *LogsMetricResponseComputeAggregationType `json:"aggregation_type,omitempty"` IncludePercentiles *bool `json:"include_percentiles,omitempty"` Path *string `json:"path,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -169,20 +163,23 @@ func (o *LogsMetricResponseCompute) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.AggregationType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.AggregationType != nil && !all.AggregationType.IsValid() { + hasInvalidField = true + } else { + o.AggregationType = all.AggregationType } - o.AggregationType = all.AggregationType o.IncludePercentiles = all.IncludePercentiles o.Path = all.Path + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response_compute_aggregation_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response_compute_aggregation_type.go index 0d2568f8e..d85f2fcea 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response_compute_aggregation_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response_compute_aggregation_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsMetricResponseComputeAggregationType The type of aggregation to use. @@ -63,47 +64,3 @@ func (v LogsMetricResponseComputeAggregationType) IsValid() bool { func (v LogsMetricResponseComputeAggregationType) Ptr() *LogsMetricResponseComputeAggregationType { return &v } - -// NullableLogsMetricResponseComputeAggregationType handles when a null is used for LogsMetricResponseComputeAggregationType. -type NullableLogsMetricResponseComputeAggregationType struct { - value *LogsMetricResponseComputeAggregationType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsMetricResponseComputeAggregationType) Get() *LogsMetricResponseComputeAggregationType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsMetricResponseComputeAggregationType) Set(val *LogsMetricResponseComputeAggregationType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsMetricResponseComputeAggregationType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsMetricResponseComputeAggregationType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsMetricResponseComputeAggregationType initializes the struct as if Set has been called. -func NewNullableLogsMetricResponseComputeAggregationType(val *LogsMetricResponseComputeAggregationType) *NullableLogsMetricResponseComputeAggregationType { - return &NullableLogsMetricResponseComputeAggregationType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsMetricResponseComputeAggregationType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsMetricResponseComputeAggregationType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response_data.go index 17b3c77ef..857cc2b32 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response_data.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o LogsMetricResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsMetricResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *LogsMetricResponseAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *LogsMetricType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *LogsMetricResponseData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response_filter.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response_filter.go index 038b2a68a..8e3c1e5ae 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response_filter.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response_filter.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o LogsMetricResponseFilter) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsMetricResponseFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Query *string `json:"query,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *LogsMetricResponseFilter) UnmarshalJSON(bytes []byte) (err error) { return err } o.Query = all.Query + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response_group_by.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response_group_by.go index 9c3c43643..9d2148305 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response_group_by.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_response_group_by.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o LogsMetricResponseGroupBy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsMetricResponseGroupBy) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Path *string `json:"path,omitempty"` TagName *string `json:"tag_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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *LogsMetricResponseGroupBy) UnmarshalJSON(bytes []byte) (err error) { } o.Path = all.Path o.TagName = all.TagName + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_type.go index 2ed873b27..2e6483d16 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsMetricType The type of the resource. The value should always be logs_metrics. @@ -61,47 +62,3 @@ func (v LogsMetricType) IsValid() bool { func (v LogsMetricType) Ptr() *LogsMetricType { return &v } - -// NullableLogsMetricType handles when a null is used for LogsMetricType. -type NullableLogsMetricType struct { - value *LogsMetricType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsMetricType) Get() *LogsMetricType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsMetricType) Set(val *LogsMetricType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsMetricType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsMetricType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsMetricType initializes the struct as if Set has been called. -func NewNullableLogsMetricType(val *LogsMetricType) *NullableLogsMetricType { - return &NullableLogsMetricType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsMetricType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsMetricType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_update_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_update_attributes.go index f1f432297..80c6dba81 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_update_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_update_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o LogsMetricUpdateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsMetricUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Compute *LogsMetricUpdateCompute `json:"compute,omitempty"` Filter *LogsMetricFilter `json:"filter,omitempty"` GroupBy []LogsMetricGroupBy `json:"group_by,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,26 +162,25 @@ func (o *LogsMetricUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Compute != nil && all.Compute.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Compute = all.Compute if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Filter = all.Filter o.GroupBy = all.GroupBy + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_update_compute.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_update_compute.go index 633957156..641faa7c9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_update_compute.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_update_compute.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -83,17 +83,11 @@ func (o LogsMetricUpdateCompute) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsMetricUpdateCompute) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IncludePercentiles *bool `json:"include_percentiles,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -102,6 +96,7 @@ func (o *LogsMetricUpdateCompute) UnmarshalJSON(bytes []byte) (err error) { return err } o.IncludePercentiles = all.IncludePercentiles + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_update_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_update_data.go index da5aaacc8..2e08249b8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_update_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_update_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o LogsMetricUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsMetricUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *LogsMetricUpdateAttributes `json:"attributes"` Type *LogsMetricType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -131,26 +126,25 @@ func (o *LogsMetricUpdateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_update_request.go index 4a6c46230..b6b8d49a6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metric_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o LogsMetricUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsMetricUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *LogsMetricUpdateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *LogsMetricUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metrics_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metrics_response.go index 551edd6c0..8c12aeda9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metrics_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_metrics_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o LogsMetricsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsMetricsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []LogsMetricResponseData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *LogsMetricsResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_query_filter.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_query_filter.go index b269be3a1..2123fe19d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_query_filter.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_query_filter.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -230,7 +230,6 @@ func (o LogsQueryFilter) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsQueryFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { From *string `json:"from,omitempty"` Indexes []string `json:"indexes,omitempty"` @@ -239,12 +238,7 @@ func (o *LogsQueryFilter) UnmarshalJSON(bytes []byte) (err error) { To *string `json:"to,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -252,22 +246,25 @@ func (o *LogsQueryFilter) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.StorageTier; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.From = all.From o.Indexes = all.Indexes o.Query = all.Query - o.StorageTier = all.StorageTier + if all.StorageTier != nil && !all.StorageTier.IsValid() { + hasInvalidField = true + } else { + o.StorageTier = all.StorageTier + } o.To = all.To + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_query_options.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_query_options.go index 2f5c6f501..cd6f7634d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_query_options.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_query_options.go @@ -5,13 +5,13 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // LogsQueryOptions Global query options that are used during the query. -// Note: You should only supply timezone or time offset but not both otherwise the query will fail. +// Note: you should supply either timezone or time offset, but not both. Otherwise, the query will fail. type LogsQueryOptions struct { // The time offset (in seconds) to apply to the query. TimeOffset *int64 `json:"timeOffset,omitempty"` @@ -120,18 +120,12 @@ func (o LogsQueryOptions) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsQueryOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { TimeOffset *int64 `json:"timeOffset,omitempty"` Timezone *string `json:"timezone,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -141,6 +135,7 @@ func (o *LogsQueryOptions) UnmarshalJSON(bytes []byte) (err error) { } o.TimeOffset = all.TimeOffset o.Timezone = all.Timezone + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_response_metadata.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_response_metadata.go index e6c8ab660..4975f71e7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_response_metadata.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_response_metadata.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -215,7 +215,6 @@ func (o LogsResponseMetadata) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Elapsed *int64 `json:"elapsed,omitempty"` Page *LogsResponseMetadataPage `json:"page,omitempty"` @@ -224,12 +223,7 @@ func (o *LogsResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { Warnings []LogsWarning `json:"warnings,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -237,29 +231,28 @@ func (o *LogsResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Elapsed = all.Elapsed if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Page = all.Page o.RequestId = all.RequestId - o.Status = all.Status + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } o.Warnings = all.Warnings + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_response_metadata_page.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_response_metadata_page.go index 51bfae5ea..50a7458e0 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_response_metadata_page.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_response_metadata_page.go @@ -5,14 +5,14 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // LogsResponseMetadataPage Paging attributes. type LogsResponseMetadataPage struct { - // The cursor to use to get the next results, if any. To make the next request, use the same. + // The cursor to use to get the next results, if any. To make the next request, use the same // parameters with the addition of the `page[cursor]`. After *string `json:"after,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct @@ -83,17 +83,11 @@ func (o LogsResponseMetadataPage) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsResponseMetadataPage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { After *string `json:"after,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -102,6 +96,7 @@ func (o *LogsResponseMetadataPage) UnmarshalJSON(bytes []byte) (err error) { return err } o.After = all.After + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_sort.go index f54ee2257..bec65f492 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_sort.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_sort.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsSort Sort parameters when querying logs. @@ -63,47 +64,3 @@ func (v LogsSort) IsValid() bool { func (v LogsSort) Ptr() *LogsSort { return &v } - -// NullableLogsSort handles when a null is used for LogsSort. -type NullableLogsSort struct { - value *LogsSort - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsSort) Get() *LogsSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsSort) Set(val *LogsSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsSort initializes the struct as if Set has been called. -func NewNullableLogsSort(val *LogsSort) *NullableLogsSort { - return &NullableLogsSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_sort_order.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_sort_order.go index a9c29e9eb..a3c1a5545 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_sort_order.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_sort_order.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsSortOrder The order to use, ascending or descending @@ -63,47 +64,3 @@ func (v LogsSortOrder) IsValid() bool { func (v LogsSortOrder) Ptr() *LogsSortOrder { return &v } - -// NullableLogsSortOrder handles when a null is used for LogsSortOrder. -type NullableLogsSortOrder struct { - value *LogsSortOrder - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsSortOrder) Get() *LogsSortOrder { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsSortOrder) Set(val *LogsSortOrder) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsSortOrder) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsSortOrder) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsSortOrder initializes the struct as if Set has been called. -func NewNullableLogsSortOrder(val *LogsSortOrder) *NullableLogsSortOrder { - return &NullableLogsSortOrder{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsSortOrder) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsSortOrder) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_storage_tier.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_storage_tier.go index 88e16178f..05e597d9e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_storage_tier.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_storage_tier.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // LogsStorageTier Specifies storage type as indexes or online-archives @@ -63,47 +64,3 @@ func (v LogsStorageTier) IsValid() bool { func (v LogsStorageTier) Ptr() *LogsStorageTier { return &v } - -// NullableLogsStorageTier handles when a null is used for LogsStorageTier. -type NullableLogsStorageTier struct { - value *LogsStorageTier - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsStorageTier) Get() *LogsStorageTier { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsStorageTier) Set(val *LogsStorageTier) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsStorageTier) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsStorageTier) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsStorageTier initializes the struct as if Set has been called. -func NewNullableLogsStorageTier(val *LogsStorageTier) *NullableLogsStorageTier { - return &NullableLogsStorageTier{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsStorageTier) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsStorageTier) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_warning.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_warning.go index 0fde40f6b..9edfecc33 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_warning.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_logs_warning.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o LogsWarning) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsWarning) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Code *string `json:"code,omitempty"` Detail *string `json:"detail,omitempty"` Title *string `json:"title,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *LogsWarning) UnmarshalJSON(bytes []byte) (err error) { o.Code = all.Code o.Detail = all.Detail o.Title = all.Title + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric.go index 1a86db482..8dc2c3133 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -119,18 +119,12 @@ func (o Metric) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Metric) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id,omitempty"` Type *MetricType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -138,19 +132,22 @@ func (o *Metric) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_active_configuration_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_active_configuration_type.go index 960ec2469..778333b45 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_active_configuration_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_active_configuration_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MetricActiveConfigurationType The metric actively queried configuration resource type. @@ -61,47 +62,3 @@ func (v MetricActiveConfigurationType) IsValid() bool { func (v MetricActiveConfigurationType) Ptr() *MetricActiveConfigurationType { return &v } - -// NullableMetricActiveConfigurationType handles when a null is used for MetricActiveConfigurationType. -type NullableMetricActiveConfigurationType struct { - value *MetricActiveConfigurationType - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricActiveConfigurationType) Get() *MetricActiveConfigurationType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricActiveConfigurationType) Set(val *MetricActiveConfigurationType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricActiveConfigurationType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricActiveConfigurationType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricActiveConfigurationType initializes the struct as if Set has been called. -func NewNullableMetricActiveConfigurationType(val *MetricActiveConfigurationType) *NullableMetricActiveConfigurationType { - return &NullableMetricActiveConfigurationType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricActiveConfigurationType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricActiveConfigurationType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_all_tags.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_all_tags.go index 6942118b4..2af829fd9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_all_tags.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_all_tags.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o MetricAllTags) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricAllTags) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *MetricAllTagsAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *MetricType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *MetricAllTags) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_all_tags_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_all_tags_attributes.go index 7a2430d00..b0d276fab 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_all_tags_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_all_tags_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o MetricAllTagsAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricAllTagsAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Tags []string `json:"tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *MetricAllTagsAttributes) UnmarshalJSON(bytes []byte) (err error) { return err } o.Tags = all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_all_tags_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_all_tags_response.go index 7ea22a002..24fa729ea 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_all_tags_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_all_tags_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o MetricAllTagsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricAllTagsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *MetricAllTags `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *MetricAllTagsResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_configure_tags_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_configure_tags_type.go index 26e12370d..b066ac2e8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_configure_tags_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_configure_tags_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MetricBulkConfigureTagsType The metric bulk configure tags resource. @@ -61,47 +62,3 @@ func (v MetricBulkConfigureTagsType) IsValid() bool { func (v MetricBulkConfigureTagsType) Ptr() *MetricBulkConfigureTagsType { return &v } - -// NullableMetricBulkConfigureTagsType handles when a null is used for MetricBulkConfigureTagsType. -type NullableMetricBulkConfigureTagsType struct { - value *MetricBulkConfigureTagsType - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricBulkConfigureTagsType) Get() *MetricBulkConfigureTagsType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricBulkConfigureTagsType) Set(val *MetricBulkConfigureTagsType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricBulkConfigureTagsType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricBulkConfigureTagsType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricBulkConfigureTagsType initializes the struct as if Set has been called. -func NewNullableMetricBulkConfigureTagsType(val *MetricBulkConfigureTagsType) *NullableMetricBulkConfigureTagsType { - return &NullableMetricBulkConfigureTagsType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricBulkConfigureTagsType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricBulkConfigureTagsType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_create.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_create.go index 32035e331..cffb15689 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_create.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_create.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -139,19 +140,13 @@ func (o MetricBulkTagConfigCreate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricBulkTagConfigCreate) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *MetricBulkTagConfigCreateAttributes `json:"attributes,omitempty"` Id *string `json:"id"` Type *MetricBulkConfigureTagsType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -165,27 +160,26 @@ func (o *MetricBulkTagConfigCreate) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_create_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_create_attributes.go index 82a5650e8..d55caec95 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_create_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_create_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o MetricBulkTagConfigCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricBulkTagConfigCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Emails []string `json:"emails,omitempty"` Tags []string `json:"tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *MetricBulkTagConfigCreateAttributes) UnmarshalJSON(bytes []byte) (err e } o.Emails = all.Emails o.Tags = all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_create_request.go index ab3e1179f..5a296b6d9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o MetricBulkTagConfigCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricBulkTagConfigCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *MetricBulkTagConfigCreate `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *MetricBulkTagConfigCreateRequest) UnmarshalJSON(bytes []byte) (err erro } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_delete.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_delete.go index 38bcc7f7c..7291eaa51 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_delete.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_delete.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -139,19 +140,13 @@ func (o MetricBulkTagConfigDelete) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricBulkTagConfigDelete) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *MetricBulkTagConfigDeleteAttributes `json:"attributes,omitempty"` Id *string `json:"id"` Type *MetricBulkConfigureTagsType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -165,27 +160,26 @@ func (o *MetricBulkTagConfigDelete) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_delete_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_delete_attributes.go index fd73ee4c3..b9a574e6c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_delete_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_delete_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o MetricBulkTagConfigDeleteAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricBulkTagConfigDeleteAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Emails []string `json:"emails,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *MetricBulkTagConfigDeleteAttributes) UnmarshalJSON(bytes []byte) (err e return err } o.Emails = all.Emails + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_delete_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_delete_request.go index 8a58671be..2d0fb8bce 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_delete_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_delete_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o MetricBulkTagConfigDeleteRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricBulkTagConfigDeleteRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *MetricBulkTagConfigDelete `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *MetricBulkTagConfigDeleteRequest) UnmarshalJSON(bytes []byte) (err erro } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_response.go index f459bb8e0..bdce11d0f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -83,17 +83,11 @@ func (o MetricBulkTagConfigResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricBulkTagConfigResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *MetricBulkTagConfigStatus `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,17 +95,20 @@ func (o *MetricBulkTagConfigResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_status.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_status.go index 2f3ccb2bc..5b47aef6c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_status.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_status.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -140,19 +141,13 @@ func (o MetricBulkTagConfigStatus) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricBulkTagConfigStatus) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *MetricBulkTagConfigStatusAttributes `json:"attributes,omitempty"` Id *string `json:"id"` Type *MetricBulkConfigureTagsType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -166,27 +161,26 @@ func (o *MetricBulkTagConfigStatus) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_status_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_status_attributes.go index 3f30c7698..bce60c838 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_status_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_bulk_tag_config_status_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o MetricBulkTagConfigStatusAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricBulkTagConfigStatusAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Emails []string `json:"emails,omitempty"` Status *string `json:"status,omitempty"` Tags []string `json:"tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *MetricBulkTagConfigStatusAttributes) UnmarshalJSON(bytes []byte) (err e o.Emails = all.Emails o.Status = all.Status o.Tags = all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_content_encoding.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_content_encoding.go index 985dbd8f9..ab658a474 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_content_encoding.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_content_encoding.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MetricContentEncoding HTTP header used to compress the media-type. @@ -65,47 +66,3 @@ func (v MetricContentEncoding) IsValid() bool { func (v MetricContentEncoding) Ptr() *MetricContentEncoding { return &v } - -// NullableMetricContentEncoding handles when a null is used for MetricContentEncoding. -type NullableMetricContentEncoding struct { - value *MetricContentEncoding - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricContentEncoding) Get() *MetricContentEncoding { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricContentEncoding) Set(val *MetricContentEncoding) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricContentEncoding) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricContentEncoding) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricContentEncoding initializes the struct as if Set has been called. -func NewNullableMetricContentEncoding(val *MetricContentEncoding) *NullableMetricContentEncoding { - return &NullableMetricContentEncoding{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricContentEncoding) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricContentEncoding) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_custom_aggregation.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_custom_aggregation.go index bd0c84eee..968433bf9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_custom_aggregation.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_custom_aggregation.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o MetricCustomAggregation) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricCustomAggregation) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Space *MetricCustomSpaceAggregation `json:"space"` Time *MetricCustomTimeAggregation `json:"time"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Space == nil { return fmt.Errorf("required field space missing") @@ -129,27 +124,26 @@ func (o *MetricCustomAggregation) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Space; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if !all.Space.IsValid() { + hasInvalidField = true + } else { + o.Space = *all.Space } - if v := all.Time; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + if !all.Time.IsValid() { + hasInvalidField = true + } else { + o.Time = *all.Time } - o.Space = *all.Space - o.Time = *all.Time + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_custom_space_aggregation.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_custom_space_aggregation.go index 4030a757f..1e728fb19 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_custom_space_aggregation.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_custom_space_aggregation.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MetricCustomSpaceAggregation A space aggregation for use in query. @@ -67,47 +68,3 @@ func (v MetricCustomSpaceAggregation) IsValid() bool { func (v MetricCustomSpaceAggregation) Ptr() *MetricCustomSpaceAggregation { return &v } - -// NullableMetricCustomSpaceAggregation handles when a null is used for MetricCustomSpaceAggregation. -type NullableMetricCustomSpaceAggregation struct { - value *MetricCustomSpaceAggregation - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricCustomSpaceAggregation) Get() *MetricCustomSpaceAggregation { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricCustomSpaceAggregation) Set(val *MetricCustomSpaceAggregation) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricCustomSpaceAggregation) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricCustomSpaceAggregation) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricCustomSpaceAggregation initializes the struct as if Set has been called. -func NewNullableMetricCustomSpaceAggregation(val *MetricCustomSpaceAggregation) *NullableMetricCustomSpaceAggregation { - return &NullableMetricCustomSpaceAggregation{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricCustomSpaceAggregation) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricCustomSpaceAggregation) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_custom_time_aggregation.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_custom_time_aggregation.go index 1113ea925..61d64d911 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_custom_time_aggregation.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_custom_time_aggregation.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MetricCustomTimeAggregation A time aggregation for use in query. @@ -69,47 +70,3 @@ func (v MetricCustomTimeAggregation) IsValid() bool { func (v MetricCustomTimeAggregation) Ptr() *MetricCustomTimeAggregation { return &v } - -// NullableMetricCustomTimeAggregation handles when a null is used for MetricCustomTimeAggregation. -type NullableMetricCustomTimeAggregation struct { - value *MetricCustomTimeAggregation - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricCustomTimeAggregation) Get() *MetricCustomTimeAggregation { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricCustomTimeAggregation) Set(val *MetricCustomTimeAggregation) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricCustomTimeAggregation) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricCustomTimeAggregation) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricCustomTimeAggregation initializes the struct as if Set has been called. -func NewNullableMetricCustomTimeAggregation(val *MetricCustomTimeAggregation) *NullableMetricCustomTimeAggregation { - return &NullableMetricCustomTimeAggregation{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricCustomTimeAggregation) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricCustomTimeAggregation) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_distinct_volume.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_distinct_volume.go index d86af93ba..384efb4fa 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_distinct_volume.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_distinct_volume.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o MetricDistinctVolume) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricDistinctVolume) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *MetricDistinctVolumeAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *MetricDistinctVolumeType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *MetricDistinctVolume) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_distinct_volume_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_distinct_volume_attributes.go index c124573a4..5717f8f74 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_distinct_volume_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_distinct_volume_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o MetricDistinctVolumeAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricDistinctVolumeAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DistinctVolume *int64 `json:"distinct_volume,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *MetricDistinctVolumeAttributes) UnmarshalJSON(bytes []byte) (err error) return err } o.DistinctVolume = all.DistinctVolume + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_distinct_volume_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_distinct_volume_type.go index 390af6303..d13140fc3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_distinct_volume_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_distinct_volume_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MetricDistinctVolumeType The metric distinct volume type. @@ -61,47 +62,3 @@ func (v MetricDistinctVolumeType) IsValid() bool { func (v MetricDistinctVolumeType) Ptr() *MetricDistinctVolumeType { return &v } - -// NullableMetricDistinctVolumeType handles when a null is used for MetricDistinctVolumeType. -type NullableMetricDistinctVolumeType struct { - value *MetricDistinctVolumeType - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricDistinctVolumeType) Get() *MetricDistinctVolumeType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricDistinctVolumeType) Set(val *MetricDistinctVolumeType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricDistinctVolumeType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricDistinctVolumeType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricDistinctVolumeType initializes the struct as if Set has been called. -func NewNullableMetricDistinctVolumeType(val *MetricDistinctVolumeType) *NullableMetricDistinctVolumeType { - return &NullableMetricDistinctVolumeType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricDistinctVolumeType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricDistinctVolumeType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_estimate.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_estimate.go index 739770ed6..1168a91ef 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_estimate.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_estimate.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o MetricEstimate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricEstimate) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *MetricEstimateAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *MetricEstimateResourceType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *MetricEstimate) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_estimate_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_estimate_attributes.go index da11f32f6..f3d862e34 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_estimate_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_estimate_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -157,19 +158,13 @@ func (o MetricEstimateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricEstimateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { EstimateType *MetricEstimateType `json:"estimate_type,omitempty"` EstimatedAt *time.Time `json:"estimated_at,omitempty"` EstimatedOutputSeries *int64 `json:"estimated_output_series,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -177,20 +172,23 @@ func (o *MetricEstimateAttributes) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.EstimateType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.EstimateType != nil && !all.EstimateType.IsValid() { + hasInvalidField = true + } else { + o.EstimateType = all.EstimateType } - o.EstimateType = all.EstimateType o.EstimatedAt = all.EstimatedAt o.EstimatedOutputSeries = all.EstimatedOutputSeries + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_estimate_resource_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_estimate_resource_type.go index 2a6b240cf..e6c0e533b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_estimate_resource_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_estimate_resource_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MetricEstimateResourceType The metric estimate resource type. @@ -61,47 +62,3 @@ func (v MetricEstimateResourceType) IsValid() bool { func (v MetricEstimateResourceType) Ptr() *MetricEstimateResourceType { return &v } - -// NullableMetricEstimateResourceType handles when a null is used for MetricEstimateResourceType. -type NullableMetricEstimateResourceType struct { - value *MetricEstimateResourceType - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricEstimateResourceType) Get() *MetricEstimateResourceType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricEstimateResourceType) Set(val *MetricEstimateResourceType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricEstimateResourceType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricEstimateResourceType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricEstimateResourceType initializes the struct as if Set has been called. -func NewNullableMetricEstimateResourceType(val *MetricEstimateResourceType) *NullableMetricEstimateResourceType { - return &NullableMetricEstimateResourceType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricEstimateResourceType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricEstimateResourceType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_estimate_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_estimate_response.go index 856f8ae83..3cbfbab87 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_estimate_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_estimate_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o MetricEstimateResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricEstimateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *MetricEstimate `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *MetricEstimateResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_estimate_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_estimate_type.go index 1e50092c2..4b52e525b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_estimate_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_estimate_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MetricEstimateType Estimate type based on the queried configuration. By default, `count_or_gauge` is returned. `distribution` is returned for distribution metrics without percentiles enabled. Lastly, `percentile` is returned if `filter[pct]=true` is queried with a distribution metric. @@ -65,47 +66,3 @@ func (v MetricEstimateType) IsValid() bool { func (v MetricEstimateType) Ptr() *MetricEstimateType { return &v } - -// NullableMetricEstimateType handles when a null is used for MetricEstimateType. -type NullableMetricEstimateType struct { - value *MetricEstimateType - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricEstimateType) Get() *MetricEstimateType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricEstimateType) Set(val *MetricEstimateType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricEstimateType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricEstimateType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricEstimateType initializes the struct as if Set has been called. -func NewNullableMetricEstimateType(val *MetricEstimateType) *NullableMetricEstimateType { - return &NullableMetricEstimateType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricEstimateType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricEstimateType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_ingested_indexed_volume.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_ingested_indexed_volume.go index 41ca5525d..5833955a1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_ingested_indexed_volume.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_ingested_indexed_volume.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o MetricIngestedIndexedVolume) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricIngestedIndexedVolume) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *MetricIngestedIndexedVolumeAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *MetricIngestedIndexedVolumeType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *MetricIngestedIndexedVolume) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_ingested_indexed_volume_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_ingested_indexed_volume_attributes.go index c9238e731..7d28de4f1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_ingested_indexed_volume_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_ingested_indexed_volume_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o MetricIngestedIndexedVolumeAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricIngestedIndexedVolumeAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IndexedVolume *int64 `json:"indexed_volume,omitempty"` IngestedVolume *int64 `json:"ingested_volume,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *MetricIngestedIndexedVolumeAttributes) UnmarshalJSON(bytes []byte) (err } o.IndexedVolume = all.IndexedVolume o.IngestedVolume = all.IngestedVolume + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_ingested_indexed_volume_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_ingested_indexed_volume_type.go index 81bec3d7f..3ff06a362 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_ingested_indexed_volume_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_ingested_indexed_volume_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MetricIngestedIndexedVolumeType The metric ingested and indexed volume type. @@ -61,47 +62,3 @@ func (v MetricIngestedIndexedVolumeType) IsValid() bool { func (v MetricIngestedIndexedVolumeType) Ptr() *MetricIngestedIndexedVolumeType { return &v } - -// NullableMetricIngestedIndexedVolumeType handles when a null is used for MetricIngestedIndexedVolumeType. -type NullableMetricIngestedIndexedVolumeType struct { - value *MetricIngestedIndexedVolumeType - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricIngestedIndexedVolumeType) Get() *MetricIngestedIndexedVolumeType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricIngestedIndexedVolumeType) Set(val *MetricIngestedIndexedVolumeType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricIngestedIndexedVolumeType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricIngestedIndexedVolumeType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricIngestedIndexedVolumeType initializes the struct as if Set has been called. -func NewNullableMetricIngestedIndexedVolumeType(val *MetricIngestedIndexedVolumeType) *NullableMetricIngestedIndexedVolumeType { - return &NullableMetricIngestedIndexedVolumeType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricIngestedIndexedVolumeType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricIngestedIndexedVolumeType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_intake_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_intake_type.go index 625e84691..2bfdf93fc 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_intake_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_intake_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MetricIntakeType The type of metric. The available types are `0` (unspecified), `1` (count), `2` (rate), and `3` (gauge). @@ -67,47 +68,3 @@ func (v MetricIntakeType) IsValid() bool { func (v MetricIntakeType) Ptr() *MetricIntakeType { return &v } - -// NullableMetricIntakeType handles when a null is used for MetricIntakeType. -type NullableMetricIntakeType struct { - value *MetricIntakeType - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricIntakeType) Get() *MetricIntakeType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricIntakeType) Set(val *MetricIntakeType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricIntakeType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricIntakeType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricIntakeType initializes the struct as if Set has been called. -func NewNullableMetricIntakeType(val *MetricIntakeType) *NullableMetricIntakeType { - return &NullableMetricIntakeType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricIntakeType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricIntakeType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_metadata.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_metadata.go index a8c5f9de9..3d69a8ff9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_metadata.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_metadata.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o MetricMetadata) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Origin *MetricOrigin `json:"origin,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *MetricMetadata) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Origin != nil && all.Origin.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Origin = all.Origin + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_origin.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_origin.go index 415970f94..91529333c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_origin.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_origin.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -160,19 +160,13 @@ func (o MetricOrigin) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricOrigin) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { MetricType *int32 `json:"metric_type,omitempty"` Product *int32 `json:"product,omitempty"` Service *int32 `json:"service,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -183,6 +177,7 @@ func (o *MetricOrigin) UnmarshalJSON(bytes []byte) (err error) { o.MetricType = all.MetricType o.Product = all.Product o.Service = all.Service + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_payload.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_payload.go index 910e32b68..83154c6fc 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_payload.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_payload.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o MetricPayload) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricPayload) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Series *[]MetricSeries `json:"series"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Series == nil { return fmt.Errorf("required field series missing") @@ -99,6 +94,7 @@ func (o *MetricPayload) UnmarshalJSON(bytes []byte) (err error) { return err } o.Series = *all.Series + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_point.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_point.go index 2fd8d1c63..9531acf73 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_point.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_point.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -116,18 +116,12 @@ func (o MetricPoint) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricPoint) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Timestamp *int64 `json:"timestamp,omitempty"` Value *float64 `json:"value,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -137,6 +131,7 @@ func (o *MetricPoint) UnmarshalJSON(bytes []byte) (err error) { } o.Timestamp = all.Timestamp o.Value = all.Value + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_resource.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_resource.go index 5a0cf32e0..d20e6b408 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_resource.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_resource.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o MetricResource) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricResource) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Name *string `json:"name,omitempty"` Type *string `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *MetricResource) UnmarshalJSON(bytes []byte) (err error) { } o.Name = all.Name o.Type = all.Type + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_series.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_series.go index 16b7a7b56..5619779bf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_series.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_series.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -336,7 +337,6 @@ func (o MetricSeries) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricSeries) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Interval *int64 `json:"interval,omitempty"` Metadata *MetricMetadata `json:"metadata,omitempty"` @@ -349,12 +349,7 @@ func (o *MetricSeries) UnmarshalJSON(bytes []byte) (err error) { Unit *string `json:"unit,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Metric == nil { return fmt.Errorf("required field metric missing") @@ -368,21 +363,11 @@ func (o *MetricSeries) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Interval = all.Interval if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Metadata = all.Metadata o.Metric = *all.Metric @@ -390,11 +375,20 @@ func (o *MetricSeries) UnmarshalJSON(bytes []byte) (err error) { o.Resources = all.Resources o.SourceTypeName = all.SourceTypeName o.Tags = all.Tags - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } o.Unit = all.Unit + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_suggested_tags_and_aggregations.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_suggested_tags_and_aggregations.go index 500042ec3..b025a3cb8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_suggested_tags_and_aggregations.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_suggested_tags_and_aggregations.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o MetricSuggestedTagsAndAggregations) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricSuggestedTagsAndAggregations) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *MetricSuggestedTagsAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *MetricActiveConfigurationType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *MetricSuggestedTagsAndAggregations) UnmarshalJSON(bytes []byte) (err er } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_suggested_tags_and_aggregations_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_suggested_tags_and_aggregations_response.go index ea01cbd15..790439d05 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_suggested_tags_and_aggregations_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_suggested_tags_and_aggregations_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o MetricSuggestedTagsAndAggregationsResponse) MarshalJSON() ([]byte, error // UnmarshalJSON deserializes the given payload. func (o *MetricSuggestedTagsAndAggregationsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *MetricSuggestedTagsAndAggregations `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *MetricSuggestedTagsAndAggregationsResponse) UnmarshalJSON(bytes []byte) } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_suggested_tags_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_suggested_tags_attributes.go index 910004eb6..d95d8a60f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_suggested_tags_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_suggested_tags_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o MetricSuggestedTagsAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricSuggestedTagsAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ActiveAggregations []MetricCustomAggregation `json:"active_aggregations,omitempty"` ActiveTags []string `json:"active_tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *MetricSuggestedTagsAttributes) UnmarshalJSON(bytes []byte) (err error) } o.ActiveAggregations = all.ActiveAggregations o.ActiveTags = all.ActiveTags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration.go index de9dae0fe..e13ec01be 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o MetricTagConfiguration) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricTagConfiguration) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *MetricTagConfigurationAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *MetricTagConfigurationType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *MetricTagConfiguration) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_attributes.go index 6c8f1353d..4747194f2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -276,7 +277,6 @@ func (o MetricTagConfigurationAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricTagConfigurationAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregations []MetricCustomAggregation `json:"aggregations,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` @@ -286,12 +286,7 @@ func (o *MetricTagConfigurationAttributes) UnmarshalJSON(bytes []byte) (err erro Tags []string `json:"tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -299,23 +294,26 @@ func (o *MetricTagConfigurationAttributes) UnmarshalJSON(bytes []byte) (err erro } else { return err } - if v := all.MetricType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Aggregations = all.Aggregations o.CreatedAt = all.CreatedAt o.IncludePercentiles = all.IncludePercentiles - o.MetricType = all.MetricType + if all.MetricType != nil && !all.MetricType.IsValid() { + hasInvalidField = true + } else { + o.MetricType = all.MetricType + } o.ModifiedAt = all.ModifiedAt o.Tags = all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_create_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_create_attributes.go index 08cf47a02..9461e752d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_create_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_create_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -188,7 +189,6 @@ func (o MetricTagConfigurationCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricTagConfigurationCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregations []MetricCustomAggregation `json:"aggregations,omitempty"` IncludePercentiles *bool `json:"include_percentiles,omitempty"` @@ -196,12 +196,7 @@ func (o *MetricTagConfigurationCreateAttributes) UnmarshalJSON(bytes []byte) (er Tags *[]string `json:"tags"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.MetricType == nil { return fmt.Errorf("required field metric_type missing") @@ -215,21 +210,24 @@ func (o *MetricTagConfigurationCreateAttributes) UnmarshalJSON(bytes []byte) (er } else { return err } - if v := all.MetricType; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Aggregations = all.Aggregations o.IncludePercentiles = all.IncludePercentiles - o.MetricType = *all.MetricType + if !all.MetricType.IsValid() { + hasInvalidField = true + } else { + o.MetricType = *all.MetricType + } o.Tags = *all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_create_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_create_data.go index 1b3dc18f5..5580960da 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_create_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_create_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -139,19 +140,13 @@ func (o MetricTagConfigurationCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricTagConfigurationCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *MetricTagConfigurationCreateAttributes `json:"attributes,omitempty"` Id *string `json:"id"` Type *MetricTagConfigurationType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -165,27 +160,26 @@ func (o *MetricTagConfigurationCreateData) UnmarshalJSON(bytes []byte) (err erro } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_create_request.go index ba2d5e193..653b31e57 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o MetricTagConfigurationCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricTagConfigurationCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *MetricTagConfigurationCreateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *MetricTagConfigurationCreateRequest) UnmarshalJSON(bytes []byte) (err e } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_metric_types.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_metric_types.go index 12bab6066..03e6a7508 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_metric_types.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_metric_types.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MetricTagConfigurationMetricTypes The metric's type. @@ -67,47 +68,3 @@ func (v MetricTagConfigurationMetricTypes) IsValid() bool { func (v MetricTagConfigurationMetricTypes) Ptr() *MetricTagConfigurationMetricTypes { return &v } - -// NullableMetricTagConfigurationMetricTypes handles when a null is used for MetricTagConfigurationMetricTypes. -type NullableMetricTagConfigurationMetricTypes struct { - value *MetricTagConfigurationMetricTypes - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricTagConfigurationMetricTypes) Get() *MetricTagConfigurationMetricTypes { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricTagConfigurationMetricTypes) Set(val *MetricTagConfigurationMetricTypes) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricTagConfigurationMetricTypes) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricTagConfigurationMetricTypes) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricTagConfigurationMetricTypes initializes the struct as if Set has been called. -func NewNullableMetricTagConfigurationMetricTypes(val *MetricTagConfigurationMetricTypes) *NullableMetricTagConfigurationMetricTypes { - return &NullableMetricTagConfigurationMetricTypes{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricTagConfigurationMetricTypes) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricTagConfigurationMetricTypes) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_response.go index bca49efdf..ac9ee5167 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o MetricTagConfigurationResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricTagConfigurationResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *MetricTagConfiguration `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *MetricTagConfigurationResponse) UnmarshalJSON(bytes []byte) (err error) } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_type.go index 317c1afc9..0ba3d218f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MetricTagConfigurationType The metric tag configuration resource type. @@ -61,47 +62,3 @@ func (v MetricTagConfigurationType) IsValid() bool { func (v MetricTagConfigurationType) Ptr() *MetricTagConfigurationType { return &v } - -// NullableMetricTagConfigurationType handles when a null is used for MetricTagConfigurationType. -type NullableMetricTagConfigurationType struct { - value *MetricTagConfigurationType - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricTagConfigurationType) Get() *MetricTagConfigurationType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricTagConfigurationType) Set(val *MetricTagConfigurationType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricTagConfigurationType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricTagConfigurationType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricTagConfigurationType initializes the struct as if Set has been called. -func NewNullableMetricTagConfigurationType(val *MetricTagConfigurationType) *NullableMetricTagConfigurationType { - return &NullableMetricTagConfigurationType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricTagConfigurationType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricTagConfigurationType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_update_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_update_attributes.go index 2984f5a36..2b565971e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_update_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_update_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -164,19 +164,13 @@ func (o MetricTagConfigurationUpdateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricTagConfigurationUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregations []MetricCustomAggregation `json:"aggregations,omitempty"` IncludePercentiles *bool `json:"include_percentiles,omitempty"` Tags []string `json:"tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -187,6 +181,7 @@ func (o *MetricTagConfigurationUpdateAttributes) UnmarshalJSON(bytes []byte) (er o.Aggregations = all.Aggregations o.IncludePercentiles = all.IncludePercentiles o.Tags = all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_update_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_update_data.go index 1ecbe509d..34296dbd7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_update_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_update_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -139,19 +140,13 @@ func (o MetricTagConfigurationUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricTagConfigurationUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *MetricTagConfigurationUpdateAttributes `json:"attributes,omitempty"` Id *string `json:"id"` Type *MetricTagConfigurationType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -165,27 +160,26 @@ func (o *MetricTagConfigurationUpdateData) UnmarshalJSON(bytes []byte) (err erro } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_update_request.go index a4f91e403..c5a187b43 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_tag_configuration_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o MetricTagConfigurationUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricTagConfigurationUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *MetricTagConfigurationUpdateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *MetricTagConfigurationUpdateRequest) UnmarshalJSON(bytes []byte) (err e } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_type.go index 90689d555..e2821f9ff 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MetricType The metric resource type. @@ -61,47 +62,3 @@ func (v MetricType) IsValid() bool { func (v MetricType) Ptr() *MetricType { return &v } - -// NullableMetricType handles when a null is used for MetricType. -type NullableMetricType struct { - value *MetricType - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricType) Get() *MetricType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricType) Set(val *MetricType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricType initializes the struct as if Set has been called. -func NewNullableMetricType(val *MetricType) *NullableMetricType { - return &NullableMetricType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_volumes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_volumes.go index a71c40974..66619937e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_volumes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_volumes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // MetricVolumes - Possible response objects for a metric's volume. @@ -103,53 +103,3 @@ func (obj *MetricVolumes) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableMetricVolumes handles when a null is used for MetricVolumes. -type NullableMetricVolumes struct { - value *MetricVolumes - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricVolumes) Get() *MetricVolumes { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricVolumes) Set(val *MetricVolumes) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricVolumes) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableMetricVolumes) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricVolumes initializes the struct as if Set has been called. -func NewNullableMetricVolumes(val *MetricVolumes) *NullableMetricVolumes { - return &NullableMetricVolumes{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricVolumes) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricVolumes) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_volumes_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_volumes_response.go index df860f0e1..ae9d000dd 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_volumes_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metric_volumes_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o MetricVolumesResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricVolumesResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *MetricVolumes `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *MetricVolumesResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metrics_aggregator.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metrics_aggregator.go index 311ff5400..edf1af9dd 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metrics_aggregator.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metrics_aggregator.go @@ -5,11 +5,12 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) -// MetricsAggregator The type of aggregation that can be performed on metrics queries. +// MetricsAggregator The type of aggregation that can be performed on metrics-based queries. type MetricsAggregator string // List of MetricsAggregator. @@ -77,47 +78,3 @@ func (v MetricsAggregator) IsValid() bool { func (v MetricsAggregator) Ptr() *MetricsAggregator { return &v } - -// NullableMetricsAggregator handles when a null is used for MetricsAggregator. -type NullableMetricsAggregator struct { - value *MetricsAggregator - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricsAggregator) Get() *MetricsAggregator { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricsAggregator) Set(val *MetricsAggregator) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricsAggregator) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricsAggregator) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricsAggregator initializes the struct as if Set has been called. -func NewNullableMetricsAggregator(val *MetricsAggregator) *NullableMetricsAggregator { - return &NullableMetricsAggregator{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricsAggregator) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricsAggregator) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metrics_and_metric_tag_configurations.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metrics_and_metric_tag_configurations.go index af5420d47..d59121f72 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metrics_and_metric_tag_configurations.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metrics_and_metric_tag_configurations.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // MetricsAndMetricTagConfigurations - Object for a metrics and metric tag configurations. @@ -103,53 +103,3 @@ func (obj *MetricsAndMetricTagConfigurations) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableMetricsAndMetricTagConfigurations handles when a null is used for MetricsAndMetricTagConfigurations. -type NullableMetricsAndMetricTagConfigurations struct { - value *MetricsAndMetricTagConfigurations - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricsAndMetricTagConfigurations) Get() *MetricsAndMetricTagConfigurations { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricsAndMetricTagConfigurations) Set(val *MetricsAndMetricTagConfigurations) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricsAndMetricTagConfigurations) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableMetricsAndMetricTagConfigurations) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricsAndMetricTagConfigurations initializes the struct as if Set has been called. -func NewNullableMetricsAndMetricTagConfigurations(val *MetricsAndMetricTagConfigurations) *NullableMetricsAndMetricTagConfigurations { - return &NullableMetricsAndMetricTagConfigurations{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricsAndMetricTagConfigurations) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricsAndMetricTagConfigurations) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metrics_and_metric_tag_configurations_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metrics_and_metric_tag_configurations_response.go index d060cd6f0..2e83319e5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metrics_and_metric_tag_configurations_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metrics_and_metric_tag_configurations_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o MetricsAndMetricTagConfigurationsResponse) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *MetricsAndMetricTagConfigurationsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []MetricsAndMetricTagConfigurations `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *MetricsAndMetricTagConfigurationsResponse) UnmarshalJSON(bytes []byte) return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metrics_data_source.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metrics_data_source.go index 6e9aeac87..a71c90592 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metrics_data_source.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metrics_data_source.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MetricsDataSource A data source that is powered by the Metrics platform. @@ -63,47 +64,3 @@ func (v MetricsDataSource) IsValid() bool { func (v MetricsDataSource) Ptr() *MetricsDataSource { return &v } - -// NullableMetricsDataSource handles when a null is used for MetricsDataSource. -type NullableMetricsDataSource struct { - value *MetricsDataSource - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricsDataSource) Get() *MetricsDataSource { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricsDataSource) Set(val *MetricsDataSource) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricsDataSource) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricsDataSource) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricsDataSource initializes the struct as if Set has been called. -func NewNullableMetricsDataSource(val *MetricsDataSource) *NullableMetricsDataSource { - return &NullableMetricsDataSource{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricsDataSource) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricsDataSource) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metrics_scalar_query.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metrics_scalar_query.go index f5a7b75fa..c61ac5bc4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metrics_scalar_query.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metrics_scalar_query.go @@ -5,15 +5,16 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // MetricsScalarQuery An individual scalar metrics query. type MetricsScalarQuery struct { - // The type of aggregation that can be performed on metrics queries. + // The type of aggregation that can be performed on metrics-based queries. Aggregator MetricsAggregator `json:"aggregator"` // A data source that is powered by the Metrics platform. DataSource MetricsDataSource `json:"data_source"` @@ -168,7 +169,6 @@ func (o MetricsScalarQuery) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricsScalarQuery) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregator *MetricsAggregator `json:"aggregator"` DataSource *MetricsDataSource `json:"data_source"` @@ -176,12 +176,7 @@ func (o *MetricsScalarQuery) UnmarshalJSON(bytes []byte) (err error) { Query *string `json:"query"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Aggregator == nil { return fmt.Errorf("required field aggregator missing") @@ -198,29 +193,28 @@ func (o *MetricsScalarQuery) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Aggregator; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.DataSource; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregator = *all.Aggregator - o.DataSource = *all.DataSource + + hasInvalidField := false + if !all.Aggregator.IsValid() { + hasInvalidField = true + } else { + o.Aggregator = *all.Aggregator + } + if !all.DataSource.IsValid() { + hasInvalidField = true + } else { + o.DataSource = *all.DataSource + } o.Name = all.Name o.Query = *all.Query + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metrics_timeseries_query.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metrics_timeseries_query.go index ee6ef899b..da910bff4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metrics_timeseries_query.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_metrics_timeseries_query.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -139,19 +140,13 @@ func (o MetricsTimeseriesQuery) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricsTimeseriesQuery) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DataSource *MetricsDataSource `json:"data_source"` Name *string `json:"name,omitempty"` Query *string `json:"query"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.DataSource == nil { return fmt.Errorf("required field data_source missing") @@ -165,20 +160,23 @@ func (o *MetricsTimeseriesQuery) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.DataSource; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if !all.DataSource.IsValid() { + hasInvalidField = true + } else { + o.DataSource = *all.DataSource } - o.DataSource = *all.DataSource o.Name = all.Name o.Query = *all.Query + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_attribute_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_attribute_create_request.go index 36c118bf9..44301ace2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_attribute_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_attribute_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o MonitorConfigPolicyAttributeCreateRequest) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *MonitorConfigPolicyAttributeCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Policy *MonitorConfigPolicyPolicyCreateRequest `json:"policy"` PolicyType *MonitorConfigPolicyType `json:"policy_type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Policy == nil { return fmt.Errorf("required field policy missing") @@ -131,19 +126,22 @@ func (o *MonitorConfigPolicyAttributeCreateRequest) UnmarshalJSON(bytes []byte) } else { return err } - if v := all.PolicyType; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Policy = *all.Policy - o.PolicyType = *all.PolicyType + if !all.PolicyType.IsValid() { + hasInvalidField = true + } else { + o.PolicyType = *all.PolicyType + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_attribute_edit_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_attribute_edit_request.go index 2600cfdb9..3f880a7fa 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_attribute_edit_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_attribute_edit_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o MonitorConfigPolicyAttributeEditRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorConfigPolicyAttributeEditRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Policy *MonitorConfigPolicyPolicy `json:"policy"` PolicyType *MonitorConfigPolicyType `json:"policy_type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Policy == nil { return fmt.Errorf("required field policy missing") @@ -131,19 +126,22 @@ func (o *MonitorConfigPolicyAttributeEditRequest) UnmarshalJSON(bytes []byte) (e } else { return err } - if v := all.PolicyType; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Policy = *all.Policy - o.PolicyType = *all.PolicyType + if !all.PolicyType.IsValid() { + hasInvalidField = true + } else { + o.PolicyType = *all.PolicyType + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_attribute_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_attribute_response.go index a6cced2a2..de7bc8b9b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_attribute_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_attribute_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -119,18 +119,12 @@ func (o MonitorConfigPolicyAttributeResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorConfigPolicyAttributeResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Policy *MonitorConfigPolicyPolicy `json:"policy,omitempty"` PolicyType *MonitorConfigPolicyType `json:"policy_type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -138,19 +132,22 @@ func (o *MonitorConfigPolicyAttributeResponse) UnmarshalJSON(bytes []byte) (err } else { return err } - if v := all.PolicyType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Policy = all.Policy - o.PolicyType = all.PolicyType + if all.PolicyType != nil && !all.PolicyType.IsValid() { + hasInvalidField = true + } else { + o.PolicyType = all.PolicyType + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_create_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_create_data.go index 0a5cc02c7..0c091138e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_create_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_create_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o MonitorConfigPolicyCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorConfigPolicyCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *MonitorConfigPolicyAttributeCreateRequest `json:"attributes"` Type *MonitorConfigPolicyResourceType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -131,26 +126,25 @@ func (o *MonitorConfigPolicyCreateData) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_create_request.go index 57f2615f5..e7b310caf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o MonitorConfigPolicyCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorConfigPolicyCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *MonitorConfigPolicyCreateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *MonitorConfigPolicyCreateRequest) UnmarshalJSON(bytes []byte) (err erro } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_edit_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_edit_data.go index 62b100d88..7531ecec1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_edit_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_edit_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -133,19 +134,13 @@ func (o MonitorConfigPolicyEditData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorConfigPolicyEditData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *MonitorConfigPolicyAttributeEditRequest `json:"attributes"` Id *string `json:"id"` Type *MonitorConfigPolicyResourceType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -162,27 +157,26 @@ func (o *MonitorConfigPolicyEditData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_edit_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_edit_request.go index de3cca2cf..74877964d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_edit_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_edit_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o MonitorConfigPolicyEditRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorConfigPolicyEditRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *MonitorConfigPolicyEditData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *MonitorConfigPolicyEditRequest) UnmarshalJSON(bytes []byte) (err error) } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_list_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_list_response.go index 7eba96d95..e62ce7ed9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_list_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_list_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o MonitorConfigPolicyListResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorConfigPolicyListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []MonitorConfigPolicyResponseData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *MonitorConfigPolicyListResponse) UnmarshalJSON(bytes []byte) (err error return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_policy.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_policy.go index 500b73911..3c907b7f8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_policy.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_policy.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // MonitorConfigPolicyPolicy - Configuration for the policy. @@ -71,53 +71,3 @@ func (obj *MonitorConfigPolicyPolicy) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableMonitorConfigPolicyPolicy handles when a null is used for MonitorConfigPolicyPolicy. -type NullableMonitorConfigPolicyPolicy struct { - value *MonitorConfigPolicyPolicy - isSet bool -} - -// Get returns the associated value. -func (v NullableMonitorConfigPolicyPolicy) Get() *MonitorConfigPolicyPolicy { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMonitorConfigPolicyPolicy) Set(val *MonitorConfigPolicyPolicy) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMonitorConfigPolicyPolicy) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableMonitorConfigPolicyPolicy) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMonitorConfigPolicyPolicy initializes the struct as if Set has been called. -func NewNullableMonitorConfigPolicyPolicy(val *MonitorConfigPolicyPolicy) *NullableMonitorConfigPolicyPolicy { - return &NullableMonitorConfigPolicyPolicy{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMonitorConfigPolicyPolicy) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMonitorConfigPolicyPolicy) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_policy_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_policy_create_request.go index fbbd4acf4..e2eaac6b9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_policy_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_policy_create_request.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // MonitorConfigPolicyPolicyCreateRequest - Configuration for the policy. @@ -71,53 +71,3 @@ func (obj *MonitorConfigPolicyPolicyCreateRequest) GetActualInstance() interface // all schemas are nil return nil } - -// NullableMonitorConfigPolicyPolicyCreateRequest handles when a null is used for MonitorConfigPolicyPolicyCreateRequest. -type NullableMonitorConfigPolicyPolicyCreateRequest struct { - value *MonitorConfigPolicyPolicyCreateRequest - isSet bool -} - -// Get returns the associated value. -func (v NullableMonitorConfigPolicyPolicyCreateRequest) Get() *MonitorConfigPolicyPolicyCreateRequest { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMonitorConfigPolicyPolicyCreateRequest) Set(val *MonitorConfigPolicyPolicyCreateRequest) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMonitorConfigPolicyPolicyCreateRequest) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableMonitorConfigPolicyPolicyCreateRequest) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMonitorConfigPolicyPolicyCreateRequest initializes the struct as if Set has been called. -func NewNullableMonitorConfigPolicyPolicyCreateRequest(val *MonitorConfigPolicyPolicyCreateRequest) *NullableMonitorConfigPolicyPolicyCreateRequest { - return &NullableMonitorConfigPolicyPolicyCreateRequest{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMonitorConfigPolicyPolicyCreateRequest) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMonitorConfigPolicyPolicyCreateRequest) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_resource_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_resource_type.go index bf50d392f..45da7a52c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_resource_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_resource_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MonitorConfigPolicyResourceType Monitor configuration policy resource type. @@ -61,47 +62,3 @@ func (v MonitorConfigPolicyResourceType) IsValid() bool { func (v MonitorConfigPolicyResourceType) Ptr() *MonitorConfigPolicyResourceType { return &v } - -// NullableMonitorConfigPolicyResourceType handles when a null is used for MonitorConfigPolicyResourceType. -type NullableMonitorConfigPolicyResourceType struct { - value *MonitorConfigPolicyResourceType - isSet bool -} - -// Get returns the associated value. -func (v NullableMonitorConfigPolicyResourceType) Get() *MonitorConfigPolicyResourceType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMonitorConfigPolicyResourceType) Set(val *MonitorConfigPolicyResourceType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMonitorConfigPolicyResourceType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMonitorConfigPolicyResourceType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMonitorConfigPolicyResourceType initializes the struct as if Set has been called. -func NewNullableMonitorConfigPolicyResourceType(val *MonitorConfigPolicyResourceType) *NullableMonitorConfigPolicyResourceType { - return &NullableMonitorConfigPolicyResourceType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMonitorConfigPolicyResourceType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMonitorConfigPolicyResourceType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_response.go index 5324427e1..5bad60b62 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o MonitorConfigPolicyResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorConfigPolicyResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *MonitorConfigPolicyResponseData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *MonitorConfigPolicyResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_response_data.go index 451d80335..d4ad6d75d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_response_data.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o MonitorConfigPolicyResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorConfigPolicyResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *MonitorConfigPolicyAttributeResponse `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *MonitorConfigPolicyResourceType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *MonitorConfigPolicyResponseData) UnmarshalJSON(bytes []byte) (err error } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_tag_policy.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_tag_policy.go index f98b181b4..1054a9a55 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_tag_policy.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_tag_policy.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o MonitorConfigPolicyTagPolicy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorConfigPolicyTagPolicy) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { TagKey *string `json:"tag_key,omitempty"` TagKeyRequired *bool `json:"tag_key_required,omitempty"` ValidTagValues []string `json:"valid_tag_values,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *MonitorConfigPolicyTagPolicy) UnmarshalJSON(bytes []byte) (err error) { o.TagKey = all.TagKey o.TagKeyRequired = all.TagKeyRequired o.ValidTagValues = all.ValidTagValues + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_tag_policy_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_tag_policy_create_request.go index 5320d7cb3..75ab216de 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_tag_policy_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_tag_policy_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -131,19 +132,13 @@ func (o MonitorConfigPolicyTagPolicyCreateRequest) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *MonitorConfigPolicyTagPolicyCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { TagKey *string `json:"tag_key"` TagKeyRequired *bool `json:"tag_key_required"` ValidTagValues *[]string `json:"valid_tag_values"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.TagKey == nil { return fmt.Errorf("required field tag_key missing") @@ -163,6 +158,7 @@ func (o *MonitorConfigPolicyTagPolicyCreateRequest) UnmarshalJSON(bytes []byte) o.TagKey = *all.TagKey o.TagKeyRequired = *all.TagKeyRequired o.ValidTagValues = *all.ValidTagValues + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_type.go index c03a65324..c50a86145 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_config_policy_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MonitorConfigPolicyType The monitor configuration policy type. @@ -61,47 +62,3 @@ func (v MonitorConfigPolicyType) IsValid() bool { func (v MonitorConfigPolicyType) Ptr() *MonitorConfigPolicyType { return &v } - -// NullableMonitorConfigPolicyType handles when a null is used for MonitorConfigPolicyType. -type NullableMonitorConfigPolicyType struct { - value *MonitorConfigPolicyType - isSet bool -} - -// Get returns the associated value. -func (v NullableMonitorConfigPolicyType) Get() *MonitorConfigPolicyType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMonitorConfigPolicyType) Set(val *MonitorConfigPolicyType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMonitorConfigPolicyType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMonitorConfigPolicyType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMonitorConfigPolicyType initializes the struct as if Set has been called. -func NewNullableMonitorConfigPolicyType(val *MonitorConfigPolicyType) *NullableMonitorConfigPolicyType { - return &NullableMonitorConfigPolicyType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMonitorConfigPolicyType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMonitorConfigPolicyType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_downtime_match_resource_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_downtime_match_resource_type.go new file mode 100644 index 000000000..2dadd8b14 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_downtime_match_resource_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/goccy/go-json" +) + +// MonitorDowntimeMatchResourceType Monitor Downtime Match resource type. +type MonitorDowntimeMatchResourceType string + +// List of MonitorDowntimeMatchResourceType. +const ( + MONITORDOWNTIMEMATCHRESOURCETYPE_DOWNTIME_MATCH MonitorDowntimeMatchResourceType = "downtime_match" +) + +var allowedMonitorDowntimeMatchResourceTypeEnumValues = []MonitorDowntimeMatchResourceType{ + MONITORDOWNTIMEMATCHRESOURCETYPE_DOWNTIME_MATCH, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *MonitorDowntimeMatchResourceType) GetAllowedValues() []MonitorDowntimeMatchResourceType { + return allowedMonitorDowntimeMatchResourceTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *MonitorDowntimeMatchResourceType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = MonitorDowntimeMatchResourceType(value) + return nil +} + +// NewMonitorDowntimeMatchResourceTypeFromValue returns a pointer to a valid MonitorDowntimeMatchResourceType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewMonitorDowntimeMatchResourceTypeFromValue(v string) (*MonitorDowntimeMatchResourceType, error) { + ev := MonitorDowntimeMatchResourceType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for MonitorDowntimeMatchResourceType: valid values are %v", v, allowedMonitorDowntimeMatchResourceTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v MonitorDowntimeMatchResourceType) IsValid() bool { + for _, existing := range allowedMonitorDowntimeMatchResourceTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MonitorDowntimeMatchResourceType value. +func (v MonitorDowntimeMatchResourceType) Ptr() *MonitorDowntimeMatchResourceType { + return &v +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_downtime_match_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_downtime_match_response.go new file mode 100644 index 000000000..fd11b3dc4 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_downtime_match_response.go @@ -0,0 +1,148 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// MonitorDowntimeMatchResponse Response for retrieving all downtime matches for a monitor. +type MonitorDowntimeMatchResponse struct { + // An array of downtime matches. + Data []MonitorDowntimeMatchResponseData `json:"data,omitempty"` + // Pagination metadata returned by the API. + Meta *DowntimeMeta `json:"meta,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{} +} + +// NewMonitorDowntimeMatchResponse instantiates a new MonitorDowntimeMatchResponse 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 NewMonitorDowntimeMatchResponse() *MonitorDowntimeMatchResponse { + this := MonitorDowntimeMatchResponse{} + return &this +} + +// NewMonitorDowntimeMatchResponseWithDefaults instantiates a new MonitorDowntimeMatchResponse 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 NewMonitorDowntimeMatchResponseWithDefaults() *MonitorDowntimeMatchResponse { + this := MonitorDowntimeMatchResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *MonitorDowntimeMatchResponse) GetData() []MonitorDowntimeMatchResponseData { + if o == nil || o.Data == nil { + var ret []MonitorDowntimeMatchResponseData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorDowntimeMatchResponse) GetDataOk() (*[]MonitorDowntimeMatchResponseData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *MonitorDowntimeMatchResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given []MonitorDowntimeMatchResponseData and assigns it to the Data field. +func (o *MonitorDowntimeMatchResponse) SetData(v []MonitorDowntimeMatchResponseData) { + o.Data = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *MonitorDowntimeMatchResponse) GetMeta() DowntimeMeta { + if o == nil || o.Meta == nil { + var ret DowntimeMeta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorDowntimeMatchResponse) GetMetaOk() (*DowntimeMeta, bool) { + if o == nil || o.Meta == nil { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *MonitorDowntimeMatchResponse) HasMeta() bool { + return o != nil && o.Meta != nil +} + +// SetMeta gets a reference to the given DowntimeMeta and assigns it to the Meta field. +func (o *MonitorDowntimeMatchResponse) SetMeta(v DowntimeMeta) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorDowntimeMatchResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorDowntimeMatchResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data []MonitorDowntimeMatchResponseData `json:"data,omitempty"` + Meta *DowntimeMeta `json:"meta,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "meta"}) + } else { + return err + } + + hasInvalidField := false + o.Data = all.Data + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Meta = all.Meta + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_downtime_match_response_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_downtime_match_response_attributes.go new file mode 100644 index 000000000..93e3f90d9 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_downtime_match_response_attributes.go @@ -0,0 +1,226 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "time" + + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// MonitorDowntimeMatchResponseAttributes Downtime match details. +type MonitorDowntimeMatchResponseAttributes struct { + // The end of the downtime. + End datadog.NullableTime `json:"end,omitempty"` + // An array of groups associated with the downtime. + Groups []string `json:"groups,omitempty"` + // The scope to which the downtime applies. Must follow the [common search syntax](https://docs.datadoghq.com/logs/explorer/search_syntax/). + Scope *string `json:"scope,omitempty"` + // The start of the downtime. + Start *time.Time `json:"start,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{} +} + +// NewMonitorDowntimeMatchResponseAttributes instantiates a new MonitorDowntimeMatchResponseAttributes 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 NewMonitorDowntimeMatchResponseAttributes() *MonitorDowntimeMatchResponseAttributes { + this := MonitorDowntimeMatchResponseAttributes{} + return &this +} + +// NewMonitorDowntimeMatchResponseAttributesWithDefaults instantiates a new MonitorDowntimeMatchResponseAttributes 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 NewMonitorDowntimeMatchResponseAttributesWithDefaults() *MonitorDowntimeMatchResponseAttributes { + this := MonitorDowntimeMatchResponseAttributes{} + return &this +} + +// GetEnd returns the End field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MonitorDowntimeMatchResponseAttributes) GetEnd() time.Time { + if o == nil || o.End.Get() == nil { + var ret time.Time + return ret + } + return *o.End.Get() +} + +// GetEndOk returns a tuple with the End field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *MonitorDowntimeMatchResponseAttributes) GetEndOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.End.Get(), o.End.IsSet() +} + +// HasEnd returns a boolean if a field has been set. +func (o *MonitorDowntimeMatchResponseAttributes) HasEnd() bool { + return o != nil && o.End.IsSet() +} + +// SetEnd gets a reference to the given datadog.NullableTime and assigns it to the End field. +func (o *MonitorDowntimeMatchResponseAttributes) SetEnd(v time.Time) { + o.End.Set(&v) +} + +// SetEndNil sets the value for End to be an explicit nil. +func (o *MonitorDowntimeMatchResponseAttributes) SetEndNil() { + o.End.Set(nil) +} + +// UnsetEnd ensures that no value is present for End, not even an explicit nil. +func (o *MonitorDowntimeMatchResponseAttributes) UnsetEnd() { + o.End.Unset() +} + +// GetGroups returns the Groups field value if set, zero value otherwise. +func (o *MonitorDowntimeMatchResponseAttributes) GetGroups() []string { + if o == nil || o.Groups == nil { + var ret []string + return ret + } + return o.Groups +} + +// GetGroupsOk returns a tuple with the Groups field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorDowntimeMatchResponseAttributes) GetGroupsOk() (*[]string, bool) { + if o == nil || o.Groups == nil { + return nil, false + } + return &o.Groups, true +} + +// HasGroups returns a boolean if a field has been set. +func (o *MonitorDowntimeMatchResponseAttributes) HasGroups() bool { + return o != nil && o.Groups != nil +} + +// SetGroups gets a reference to the given []string and assigns it to the Groups field. +func (o *MonitorDowntimeMatchResponseAttributes) SetGroups(v []string) { + o.Groups = v +} + +// GetScope returns the Scope field value if set, zero value otherwise. +func (o *MonitorDowntimeMatchResponseAttributes) GetScope() string { + if o == nil || o.Scope == nil { + var ret string + return ret + } + return *o.Scope +} + +// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorDowntimeMatchResponseAttributes) GetScopeOk() (*string, bool) { + if o == nil || o.Scope == nil { + return nil, false + } + return o.Scope, true +} + +// HasScope returns a boolean if a field has been set. +func (o *MonitorDowntimeMatchResponseAttributes) HasScope() bool { + return o != nil && o.Scope != nil +} + +// SetScope gets a reference to the given string and assigns it to the Scope field. +func (o *MonitorDowntimeMatchResponseAttributes) SetScope(v string) { + o.Scope = &v +} + +// GetStart returns the Start field value if set, zero value otherwise. +func (o *MonitorDowntimeMatchResponseAttributes) GetStart() time.Time { + if o == nil || o.Start == nil { + var ret time.Time + return ret + } + return *o.Start +} + +// GetStartOk returns a tuple with the Start field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorDowntimeMatchResponseAttributes) GetStartOk() (*time.Time, bool) { + if o == nil || o.Start == nil { + return nil, false + } + return o.Start, true +} + +// HasStart returns a boolean if a field has been set. +func (o *MonitorDowntimeMatchResponseAttributes) HasStart() bool { + return o != nil && o.Start != nil +} + +// SetStart gets a reference to the given time.Time and assigns it to the Start field. +func (o *MonitorDowntimeMatchResponseAttributes) SetStart(v time.Time) { + o.Start = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorDowntimeMatchResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.End.IsSet() { + toSerialize["end"] = o.End.Get() + } + if o.Groups != nil { + toSerialize["groups"] = o.Groups + } + if o.Scope != nil { + toSerialize["scope"] = o.Scope + } + if o.Start != nil { + if o.Start.Nanosecond() == 0 { + toSerialize["start"] = o.Start.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["start"] = o.Start.Format("2006-01-02T15:04:05.000Z07:00") + } + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorDowntimeMatchResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + End datadog.NullableTime `json:"end,omitempty"` + Groups []string `json:"groups,omitempty"` + Scope *string `json:"scope,omitempty"` + Start *time.Time `json:"start,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"end", "groups", "scope", "start"}) + } else { + return err + } + o.End = all.End + o.Groups = all.Groups + o.Scope = all.Scope + o.Start = all.Start + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_downtime_match_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_downtime_match_response_data.go new file mode 100644 index 000000000..6812c3d12 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_downtime_match_response_data.go @@ -0,0 +1,202 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// MonitorDowntimeMatchResponseData A downtime match. +type MonitorDowntimeMatchResponseData struct { + // Downtime match details. + Attributes *MonitorDowntimeMatchResponseAttributes `json:"attributes,omitempty"` + // The downtime ID. + Id datadog.NullableString `json:"id,omitempty"` + // Monitor Downtime Match resource type. + Type *MonitorDowntimeMatchResourceType `json:"type,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{} +} + +// NewMonitorDowntimeMatchResponseData instantiates a new MonitorDowntimeMatchResponseData 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 NewMonitorDowntimeMatchResponseData() *MonitorDowntimeMatchResponseData { + this := MonitorDowntimeMatchResponseData{} + var typeVar MonitorDowntimeMatchResourceType = MONITORDOWNTIMEMATCHRESOURCETYPE_DOWNTIME_MATCH + this.Type = &typeVar + return &this +} + +// NewMonitorDowntimeMatchResponseDataWithDefaults instantiates a new MonitorDowntimeMatchResponseData 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 NewMonitorDowntimeMatchResponseDataWithDefaults() *MonitorDowntimeMatchResponseData { + this := MonitorDowntimeMatchResponseData{} + var typeVar MonitorDowntimeMatchResourceType = MONITORDOWNTIMEMATCHRESOURCETYPE_DOWNTIME_MATCH + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *MonitorDowntimeMatchResponseData) GetAttributes() MonitorDowntimeMatchResponseAttributes { + if o == nil || o.Attributes == nil { + var ret MonitorDowntimeMatchResponseAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorDowntimeMatchResponseData) GetAttributesOk() (*MonitorDowntimeMatchResponseAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *MonitorDowntimeMatchResponseData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given MonitorDowntimeMatchResponseAttributes and assigns it to the Attributes field. +func (o *MonitorDowntimeMatchResponseData) SetAttributes(v MonitorDowntimeMatchResponseAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MonitorDowntimeMatchResponseData) GetId() string { + if o == nil || o.Id.Get() == nil { + var ret string + return ret + } + return *o.Id.Get() +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *MonitorDowntimeMatchResponseData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id.Get(), o.Id.IsSet() +} + +// HasId returns a boolean if a field has been set. +func (o *MonitorDowntimeMatchResponseData) HasId() bool { + return o != nil && o.Id.IsSet() +} + +// SetId gets a reference to the given datadog.NullableString and assigns it to the Id field. +func (o *MonitorDowntimeMatchResponseData) SetId(v string) { + o.Id.Set(&v) +} + +// SetIdNil sets the value for Id to be an explicit nil. +func (o *MonitorDowntimeMatchResponseData) SetIdNil() { + o.Id.Set(nil) +} + +// UnsetId ensures that no value is present for Id, not even an explicit nil. +func (o *MonitorDowntimeMatchResponseData) UnsetId() { + o.Id.Unset() +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *MonitorDowntimeMatchResponseData) GetType() MonitorDowntimeMatchResourceType { + if o == nil || o.Type == nil { + var ret MonitorDowntimeMatchResourceType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorDowntimeMatchResponseData) GetTypeOk() (*MonitorDowntimeMatchResourceType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *MonitorDowntimeMatchResponseData) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given MonitorDowntimeMatchResourceType and assigns it to the Type field. +func (o *MonitorDowntimeMatchResponseData) SetType(v MonitorDowntimeMatchResourceType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorDowntimeMatchResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id.IsSet() { + toSerialize["id"] = o.Id.Get() + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorDowntimeMatchResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *MonitorDowntimeMatchResponseAttributes `json:"attributes,omitempty"` + Id datadog.NullableString `json:"id,omitempty"` + Type *MonitorDowntimeMatchResourceType `json:"type,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_type.go index d52f29c9c..0fafd1911 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_monitor_type.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -412,7 +412,6 @@ func (o MonitorType) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorType) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CreatedAt *int64 `json:"created_at,omitempty"` GroupStatus *int32 `json:"group_status,omitempty"` @@ -427,12 +426,7 @@ func (o *MonitorType) UnmarshalJSON(bytes []byte) (err error) { Type *string `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -451,6 +445,7 @@ func (o *MonitorType) UnmarshalJSON(bytes []byte) (err error) { o.Tags = all.Tags o.TemplatedName = all.TemplatedName o.Type = all.Type + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_request.go index a9f1028d2..0edfe12a3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o MuteFindingRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MuteFindingRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *MuteFindingRequestData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *MuteFindingRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_request_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_request_attributes.go index 6f508387f..022e84d85 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_request_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_request_attributes.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MuteFindingRequestAttributes The mute properties to be updated. @@ -70,29 +71,25 @@ func (o MuteFindingRequestAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MuteFindingRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Mute *MuteFindingRequestProperties `json:"mute"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Mute == nil { return fmt.Errorf("required field mute missing") } + + hasInvalidField := false if all.Mute.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Mute = *all.Mute + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_request_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_request_data.go index d6858c775..7871e4529 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_request_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_request_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -133,19 +134,13 @@ func (o MuteFindingRequestData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MuteFindingRequestData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *MuteFindingRequestAttributes `json:"attributes"` Id *string `json:"id"` Type *FindingType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -162,27 +157,26 @@ func (o *MuteFindingRequestData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_request_properties.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_request_properties.go index 2f705471c..392b17ea6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_request_properties.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_request_properties.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // MuteFindingRequestProperties Object containing the new mute properties of the finding. @@ -165,7 +166,6 @@ func (o MuteFindingRequestProperties) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MuteFindingRequestProperties) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Description *string `json:"description,omitempty"` ExpirationDate *int64 `json:"expiration_date,omitempty"` @@ -173,12 +173,7 @@ func (o *MuteFindingRequestProperties) UnmarshalJSON(bytes []byte) (err error) { Reason *FindingMuteReason `json:"reason"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Muted == nil { return fmt.Errorf("required field muted missing") @@ -186,18 +181,20 @@ func (o *MuteFindingRequestProperties) UnmarshalJSON(bytes []byte) (err error) { 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 { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Description = all.Description o.ExpirationDate = all.ExpirationDate o.Muted = *all.Muted - o.Reason = *all.Reason + if !all.Reason.IsValid() { + hasInvalidField = true + } else { + o.Reason = *all.Reason + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_response.go index f61637563..4174ce169 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_response.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o MuteFindingResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MuteFindingResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *MuteFindingResponseData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *MuteFindingResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_response_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_response_attributes.go index 9b7191141..80f1eabbe 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_response_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_response_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -346,7 +346,6 @@ func (o MuteFindingResponseAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MuteFindingResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Evaluation *FindingEvaluation `json:"evaluation,omitempty"` EvaluationChangedAt *int64 `json:"evaluation_changed_at,omitempty"` @@ -359,12 +358,7 @@ func (o *MuteFindingResponseAttributes) UnmarshalJSON(bytes []byte) (err error) Tags []string `json:"tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -372,48 +366,39 @@ func (o *MuteFindingResponseAttributes) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.Evaluation; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Evaluation = all.Evaluation + + hasInvalidField := false + if all.Evaluation != nil && !all.Evaluation.IsValid() { + hasInvalidField = true + } else { + o.Evaluation = all.Evaluation + } o.EvaluationChangedAt = all.EvaluationChangedAt if all.Mute != nil && all.Mute.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Mute = all.Mute o.Resource = all.Resource o.ResourceDiscoveryDate = all.ResourceDiscoveryDate o.ResourceType = all.ResourceType if all.Rule != nil && all.Rule.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Rule = all.Rule - o.Status = all.Status + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } o.Tags = all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_response_data.go index cc014bc23..37728e5d9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_response_data.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o MuteFindingResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MuteFindingResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *MuteFindingResponseAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *FindingType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *MuteFindingResponseData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_response_properties.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_response_properties.go index 780d7ebf5..022cd0bea 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_response_properties.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_mute_finding_response_properties.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // MuteFindingResponseProperties Information about the mute status of this finding. @@ -178,7 +178,6 @@ func (o MuteFindingResponseProperties) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MuteFindingResponseProperties) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Description *string `json:"description,omitempty"` ExpirationDate *int64 `json:"expiration_date,omitempty"` @@ -186,25 +185,22 @@ func (o *MuteFindingResponseProperties) UnmarshalJSON(bytes []byte) (err error) Reason *FindingMuteReason `json:"reason,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Reason; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } + + hasInvalidField := false o.Description = all.Description o.ExpirationDate = all.ExpirationDate o.Muted = all.Muted - o.Reason = all.Reason + if all.Reason != nil && !all.Reason.IsValid() { + hasInvalidField = true + } else { + o.Reason = all.Reason + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_nullable_relationship_to_user.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_nullable_relationship_to_user.go index 0dc9d1698..3fdc55eb1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_nullable_relationship_to_user.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_nullable_relationship_to_user.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -79,17 +80,11 @@ func (o NullableRelationshipToUser) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NullableRelationshipToUser) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data NullableNullableRelationshipToUserData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if !all.Data.IsSet() { return fmt.Errorf("required field data missing") @@ -101,6 +96,7 @@ func (o *NullableRelationshipToUser) UnmarshalJSON(bytes []byte) (err error) { return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_nullable_relationship_to_user_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_nullable_relationship_to_user_data.go index a92edad30..b4e854299 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_nullable_relationship_to_user_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_nullable_relationship_to_user_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o NullableRelationshipToUserData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NullableRelationshipToUserData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id"` Type *UsersType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -131,20 +126,23 @@ func (o *NullableRelationshipToUserData) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_on_demand_concurrency_cap.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_on_demand_concurrency_cap.go index 03b32a9f7..dda651c03 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_on_demand_concurrency_cap.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_on_demand_concurrency_cap.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -14,6 +14,8 @@ import ( type OnDemandConcurrencyCap struct { // On-demand concurrency cap attributes. Attributes *OnDemandConcurrencyCapAttributes `json:"attributes,omitempty"` + // On-demand concurrency cap type. + Type *OnDemandConcurrencyCapType `json:"type,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{} @@ -64,6 +66,34 @@ func (o *OnDemandConcurrencyCap) SetAttributes(v OnDemandConcurrencyCapAttribute o.Attributes = &v } +// GetType returns the Type field value if set, zero value otherwise. +func (o *OnDemandConcurrencyCap) GetType() OnDemandConcurrencyCapType { + if o == nil || o.Type == nil { + var ret OnDemandConcurrencyCapType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OnDemandConcurrencyCap) GetTypeOk() (*OnDemandConcurrencyCapType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *OnDemandConcurrencyCap) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given OnDemandConcurrencyCapType and assigns it to the Type field. +func (o *OnDemandConcurrencyCap) SetType(v OnDemandConcurrencyCapType) { + o.Type = &v +} + // MarshalJSON serializes the struct using spec logic. func (o OnDemandConcurrencyCap) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -73,6 +103,9 @@ func (o OnDemandConcurrencyCap) MarshalJSON() ([]byte, error) { if o.Attributes != nil { toSerialize["attributes"] = o.Attributes } + if o.Type != nil { + toSerialize["type"] = o.Type + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -82,35 +115,38 @@ func (o OnDemandConcurrencyCap) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OnDemandConcurrencyCap) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *OnDemandConcurrencyCapAttributes `json:"attributes,omitempty"` + Type *OnDemandConcurrencyCapType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"attributes"}) + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) } else { return err } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_on_demand_concurrency_cap_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_on_demand_concurrency_cap_attributes.go index e21e50685..36a742bde 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_on_demand_concurrency_cap_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_on_demand_concurrency_cap_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o OnDemandConcurrencyCapAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OnDemandConcurrencyCapAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { OnDemandConcurrencyCap *float64 `json:"on_demand_concurrency_cap,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *OnDemandConcurrencyCapAttributes) UnmarshalJSON(bytes []byte) (err erro return err } o.OnDemandConcurrencyCap = all.OnDemandConcurrencyCap + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_on_demand_concurrency_cap_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_on_demand_concurrency_cap_response.go index 31dfe77f7..4ab9cd11d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_on_demand_concurrency_cap_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_on_demand_concurrency_cap_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o OnDemandConcurrencyCapResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OnDemandConcurrencyCapResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *OnDemandConcurrencyCap `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *OnDemandConcurrencyCapResponse) UnmarshalJSON(bytes []byte) (err error) } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_on_demand_concurrency_cap_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_on_demand_concurrency_cap_type.go new file mode 100644 index 000000000..d4a5a540a --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_on_demand_concurrency_cap_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/goccy/go-json" +) + +// OnDemandConcurrencyCapType On-demand concurrency cap type. +type OnDemandConcurrencyCapType string + +// List of OnDemandConcurrencyCapType. +const ( + ONDEMANDCONCURRENCYCAPTYPE_ON_DEMAND_CONCURRENCY_CAP OnDemandConcurrencyCapType = "on_demand_concurrency_cap" +) + +var allowedOnDemandConcurrencyCapTypeEnumValues = []OnDemandConcurrencyCapType{ + ONDEMANDCONCURRENCYCAPTYPE_ON_DEMAND_CONCURRENCY_CAP, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *OnDemandConcurrencyCapType) GetAllowedValues() []OnDemandConcurrencyCapType { + return allowedOnDemandConcurrencyCapTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *OnDemandConcurrencyCapType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = OnDemandConcurrencyCapType(value) + return nil +} + +// NewOnDemandConcurrencyCapTypeFromValue returns a pointer to a valid OnDemandConcurrencyCapType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewOnDemandConcurrencyCapTypeFromValue(v string) (*OnDemandConcurrencyCapType, error) { + ev := OnDemandConcurrencyCapType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for OnDemandConcurrencyCapType: valid values are %v", v, allowedOnDemandConcurrencyCapTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v OnDemandConcurrencyCapType) IsValid() bool { + for _, existing := range allowedOnDemandConcurrencyCapTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to OnDemandConcurrencyCapType value. +func (v OnDemandConcurrencyCapType) Ptr() *OnDemandConcurrencyCapType { + return &v +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_create_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_create_attributes.go index 7a2114a25..2798234a3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_create_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_create_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -164,7 +165,6 @@ func (o OpsgenieServiceCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OpsgenieServiceCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CustomUrl *string `json:"custom_url,omitempty"` Name *string `json:"name"` @@ -172,12 +172,7 @@ func (o *OpsgenieServiceCreateAttributes) UnmarshalJSON(bytes []byte) (err error Region *OpsgenieServiceRegionType `json:"region"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -194,21 +189,24 @@ func (o *OpsgenieServiceCreateAttributes) UnmarshalJSON(bytes []byte) (err error } else { return err } - if v := all.Region; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.CustomUrl = all.CustomUrl o.Name = *all.Name o.OpsgenieApiKey = *all.OpsgenieApiKey - o.Region = *all.Region + if !all.Region.IsValid() { + hasInvalidField = true + } else { + o.Region = *all.Region + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_create_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_create_data.go index 0298348dd..3fe9e925e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_create_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_create_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o OpsgenieServiceCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OpsgenieServiceCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *OpsgenieServiceCreateAttributes `json:"attributes"` Type *OpsgenieServiceType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -131,26 +126,25 @@ func (o *OpsgenieServiceCreateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_create_request.go index 3a71db18e..7a553b7b2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o OpsgenieServiceCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OpsgenieServiceCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *OpsgenieServiceCreateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *OpsgenieServiceCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_region_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_region_type.go index d6fa1987e..364f97e4e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_region_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_region_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // OpsgenieServiceRegionType The region for the Opsgenie service. @@ -65,47 +66,3 @@ func (v OpsgenieServiceRegionType) IsValid() bool { func (v OpsgenieServiceRegionType) Ptr() *OpsgenieServiceRegionType { return &v } - -// NullableOpsgenieServiceRegionType handles when a null is used for OpsgenieServiceRegionType. -type NullableOpsgenieServiceRegionType struct { - value *OpsgenieServiceRegionType - isSet bool -} - -// Get returns the associated value. -func (v NullableOpsgenieServiceRegionType) Get() *OpsgenieServiceRegionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableOpsgenieServiceRegionType) Set(val *OpsgenieServiceRegionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableOpsgenieServiceRegionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableOpsgenieServiceRegionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableOpsgenieServiceRegionType initializes the struct as if Set has been called. -func NewNullableOpsgenieServiceRegionType(val *OpsgenieServiceRegionType) *NullableOpsgenieServiceRegionType { - return &NullableOpsgenieServiceRegionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableOpsgenieServiceRegionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableOpsgenieServiceRegionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_response.go index 142124e3e..2b7ad4445 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_response.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o OpsgenieServiceResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OpsgenieServiceResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *OpsgenieServiceResponseData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *OpsgenieServiceResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_response_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_response_attributes.go index 106510d75..a816e6e10 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_response_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_response_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -159,19 +159,13 @@ func (o OpsgenieServiceResponseAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OpsgenieServiceResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CustomUrl datadog.NullableString `json:"custom_url,omitempty"` Name *string `json:"name,omitempty"` Region *OpsgenieServiceRegionType `json:"region,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -179,20 +173,23 @@ func (o *OpsgenieServiceResponseAttributes) UnmarshalJSON(bytes []byte) (err err } else { return err } - if v := all.Region; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.CustomUrl = all.CustomUrl o.Name = all.Name - o.Region = all.Region + if all.Region != nil && !all.Region.IsValid() { + hasInvalidField = true + } else { + o.Region = all.Region + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_response_data.go index 63af45dfc..c9edde6ea 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_response_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -133,19 +134,13 @@ func (o OpsgenieServiceResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OpsgenieServiceResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *OpsgenieServiceResponseAttributes `json:"attributes"` Id *string `json:"id"` Type *OpsgenieServiceType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -162,27 +157,26 @@ func (o *OpsgenieServiceResponseData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_type.go index 060cc454c..ad27030dc 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // OpsgenieServiceType Opsgenie service resource type. @@ -61,47 +62,3 @@ func (v OpsgenieServiceType) IsValid() bool { func (v OpsgenieServiceType) Ptr() *OpsgenieServiceType { return &v } - -// NullableOpsgenieServiceType handles when a null is used for OpsgenieServiceType. -type NullableOpsgenieServiceType struct { - value *OpsgenieServiceType - isSet bool -} - -// Get returns the associated value. -func (v NullableOpsgenieServiceType) Get() *OpsgenieServiceType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableOpsgenieServiceType) Set(val *OpsgenieServiceType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableOpsgenieServiceType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableOpsgenieServiceType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableOpsgenieServiceType initializes the struct as if Set has been called. -func NewNullableOpsgenieServiceType(val *OpsgenieServiceType) *NullableOpsgenieServiceType { - return &NullableOpsgenieServiceType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableOpsgenieServiceType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableOpsgenieServiceType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_update_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_update_attributes.go index 464c28d22..eeb4c4d0d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_update_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_update_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -192,7 +192,6 @@ func (o OpsgenieServiceUpdateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OpsgenieServiceUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CustomUrl datadog.NullableString `json:"custom_url,omitempty"` Name *string `json:"name,omitempty"` @@ -200,12 +199,7 @@ func (o *OpsgenieServiceUpdateAttributes) UnmarshalJSON(bytes []byte) (err error Region *OpsgenieServiceRegionType `json:"region,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -213,21 +207,24 @@ func (o *OpsgenieServiceUpdateAttributes) UnmarshalJSON(bytes []byte) (err error } else { return err } - if v := all.Region; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.CustomUrl = all.CustomUrl o.Name = all.Name o.OpsgenieApiKey = all.OpsgenieApiKey - o.Region = all.Region + if all.Region != nil && !all.Region.IsValid() { + hasInvalidField = true + } else { + o.Region = all.Region + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_update_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_update_data.go index 6e08b78d1..9687424ca 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_update_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_update_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -133,19 +134,13 @@ func (o OpsgenieServiceUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OpsgenieServiceUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *OpsgenieServiceUpdateAttributes `json:"attributes"` Id *string `json:"id"` Type *OpsgenieServiceType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -162,27 +157,26 @@ func (o *OpsgenieServiceUpdateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_update_request.go index 6654eed2e..997c187be 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_service_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o OpsgenieServiceUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OpsgenieServiceUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *OpsgenieServiceUpdateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *OpsgenieServiceUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_services_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_services_response.go index 79ca1ff29..44609c7d6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_services_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_opsgenie_services_response.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o OpsgenieServicesResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OpsgenieServicesResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *[]OpsgenieServiceResponseData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -99,6 +94,7 @@ func (o *OpsgenieServicesResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_organization.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_organization.go index fe86af89f..c65fce104 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_organization.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_organization.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -145,19 +146,13 @@ func (o Organization) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Organization) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *OrganizationAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *OrganizationsType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -168,27 +163,26 @@ func (o *Organization) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_organization_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_organization_attributes.go index 022247a71..94197a924 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_organization_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_organization_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -322,7 +323,6 @@ func (o OrganizationAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OrganizationAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CreatedAt *time.Time `json:"created_at,omitempty"` Description *string `json:"description,omitempty"` @@ -334,12 +334,7 @@ func (o *OrganizationAttributes) UnmarshalJSON(bytes []byte) (err error) { Url *string `json:"url,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -355,6 +350,7 @@ func (o *OrganizationAttributes) UnmarshalJSON(bytes []byte) (err error) { o.PublicId = all.PublicId o.Sharing = all.Sharing o.Url = all.Url + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_organizations_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_organizations_type.go index 545f2cf67..a8adecfac 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_organizations_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_organizations_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // OrganizationsType Organizations resource type. @@ -61,47 +62,3 @@ func (v OrganizationsType) IsValid() bool { func (v OrganizationsType) Ptr() *OrganizationsType { return &v } - -// NullableOrganizationsType handles when a null is used for OrganizationsType. -type NullableOrganizationsType struct { - value *OrganizationsType - isSet bool -} - -// Get returns the associated value. -func (v NullableOrganizationsType) Get() *OrganizationsType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableOrganizationsType) Set(val *OrganizationsType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableOrganizationsType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableOrganizationsType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableOrganizationsType initializes the struct as if Set has been called. -func NewNullableOrganizationsType(val *OrganizationsType) *NullableOrganizationsType { - return &NullableOrganizationsType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableOrganizationsType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableOrganizationsType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_pagination.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_pagination.go index 0034eecf1..0bf35b998 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_pagination.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_pagination.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o Pagination) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Pagination) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { TotalCount *int64 `json:"total_count,omitempty"` TotalFilteredCount *int64 `json:"total_filtered_count,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *Pagination) UnmarshalJSON(bytes []byte) (err error) { } o.TotalCount = all.TotalCount o.TotalFilteredCount = all.TotalFilteredCount + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_partial_api_key.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_partial_api_key.go index f66d8664f..1689d2a9c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_partial_api_key.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_partial_api_key.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -185,7 +185,6 @@ func (o PartialAPIKey) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *PartialAPIKey) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *PartialAPIKeyAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` @@ -193,12 +192,7 @@ func (o *PartialAPIKey) UnmarshalJSON(bytes []byte) (err error) { Type *APIKeysType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,35 +200,30 @@ func (o *PartialAPIKey) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_partial_api_key_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_partial_api_key_attributes.go index 2730a4708..e212acbe5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_partial_api_key_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_partial_api_key_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -181,7 +181,6 @@ func (o PartialAPIKeyAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *PartialAPIKeyAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CreatedAt *string `json:"created_at,omitempty"` Last4 *string `json:"last4,omitempty"` @@ -189,12 +188,7 @@ func (o *PartialAPIKeyAttributes) UnmarshalJSON(bytes []byte) (err error) { 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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,6 +200,7 @@ func (o *PartialAPIKeyAttributes) UnmarshalJSON(bytes []byte) (err error) { o.Last4 = all.Last4 o.ModifiedAt = all.ModifiedAt o.Name = all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_partial_application_key.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_partial_application_key.go index a0bc9f882..0baebc952 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_partial_application_key.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_partial_application_key.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -185,7 +185,6 @@ func (o PartialApplicationKey) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *PartialApplicationKey) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *PartialApplicationKeyAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` @@ -193,12 +192,7 @@ func (o *PartialApplicationKey) UnmarshalJSON(bytes []byte) (err error) { Type *ApplicationKeysType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,35 +200,30 @@ func (o *PartialApplicationKey) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_partial_application_key_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_partial_application_key_attributes.go index c8abdf951..f4e869c6b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_partial_application_key_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_partial_application_key_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -18,7 +18,7 @@ type PartialApplicationKeyAttributes struct { Last4 *string `json:"last4,omitempty"` // Name of the application key. Name *string `json:"name,omitempty"` - // Array of scopes to grant the application key. This feature is in private beta, please contact Datadog support to enable scopes for your application keys. + // Array of scopes to grant the application key. Scopes datadog.NullableList[string] `json:"scopes,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` @@ -192,7 +192,6 @@ func (o PartialApplicationKeyAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *PartialApplicationKeyAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CreatedAt *string `json:"created_at,omitempty"` Last4 *string `json:"last4,omitempty"` @@ -200,12 +199,7 @@ func (o *PartialApplicationKeyAttributes) UnmarshalJSON(bytes []byte) (err error Scopes datadog.NullableList[string] `json:"scopes,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -217,6 +211,7 @@ func (o *PartialApplicationKeyAttributes) UnmarshalJSON(bytes []byte) (err error o.Last4 = all.Last4 o.Name = all.Name o.Scopes = all.Scopes + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_partial_application_key_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_partial_application_key_response.go index fa1a690fd..b703f6822 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_partial_application_key_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_partial_application_key_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o PartialApplicationKeyResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *PartialApplicationKeyResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *PartialApplicationKey `json:"data,omitempty"` Included []ApplicationKeyResponseIncludedItem `json:"included,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *PartialApplicationKeyResponse) UnmarshalJSON(bytes []byte) (err error) } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data o.Included = all.Included + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_permission.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_permission.go index a3c745b37..049c7afbb 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_permission.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_permission.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -145,19 +146,13 @@ func (o Permission) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Permission) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *PermissionAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *PermissionsType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -168,27 +163,26 @@ func (o *Permission) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_permission_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_permission_attributes.go index 7712fa702..da68cd7c2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_permission_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_permission_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -285,7 +286,6 @@ func (o PermissionAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *PermissionAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Created *time.Time `json:"created,omitempty"` Description *string `json:"description,omitempty"` @@ -296,12 +296,7 @@ func (o *PermissionAttributes) UnmarshalJSON(bytes []byte) (err error) { Restricted *bool `json:"restricted,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -316,6 +311,7 @@ func (o *PermissionAttributes) UnmarshalJSON(bytes []byte) (err error) { o.GroupName = all.GroupName o.Name = all.Name o.Restricted = all.Restricted + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_permissions_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_permissions_response.go index ebfd786a1..52ce76ff6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_permissions_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_permissions_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o PermissionsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *PermissionsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []Permission `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *PermissionsResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_permissions_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_permissions_type.go index 3dcbeb1d1..97f067185 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_permissions_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_permissions_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // PermissionsType Permissions resource type. @@ -61,47 +62,3 @@ func (v PermissionsType) IsValid() bool { func (v PermissionsType) Ptr() *PermissionsType { return &v } - -// NullablePermissionsType handles when a null is used for PermissionsType. -type NullablePermissionsType struct { - value *PermissionsType - isSet bool -} - -// Get returns the associated value. -func (v NullablePermissionsType) Get() *PermissionsType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullablePermissionsType) Set(val *PermissionsType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullablePermissionsType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullablePermissionsType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullablePermissionsType initializes the struct as if Set has been called. -func NewNullablePermissionsType(val *PermissionsType) *NullablePermissionsType { - return &NullablePermissionsType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullablePermissionsType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullablePermissionsType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_process_summaries_meta.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_process_summaries_meta.go index 956ff6b63..9339197c9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_process_summaries_meta.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_process_summaries_meta.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o ProcessSummariesMeta) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ProcessSummariesMeta) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Page *ProcessSummariesMetaPage `json:"page,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *ProcessSummariesMeta) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Page = all.Page + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_process_summaries_meta_page.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_process_summaries_meta_page.go index 2e0c71a45..41560a5d6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_process_summaries_meta_page.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_process_summaries_meta_page.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -116,18 +116,12 @@ func (o ProcessSummariesMetaPage) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ProcessSummariesMetaPage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { After *string `json:"after,omitempty"` Size *int32 `json:"size,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -137,6 +131,7 @@ func (o *ProcessSummariesMetaPage) UnmarshalJSON(bytes []byte) (err error) { } o.After = all.After o.Size = all.Size + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_process_summaries_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_process_summaries_response.go index c371bbed8..80857491f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_process_summaries_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_process_summaries_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o ProcessSummariesResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ProcessSummariesResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []ProcessSummary `json:"data,omitempty"` Meta *ProcessSummariesMeta `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *ProcessSummariesResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Data = all.Data if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_process_summary.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_process_summary.go index 454177267..049de6957 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_process_summary.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_process_summary.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o ProcessSummary) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ProcessSummary) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *ProcessSummaryAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *ProcessSummaryType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *ProcessSummary) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_process_summary_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_process_summary_attributes.go index 1bf0e7fd2..674441124 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_process_summary_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_process_summary_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -313,7 +313,6 @@ func (o ProcessSummaryAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ProcessSummaryAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Cmdline *string `json:"cmdline,omitempty"` Host *string `json:"host,omitempty"` @@ -325,12 +324,7 @@ func (o *ProcessSummaryAttributes) UnmarshalJSON(bytes []byte) (err error) { User *string `json:"user,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -346,6 +340,7 @@ func (o *ProcessSummaryAttributes) UnmarshalJSON(bytes []byte) (err error) { o.Tags = all.Tags o.Timestamp = all.Timestamp o.User = all.User + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_process_summary_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_process_summary_type.go index ee19e1740..8d76bea40 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_process_summary_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_process_summary_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ProcessSummaryType Type of process summary. @@ -61,47 +62,3 @@ func (v ProcessSummaryType) IsValid() bool { func (v ProcessSummaryType) Ptr() *ProcessSummaryType { return &v } - -// NullableProcessSummaryType handles when a null is used for ProcessSummaryType. -type NullableProcessSummaryType struct { - value *ProcessSummaryType - isSet bool -} - -// Get returns the associated value. -func (v NullableProcessSummaryType) Get() *ProcessSummaryType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableProcessSummaryType) Set(val *ProcessSummaryType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableProcessSummaryType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableProcessSummaryType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableProcessSummaryType initializes the struct as if Set has been called. -func NewNullableProcessSummaryType(val *ProcessSummaryType) *NullableProcessSummaryType { - return &NullableProcessSummaryType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableProcessSummaryType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableProcessSummaryType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_query_formula.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_query_formula.go index 3e249f279..fe721a4c2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_query_formula.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_query_formula.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -16,6 +17,7 @@ type QueryFormula struct { // Formula string, referencing one or more queries with their name property. Formula string `json:"formula"` // Message for specifying limits to the number of values returned by a query. + // This limit is only for scalar queries and has no effect on timeseries queries. Limit *FormulaLimit `json:"limit,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` @@ -110,18 +112,12 @@ func (o QueryFormula) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *QueryFormula) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Formula *string `json:"formula"` Limit *FormulaLimit `json:"limit,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Formula == nil { return fmt.Errorf("required field formula missing") @@ -132,18 +128,21 @@ func (o *QueryFormula) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Formula = *all.Formula if all.Limit != nil && all.Limit.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Limit = all.Limit + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_query_sort_order.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_query_sort_order.go index 481a42d46..74329bd88 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_query_sort_order.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_query_sort_order.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // QuerySortOrder Direction of sort. @@ -63,47 +64,3 @@ func (v QuerySortOrder) IsValid() bool { func (v QuerySortOrder) Ptr() *QuerySortOrder { return &v } - -// NullableQuerySortOrder handles when a null is used for QuerySortOrder. -type NullableQuerySortOrder struct { - value *QuerySortOrder - isSet bool -} - -// Get returns the associated value. -func (v NullableQuerySortOrder) Get() *QuerySortOrder { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableQuerySortOrder) Set(val *QuerySortOrder) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableQuerySortOrder) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableQuerySortOrder) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableQuerySortOrder initializes the struct as if Set has been called. -func NewNullableQuerySortOrder(val *QuerySortOrder) *NullableQuerySortOrder { - return &NullableQuerySortOrder{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableQuerySortOrder) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableQuerySortOrder) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_incident_attachment.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_incident_attachment.go index 79f204768..ff0c0a69e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_incident_attachment.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_incident_attachment.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o RelationshipToIncidentAttachment) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToIncidentAttachment) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *[]RelationshipToIncidentAttachmentData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -99,6 +94,7 @@ func (o *RelationshipToIncidentAttachment) UnmarshalJSON(bytes []byte) (err erro return err } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_incident_attachment_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_incident_attachment_data.go index bc22c7bc0..b2a94477c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_incident_attachment_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_incident_attachment_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o RelationshipToIncidentAttachmentData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToIncidentAttachmentData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id"` Type *IncidentAttachmentType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -131,19 +126,22 @@ func (o *RelationshipToIncidentAttachmentData) UnmarshalJSON(bytes []byte) (err } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_incident_integration_metadata_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_incident_integration_metadata_data.go index a6ae6c47c..7f4b9b863 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_incident_integration_metadata_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_incident_integration_metadata_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o RelationshipToIncidentIntegrationMetadataData) MarshalJSON() ([]byte, er // UnmarshalJSON deserializes the given payload. func (o *RelationshipToIncidentIntegrationMetadataData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id"` Type *IncidentIntegrationMetadataType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -131,19 +126,22 @@ func (o *RelationshipToIncidentIntegrationMetadataData) UnmarshalJSON(bytes []by } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_incident_integration_metadatas.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_incident_integration_metadatas.go index f4abe6480..cb773225c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_incident_integration_metadatas.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_incident_integration_metadatas.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o RelationshipToIncidentIntegrationMetadatas) MarshalJSON() ([]byte, error // UnmarshalJSON deserializes the given payload. func (o *RelationshipToIncidentIntegrationMetadatas) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *[]RelationshipToIncidentIntegrationMetadataData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -99,6 +94,7 @@ func (o *RelationshipToIncidentIntegrationMetadatas) UnmarshalJSON(bytes []byte) return err } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_incident_postmortem.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_incident_postmortem.go index 1add15aef..763ab426d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_incident_postmortem.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_incident_postmortem.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o RelationshipToIncidentPostmortem) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToIncidentPostmortem) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *RelationshipToIncidentPostmortemData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *RelationshipToIncidentPostmortem) UnmarshalJSON(bytes []byte) (err erro } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_incident_postmortem_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_incident_postmortem_data.go index f6dabb35f..2b1fc0bed 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_incident_postmortem_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_incident_postmortem_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o RelationshipToIncidentPostmortemData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToIncidentPostmortemData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id"` Type *IncidentPostmortemType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -131,19 +126,22 @@ func (o *RelationshipToIncidentPostmortemData) UnmarshalJSON(bytes []byte) (err } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_organization.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_organization.go index 87cbddcb0..eac3518bf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_organization.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_organization.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o RelationshipToOrganization) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToOrganization) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *RelationshipToOrganizationData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *RelationshipToOrganization) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_organization_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_organization_data.go index 332578b1e..c33d48b75 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_organization_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_organization_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o RelationshipToOrganizationData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToOrganizationData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id"` Type *OrganizationsType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -131,19 +126,22 @@ func (o *RelationshipToOrganizationData) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_organizations.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_organizations.go index 1b4a821cb..1224287f8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_organizations.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_organizations.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o RelationshipToOrganizations) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToOrganizations) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *[]RelationshipToOrganizationData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -99,6 +94,7 @@ func (o *RelationshipToOrganizations) UnmarshalJSON(bytes []byte) (err error) { return err } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_permission.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_permission.go index eaeb575dc..b0458f971 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_permission.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_permission.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o RelationshipToPermission) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToPermission) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *RelationshipToPermissionData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *RelationshipToPermission) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_permission_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_permission_data.go index 09c7d6722..5445a87a1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_permission_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_permission_data.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -119,18 +119,12 @@ func (o RelationshipToPermissionData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToPermissionData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id,omitempty"` Type *PermissionsType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -138,19 +132,22 @@ func (o *RelationshipToPermissionData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_permissions.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_permissions.go index 7dba0d651..6cbd83ac1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_permissions.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_permissions.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o RelationshipToPermissions) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToPermissions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []RelationshipToPermissionData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *RelationshipToPermissions) UnmarshalJSON(bytes []byte) (err error) { return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_role.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_role.go index baa8c92ad..e418ec7f7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_role.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_role.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o RelationshipToRole) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToRole) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *RelationshipToRoleData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *RelationshipToRole) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_role_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_role_data.go index 4043b8422..be9311cde 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_role_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_role_data.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -119,18 +119,12 @@ func (o RelationshipToRoleData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToRoleData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id,omitempty"` Type *RolesType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -138,19 +132,22 @@ func (o *RelationshipToRoleData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_roles.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_roles.go index d9d9f9045..1ea22fb71 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_roles.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_roles.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o RelationshipToRoles) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToRoles) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []RelationshipToRoleData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *RelationshipToRoles) UnmarshalJSON(bytes []byte) (err error) { return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_saml_assertion_attribute.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_saml_assertion_attribute.go index b5240af3c..2649df68a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_saml_assertion_attribute.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_saml_assertion_attribute.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o RelationshipToSAMLAssertionAttribute) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToSAMLAssertionAttribute) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *RelationshipToSAMLAssertionAttributeData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *RelationshipToSAMLAssertionAttribute) UnmarshalJSON(bytes []byte) (err } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_saml_assertion_attribute_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_saml_assertion_attribute_data.go index a1c966939..85e450460 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_saml_assertion_attribute_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_saml_assertion_attribute_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o RelationshipToSAMLAssertionAttributeData) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *RelationshipToSAMLAssertionAttributeData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id"` Type *SAMLAssertionAttributesType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -131,19 +126,22 @@ func (o *RelationshipToSAMLAssertionAttributeData) UnmarshalJSON(bytes []byte) ( } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_team_link_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_team_link_data.go index e9d784a99..ed4112e75 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_team_link_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_team_link_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o RelationshipToTeamLinkData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToTeamLinkData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id"` Type *TeamLinkType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -131,19 +126,22 @@ func (o *RelationshipToTeamLinkData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_team_links.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_team_links.go index 3ead00fea..a9e0a6723 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_team_links.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_team_links.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -14,6 +14,8 @@ import ( type RelationshipToTeamLinks struct { // Related team links Data []RelationshipToTeamLinkData `json:"data,omitempty"` + // Links attributes. + Links *TeamRelationshipsLinks `json:"links,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{} @@ -64,6 +66,34 @@ func (o *RelationshipToTeamLinks) SetData(v []RelationshipToTeamLinkData) { o.Data = v } +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *RelationshipToTeamLinks) GetLinks() TeamRelationshipsLinks { + if o == nil || o.Links == nil { + var ret TeamRelationshipsLinks + return ret + } + return *o.Links +} + +// GetLinksOk returns a tuple with the Links field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RelationshipToTeamLinks) GetLinksOk() (*TeamRelationshipsLinks, bool) { + if o == nil || o.Links == nil { + return nil, false + } + return o.Links, true +} + +// HasLinks returns a boolean if a field has been set. +func (o *RelationshipToTeamLinks) HasLinks() bool { + return o != nil && o.Links != nil +} + +// SetLinks gets a reference to the given TeamRelationshipsLinks and assigns it to the Links field. +func (o *RelationshipToTeamLinks) SetLinks(v TeamRelationshipsLinks) { + o.Links = &v +} + // MarshalJSON serializes the struct using spec logic. func (o RelationshipToTeamLinks) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -73,6 +103,9 @@ func (o RelationshipToTeamLinks) MarshalJSON() ([]byte, error) { if o.Data != nil { toSerialize["data"] = o.Data } + if o.Links != nil { + toSerialize["links"] = o.Links + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -82,28 +115,34 @@ func (o RelationshipToTeamLinks) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToTeamLinks) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { - Data []RelationshipToTeamLinkData `json:"data,omitempty"` + Data []RelationshipToTeamLinkData `json:"data,omitempty"` + Links *TeamRelationshipsLinks `json:"links,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + datadog.DeleteKeys(additionalProperties, &[]string{"data", "links"}) } else { return err } + + hasInvalidField := false o.Data = all.Data + if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Links = all.Links + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_user.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_user.go index 30f733ee8..9ce304964 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_user.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_user.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o RelationshipToUser) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToUser) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *RelationshipToUserData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *RelationshipToUser) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_user_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_user_data.go index c42f180fe..9dba1540b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_user_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_user_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o RelationshipToUserData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToUserData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id"` Type *UsersType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -131,19 +126,22 @@ func (o *RelationshipToUserData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_user_team_permission.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_user_team_permission.go index c3b4942b2..4e8c82635 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_user_team_permission.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_user_team_permission.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -14,6 +14,8 @@ import ( type RelationshipToUserTeamPermission struct { // Related user team permission data Data *RelationshipToUserTeamPermissionData `json:"data,omitempty"` + // Links attributes. + Links *TeamRelationshipsLinks `json:"links,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{} @@ -64,6 +66,34 @@ func (o *RelationshipToUserTeamPermission) SetData(v RelationshipToUserTeamPermi o.Data = &v } +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *RelationshipToUserTeamPermission) GetLinks() TeamRelationshipsLinks { + if o == nil || o.Links == nil { + var ret TeamRelationshipsLinks + return ret + } + return *o.Links +} + +// GetLinksOk returns a tuple with the Links field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RelationshipToUserTeamPermission) GetLinksOk() (*TeamRelationshipsLinks, bool) { + if o == nil || o.Links == nil { + return nil, false + } + return o.Links, true +} + +// HasLinks returns a boolean if a field has been set. +func (o *RelationshipToUserTeamPermission) HasLinks() bool { + return o != nil && o.Links != nil +} + +// SetLinks gets a reference to the given TeamRelationshipsLinks and assigns it to the Links field. +func (o *RelationshipToUserTeamPermission) SetLinks(v TeamRelationshipsLinks) { + o.Links = &v +} + // MarshalJSON serializes the struct using spec logic. func (o RelationshipToUserTeamPermission) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -73,6 +103,9 @@ func (o RelationshipToUserTeamPermission) MarshalJSON() ([]byte, error) { if o.Data != nil { toSerialize["data"] = o.Data } + if o.Links != nil { + toSerialize["links"] = o.Links + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -82,35 +115,37 @@ func (o RelationshipToUserTeamPermission) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToUserTeamPermission) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { - Data *RelationshipToUserTeamPermissionData `json:"data,omitempty"` + Data *RelationshipToUserTeamPermissionData `json:"data,omitempty"` + Links *TeamRelationshipsLinks `json:"links,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + datadog.DeleteKeys(additionalProperties, &[]string{"data", "links"}) } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Links = all.Links + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_user_team_permission_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_user_team_permission_data.go index 707c8afff..35da26539 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_user_team_permission_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_user_team_permission_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o RelationshipToUserTeamPermissionData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToUserTeamPermissionData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id"` Type *UserTeamPermissionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -131,19 +126,22 @@ func (o *RelationshipToUserTeamPermissionData) UnmarshalJSON(bytes []byte) (err } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_user_team_user.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_user_team_user.go index 3444c860e..83d942349 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_user_team_user.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_user_team_user.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o RelationshipToUserTeamUser) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToUserTeamUser) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *RelationshipToUserTeamUserData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *RelationshipToUserTeamUser) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_user_team_user_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_user_team_user_data.go index 079215bb3..f10890169 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_user_team_user_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_user_team_user_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o RelationshipToUserTeamUserData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToUserTeamUserData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id"` Type *UserTeamUserType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -131,19 +126,22 @@ func (o *RelationshipToUserTeamUserData) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_users.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_users.go index 1864a1d1b..d1482bb14 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_users.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_relationship_to_users.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o RelationshipToUsers) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToUsers) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *[]RelationshipToUserData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -99,6 +94,7 @@ func (o *RelationshipToUsers) UnmarshalJSON(bytes []byte) (err error) { return err } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_response_meta_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_response_meta_attributes.go index dbec9d581..a90e699a5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_response_meta_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_response_meta_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o ResponseMetaAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ResponseMetaAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Page *Pagination `json:"page,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *ResponseMetaAttributes) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Page = all.Page + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_restriction_policy.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_restriction_policy.go index 0a9fcdef9..545dd47df 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_restriction_policy.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_restriction_policy.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -133,19 +134,13 @@ func (o RestrictionPolicy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RestrictionPolicy) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *RestrictionPolicyAttributes `json:"attributes"` Id *string `json:"id"` Type *RestrictionPolicyType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -162,27 +157,26 @@ func (o *RestrictionPolicy) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_restriction_policy_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_restriction_policy_attributes.go index c7b8bd2e3..06099ad4c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_restriction_policy_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_restriction_policy_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o RestrictionPolicyAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RestrictionPolicyAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Bindings *[]RestrictionPolicyBinding `json:"bindings"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Bindings == nil { return fmt.Errorf("required field bindings missing") @@ -99,6 +94,7 @@ func (o *RestrictionPolicyAttributes) UnmarshalJSON(bytes []byte) (err error) { return err } o.Bindings = *all.Bindings + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_restriction_policy_binding.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_restriction_policy_binding.go index 4534b823f..3d8436eb6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_restriction_policy_binding.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_restriction_policy_binding.go @@ -5,17 +5,19 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // RestrictionPolicyBinding Specifies which principals are associated with a relation. type RestrictionPolicyBinding struct { // An array of principals. A principal is a subject or group of subjects. - // Each principal is formatted as `type:id`. Supported types: `role` and `org`. + // Each principal is formatted as `type:id`. Supported types: `role`, `team` (beta), `user` (beta), and `org`. // The org ID can be obtained through the api/v2/current_user API. + // The user principal type accepts service account IDs. Principals []string `json:"principals"` // The role/level of access. Relation string `json:"relation"` @@ -106,18 +108,12 @@ func (o RestrictionPolicyBinding) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RestrictionPolicyBinding) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Principals *[]string `json:"principals"` Relation *string `json:"relation"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Principals == nil { return fmt.Errorf("required field principals missing") @@ -133,6 +129,7 @@ func (o *RestrictionPolicyBinding) UnmarshalJSON(bytes []byte) (err error) { } o.Principals = *all.Principals o.Relation = *all.Relation + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_restriction_policy_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_restriction_policy_response.go index cc1255c9b..3b02555ad 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_restriction_policy_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_restriction_policy_response.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o RestrictionPolicyResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RestrictionPolicyResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *RestrictionPolicy `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *RestrictionPolicyResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_restriction_policy_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_restriction_policy_type.go index d39ec533d..4f96f84c4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_restriction_policy_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_restriction_policy_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // RestrictionPolicyType Restriction policy type. @@ -61,47 +62,3 @@ func (v RestrictionPolicyType) IsValid() bool { func (v RestrictionPolicyType) Ptr() *RestrictionPolicyType { return &v } - -// NullableRestrictionPolicyType handles when a null is used for RestrictionPolicyType. -type NullableRestrictionPolicyType struct { - value *RestrictionPolicyType - isSet bool -} - -// Get returns the associated value. -func (v NullableRestrictionPolicyType) Get() *RestrictionPolicyType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRestrictionPolicyType) Set(val *RestrictionPolicyType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRestrictionPolicyType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableRestrictionPolicyType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRestrictionPolicyType initializes the struct as if Set has been called. -func NewNullableRestrictionPolicyType(val *RestrictionPolicyType) *NullableRestrictionPolicyType { - return &NullableRestrictionPolicyType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRestrictionPolicyType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRestrictionPolicyType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_restriction_policy_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_restriction_policy_update_request.go index cdc65bb42..c54135028 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_restriction_policy_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_restriction_policy_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o RestrictionPolicyUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RestrictionPolicyUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *RestrictionPolicy `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *RestrictionPolicyUpdateRequest) UnmarshalJSON(bytes []byte) (err error) } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role.go index 02d44481f..30452d8fd 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -178,7 +179,6 @@ func (o Role) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Role) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *RoleAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` @@ -186,12 +186,7 @@ func (o *Role) UnmarshalJSON(bytes []byte) (err error) { Type *RolesType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -202,35 +197,30 @@ func (o *Role) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_attributes.go index cb353b919..5db4d27c1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -190,7 +191,6 @@ func (o RoleAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CreatedAt *time.Time `json:"created_at,omitempty"` ModifiedAt *time.Time `json:"modified_at,omitempty"` @@ -198,12 +198,7 @@ func (o *RoleAttributes) UnmarshalJSON(bytes []byte) (err error) { UserCount *int64 `json:"user_count,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -215,6 +210,7 @@ func (o *RoleAttributes) UnmarshalJSON(bytes []byte) (err error) { o.ModifiedAt = all.ModifiedAt o.Name = all.Name o.UserCount = all.UserCount + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_clone.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_clone.go index 88fb6d64f..adb104768 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_clone.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_clone.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o RoleClone) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleClone) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *RoleCloneAttributes `json:"attributes"` Type *RolesType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -131,26 +126,25 @@ func (o *RoleClone) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_clone_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_clone_attributes.go index c087c4e90..991155121 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_clone_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_clone_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o RoleCloneAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleCloneAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Name *string `json:"name"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -99,6 +94,7 @@ func (o *RoleCloneAttributes) UnmarshalJSON(bytes []byte) (err error) { return err } o.Name = *all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_clone_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_clone_request.go index 88d913b05..ad07c0a1e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_clone_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_clone_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o RoleCloneRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleCloneRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *RoleClone `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *RoleCloneRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_create_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_create_attributes.go index 95d827bf2..5173ec82b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_create_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_create_attributes.go @@ -5,10 +5,11 @@ package datadogV2 import ( - "encoding/json" "fmt" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +153,13 @@ func (o RoleCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CreatedAt *time.Time `json:"created_at,omitempty"` ModifiedAt *time.Time `json:"modified_at,omitempty"` Name *string `json:"name"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -178,6 +173,7 @@ func (o *RoleCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { o.CreatedAt = all.CreatedAt o.ModifiedAt = all.ModifiedAt o.Name = *all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_create_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_create_data.go index 13b9ed6de..457d594f8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_create_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_create_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -147,19 +148,13 @@ func (o RoleCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *RoleCreateAttributes `json:"attributes"` Relationships *RoleRelationships `json:"relationships,omitempty"` Type *RolesType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -170,34 +165,29 @@ func (o *RoleCreateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_create_request.go index d8922bbb8..15769d9c1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o RoleCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *RoleCreateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *RoleCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_create_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_create_response.go index a6cbba1ec..65eba27b3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_create_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_create_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o RoleCreateResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleCreateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *RoleCreateResponseData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *RoleCreateResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_create_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_create_response_data.go index e0ffa33bf..2554784c8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_create_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_create_response_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -178,7 +179,6 @@ func (o RoleCreateResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleCreateResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *RoleCreateAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` @@ -186,12 +186,7 @@ func (o *RoleCreateResponseData) UnmarshalJSON(bytes []byte) (err error) { Type *RolesType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -202,35 +197,30 @@ func (o *RoleCreateResponseData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_relationships.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_relationships.go index ba6d8aa20..beb57e761 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_relationships.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_relationships.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o RoleRelationships) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Permissions *RelationshipToPermissions `json:"permissions,omitempty"` Users *RelationshipToUsers `json:"users,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,25 +128,24 @@ func (o *RoleRelationships) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Permissions != nil && all.Permissions.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Permissions = all.Permissions if all.Users != nil && all.Users.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Users = all.Users + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_response.go index bf3734635..f26f8816f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o RoleResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *Role `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *RoleResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_response_relationships.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_response_relationships.go index 81a62191a..29436b8d8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_response_relationships.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_response_relationships.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o RoleResponseRelationships) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleResponseRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Permissions *RelationshipToPermissions `json:"permissions,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *RoleResponseRelationships) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Permissions != nil && all.Permissions.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Permissions = all.Permissions + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_update_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_update_attributes.go index 9a4b6c97f..ac23c2944 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_update_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_update_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -157,19 +158,13 @@ func (o RoleUpdateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CreatedAt *time.Time `json:"created_at,omitempty"` ModifiedAt *time.Time `json:"modified_at,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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -180,6 +175,7 @@ func (o *RoleUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { o.CreatedAt = all.CreatedAt o.ModifiedAt = all.ModifiedAt o.Name = all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_update_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_update_data.go index dd05c9be1..b2259eb8a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_update_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_update_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -166,7 +167,6 @@ func (o RoleUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *RoleUpdateAttributes `json:"attributes"` Id *string `json:"id"` @@ -174,12 +174,7 @@ func (o *RoleUpdateData) UnmarshalJSON(bytes []byte) (err error) { Type *RolesType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -196,35 +191,30 @@ func (o *RoleUpdateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_update_request.go index 7b04596a2..5aa0cf467 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o RoleUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *RoleUpdateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *RoleUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_update_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_update_response.go index 7e4e1e51e..4bcc09dd2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_update_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_update_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o RoleUpdateResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleUpdateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *RoleUpdateResponseData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *RoleUpdateResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_update_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_update_response_data.go index 40b6b608e..e51aac422 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_update_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_role_update_response_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -178,7 +179,6 @@ func (o RoleUpdateResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleUpdateResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *RoleUpdateAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` @@ -186,12 +186,7 @@ func (o *RoleUpdateResponseData) UnmarshalJSON(bytes []byte) (err error) { Type *RolesType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -202,35 +197,30 @@ func (o *RoleUpdateResponseData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_roles_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_roles_response.go index 2158eb1d2..992b49400 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_roles_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_roles_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o RolesResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RolesResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []Role `json:"data,omitempty"` Meta *ResponseMetaAttributes `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *RolesResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Data = all.Data if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_roles_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_roles_sort.go index ae0c2276b..1dd0ed7b5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_roles_sort.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_roles_sort.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // RolesSort Sorting options for roles. @@ -71,47 +72,3 @@ func (v RolesSort) IsValid() bool { func (v RolesSort) Ptr() *RolesSort { return &v } - -// NullableRolesSort handles when a null is used for RolesSort. -type NullableRolesSort struct { - value *RolesSort - isSet bool -} - -// Get returns the associated value. -func (v NullableRolesSort) Get() *RolesSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRolesSort) Set(val *RolesSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRolesSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableRolesSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRolesSort initializes the struct as if Set has been called. -func NewNullableRolesSort(val *RolesSort) *NullableRolesSort { - return &NullableRolesSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRolesSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRolesSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_roles_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_roles_type.go index 02efa4b9e..19b7832f7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_roles_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_roles_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // RolesType Roles type. @@ -61,47 +62,3 @@ func (v RolesType) IsValid() bool { func (v RolesType) Ptr() *RolesType { return &v } - -// NullableRolesType handles when a null is used for RolesType. -type NullableRolesType struct { - value *RolesType - isSet bool -} - -// Get returns the associated value. -func (v NullableRolesType) Get() *RolesType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRolesType) Set(val *RolesType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRolesType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableRolesType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRolesType initializes the struct as if Set has been called. -func NewNullableRolesType(val *RolesType) *NullableRolesType { - return &NullableRolesType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRolesType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRolesType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregate_bucket_value.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregate_bucket_value.go index 0dc31c967..ca70f3f06 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregate_bucket_value.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregate_bucket_value.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // RUMAggregateBucketValue - A bucket value, can be either a timeseries or a single value. @@ -135,53 +135,3 @@ func (obj *RUMAggregateBucketValue) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableRUMAggregateBucketValue handles when a null is used for RUMAggregateBucketValue. -type NullableRUMAggregateBucketValue struct { - value *RUMAggregateBucketValue - isSet bool -} - -// Get returns the associated value. -func (v NullableRUMAggregateBucketValue) Get() *RUMAggregateBucketValue { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRUMAggregateBucketValue) Set(val *RUMAggregateBucketValue) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRUMAggregateBucketValue) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableRUMAggregateBucketValue) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRUMAggregateBucketValue initializes the struct as if Set has been called. -func NewNullableRUMAggregateBucketValue(val *RUMAggregateBucketValue) *NullableRUMAggregateBucketValue { - return &NullableRUMAggregateBucketValue{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRUMAggregateBucketValue) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRUMAggregateBucketValue) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregate_bucket_value_timeseries.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregate_bucket_value_timeseries.go index d1414e67b..78ebf70aa 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregate_bucket_value_timeseries.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregate_bucket_value_timeseries.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // RUMAggregateBucketValueTimeseries A timeseries array. @@ -47,5 +47,17 @@ func (o RUMAggregateBucketValueTimeseries) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMAggregateBucketValueTimeseries) UnmarshalJSON(bytes []byte) (err error) { - return json.Unmarshal(bytes, &o.Items) + if err = json.Unmarshal(bytes, &o.Items); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + if o.Items != nil && len(o.Items) > 0 { + for _, v := range o.Items { + if v.UnparsedObject != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + } + } + + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregate_bucket_value_timeseries_point.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregate_bucket_value_timeseries_point.go index 6b6c9c322..b2ef14c62 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregate_bucket_value_timeseries_point.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregate_bucket_value_timeseries_point.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -120,18 +121,12 @@ func (o RUMAggregateBucketValueTimeseriesPoint) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMAggregateBucketValueTimeseriesPoint) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Time *time.Time `json:"time,omitempty"` Value *float64 `json:"value,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -141,6 +136,7 @@ func (o *RUMAggregateBucketValueTimeseriesPoint) UnmarshalJSON(bytes []byte) (er } o.Time = all.Time o.Value = all.Value + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregate_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregate_request.go index 0457c8881..63711b668 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregate_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregate_request.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -215,7 +215,6 @@ func (o RUMAggregateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMAggregateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Compute []RUMCompute `json:"compute,omitempty"` Filter *RUMQueryFilter `json:"filter,omitempty"` @@ -224,12 +223,7 @@ func (o *RUMAggregateRequest) UnmarshalJSON(bytes []byte) (err error) { Page *RUMQueryPageOptions `json:"page,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -237,35 +231,30 @@ func (o *RUMAggregateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Compute = all.Compute if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Filter = all.Filter o.GroupBy = all.GroupBy if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Options = all.Options if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Page = all.Page + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregate_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregate_sort.go index f414bab08..9f0158768 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregate_sort.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregate_sort.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -185,7 +185,6 @@ func (o RUMAggregateSort) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMAggregateSort) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregation *RUMAggregationFunction `json:"aggregation,omitempty"` Metric *string `json:"metric,omitempty"` @@ -193,12 +192,7 @@ func (o *RUMAggregateSort) UnmarshalJSON(bytes []byte) (err error) { Type *RUMAggregateSortType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,37 +200,32 @@ func (o *RUMAggregateSort) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Aggregation; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Order; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregation = all.Aggregation + + hasInvalidField := false + if all.Aggregation != nil && !all.Aggregation.IsValid() { + hasInvalidField = true + } else { + o.Aggregation = all.Aggregation + } o.Metric = all.Metric - o.Order = all.Order - o.Type = all.Type + if all.Order != nil && !all.Order.IsValid() { + hasInvalidField = true + } else { + o.Order = all.Order + } + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregate_sort_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregate_sort_type.go index 1dec6a776..1ef77a420 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregate_sort_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregate_sort_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // RUMAggregateSortType The type of sorting algorithm. @@ -63,47 +64,3 @@ func (v RUMAggregateSortType) IsValid() bool { func (v RUMAggregateSortType) Ptr() *RUMAggregateSortType { return &v } - -// NullableRUMAggregateSortType handles when a null is used for RUMAggregateSortType. -type NullableRUMAggregateSortType struct { - value *RUMAggregateSortType - isSet bool -} - -// Get returns the associated value. -func (v NullableRUMAggregateSortType) Get() *RUMAggregateSortType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRUMAggregateSortType) Set(val *RUMAggregateSortType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRUMAggregateSortType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableRUMAggregateSortType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRUMAggregateSortType initializes the struct as if Set has been called. -func NewNullableRUMAggregateSortType(val *RUMAggregateSortType) *NullableRUMAggregateSortType { - return &NullableRUMAggregateSortType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRUMAggregateSortType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRUMAggregateSortType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregation_buckets_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregation_buckets_response.go index e56de20fb..b3380e593 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregation_buckets_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregation_buckets_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o RUMAggregationBucketsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMAggregationBucketsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Buckets []RUMBucketResponse `json:"buckets,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *RUMAggregationBucketsResponse) UnmarshalJSON(bytes []byte) (err error) return err } o.Buckets = all.Buckets + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregation_function.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregation_function.go index 1d1b64cba..b5c847e71 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregation_function.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_aggregation_function.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // RUMAggregationFunction An aggregation function. @@ -83,47 +84,3 @@ func (v RUMAggregationFunction) IsValid() bool { func (v RUMAggregationFunction) Ptr() *RUMAggregationFunction { return &v } - -// NullableRUMAggregationFunction handles when a null is used for RUMAggregationFunction. -type NullableRUMAggregationFunction struct { - value *RUMAggregationFunction - isSet bool -} - -// Get returns the associated value. -func (v NullableRUMAggregationFunction) Get() *RUMAggregationFunction { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRUMAggregationFunction) Set(val *RUMAggregationFunction) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRUMAggregationFunction) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableRUMAggregationFunction) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRUMAggregationFunction initializes the struct as if Set has been called. -func NewNullableRUMAggregationFunction(val *RUMAggregationFunction) *NullableRUMAggregationFunction { - return &NullableRUMAggregationFunction{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRUMAggregationFunction) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRUMAggregationFunction) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_analytics_aggregate_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_analytics_aggregate_response.go index 827ab306b..d7719e2c0 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_analytics_aggregate_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_analytics_aggregate_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o RUMAnalyticsAggregateResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMAnalyticsAggregateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *RUMAggregationBucketsResponse `json:"data,omitempty"` Links *RUMResponseLinks `json:"links,omitempty"` Meta *RUMResponseMetadata `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,33 +162,28 @@ func (o *RUMAnalyticsAggregateResponse) UnmarshalJSON(bytes []byte) (err error) } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Links = all.Links if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application.go index 0e62dae87..1b7315fd7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -133,19 +134,13 @@ func (o RUMApplication) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMApplication) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *RUMApplicationAttributes `json:"attributes"` Id *string `json:"id"` Type *RUMApplicationType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -162,27 +157,26 @@ func (o *RUMApplication) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_attributes.go index 5a284ae02..e57f7e6fa 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -359,7 +360,6 @@ func (o RUMApplicationAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMApplicationAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApplicationId *string `json:"application_id"` ClientToken *string `json:"client_token"` @@ -374,12 +374,7 @@ func (o *RUMApplicationAttributes) UnmarshalJSON(bytes []byte) (err error) { UpdatedByHandle *string `json:"updated_by_handle"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.ApplicationId == nil { return fmt.Errorf("required field application_id missing") @@ -425,6 +420,7 @@ func (o *RUMApplicationAttributes) UnmarshalJSON(bytes []byte) (err error) { o.Type = *all.Type o.UpdatedAt = *all.UpdatedAt o.UpdatedByHandle = *all.UpdatedByHandle + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_create.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_create.go index 7db4c1b3a..fd982670c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_create.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_create.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o RUMApplicationCreate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMApplicationCreate) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *RUMApplicationCreateAttributes `json:"attributes"` Type *RUMApplicationCreateType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -131,26 +126,25 @@ func (o *RUMApplicationCreate) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_create_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_create_attributes.go index 7bbc08bc9..7ea6c7b29 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_create_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_create_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o RUMApplicationCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMApplicationCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Name *string `json:"name"` Type *string `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -134,6 +129,7 @@ func (o *RUMApplicationCreateAttributes) UnmarshalJSON(bytes []byte) (err error) } o.Name = *all.Name o.Type = all.Type + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_create_request.go index d9deb7a46..e13c19142 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o RUMApplicationCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMApplicationCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *RUMApplicationCreate `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *RUMApplicationCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_create_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_create_type.go index 097c11d82..ed300dc9f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_create_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_create_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // RUMApplicationCreateType RUM application creation type. @@ -61,47 +62,3 @@ func (v RUMApplicationCreateType) IsValid() bool { func (v RUMApplicationCreateType) Ptr() *RUMApplicationCreateType { return &v } - -// NullableRUMApplicationCreateType handles when a null is used for RUMApplicationCreateType. -type NullableRUMApplicationCreateType struct { - value *RUMApplicationCreateType - isSet bool -} - -// Get returns the associated value. -func (v NullableRUMApplicationCreateType) Get() *RUMApplicationCreateType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRUMApplicationCreateType) Set(val *RUMApplicationCreateType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRUMApplicationCreateType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableRUMApplicationCreateType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRUMApplicationCreateType initializes the struct as if Set has been called. -func NewNullableRUMApplicationCreateType(val *RUMApplicationCreateType) *NullableRUMApplicationCreateType { - return &NullableRUMApplicationCreateType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRUMApplicationCreateType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRUMApplicationCreateType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_list.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_list.go index ed70d5e57..178d0429a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_list.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_list.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -15,6 +16,8 @@ import ( type RUMApplicationList struct { // RUM application list attributes. Attributes RUMApplicationListAttributes `json:"attributes"` + // RUM application ID. + Id *string `json:"id,omitempty"` // RUM application list type. Type RUMApplicationListType `json:"type"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct @@ -66,6 +69,34 @@ func (o *RUMApplicationList) SetAttributes(v RUMApplicationListAttributes) { o.Attributes = v } +// GetId returns the Id field value if set, zero value otherwise. +func (o *RUMApplicationList) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMApplicationList) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *RUMApplicationList) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *RUMApplicationList) SetId(v string) { + o.Id = &v +} + // GetType returns the Type field value. func (o *RUMApplicationList) GetType() RUMApplicationListType { if o == nil { @@ -96,6 +127,9 @@ func (o RUMApplicationList) MarshalJSON() ([]byte, error) { return json.Marshal(o.UnparsedObject) } toSerialize["attributes"] = o.Attributes + if o.Id != nil { + toSerialize["id"] = o.Id + } toSerialize["type"] = o.Type for key, value := range o.AdditionalProperties { @@ -106,18 +140,13 @@ func (o RUMApplicationList) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMApplicationList) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *RUMApplicationListAttributes `json:"attributes"` + Id *string `json:"id,omitempty"` Type *RUMApplicationListType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -127,30 +156,30 @@ func (o *RUMApplicationList) UnmarshalJSON(bytes []byte) (err error) { } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + o.Id = all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_list_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_list_attributes.go index 897210c67..c29db5f87 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_list_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_list_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -332,7 +333,6 @@ func (o RUMApplicationListAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMApplicationListAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ApplicationId *string `json:"application_id"` CreatedAt *int64 `json:"created_at"` @@ -346,12 +346,7 @@ func (o *RUMApplicationListAttributes) UnmarshalJSON(bytes []byte) (err error) { UpdatedByHandle *string `json:"updated_by_handle"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.ApplicationId == nil { return fmt.Errorf("required field application_id missing") @@ -393,6 +388,7 @@ func (o *RUMApplicationListAttributes) UnmarshalJSON(bytes []byte) (err error) { o.Type = *all.Type o.UpdatedAt = *all.UpdatedAt o.UpdatedByHandle = *all.UpdatedByHandle + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_list_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_list_type.go index e646e55f3..7a1a3a2f3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_list_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_list_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // RUMApplicationListType RUM application list type. @@ -61,47 +62,3 @@ func (v RUMApplicationListType) IsValid() bool { func (v RUMApplicationListType) Ptr() *RUMApplicationListType { return &v } - -// NullableRUMApplicationListType handles when a null is used for RUMApplicationListType. -type NullableRUMApplicationListType struct { - value *RUMApplicationListType - isSet bool -} - -// Get returns the associated value. -func (v NullableRUMApplicationListType) Get() *RUMApplicationListType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRUMApplicationListType) Set(val *RUMApplicationListType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRUMApplicationListType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableRUMApplicationListType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRUMApplicationListType initializes the struct as if Set has been called. -func NewNullableRUMApplicationListType(val *RUMApplicationListType) *NullableRUMApplicationListType { - return &NullableRUMApplicationListType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRUMApplicationListType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRUMApplicationListType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_response.go index efe09cd1c..b4e79b46c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o RUMApplicationResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMApplicationResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *RUMApplication `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *RUMApplicationResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_type.go index 287790d48..246fb251f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // RUMApplicationType RUM application response type. @@ -61,47 +62,3 @@ func (v RUMApplicationType) IsValid() bool { func (v RUMApplicationType) Ptr() *RUMApplicationType { return &v } - -// NullableRUMApplicationType handles when a null is used for RUMApplicationType. -type NullableRUMApplicationType struct { - value *RUMApplicationType - isSet bool -} - -// Get returns the associated value. -func (v NullableRUMApplicationType) Get() *RUMApplicationType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRUMApplicationType) Set(val *RUMApplicationType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRUMApplicationType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableRUMApplicationType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRUMApplicationType initializes the struct as if Set has been called. -func NewNullableRUMApplicationType(val *RUMApplicationType) *NullableRUMApplicationType { - return &NullableRUMApplicationType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRUMApplicationType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRUMApplicationType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_update.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_update.go index 0ab49f0f9..0ede89f49 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_update.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_update.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -139,19 +140,13 @@ func (o RUMApplicationUpdate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMApplicationUpdate) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *RUMApplicationUpdateAttributes `json:"attributes,omitempty"` Id *string `json:"id"` Type *RUMApplicationUpdateType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -165,27 +160,26 @@ func (o *RUMApplicationUpdate) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_update_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_update_attributes.go index cac4faaf9..6c6889a2c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_update_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_update_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o RUMApplicationUpdateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMApplicationUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Name *string `json:"name,omitempty"` Type *string `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *RUMApplicationUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) } o.Name = all.Name o.Type = all.Type + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_update_request.go index e30b2a66d..d87766010 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o RUMApplicationUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMApplicationUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *RUMApplicationUpdate `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *RUMApplicationUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_update_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_update_type.go index b71815ab6..4c1553422 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_update_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_application_update_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // RUMApplicationUpdateType RUM application update type. @@ -61,47 +62,3 @@ func (v RUMApplicationUpdateType) IsValid() bool { func (v RUMApplicationUpdateType) Ptr() *RUMApplicationUpdateType { return &v } - -// NullableRUMApplicationUpdateType handles when a null is used for RUMApplicationUpdateType. -type NullableRUMApplicationUpdateType struct { - value *RUMApplicationUpdateType - isSet bool -} - -// Get returns the associated value. -func (v NullableRUMApplicationUpdateType) Get() *RUMApplicationUpdateType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRUMApplicationUpdateType) Set(val *RUMApplicationUpdateType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRUMApplicationUpdateType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableRUMApplicationUpdateType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRUMApplicationUpdateType initializes the struct as if Set has been called. -func NewNullableRUMApplicationUpdateType(val *RUMApplicationUpdateType) *NullableRUMApplicationUpdateType { - return &NullableRUMApplicationUpdateType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRUMApplicationUpdateType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRUMApplicationUpdateType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_applications_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_applications_response.go index f1697ae1c..865d402aa 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_applications_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_applications_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o RUMApplicationsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMApplicationsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []RUMApplicationList `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *RUMApplicationsResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_bucket_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_bucket_response.go index 7e75455b3..1c3f4d25e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_bucket_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_bucket_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o RUMBucketResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMBucketResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { By map[string]string `json:"by,omitempty"` Computes map[string]RUMAggregateBucketValue `json:"computes,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *RUMBucketResponse) UnmarshalJSON(bytes []byte) (err error) { } o.By = all.By o.Computes = all.Computes + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_compute.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_compute.go index 2dd7a0c7c..4cffd59f8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_compute.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_compute.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -181,7 +182,6 @@ func (o RUMCompute) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMCompute) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregation *RUMAggregationFunction `json:"aggregation"` Interval *string `json:"interval,omitempty"` @@ -189,12 +189,7 @@ func (o *RUMCompute) UnmarshalJSON(bytes []byte) (err error) { Type *RUMComputeType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Aggregation == nil { return fmt.Errorf("required field aggregation missing") @@ -205,29 +200,28 @@ func (o *RUMCompute) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Aggregation; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregation = *all.Aggregation + + hasInvalidField := false + if !all.Aggregation.IsValid() { + hasInvalidField = true + } else { + o.Aggregation = *all.Aggregation + } o.Interval = all.Interval o.Metric = all.Metric - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_compute_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_compute_type.go index d6acce8df..acd29db5e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_compute_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_compute_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // RUMComputeType The type of compute. @@ -63,47 +64,3 @@ func (v RUMComputeType) IsValid() bool { func (v RUMComputeType) Ptr() *RUMComputeType { return &v } - -// NullableRUMComputeType handles when a null is used for RUMComputeType. -type NullableRUMComputeType struct { - value *RUMComputeType - isSet bool -} - -// Get returns the associated value. -func (v NullableRUMComputeType) Get() *RUMComputeType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRUMComputeType) Set(val *RUMComputeType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRUMComputeType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableRUMComputeType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRUMComputeType initializes the struct as if Set has been called. -func NewNullableRUMComputeType(val *RUMComputeType) *NullableRUMComputeType { - return &NullableRUMComputeType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRUMComputeType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRUMComputeType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_event.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_event.go index a3e734086..783b342d8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_event.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_event.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o RUMEvent) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMEvent) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *RUMEventAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *RUMEventType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *RUMEvent) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_event_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_event_attributes.go index dc1add717..ee2c87b20 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_event_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_event_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -188,7 +189,6 @@ func (o RUMEventAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMEventAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes map[string]interface{} `json:"attributes,omitempty"` Service *string `json:"service,omitempty"` @@ -196,12 +196,7 @@ func (o *RUMEventAttributes) UnmarshalJSON(bytes []byte) (err error) { Timestamp *time.Time `json:"timestamp,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -213,6 +208,7 @@ func (o *RUMEventAttributes) UnmarshalJSON(bytes []byte) (err error) { o.Service = all.Service o.Tags = all.Tags o.Timestamp = all.Timestamp + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_event_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_event_type.go index ab2f83962..15208b3ef 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_event_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_event_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // RUMEventType Type of the event. @@ -61,47 +62,3 @@ func (v RUMEventType) IsValid() bool { func (v RUMEventType) Ptr() *RUMEventType { return &v } - -// NullableRUMEventType handles when a null is used for RUMEventType. -type NullableRUMEventType struct { - value *RUMEventType - isSet bool -} - -// Get returns the associated value. -func (v NullableRUMEventType) Get() *RUMEventType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRUMEventType) Set(val *RUMEventType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRUMEventType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableRUMEventType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRUMEventType initializes the struct as if Set has been called. -func NewNullableRUMEventType(val *RUMEventType) *NullableRUMEventType { - return &NullableRUMEventType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRUMEventType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRUMEventType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_events_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_events_response.go index af306c206..141abc052 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_events_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_events_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o RUMEventsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMEventsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []RUMEvent `json:"data,omitempty"` Links *RUMResponseLinks `json:"links,omitempty"` Meta *RUMResponseMetadata `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,26 +162,25 @@ func (o *RUMEventsResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Data = all.Data if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Links = all.Links if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_group_by.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_group_by.go index 6fe45ef2e..fa2954c67 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_group_by.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_group_by.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -247,7 +248,6 @@ func (o RUMGroupBy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMGroupBy) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Facet *string `json:"facet"` Histogram *RUMGroupByHistogram `json:"histogram,omitempty"` @@ -257,12 +257,7 @@ func (o *RUMGroupBy) UnmarshalJSON(bytes []byte) (err error) { Total *RUMGroupByTotal `json:"total,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Facet == nil { return fmt.Errorf("required field facet missing") @@ -273,29 +268,28 @@ func (o *RUMGroupBy) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Facet = *all.Facet if all.Histogram != nil && all.Histogram.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Histogram = all.Histogram o.Limit = all.Limit o.Missing = all.Missing if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Sort = all.Sort o.Total = all.Total + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_group_by_histogram.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_group_by_histogram.go index c4637e86a..6a8bdf246 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_group_by_histogram.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_group_by_histogram.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -134,19 +135,13 @@ func (o RUMGroupByHistogram) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMGroupByHistogram) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Interval *float64 `json:"interval"` Max *float64 `json:"max"` Min *float64 `json:"min"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Interval == nil { return fmt.Errorf("required field interval missing") @@ -166,6 +161,7 @@ func (o *RUMGroupByHistogram) UnmarshalJSON(bytes []byte) (err error) { o.Interval = *all.Interval o.Max = *all.Max o.Min = *all.Min + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_group_by_missing.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_group_by_missing.go index 9c466d39a..89824ba20 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_group_by_missing.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_group_by_missing.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // RUMGroupByMissing - The value to use for logs that don't have the facet used to group by. @@ -103,53 +103,3 @@ func (obj *RUMGroupByMissing) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableRUMGroupByMissing handles when a null is used for RUMGroupByMissing. -type NullableRUMGroupByMissing struct { - value *RUMGroupByMissing - isSet bool -} - -// Get returns the associated value. -func (v NullableRUMGroupByMissing) Get() *RUMGroupByMissing { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRUMGroupByMissing) Set(val *RUMGroupByMissing) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRUMGroupByMissing) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableRUMGroupByMissing) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRUMGroupByMissing initializes the struct as if Set has been called. -func NewNullableRUMGroupByMissing(val *RUMGroupByMissing) *NullableRUMGroupByMissing { - return &NullableRUMGroupByMissing{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRUMGroupByMissing) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRUMGroupByMissing) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_group_by_total.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_group_by_total.go index 71ad650ea..8e416f05a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_group_by_total.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_group_by_total.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // RUMGroupByTotal - A resulting object to put the given computes in over all the matching records. @@ -135,53 +135,3 @@ func (obj *RUMGroupByTotal) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableRUMGroupByTotal handles when a null is used for RUMGroupByTotal. -type NullableRUMGroupByTotal struct { - value *RUMGroupByTotal - isSet bool -} - -// Get returns the associated value. -func (v NullableRUMGroupByTotal) Get() *RUMGroupByTotal { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRUMGroupByTotal) Set(val *RUMGroupByTotal) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRUMGroupByTotal) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableRUMGroupByTotal) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRUMGroupByTotal initializes the struct as if Set has been called. -func NewNullableRUMGroupByTotal(val *RUMGroupByTotal) *NullableRUMGroupByTotal { - return &NullableRUMGroupByTotal{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRUMGroupByTotal) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRUMGroupByTotal) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_query_filter.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_query_filter.go index d7d8dd3de..d7f289a9e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_query_filter.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_query_filter.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -160,19 +160,13 @@ func (o RUMQueryFilter) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMQueryFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { From *string `json:"from,omitempty"` Query *string `json:"query,omitempty"` To *string `json:"to,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -183,6 +177,7 @@ func (o *RUMQueryFilter) UnmarshalJSON(bytes []byte) (err error) { o.From = all.From o.Query = all.Query o.To = all.To + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_query_options.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_query_options.go index f92500d8b..1d6a17488 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_query_options.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_query_options.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -120,18 +120,12 @@ func (o RUMQueryOptions) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMQueryOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { TimeOffset *int64 `json:"time_offset,omitempty"` Timezone *string `json:"timezone,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -141,6 +135,7 @@ func (o *RUMQueryOptions) UnmarshalJSON(bytes []byte) (err error) { } o.TimeOffset = all.TimeOffset o.Timezone = all.Timezone + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_query_page_options.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_query_page_options.go index ab1ab7834..074262cfb 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_query_page_options.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_query_page_options.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -119,18 +119,12 @@ func (o RUMQueryPageOptions) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMQueryPageOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Cursor *string `json:"cursor,omitempty"` Limit *int32 `json:"limit,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -140,6 +134,7 @@ func (o *RUMQueryPageOptions) UnmarshalJSON(bytes []byte) (err error) { } o.Cursor = all.Cursor o.Limit = all.Limit + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_response_links.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_response_links.go index f1de23dbf..608c24a23 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_response_links.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_response_links.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -83,17 +83,11 @@ func (o RUMResponseLinks) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMResponseLinks) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Next *string `json:"next,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -102,6 +96,7 @@ func (o *RUMResponseLinks) UnmarshalJSON(bytes []byte) (err error) { return err } o.Next = all.Next + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_response_metadata.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_response_metadata.go index a98fce359..8c69ea6f0 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_response_metadata.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_response_metadata.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -215,7 +215,6 @@ func (o RUMResponseMetadata) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Elapsed *int64 `json:"elapsed,omitempty"` Page *RUMResponsePage `json:"page,omitempty"` @@ -224,12 +223,7 @@ func (o *RUMResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { Warnings []RUMWarning `json:"warnings,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -237,29 +231,28 @@ func (o *RUMResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Elapsed = all.Elapsed if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Page = all.Page o.RequestId = all.RequestId - o.Status = all.Status + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } o.Warnings = all.Warnings + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_response_page.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_response_page.go index 7c8042cf4..4ef5fd6ff 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_response_page.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_response_page.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o RUMResponsePage) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMResponsePage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { After *string `json:"after,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *RUMResponsePage) UnmarshalJSON(bytes []byte) (err error) { return err } o.After = all.After + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_response_status.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_response_status.go index 819ef57a0..37686cde7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_response_status.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_response_status.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // RUMResponseStatus The status of the response. @@ -63,47 +64,3 @@ func (v RUMResponseStatus) IsValid() bool { func (v RUMResponseStatus) Ptr() *RUMResponseStatus { return &v } - -// NullableRUMResponseStatus handles when a null is used for RUMResponseStatus. -type NullableRUMResponseStatus struct { - value *RUMResponseStatus - isSet bool -} - -// Get returns the associated value. -func (v NullableRUMResponseStatus) Get() *RUMResponseStatus { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRUMResponseStatus) Set(val *RUMResponseStatus) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRUMResponseStatus) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableRUMResponseStatus) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRUMResponseStatus initializes the struct as if Set has been called. -func NewNullableRUMResponseStatus(val *RUMResponseStatus) *NullableRUMResponseStatus { - return &NullableRUMResponseStatus{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRUMResponseStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRUMResponseStatus) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_search_events_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_search_events_request.go index 0f376fc93..1cb917fc5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_search_events_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_search_events_request.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -182,7 +182,6 @@ func (o RUMSearchEventsRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMSearchEventsRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Filter *RUMQueryFilter `json:"filter,omitempty"` Options *RUMQueryOptions `json:"options,omitempty"` @@ -190,12 +189,7 @@ func (o *RUMSearchEventsRequest) UnmarshalJSON(bytes []byte) (err error) { Sort *RUMSort `json:"sort,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -203,42 +197,33 @@ func (o *RUMSearchEventsRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Sort; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Filter = all.Filter if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Options = all.Options if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Page = all.Page - o.Sort = all.Sort + if all.Sort != nil && !all.Sort.IsValid() { + hasInvalidField = true + } else { + o.Sort = all.Sort + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_sort.go index c464e4db6..451f0a03a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_sort.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_sort.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // RUMSort Sort parameters when querying events. @@ -63,47 +64,3 @@ func (v RUMSort) IsValid() bool { func (v RUMSort) Ptr() *RUMSort { return &v } - -// NullableRUMSort handles when a null is used for RUMSort. -type NullableRUMSort struct { - value *RUMSort - isSet bool -} - -// Get returns the associated value. -func (v NullableRUMSort) Get() *RUMSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRUMSort) Set(val *RUMSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRUMSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableRUMSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRUMSort initializes the struct as if Set has been called. -func NewNullableRUMSort(val *RUMSort) *NullableRUMSort { - return &NullableRUMSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRUMSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRUMSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_sort_order.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_sort_order.go index 9010973d4..d2c0f7bdf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_sort_order.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_sort_order.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // RUMSortOrder The order to use, ascending or descending. @@ -63,47 +64,3 @@ func (v RUMSortOrder) IsValid() bool { func (v RUMSortOrder) Ptr() *RUMSortOrder { return &v } - -// NullableRUMSortOrder handles when a null is used for RUMSortOrder. -type NullableRUMSortOrder struct { - value *RUMSortOrder - isSet bool -} - -// Get returns the associated value. -func (v NullableRUMSortOrder) Get() *RUMSortOrder { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRUMSortOrder) Set(val *RUMSortOrder) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRUMSortOrder) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableRUMSortOrder) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRUMSortOrder initializes the struct as if Set has been called. -func NewNullableRUMSortOrder(val *RUMSortOrder) *NullableRUMSortOrder { - return &NullableRUMSortOrder{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRUMSortOrder) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRUMSortOrder) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_warning.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_warning.go index 8c0b4b708..a402e4a34 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_warning.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_rum_warning.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o RUMWarning) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMWarning) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Code *string `json:"code,omitempty"` Detail *string `json:"detail,omitempty"` Title *string `json:"title,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *RUMWarning) UnmarshalJSON(bytes []byte) (err error) { o.Code = all.Code o.Detail = all.Detail o.Title = all.Title + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_saml_assertion_attribute.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_saml_assertion_attribute.go index 473038aaf..2483d043a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_saml_assertion_attribute.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_saml_assertion_attribute.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -139,19 +140,13 @@ func (o SAMLAssertionAttribute) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SAMLAssertionAttribute) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SAMLAssertionAttributeAttributes `json:"attributes,omitempty"` Id *string `json:"id"` Type *SAMLAssertionAttributesType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -165,27 +160,26 @@ func (o *SAMLAssertionAttribute) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_saml_assertion_attribute_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_saml_assertion_attribute_attributes.go index 7f32794f4..41ab4798b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_saml_assertion_attribute_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_saml_assertion_attribute_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SAMLAssertionAttributeAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SAMLAssertionAttributeAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AttributeKey *string `json:"attribute_key,omitempty"` AttributeValue *string `json:"attribute_value,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *SAMLAssertionAttributeAttributes) UnmarshalJSON(bytes []byte) (err erro } o.AttributeKey = all.AttributeKey o.AttributeValue = all.AttributeValue + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_saml_assertion_attributes_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_saml_assertion_attributes_type.go index 60d3d33dd..8fd6c3a29 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_saml_assertion_attributes_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_saml_assertion_attributes_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SAMLAssertionAttributesType SAML assertion attributes resource type. @@ -61,47 +62,3 @@ func (v SAMLAssertionAttributesType) IsValid() bool { func (v SAMLAssertionAttributesType) Ptr() *SAMLAssertionAttributesType { return &v } - -// NullableSAMLAssertionAttributesType handles when a null is used for SAMLAssertionAttributesType. -type NullableSAMLAssertionAttributesType struct { - value *SAMLAssertionAttributesType - isSet bool -} - -// Get returns the associated value. -func (v NullableSAMLAssertionAttributesType) Get() *SAMLAssertionAttributesType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSAMLAssertionAttributesType) Set(val *SAMLAssertionAttributesType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSAMLAssertionAttributesType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSAMLAssertionAttributesType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSAMLAssertionAttributesType initializes the struct as if Set has been called. -func NewNullableSAMLAssertionAttributesType(val *SAMLAssertionAttributesType) *NullableSAMLAssertionAttributesType { - return &NullableSAMLAssertionAttributesType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSAMLAssertionAttributesType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSAMLAssertionAttributesType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_column.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_column.go index 2accfc024..5ba1bb75f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_column.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_column.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // ScalarColumn - A single column in a scalar query response. @@ -103,53 +103,3 @@ func (obj *ScalarColumn) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableScalarColumn handles when a null is used for ScalarColumn. -type NullableScalarColumn struct { - value *ScalarColumn - isSet bool -} - -// Get returns the associated value. -func (v NullableScalarColumn) Get() *ScalarColumn { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableScalarColumn) Set(val *ScalarColumn) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableScalarColumn) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableScalarColumn) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableScalarColumn initializes the struct as if Set has been called. -func NewNullableScalarColumn(val *ScalarColumn) *NullableScalarColumn { - return &NullableScalarColumn{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableScalarColumn) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableScalarColumn) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_query_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_query_request.go index 7f0f02e3f..f17d9b4b7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_query_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_query_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o ScalarFormulaQueryRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ScalarFormulaQueryRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *ScalarFormulaRequest `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *ScalarFormulaQueryRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_query_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_query_response.go index 2429b2379..529420fb5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_query_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_query_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o ScalarFormulaQueryResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ScalarFormulaQueryResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *ScalarResponse `json:"data,omitempty"` Errors *string `json:"errors,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *ScalarFormulaQueryResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data o.Errors = all.Errors + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_request.go index 9f43b6bfa..2e8164dec 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o ScalarFormulaRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ScalarFormulaRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *ScalarFormulaRequestAttributes `json:"attributes"` Type *ScalarFormulaRequestType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -131,26 +126,25 @@ func (o *ScalarFormulaRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_request_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_request_attributes.go index c85972747..96273c54c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_request_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_request_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -164,7 +165,6 @@ func (o ScalarFormulaRequestAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ScalarFormulaRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Formulas []QueryFormula `json:"formulas,omitempty"` From *int64 `json:"from"` @@ -172,12 +172,7 @@ func (o *ScalarFormulaRequestAttributes) UnmarshalJSON(bytes []byte) (err error) To *int64 `json:"to"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.From == nil { return fmt.Errorf("required field from missing") @@ -198,6 +193,7 @@ func (o *ScalarFormulaRequestAttributes) UnmarshalJSON(bytes []byte) (err error) o.From = *all.From o.Queries = *all.Queries o.To = *all.To + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_request_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_request_type.go index 21233c6fe..549a2c716 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_request_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_request_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ScalarFormulaRequestType The type of the resource. The value should always be scalar_request. @@ -61,47 +62,3 @@ func (v ScalarFormulaRequestType) IsValid() bool { func (v ScalarFormulaRequestType) Ptr() *ScalarFormulaRequestType { return &v } - -// NullableScalarFormulaRequestType handles when a null is used for ScalarFormulaRequestType. -type NullableScalarFormulaRequestType struct { - value *ScalarFormulaRequestType - isSet bool -} - -// Get returns the associated value. -func (v NullableScalarFormulaRequestType) Get() *ScalarFormulaRequestType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableScalarFormulaRequestType) Set(val *ScalarFormulaRequestType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableScalarFormulaRequestType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableScalarFormulaRequestType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableScalarFormulaRequestType initializes the struct as if Set has been called. -func NewNullableScalarFormulaRequestType(val *ScalarFormulaRequestType) *NullableScalarFormulaRequestType { - return &NullableScalarFormulaRequestType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableScalarFormulaRequestType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableScalarFormulaRequestType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_response_atrributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_response_atrributes.go index ff8468d77..a8be6c03b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_response_atrributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_response_atrributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o ScalarFormulaResponseAtrributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ScalarFormulaResponseAtrributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Columns []ScalarColumn `json:"columns,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *ScalarFormulaResponseAtrributes) UnmarshalJSON(bytes []byte) (err error return err } o.Columns = all.Columns + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_response_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_response_type.go index 60731c2ac..4b3910972 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_response_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_formula_response_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ScalarFormulaResponseType The type of the resource. The value should always be scalar_response. @@ -61,47 +62,3 @@ func (v ScalarFormulaResponseType) IsValid() bool { func (v ScalarFormulaResponseType) Ptr() *ScalarFormulaResponseType { return &v } - -// NullableScalarFormulaResponseType handles when a null is used for ScalarFormulaResponseType. -type NullableScalarFormulaResponseType struct { - value *ScalarFormulaResponseType - isSet bool -} - -// Get returns the associated value. -func (v NullableScalarFormulaResponseType) Get() *ScalarFormulaResponseType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableScalarFormulaResponseType) Set(val *ScalarFormulaResponseType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableScalarFormulaResponseType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableScalarFormulaResponseType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableScalarFormulaResponseType initializes the struct as if Set has been called. -func NewNullableScalarFormulaResponseType(val *ScalarFormulaResponseType) *NullableScalarFormulaResponseType { - return &NullableScalarFormulaResponseType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableScalarFormulaResponseType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableScalarFormulaResponseType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_meta.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_meta.go index 2af4c1aab..7c0c88fb4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_meta.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_meta.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -85,17 +85,11 @@ func (o ScalarMeta) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ScalarMeta) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Unit []Unit `json:"unit,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -104,6 +98,7 @@ func (o *ScalarMeta) UnmarshalJSON(bytes []byte) (err error) { return err } o.Unit = all.Unit + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_query.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_query.go index cace600c1..9c7162039 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_query.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_query.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // ScalarQuery - An individual scalar query to one of the basic Datadog data sources. @@ -103,53 +103,3 @@ func (obj *ScalarQuery) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableScalarQuery handles when a null is used for ScalarQuery. -type NullableScalarQuery struct { - value *ScalarQuery - isSet bool -} - -// Get returns the associated value. -func (v NullableScalarQuery) Get() *ScalarQuery { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableScalarQuery) Set(val *ScalarQuery) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableScalarQuery) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableScalarQuery) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableScalarQuery initializes the struct as if Set has been called. -func NewNullableScalarQuery(val *ScalarQuery) *NullableScalarQuery { - return &NullableScalarQuery{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableScalarQuery) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableScalarQuery) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_response.go index 7118b6ccd..7465b0e3a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_scalar_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -119,18 +119,12 @@ func (o ScalarResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ScalarResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *ScalarFormulaResponseAtrributes `json:"attributes,omitempty"` Type *ScalarFormulaResponseType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -138,26 +132,25 @@ func (o *ScalarResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter.go index e76e941b5..a2b0721d8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o SecurityFilter) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SecurityFilterAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *SecurityFilterType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *SecurityFilter) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_attributes.go index 6f10a3e45..e7dbcc91f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -280,7 +280,6 @@ func (o SecurityFilterAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityFilterAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ExclusionFilters []SecurityFilterExclusionFilterResponse `json:"exclusion_filters,omitempty"` FilteredDataType *SecurityFilterFilteredDataType `json:"filtered_data_type,omitempty"` @@ -291,12 +290,7 @@ func (o *SecurityFilterAttributes) UnmarshalJSON(bytes []byte) (err error) { Version *int32 `json:"version,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -304,24 +298,27 @@ func (o *SecurityFilterAttributes) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.FilteredDataType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.ExclusionFilters = all.ExclusionFilters - o.FilteredDataType = all.FilteredDataType + if all.FilteredDataType != nil && !all.FilteredDataType.IsValid() { + hasInvalidField = true + } else { + o.FilteredDataType = all.FilteredDataType + } o.IsBuiltin = all.IsBuiltin o.IsEnabled = all.IsEnabled o.Name = all.Name o.Query = all.Query o.Version = all.Version + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_create_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_create_attributes.go index 660b4710e..e358cb21d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_create_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_create_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -185,7 +186,6 @@ func (o SecurityFilterCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityFilterCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ExclusionFilters *[]SecurityFilterExclusionFilter `json:"exclusion_filters"` FilteredDataType *SecurityFilterFilteredDataType `json:"filtered_data_type"` @@ -194,12 +194,7 @@ func (o *SecurityFilterCreateAttributes) UnmarshalJSON(bytes []byte) (err error) Query *string `json:"query"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.ExclusionFilters == nil { return fmt.Errorf("required field exclusion_filters missing") @@ -222,22 +217,25 @@ func (o *SecurityFilterCreateAttributes) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.FilteredDataType; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.ExclusionFilters = *all.ExclusionFilters - o.FilteredDataType = *all.FilteredDataType + if !all.FilteredDataType.IsValid() { + hasInvalidField = true + } else { + o.FilteredDataType = *all.FilteredDataType + } o.IsEnabled = *all.IsEnabled o.Name = *all.Name o.Query = *all.Query + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_create_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_create_data.go index 35896926d..d3ac17ce1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_create_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_create_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o SecurityFilterCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityFilterCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SecurityFilterCreateAttributes `json:"attributes"` Type *SecurityFilterType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -131,26 +126,25 @@ func (o *SecurityFilterCreateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_create_request.go index d81ebdeed..9985720df 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o SecurityFilterCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityFilterCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SecurityFilterCreateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *SecurityFilterCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_exclusion_filter.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_exclusion_filter.go index 8c7f9d94f..7420c2b60 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_exclusion_filter.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_exclusion_filter.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o SecurityFilterExclusionFilter) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityFilterExclusionFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Name *string `json:"name"` Query *string `json:"query"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -131,6 +126,7 @@ func (o *SecurityFilterExclusionFilter) UnmarshalJSON(bytes []byte) (err error) } o.Name = *all.Name o.Query = *all.Query + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_exclusion_filter_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_exclusion_filter_response.go index dabf76440..3555104d6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_exclusion_filter_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_exclusion_filter_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SecurityFilterExclusionFilterResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityFilterExclusionFilterResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Name *string `json:"name,omitempty"` Query *string `json:"query,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *SecurityFilterExclusionFilterResponse) UnmarshalJSON(bytes []byte) (err } o.Name = all.Name o.Query = all.Query + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_filtered_data_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_filtered_data_type.go index ca1ebbea7..cddbe16cf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_filtered_data_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_filtered_data_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SecurityFilterFilteredDataType The filtered data type. @@ -61,47 +62,3 @@ func (v SecurityFilterFilteredDataType) IsValid() bool { func (v SecurityFilterFilteredDataType) Ptr() *SecurityFilterFilteredDataType { return &v } - -// NullableSecurityFilterFilteredDataType handles when a null is used for SecurityFilterFilteredDataType. -type NullableSecurityFilterFilteredDataType struct { - value *SecurityFilterFilteredDataType - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityFilterFilteredDataType) Get() *SecurityFilterFilteredDataType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityFilterFilteredDataType) Set(val *SecurityFilterFilteredDataType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityFilterFilteredDataType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityFilterFilteredDataType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityFilterFilteredDataType initializes the struct as if Set has been called. -func NewNullableSecurityFilterFilteredDataType(val *SecurityFilterFilteredDataType) *NullableSecurityFilterFilteredDataType { - return &NullableSecurityFilterFilteredDataType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityFilterFilteredDataType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityFilterFilteredDataType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_meta.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_meta.go index 9dc273a0c..cd98e3085 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_meta.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_meta.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SecurityFilterMeta) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityFilterMeta) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Warning *string `json:"warning,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *SecurityFilterMeta) UnmarshalJSON(bytes []byte) (err error) { return err } o.Warning = all.Warning + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_response.go index 0f09e4a67..246eda495 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SecurityFilterResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityFilterResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SecurityFilter `json:"data,omitempty"` Meta *SecurityFilterMeta `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,25 +128,24 @@ func (o *SecurityFilterResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_type.go index a95e33deb..94974ad38 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SecurityFilterType The type of the resource. The value should always be `security_filters`. @@ -61,47 +62,3 @@ func (v SecurityFilterType) IsValid() bool { func (v SecurityFilterType) Ptr() *SecurityFilterType { return &v } - -// NullableSecurityFilterType handles when a null is used for SecurityFilterType. -type NullableSecurityFilterType struct { - value *SecurityFilterType - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityFilterType) Get() *SecurityFilterType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityFilterType) Set(val *SecurityFilterType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityFilterType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityFilterType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityFilterType initializes the struct as if Set has been called. -func NewNullableSecurityFilterType(val *SecurityFilterType) *NullableSecurityFilterType { - return &NullableSecurityFilterType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityFilterType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityFilterType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_update_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_update_attributes.go index 7c47a688e..f30a7720e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_update_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_update_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -247,7 +247,6 @@ func (o SecurityFilterUpdateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityFilterUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ExclusionFilters []SecurityFilterExclusionFilter `json:"exclusion_filters,omitempty"` FilteredDataType *SecurityFilterFilteredDataType `json:"filtered_data_type,omitempty"` @@ -257,12 +256,7 @@ func (o *SecurityFilterUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) Version *int32 `json:"version,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -270,23 +264,26 @@ func (o *SecurityFilterUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.FilteredDataType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.ExclusionFilters = all.ExclusionFilters - o.FilteredDataType = all.FilteredDataType + if all.FilteredDataType != nil && !all.FilteredDataType.IsValid() { + hasInvalidField = true + } else { + o.FilteredDataType = all.FilteredDataType + } o.IsEnabled = all.IsEnabled o.Name = all.Name o.Query = all.Query o.Version = all.Version + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_update_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_update_data.go index 46450a85a..645fb7960 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_update_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_update_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o SecurityFilterUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityFilterUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SecurityFilterUpdateAttributes `json:"attributes"` Type *SecurityFilterType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -131,26 +126,25 @@ func (o *SecurityFilterUpdateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_update_request.go index 744ed06a3..b69e37abd 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filter_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o SecurityFilterUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityFilterUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SecurityFilterUpdateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *SecurityFilterUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filters_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filters_response.go index 423a3f0c6..e88715d7f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filters_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_filters_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SecurityFiltersResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityFiltersResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []SecurityFilter `json:"data,omitempty"` Meta *SecurityFilterMeta `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *SecurityFiltersResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Data = all.Data if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_filter.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_filter.go index e6e10bfcc..ec05887bf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_filter.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_filter.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SecurityMonitoringFilter) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Action *SecurityMonitoringFilterAction `json:"action,omitempty"` Query *string `json:"query,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,19 +128,22 @@ func (o *SecurityMonitoringFilter) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Action; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.Action != nil && !all.Action.IsValid() { + hasInvalidField = true + } else { + o.Action = all.Action } - o.Action = all.Action o.Query = all.Query + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_filter_action.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_filter_action.go index 4cf829901..46de72e68 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_filter_action.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_filter_action.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SecurityMonitoringFilterAction The type of filtering action. @@ -63,47 +64,3 @@ func (v SecurityMonitoringFilterAction) IsValid() bool { func (v SecurityMonitoringFilterAction) Ptr() *SecurityMonitoringFilterAction { return &v } - -// NullableSecurityMonitoringFilterAction handles when a null is used for SecurityMonitoringFilterAction. -type NullableSecurityMonitoringFilterAction struct { - value *SecurityMonitoringFilterAction - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringFilterAction) Get() *SecurityMonitoringFilterAction { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringFilterAction) Set(val *SecurityMonitoringFilterAction) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringFilterAction) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringFilterAction) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringFilterAction initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringFilterAction(val *SecurityMonitoringFilterAction) *NullableSecurityMonitoringFilterAction { - return &NullableSecurityMonitoringFilterAction{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringFilterAction) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringFilterAction) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_list_rules_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_list_rules_response.go index bfe6aa756..08446bcda 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_list_rules_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_list_rules_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SecurityMonitoringListRulesResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringListRulesResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []SecurityMonitoringRuleResponse `json:"data,omitempty"` Meta *ResponseMetaAttributes `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *SecurityMonitoringListRulesResponse) UnmarshalJSON(bytes []byte) (err e } else { return err } + + hasInvalidField := false o.Data = all.Data if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_case.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_case.go index 2c88dbf5b..0a700160c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_case.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_case.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -182,7 +182,6 @@ func (o SecurityMonitoringRuleCase) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringRuleCase) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Condition *string `json:"condition,omitempty"` Name *string `json:"name,omitempty"` @@ -190,12 +189,7 @@ func (o *SecurityMonitoringRuleCase) UnmarshalJSON(bytes []byte) (err error) { Status *SecurityMonitoringRuleSeverity `json:"status,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -203,21 +197,24 @@ func (o *SecurityMonitoringRuleCase) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Condition = all.Condition o.Name = all.Name o.Notifications = all.Notifications - o.Status = all.Status + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_case_create.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_case_create.go index dc9b8daa4..32793031c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_case_create.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_case_create.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -177,7 +178,6 @@ func (o SecurityMonitoringRuleCaseCreate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringRuleCaseCreate) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Condition *string `json:"condition,omitempty"` Name *string `json:"name,omitempty"` @@ -185,12 +185,7 @@ func (o *SecurityMonitoringRuleCaseCreate) UnmarshalJSON(bytes []byte) (err erro Status *SecurityMonitoringRuleSeverity `json:"status"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Status == nil { return fmt.Errorf("required field status missing") @@ -201,21 +196,24 @@ func (o *SecurityMonitoringRuleCaseCreate) UnmarshalJSON(bytes []byte) (err erro } else { return err } - if v := all.Status; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Condition = all.Condition o.Name = all.Name o.Notifications = all.Notifications - o.Status = *all.Status + if !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = *all.Status + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_create_payload.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_create_payload.go index ffa7505be..d56de3dec 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_create_payload.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_create_payload.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // SecurityMonitoringRuleCreatePayload - Create a new rule. @@ -135,53 +135,3 @@ func (obj *SecurityMonitoringRuleCreatePayload) GetActualInstance() interface{} // all schemas are nil return nil } - -// NullableSecurityMonitoringRuleCreatePayload handles when a null is used for SecurityMonitoringRuleCreatePayload. -type NullableSecurityMonitoringRuleCreatePayload struct { - value *SecurityMonitoringRuleCreatePayload - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleCreatePayload) Get() *SecurityMonitoringRuleCreatePayload { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleCreatePayload) Set(val *SecurityMonitoringRuleCreatePayload) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleCreatePayload) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableSecurityMonitoringRuleCreatePayload) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleCreatePayload initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleCreatePayload(val *SecurityMonitoringRuleCreatePayload) *NullableSecurityMonitoringRuleCreatePayload { - return &NullableSecurityMonitoringRuleCreatePayload{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleCreatePayload) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleCreatePayload) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_detection_method.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_detection_method.go index 7f8d1e87b..38954c1ae 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_detection_method.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_detection_method.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SecurityMonitoringRuleDetectionMethod The detection method. @@ -71,47 +72,3 @@ func (v SecurityMonitoringRuleDetectionMethod) IsValid() bool { func (v SecurityMonitoringRuleDetectionMethod) Ptr() *SecurityMonitoringRuleDetectionMethod { return &v } - -// NullableSecurityMonitoringRuleDetectionMethod handles when a null is used for SecurityMonitoringRuleDetectionMethod. -type NullableSecurityMonitoringRuleDetectionMethod struct { - value *SecurityMonitoringRuleDetectionMethod - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleDetectionMethod) Get() *SecurityMonitoringRuleDetectionMethod { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleDetectionMethod) Set(val *SecurityMonitoringRuleDetectionMethod) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleDetectionMethod) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringRuleDetectionMethod) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleDetectionMethod initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleDetectionMethod(val *SecurityMonitoringRuleDetectionMethod) *NullableSecurityMonitoringRuleDetectionMethod { - return &NullableSecurityMonitoringRuleDetectionMethod{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleDetectionMethod) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleDetectionMethod) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_evaluation_window.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_evaluation_window.go index 6d0034c74..e15be16c0 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_evaluation_window.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_evaluation_window.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SecurityMonitoringRuleEvaluationWindow A time window is specified to match when at least one of the cases matches true. This is a sliding window @@ -76,47 +77,3 @@ func (v SecurityMonitoringRuleEvaluationWindow) IsValid() bool { func (v SecurityMonitoringRuleEvaluationWindow) Ptr() *SecurityMonitoringRuleEvaluationWindow { return &v } - -// NullableSecurityMonitoringRuleEvaluationWindow handles when a null is used for SecurityMonitoringRuleEvaluationWindow. -type NullableSecurityMonitoringRuleEvaluationWindow struct { - value *SecurityMonitoringRuleEvaluationWindow - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleEvaluationWindow) Get() *SecurityMonitoringRuleEvaluationWindow { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleEvaluationWindow) Set(val *SecurityMonitoringRuleEvaluationWindow) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleEvaluationWindow) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringRuleEvaluationWindow) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleEvaluationWindow initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleEvaluationWindow(val *SecurityMonitoringRuleEvaluationWindow) *NullableSecurityMonitoringRuleEvaluationWindow { - return &NullableSecurityMonitoringRuleEvaluationWindow{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleEvaluationWindow) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleEvaluationWindow) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_hardcoded_evaluator_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_hardcoded_evaluator_type.go index 89c531351..159d2bbbf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_hardcoded_evaluator_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_hardcoded_evaluator_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SecurityMonitoringRuleHardcodedEvaluatorType Hardcoded evaluator type. @@ -61,47 +62,3 @@ func (v SecurityMonitoringRuleHardcodedEvaluatorType) IsValid() bool { func (v SecurityMonitoringRuleHardcodedEvaluatorType) Ptr() *SecurityMonitoringRuleHardcodedEvaluatorType { return &v } - -// NullableSecurityMonitoringRuleHardcodedEvaluatorType handles when a null is used for SecurityMonitoringRuleHardcodedEvaluatorType. -type NullableSecurityMonitoringRuleHardcodedEvaluatorType struct { - value *SecurityMonitoringRuleHardcodedEvaluatorType - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleHardcodedEvaluatorType) Get() *SecurityMonitoringRuleHardcodedEvaluatorType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleHardcodedEvaluatorType) Set(val *SecurityMonitoringRuleHardcodedEvaluatorType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleHardcodedEvaluatorType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringRuleHardcodedEvaluatorType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleHardcodedEvaluatorType initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleHardcodedEvaluatorType(val *SecurityMonitoringRuleHardcodedEvaluatorType) *NullableSecurityMonitoringRuleHardcodedEvaluatorType { - return &NullableSecurityMonitoringRuleHardcodedEvaluatorType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleHardcodedEvaluatorType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleHardcodedEvaluatorType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_impossible_travel_options.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_impossible_travel_options.go index 7e2d84813..dfa65ea26 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_impossible_travel_options.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_impossible_travel_options.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -83,17 +83,11 @@ func (o SecurityMonitoringRuleImpossibleTravelOptions) MarshalJSON() ([]byte, er // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringRuleImpossibleTravelOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { BaselineUserLocations *bool `json:"baselineUserLocations,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -102,6 +96,7 @@ func (o *SecurityMonitoringRuleImpossibleTravelOptions) UnmarshalJSON(bytes []by return err } o.BaselineUserLocations = all.BaselineUserLocations + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_keep_alive.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_keep_alive.go index 925b1e79e..30f75a2e6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_keep_alive.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_keep_alive.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SecurityMonitoringRuleKeepAlive Once a signal is generated, the signal will remain “open” if a case is matched at least once within @@ -80,47 +81,3 @@ func (v SecurityMonitoringRuleKeepAlive) IsValid() bool { func (v SecurityMonitoringRuleKeepAlive) Ptr() *SecurityMonitoringRuleKeepAlive { return &v } - -// NullableSecurityMonitoringRuleKeepAlive handles when a null is used for SecurityMonitoringRuleKeepAlive. -type NullableSecurityMonitoringRuleKeepAlive struct { - value *SecurityMonitoringRuleKeepAlive - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleKeepAlive) Get() *SecurityMonitoringRuleKeepAlive { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleKeepAlive) Set(val *SecurityMonitoringRuleKeepAlive) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleKeepAlive) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringRuleKeepAlive) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleKeepAlive initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleKeepAlive(val *SecurityMonitoringRuleKeepAlive) *NullableSecurityMonitoringRuleKeepAlive { - return &NullableSecurityMonitoringRuleKeepAlive{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleKeepAlive) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleKeepAlive) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_max_signal_duration.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_max_signal_duration.go index 9d6e0f616..ad880c9ff 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_max_signal_duration.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_max_signal_duration.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SecurityMonitoringRuleMaxSignalDuration A signal will “close” regardless of the query being matched once the time exceeds the maximum duration. @@ -84,47 +85,3 @@ func (v SecurityMonitoringRuleMaxSignalDuration) IsValid() bool { func (v SecurityMonitoringRuleMaxSignalDuration) Ptr() *SecurityMonitoringRuleMaxSignalDuration { return &v } - -// NullableSecurityMonitoringRuleMaxSignalDuration handles when a null is used for SecurityMonitoringRuleMaxSignalDuration. -type NullableSecurityMonitoringRuleMaxSignalDuration struct { - value *SecurityMonitoringRuleMaxSignalDuration - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleMaxSignalDuration) Get() *SecurityMonitoringRuleMaxSignalDuration { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleMaxSignalDuration) Set(val *SecurityMonitoringRuleMaxSignalDuration) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleMaxSignalDuration) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringRuleMaxSignalDuration) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleMaxSignalDuration initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleMaxSignalDuration(val *SecurityMonitoringRuleMaxSignalDuration) *NullableSecurityMonitoringRuleMaxSignalDuration { - return &NullableSecurityMonitoringRuleMaxSignalDuration{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleMaxSignalDuration) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleMaxSignalDuration) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_new_value_options.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_new_value_options.go index 500f7c833..ce33ed782 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_new_value_options.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_new_value_options.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -194,7 +194,6 @@ func (o SecurityMonitoringRuleNewValueOptions) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringRuleNewValueOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ForgetAfter *SecurityMonitoringRuleNewValueOptionsForgetAfter `json:"forgetAfter,omitempty"` LearningDuration *SecurityMonitoringRuleNewValueOptionsLearningDuration `json:"learningDuration,omitempty"` @@ -202,12 +201,7 @@ func (o *SecurityMonitoringRuleNewValueOptions) UnmarshalJSON(bytes []byte) (err LearningThreshold *SecurityMonitoringRuleNewValueOptionsLearningThreshold `json:"learningThreshold,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -215,45 +209,36 @@ func (o *SecurityMonitoringRuleNewValueOptions) UnmarshalJSON(bytes []byte) (err } else { return err } - if v := all.ForgetAfter; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.ForgetAfter != nil && !all.ForgetAfter.IsValid() { + hasInvalidField = true + } else { + o.ForgetAfter = all.ForgetAfter } - if v := all.LearningDuration; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + if all.LearningDuration != nil && !all.LearningDuration.IsValid() { + hasInvalidField = true + } else { + o.LearningDuration = all.LearningDuration } - if v := all.LearningMethod; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + if all.LearningMethod != nil && !all.LearningMethod.IsValid() { + hasInvalidField = true + } else { + o.LearningMethod = all.LearningMethod } - if v := all.LearningThreshold; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + if all.LearningThreshold != nil && !all.LearningThreshold.IsValid() { + hasInvalidField = true + } else { + o.LearningThreshold = all.LearningThreshold } - o.ForgetAfter = all.ForgetAfter - o.LearningDuration = all.LearningDuration - o.LearningMethod = all.LearningMethod - o.LearningThreshold = all.LearningThreshold + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_new_value_options_forget_after.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_new_value_options_forget_after.go index 46f8a6737..f80b9b267 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_new_value_options_forget_after.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_new_value_options_forget_after.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SecurityMonitoringRuleNewValueOptionsForgetAfter The duration in days after which a learned value is forgotten. @@ -71,47 +72,3 @@ func (v SecurityMonitoringRuleNewValueOptionsForgetAfter) IsValid() bool { func (v SecurityMonitoringRuleNewValueOptionsForgetAfter) Ptr() *SecurityMonitoringRuleNewValueOptionsForgetAfter { return &v } - -// NullableSecurityMonitoringRuleNewValueOptionsForgetAfter handles when a null is used for SecurityMonitoringRuleNewValueOptionsForgetAfter. -type NullableSecurityMonitoringRuleNewValueOptionsForgetAfter struct { - value *SecurityMonitoringRuleNewValueOptionsForgetAfter - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleNewValueOptionsForgetAfter) Get() *SecurityMonitoringRuleNewValueOptionsForgetAfter { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleNewValueOptionsForgetAfter) Set(val *SecurityMonitoringRuleNewValueOptionsForgetAfter) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleNewValueOptionsForgetAfter) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringRuleNewValueOptionsForgetAfter) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleNewValueOptionsForgetAfter initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleNewValueOptionsForgetAfter(val *SecurityMonitoringRuleNewValueOptionsForgetAfter) *NullableSecurityMonitoringRuleNewValueOptionsForgetAfter { - return &NullableSecurityMonitoringRuleNewValueOptionsForgetAfter{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleNewValueOptionsForgetAfter) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleNewValueOptionsForgetAfter) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_new_value_options_learning_duration.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_new_value_options_learning_duration.go index a8e136384..cb092a099 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_new_value_options_learning_duration.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_new_value_options_learning_duration.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SecurityMonitoringRuleNewValueOptionsLearningDuration The duration in days during which values are learned, and after which signals will be generated for values that @@ -66,47 +67,3 @@ func (v SecurityMonitoringRuleNewValueOptionsLearningDuration) IsValid() bool { func (v SecurityMonitoringRuleNewValueOptionsLearningDuration) Ptr() *SecurityMonitoringRuleNewValueOptionsLearningDuration { return &v } - -// NullableSecurityMonitoringRuleNewValueOptionsLearningDuration handles when a null is used for SecurityMonitoringRuleNewValueOptionsLearningDuration. -type NullableSecurityMonitoringRuleNewValueOptionsLearningDuration struct { - value *SecurityMonitoringRuleNewValueOptionsLearningDuration - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleNewValueOptionsLearningDuration) Get() *SecurityMonitoringRuleNewValueOptionsLearningDuration { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningDuration) Set(val *SecurityMonitoringRuleNewValueOptionsLearningDuration) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleNewValueOptionsLearningDuration) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningDuration) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleNewValueOptionsLearningDuration initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleNewValueOptionsLearningDuration(val *SecurityMonitoringRuleNewValueOptionsLearningDuration) *NullableSecurityMonitoringRuleNewValueOptionsLearningDuration { - return &NullableSecurityMonitoringRuleNewValueOptionsLearningDuration{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleNewValueOptionsLearningDuration) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningDuration) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_new_value_options_learning_method.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_new_value_options_learning_method.go index 69e971f83..d7969747a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_new_value_options_learning_method.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_new_value_options_learning_method.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SecurityMonitoringRuleNewValueOptionsLearningMethod The learning method used to determine when signals should be generated for values that weren't learned. @@ -63,47 +64,3 @@ func (v SecurityMonitoringRuleNewValueOptionsLearningMethod) IsValid() bool { func (v SecurityMonitoringRuleNewValueOptionsLearningMethod) Ptr() *SecurityMonitoringRuleNewValueOptionsLearningMethod { return &v } - -// NullableSecurityMonitoringRuleNewValueOptionsLearningMethod handles when a null is used for SecurityMonitoringRuleNewValueOptionsLearningMethod. -type NullableSecurityMonitoringRuleNewValueOptionsLearningMethod struct { - value *SecurityMonitoringRuleNewValueOptionsLearningMethod - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) Get() *SecurityMonitoringRuleNewValueOptionsLearningMethod { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) Set(val *SecurityMonitoringRuleNewValueOptionsLearningMethod) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleNewValueOptionsLearningMethod initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleNewValueOptionsLearningMethod(val *SecurityMonitoringRuleNewValueOptionsLearningMethod) *NullableSecurityMonitoringRuleNewValueOptionsLearningMethod { - return &NullableSecurityMonitoringRuleNewValueOptionsLearningMethod{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_new_value_options_learning_threshold.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_new_value_options_learning_threshold.go index 03291d146..2c8082317 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_new_value_options_learning_threshold.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_new_value_options_learning_threshold.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SecurityMonitoringRuleNewValueOptionsLearningThreshold A number of occurrences after which signals will be generated for values that weren't learned. @@ -63,47 +64,3 @@ func (v SecurityMonitoringRuleNewValueOptionsLearningThreshold) IsValid() bool { func (v SecurityMonitoringRuleNewValueOptionsLearningThreshold) Ptr() *SecurityMonitoringRuleNewValueOptionsLearningThreshold { return &v } - -// NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold handles when a null is used for SecurityMonitoringRuleNewValueOptionsLearningThreshold. -type NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold struct { - value *SecurityMonitoringRuleNewValueOptionsLearningThreshold - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold) Get() *SecurityMonitoringRuleNewValueOptionsLearningThreshold { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold) Set(val *SecurityMonitoringRuleNewValueOptionsLearningThreshold) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleNewValueOptionsLearningThreshold initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleNewValueOptionsLearningThreshold(val *SecurityMonitoringRuleNewValueOptionsLearningThreshold) *NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold { - return &NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_options.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_options.go index 63562ca80..e7322e0aa 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_options.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_options.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -353,7 +353,6 @@ func (o SecurityMonitoringRuleOptions) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringRuleOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ComplianceRuleOptions *CloudConfigurationComplianceRuleOptions `json:"complianceRuleOptions,omitempty"` DecreaseCriticalityBasedOnEnv *bool `json:"decreaseCriticalityBasedOnEnv,omitempty"` @@ -366,12 +365,7 @@ func (o *SecurityMonitoringRuleOptions) UnmarshalJSON(bytes []byte) (err error) NewValueOptions *SecurityMonitoringRuleNewValueOptions `json:"newValueOptions,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -379,79 +373,54 @@ func (o *SecurityMonitoringRuleOptions) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.DetectionMethod; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.EvaluationWindow; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.HardcodedEvaluatorType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.KeepAlive; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.MaxSignalDuration; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.ComplianceRuleOptions != nil && all.ComplianceRuleOptions.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ComplianceRuleOptions = all.ComplianceRuleOptions o.DecreaseCriticalityBasedOnEnv = all.DecreaseCriticalityBasedOnEnv - o.DetectionMethod = all.DetectionMethod - o.EvaluationWindow = all.EvaluationWindow - o.HardcodedEvaluatorType = all.HardcodedEvaluatorType + if all.DetectionMethod != nil && !all.DetectionMethod.IsValid() { + hasInvalidField = true + } else { + o.DetectionMethod = all.DetectionMethod + } + if all.EvaluationWindow != nil && !all.EvaluationWindow.IsValid() { + hasInvalidField = true + } else { + o.EvaluationWindow = all.EvaluationWindow + } + if all.HardcodedEvaluatorType != nil && !all.HardcodedEvaluatorType.IsValid() { + hasInvalidField = true + } else { + o.HardcodedEvaluatorType = all.HardcodedEvaluatorType + } if all.ImpossibleTravelOptions != nil && all.ImpossibleTravelOptions.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ImpossibleTravelOptions = all.ImpossibleTravelOptions - o.KeepAlive = all.KeepAlive - o.MaxSignalDuration = all.MaxSignalDuration + if all.KeepAlive != nil && !all.KeepAlive.IsValid() { + hasInvalidField = true + } else { + o.KeepAlive = all.KeepAlive + } + if all.MaxSignalDuration != nil && !all.MaxSignalDuration.IsValid() { + hasInvalidField = true + } else { + o.MaxSignalDuration = all.MaxSignalDuration + } if all.NewValueOptions != nil && all.NewValueOptions.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.NewValueOptions = all.NewValueOptions + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_query.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_query.go index 2ecee3966..0733f8c70 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_query.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_query.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // SecurityMonitoringRuleQuery - Query for matching rule. @@ -103,53 +103,3 @@ func (obj *SecurityMonitoringRuleQuery) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableSecurityMonitoringRuleQuery handles when a null is used for SecurityMonitoringRuleQuery. -type NullableSecurityMonitoringRuleQuery struct { - value *SecurityMonitoringRuleQuery - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleQuery) Get() *SecurityMonitoringRuleQuery { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleQuery) Set(val *SecurityMonitoringRuleQuery) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleQuery) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableSecurityMonitoringRuleQuery) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleQuery initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleQuery(val *SecurityMonitoringRuleQuery) *NullableSecurityMonitoringRuleQuery { - return &NullableSecurityMonitoringRuleQuery{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleQuery) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleQuery) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_query_aggregation.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_query_aggregation.go index f2a72094c..af8ac8cff 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_query_aggregation.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_query_aggregation.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SecurityMonitoringRuleQueryAggregation The aggregation type. @@ -75,47 +76,3 @@ func (v SecurityMonitoringRuleQueryAggregation) IsValid() bool { func (v SecurityMonitoringRuleQueryAggregation) Ptr() *SecurityMonitoringRuleQueryAggregation { return &v } - -// NullableSecurityMonitoringRuleQueryAggregation handles when a null is used for SecurityMonitoringRuleQueryAggregation. -type NullableSecurityMonitoringRuleQueryAggregation struct { - value *SecurityMonitoringRuleQueryAggregation - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleQueryAggregation) Get() *SecurityMonitoringRuleQueryAggregation { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleQueryAggregation) Set(val *SecurityMonitoringRuleQueryAggregation) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleQueryAggregation) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringRuleQueryAggregation) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleQueryAggregation initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleQueryAggregation(val *SecurityMonitoringRuleQueryAggregation) *NullableSecurityMonitoringRuleQueryAggregation { - return &NullableSecurityMonitoringRuleQueryAggregation{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleQueryAggregation) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleQueryAggregation) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_response.go index 1faa789a7..c04b20c0c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // SecurityMonitoringRuleResponse - Create a new rule. @@ -103,53 +103,3 @@ func (obj *SecurityMonitoringRuleResponse) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableSecurityMonitoringRuleResponse handles when a null is used for SecurityMonitoringRuleResponse. -type NullableSecurityMonitoringRuleResponse struct { - value *SecurityMonitoringRuleResponse - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleResponse) Get() *SecurityMonitoringRuleResponse { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleResponse) Set(val *SecurityMonitoringRuleResponse) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleResponse) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableSecurityMonitoringRuleResponse) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleResponse initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleResponse(val *SecurityMonitoringRuleResponse) *NullableSecurityMonitoringRuleResponse { - return &NullableSecurityMonitoringRuleResponse{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleResponse) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleResponse) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_severity.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_severity.go index a53737797..aad7bd089 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_severity.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_severity.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SecurityMonitoringRuleSeverity Severity of the Security Signal. @@ -69,47 +70,3 @@ func (v SecurityMonitoringRuleSeverity) IsValid() bool { func (v SecurityMonitoringRuleSeverity) Ptr() *SecurityMonitoringRuleSeverity { return &v } - -// NullableSecurityMonitoringRuleSeverity handles when a null is used for SecurityMonitoringRuleSeverity. -type NullableSecurityMonitoringRuleSeverity struct { - value *SecurityMonitoringRuleSeverity - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleSeverity) Get() *SecurityMonitoringRuleSeverity { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleSeverity) Set(val *SecurityMonitoringRuleSeverity) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleSeverity) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringRuleSeverity) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleSeverity initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleSeverity(val *SecurityMonitoringRuleSeverity) *NullableSecurityMonitoringRuleSeverity { - return &NullableSecurityMonitoringRuleSeverity{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleSeverity) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleSeverity) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_type_create.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_type_create.go index 88a093f4b..4d1a66503 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_type_create.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_type_create.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SecurityMonitoringRuleTypeCreate The rule type. @@ -63,47 +64,3 @@ func (v SecurityMonitoringRuleTypeCreate) IsValid() bool { func (v SecurityMonitoringRuleTypeCreate) Ptr() *SecurityMonitoringRuleTypeCreate { return &v } - -// NullableSecurityMonitoringRuleTypeCreate handles when a null is used for SecurityMonitoringRuleTypeCreate. -type NullableSecurityMonitoringRuleTypeCreate struct { - value *SecurityMonitoringRuleTypeCreate - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleTypeCreate) Get() *SecurityMonitoringRuleTypeCreate { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleTypeCreate) Set(val *SecurityMonitoringRuleTypeCreate) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleTypeCreate) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringRuleTypeCreate) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleTypeCreate initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleTypeCreate(val *SecurityMonitoringRuleTypeCreate) *NullableSecurityMonitoringRuleTypeCreate { - return &NullableSecurityMonitoringRuleTypeCreate{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleTypeCreate) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleTypeCreate) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_type_read.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_type_read.go index c80bb4542..863e85f10 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_type_read.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_type_read.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SecurityMonitoringRuleTypeRead The rule type. @@ -69,47 +70,3 @@ func (v SecurityMonitoringRuleTypeRead) IsValid() bool { func (v SecurityMonitoringRuleTypeRead) Ptr() *SecurityMonitoringRuleTypeRead { return &v } - -// NullableSecurityMonitoringRuleTypeRead handles when a null is used for SecurityMonitoringRuleTypeRead. -type NullableSecurityMonitoringRuleTypeRead struct { - value *SecurityMonitoringRuleTypeRead - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleTypeRead) Get() *SecurityMonitoringRuleTypeRead { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleTypeRead) Set(val *SecurityMonitoringRuleTypeRead) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleTypeRead) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringRuleTypeRead) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleTypeRead initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleTypeRead(val *SecurityMonitoringRuleTypeRead) *NullableSecurityMonitoringRuleTypeRead { - return &NullableSecurityMonitoringRuleTypeRead{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleTypeRead) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleTypeRead) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_update_payload.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_update_payload.go index ee8f1f240..8ee53823b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_update_payload.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_rule_update_payload.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -412,7 +412,6 @@ func (o SecurityMonitoringRuleUpdatePayload) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringRuleUpdatePayload) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Cases []SecurityMonitoringRuleCase `json:"cases,omitempty"` ComplianceSignalOptions *CloudConfigurationRuleComplianceSignalOptions `json:"complianceSignalOptions,omitempty"` @@ -427,12 +426,7 @@ func (o *SecurityMonitoringRuleUpdatePayload) UnmarshalJSON(bytes []byte) (err e Version *int32 `json:"version,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -440,13 +434,11 @@ func (o *SecurityMonitoringRuleUpdatePayload) UnmarshalJSON(bytes []byte) (err e } else { return err } + + hasInvalidField := false o.Cases = all.Cases if all.ComplianceSignalOptions != nil && all.ComplianceSignalOptions.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ComplianceSignalOptions = all.ComplianceSignalOptions o.Filters = all.Filters @@ -455,19 +447,20 @@ func (o *SecurityMonitoringRuleUpdatePayload) UnmarshalJSON(bytes []byte) (err e o.Message = all.Message o.Name = all.Name if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Options = all.Options o.Queries = all.Queries o.Tags = all.Tags o.Version = all.Version + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal.go index 6b6411707..4af5625cf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -153,19 +153,13 @@ func (o SecurityMonitoringSignal) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignal) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SecurityMonitoringSignalAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *SecurityMonitoringSignalType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -173,27 +167,26 @@ func (o *SecurityMonitoringSignal) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_archive_reason.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_archive_reason.go index 235b8ea13..aacb1fd59 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_archive_reason.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_archive_reason.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SecurityMonitoringSignalArchiveReason Reason a signal is archived. @@ -69,47 +70,3 @@ func (v SecurityMonitoringSignalArchiveReason) IsValid() bool { func (v SecurityMonitoringSignalArchiveReason) Ptr() *SecurityMonitoringSignalArchiveReason { return &v } - -// NullableSecurityMonitoringSignalArchiveReason handles when a null is used for SecurityMonitoringSignalArchiveReason. -type NullableSecurityMonitoringSignalArchiveReason struct { - value *SecurityMonitoringSignalArchiveReason - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringSignalArchiveReason) Get() *SecurityMonitoringSignalArchiveReason { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringSignalArchiveReason) Set(val *SecurityMonitoringSignalArchiveReason) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringSignalArchiveReason) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringSignalArchiveReason) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringSignalArchiveReason initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringSignalArchiveReason(val *SecurityMonitoringSignalArchiveReason) *NullableSecurityMonitoringSignalArchiveReason { - return &NullableSecurityMonitoringSignalArchiveReason{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringSignalArchiveReason) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringSignalArchiveReason) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_assignee_update_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_assignee_update_attributes.go index 23c5e91a6..996fec411 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_assignee_update_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_assignee_update_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o SecurityMonitoringSignalAssigneeUpdateAttributes) MarshalJSON() ([]byte, // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalAssigneeUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Assignee *SecurityMonitoringTriageUser `json:"assignee"` Version *int64 `json:"version,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Assignee == nil { return fmt.Errorf("required field assignee missing") @@ -132,18 +127,21 @@ func (o *SecurityMonitoringSignalAssigneeUpdateAttributes) UnmarshalJSON(bytes [ } else { return err } + + hasInvalidField := false if all.Assignee.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Assignee = *all.Assignee o.Version = all.Version + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_assignee_update_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_assignee_update_data.go index 2a46e809b..3a822d5f9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_assignee_update_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_assignee_update_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o SecurityMonitoringSignalAssigneeUpdateData) MarshalJSON() ([]byte, error // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalAssigneeUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SecurityMonitoringSignalAssigneeUpdateAttributes `json:"attributes"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -98,17 +93,20 @@ func (o *SecurityMonitoringSignalAssigneeUpdateData) UnmarshalJSON(bytes []byte) } else { return err } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_assignee_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_assignee_update_request.go index d8b0fbe94..f9ec6dbd9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_assignee_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_assignee_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o SecurityMonitoringSignalAssigneeUpdateRequest) MarshalJSON() ([]byte, er // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalAssigneeUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SecurityMonitoringSignalAssigneeUpdateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *SecurityMonitoringSignalAssigneeUpdateRequest) UnmarshalJSON(bytes []by } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_attributes.go index 3392fe6fc..ca3936ca9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -187,7 +188,6 @@ func (o SecurityMonitoringSignalAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes map[string]interface{} `json:"attributes,omitempty"` Message *string `json:"message,omitempty"` @@ -195,12 +195,7 @@ func (o *SecurityMonitoringSignalAttributes) UnmarshalJSON(bytes []byte) (err er Timestamp *time.Time `json:"timestamp,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -212,6 +207,7 @@ func (o *SecurityMonitoringSignalAttributes) UnmarshalJSON(bytes []byte) (err er o.Message = all.Message o.Tags = all.Tags o.Timestamp = all.Timestamp + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_incidents_update_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_incidents_update_attributes.go index 64ce4f9ce..e6e75f784 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_incidents_update_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_incidents_update_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o SecurityMonitoringSignalIncidentsUpdateAttributes) MarshalJSON() ([]byte // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalIncidentsUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IncidentIds *[]int64 `json:"incident_ids"` Version *int64 `json:"version,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.IncidentIds == nil { return fmt.Errorf("required field incident_ids missing") @@ -134,6 +129,7 @@ func (o *SecurityMonitoringSignalIncidentsUpdateAttributes) UnmarshalJSON(bytes } o.IncidentIds = *all.IncidentIds o.Version = all.Version + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_incidents_update_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_incidents_update_data.go index 0d64bc41d..8f6686d65 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_incidents_update_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_incidents_update_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o SecurityMonitoringSignalIncidentsUpdateData) MarshalJSON() ([]byte, erro // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalIncidentsUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SecurityMonitoringSignalIncidentsUpdateAttributes `json:"attributes"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -98,17 +93,20 @@ func (o *SecurityMonitoringSignalIncidentsUpdateData) UnmarshalJSON(bytes []byte } else { return err } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_incidents_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_incidents_update_request.go index 4a9b84d4d..0996db285 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_incidents_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_incidents_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o SecurityMonitoringSignalIncidentsUpdateRequest) MarshalJSON() ([]byte, e // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalIncidentsUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SecurityMonitoringSignalIncidentsUpdateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *SecurityMonitoringSignalIncidentsUpdateRequest) UnmarshalJSON(bytes []b } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_list_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_list_request.go index 5b889d53c..819dcd078 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_list_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_list_request.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o SecurityMonitoringSignalListRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalListRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Filter *SecurityMonitoringSignalListRequestFilter `json:"filter,omitempty"` Page *SecurityMonitoringSignalListRequestPage `json:"page,omitempty"` Sort *SecurityMonitoringSignalsSort `json:"sort,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,34 +162,29 @@ func (o *SecurityMonitoringSignalListRequest) UnmarshalJSON(bytes []byte) (err e } else { return err } - if v := all.Sort; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Filter = all.Filter if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Page = all.Page - o.Sort = all.Sort + if all.Sort != nil && !all.Sort.IsValid() { + hasInvalidField = true + } else { + o.Sort = all.Sort + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_list_request_filter.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_list_request_filter.go index 1dc1384ab..5ed4f9375 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_list_request_filter.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_list_request_filter.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -157,19 +158,13 @@ func (o SecurityMonitoringSignalListRequestFilter) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalListRequestFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { From *time.Time `json:"from,omitempty"` Query *string `json:"query,omitempty"` To *time.Time `json:"to,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -180,6 +175,7 @@ func (o *SecurityMonitoringSignalListRequestFilter) UnmarshalJSON(bytes []byte) o.From = all.From o.Query = all.Query o.To = all.To + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_list_request_page.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_list_request_page.go index e1b77fcbc..b3384775b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_list_request_page.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_list_request_page.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -119,18 +119,12 @@ func (o SecurityMonitoringSignalListRequestPage) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalListRequestPage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Cursor *string `json:"cursor,omitempty"` Limit *int32 `json:"limit,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -140,6 +134,7 @@ func (o *SecurityMonitoringSignalListRequestPage) UnmarshalJSON(bytes []byte) (e } o.Cursor = all.Cursor o.Limit = all.Limit + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_metadata_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_metadata_type.go new file mode 100644 index 000000000..b27b16042 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_metadata_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/goccy/go-json" +) + +// SecurityMonitoringSignalMetadataType The type of event. +type SecurityMonitoringSignalMetadataType string + +// List of SecurityMonitoringSignalMetadataType. +const ( + SECURITYMONITORINGSIGNALMETADATATYPE_SIGNAL_METADATA SecurityMonitoringSignalMetadataType = "signal_metadata" +) + +var allowedSecurityMonitoringSignalMetadataTypeEnumValues = []SecurityMonitoringSignalMetadataType{ + SECURITYMONITORINGSIGNALMETADATATYPE_SIGNAL_METADATA, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringSignalMetadataType) GetAllowedValues() []SecurityMonitoringSignalMetadataType { + return allowedSecurityMonitoringSignalMetadataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringSignalMetadataType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringSignalMetadataType(value) + return nil +} + +// NewSecurityMonitoringSignalMetadataTypeFromValue returns a pointer to a valid SecurityMonitoringSignalMetadataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringSignalMetadataTypeFromValue(v string) (*SecurityMonitoringSignalMetadataType, error) { + ev := SecurityMonitoringSignalMetadataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringSignalMetadataType: valid values are %v", v, allowedSecurityMonitoringSignalMetadataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringSignalMetadataType) IsValid() bool { + for _, existing := range allowedSecurityMonitoringSignalMetadataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringSignalMetadataType value. +func (v SecurityMonitoringSignalMetadataType) Ptr() *SecurityMonitoringSignalMetadataType { + return &v +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_response.go new file mode 100644 index 000000000..d23bfe5c7 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_response.go @@ -0,0 +1,113 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SecurityMonitoringSignalResponse Security Signal response data object. +type SecurityMonitoringSignalResponse struct { + // Object description of a security signal. + Data *SecurityMonitoringSignal `json:"data,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{} +} + +// NewSecurityMonitoringSignalResponse instantiates a new SecurityMonitoringSignalResponse 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 NewSecurityMonitoringSignalResponse() *SecurityMonitoringSignalResponse { + this := SecurityMonitoringSignalResponse{} + return &this +} + +// NewSecurityMonitoringSignalResponseWithDefaults instantiates a new SecurityMonitoringSignalResponse 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 NewSecurityMonitoringSignalResponseWithDefaults() *SecurityMonitoringSignalResponse { + this := SecurityMonitoringSignalResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalResponse) GetData() SecurityMonitoringSignal { + if o == nil || o.Data == nil { + var ret SecurityMonitoringSignal + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalResponse) GetDataOk() (*SecurityMonitoringSignal, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given SecurityMonitoringSignal and assigns it to the Data field. +func (o *SecurityMonitoringSignalResponse) SetData(v SecurityMonitoringSignal) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignalResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignalResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *SecurityMonitoringSignal `json:"data,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_rule_create_payload.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_rule_create_payload.go index 68535e1c4..12503ab37 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_rule_create_payload.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_rule_create_payload.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -344,7 +345,6 @@ func (o SecurityMonitoringSignalRuleCreatePayload) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalRuleCreatePayload) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Cases *[]SecurityMonitoringRuleCaseCreate `json:"cases"` Filters []SecurityMonitoringFilter `json:"filters,omitempty"` @@ -358,12 +358,7 @@ func (o *SecurityMonitoringSignalRuleCreatePayload) UnmarshalJSON(bytes []byte) Type *SecurityMonitoringSignalRuleType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Cases == nil { return fmt.Errorf("required field cases missing") @@ -389,14 +384,8 @@ func (o *SecurityMonitoringSignalRuleCreatePayload) UnmarshalJSON(bytes []byte) } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Cases = *all.Cases o.Filters = all.Filters o.HasExtendedTitle = all.HasExtendedTitle @@ -404,19 +393,24 @@ func (o *SecurityMonitoringSignalRuleCreatePayload) UnmarshalJSON(bytes []byte) o.Message = *all.Message o.Name = *all.Name if all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Options = *all.Options o.Queries = *all.Queries o.Tags = all.Tags - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_rule_query.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_rule_query.go index c81e7ad8a..94ad1a61c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_rule_query.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_rule_query.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -242,7 +243,6 @@ func (o SecurityMonitoringSignalRuleQuery) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalRuleQuery) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregation *SecurityMonitoringRuleQueryAggregation `json:"aggregation,omitempty"` CorrelatedByFields []string `json:"correlatedByFields,omitempty"` @@ -252,12 +252,7 @@ func (o *SecurityMonitoringSignalRuleQuery) UnmarshalJSON(bytes []byte) (err err RuleId *string `json:"ruleId"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.RuleId == nil { return fmt.Errorf("required field ruleId missing") @@ -268,23 +263,26 @@ func (o *SecurityMonitoringSignalRuleQuery) UnmarshalJSON(bytes []byte) (err err } else { return err } - if v := all.Aggregation; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.Aggregation != nil && !all.Aggregation.IsValid() { + hasInvalidField = true + } else { + o.Aggregation = all.Aggregation } - o.Aggregation = all.Aggregation o.CorrelatedByFields = all.CorrelatedByFields o.CorrelatedQueryIndex = all.CorrelatedQueryIndex o.Metrics = all.Metrics o.Name = all.Name o.RuleId = *all.RuleId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_rule_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_rule_response.go index 1186eb3c1..a28797f7f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_rule_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_rule_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -643,7 +643,6 @@ func (o SecurityMonitoringSignalRuleResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalRuleResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Cases []SecurityMonitoringRuleCase `json:"cases,omitempty"` CreatedAt *int64 `json:"createdAt,omitempty"` @@ -665,12 +664,7 @@ func (o *SecurityMonitoringSignalRuleResponse) UnmarshalJSON(bytes []byte) (err Version *int64 `json:"version,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -678,14 +672,8 @@ func (o *SecurityMonitoringSignalRuleResponse) UnmarshalJSON(bytes []byte) (err } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Cases = all.Cases o.CreatedAt = all.CreatedAt o.CreationAuthorId = all.CreationAuthorId @@ -699,21 +687,26 @@ func (o *SecurityMonitoringSignalRuleResponse) UnmarshalJSON(bytes []byte) (err o.Message = all.Message o.Name = all.Name if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Options = all.Options o.Queries = all.Queries o.Tags = all.Tags - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } o.UpdateAuthorId = all.UpdateAuthorId o.Version = all.Version + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_rule_response_query.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_rule_response_query.go index f41049b70..3d86ad1d8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_rule_response_query.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_rule_response_query.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -14,12 +14,16 @@ import ( type SecurityMonitoringSignalRuleResponseQuery struct { // The aggregation type. Aggregation *SecurityMonitoringRuleQueryAggregation `json:"aggregation,omitempty"` - // Fields to group by. + // Fields to correlate by. CorrelatedByFields []string `json:"correlatedByFields,omitempty"` // Index of the rule query used to retrieve the correlated field. CorrelatedQueryIndex *int32 `json:"correlatedQueryIndex,omitempty"` // Default Rule ID to match on signals. DefaultRuleId *string `json:"defaultRuleId,omitempty"` + // Field for which the cardinality is measured. Sent as an array. + DistinctFields []string `json:"distinctFields,omitempty"` + // Fields to group by. + GroupByFields []string `json:"groupByFields,omitempty"` // Group of target fields to aggregate over. Metrics []string `json:"metrics,omitempty"` // Name of the query. @@ -160,6 +164,62 @@ func (o *SecurityMonitoringSignalRuleResponseQuery) SetDefaultRuleId(v string) { o.DefaultRuleId = &v } +// GetDistinctFields returns the DistinctFields field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalRuleResponseQuery) GetDistinctFields() []string { + if o == nil || o.DistinctFields == nil { + var ret []string + return ret + } + return o.DistinctFields +} + +// GetDistinctFieldsOk returns a tuple with the DistinctFields field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalRuleResponseQuery) GetDistinctFieldsOk() (*[]string, bool) { + if o == nil || o.DistinctFields == nil { + return nil, false + } + return &o.DistinctFields, true +} + +// HasDistinctFields returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalRuleResponseQuery) HasDistinctFields() bool { + return o != nil && o.DistinctFields != nil +} + +// SetDistinctFields gets a reference to the given []string and assigns it to the DistinctFields field. +func (o *SecurityMonitoringSignalRuleResponseQuery) SetDistinctFields(v []string) { + o.DistinctFields = v +} + +// GetGroupByFields returns the GroupByFields field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalRuleResponseQuery) GetGroupByFields() []string { + if o == nil || o.GroupByFields == nil { + var ret []string + return ret + } + return o.GroupByFields +} + +// GetGroupByFieldsOk returns a tuple with the GroupByFields field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalRuleResponseQuery) GetGroupByFieldsOk() (*[]string, bool) { + if o == nil || o.GroupByFields == nil { + return nil, false + } + return &o.GroupByFields, true +} + +// HasGroupByFields returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalRuleResponseQuery) HasGroupByFields() bool { + return o != nil && o.GroupByFields != nil +} + +// SetGroupByFields gets a reference to the given []string and assigns it to the GroupByFields field. +func (o *SecurityMonitoringSignalRuleResponseQuery) SetGroupByFields(v []string) { + o.GroupByFields = v +} + // GetMetrics returns the Metrics field value if set, zero value otherwise. func (o *SecurityMonitoringSignalRuleResponseQuery) GetMetrics() []string { if o == nil || o.Metrics == nil { @@ -262,6 +322,12 @@ func (o SecurityMonitoringSignalRuleResponseQuery) MarshalJSON() ([]byte, error) if o.DefaultRuleId != nil { toSerialize["defaultRuleId"] = o.DefaultRuleId } + if o.DistinctFields != nil { + toSerialize["distinctFields"] = o.DistinctFields + } + if o.GroupByFields != nil { + toSerialize["groupByFields"] = o.GroupByFields + } if o.Metrics != nil { toSerialize["metrics"] = o.Metrics } @@ -280,48 +346,49 @@ func (o SecurityMonitoringSignalRuleResponseQuery) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalRuleResponseQuery) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregation *SecurityMonitoringRuleQueryAggregation `json:"aggregation,omitempty"` CorrelatedByFields []string `json:"correlatedByFields,omitempty"` CorrelatedQueryIndex *int32 `json:"correlatedQueryIndex,omitempty"` DefaultRuleId *string `json:"defaultRuleId,omitempty"` + DistinctFields []string `json:"distinctFields,omitempty"` + GroupByFields []string `json:"groupByFields,omitempty"` Metrics []string `json:"metrics,omitempty"` Name *string `json:"name,omitempty"` RuleId *string `json:"ruleId,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"aggregation", "correlatedByFields", "correlatedQueryIndex", "defaultRuleId", "metrics", "name", "ruleId"}) + datadog.DeleteKeys(additionalProperties, &[]string{"aggregation", "correlatedByFields", "correlatedQueryIndex", "defaultRuleId", "distinctFields", "groupByFields", "metrics", "name", "ruleId"}) } else { return err } - if v := all.Aggregation; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.Aggregation != nil && !all.Aggregation.IsValid() { + hasInvalidField = true + } else { + o.Aggregation = all.Aggregation } - o.Aggregation = all.Aggregation o.CorrelatedByFields = all.CorrelatedByFields o.CorrelatedQueryIndex = all.CorrelatedQueryIndex o.DefaultRuleId = all.DefaultRuleId + o.DistinctFields = all.DistinctFields + o.GroupByFields = all.GroupByFields o.Metrics = all.Metrics o.Name = all.Name o.RuleId = all.RuleId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_rule_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_rule_type.go index 61cab376d..141f759bc 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_rule_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_rule_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SecurityMonitoringSignalRuleType The rule type. @@ -61,47 +62,3 @@ func (v SecurityMonitoringSignalRuleType) IsValid() bool { func (v SecurityMonitoringSignalRuleType) Ptr() *SecurityMonitoringSignalRuleType { return &v } - -// NullableSecurityMonitoringSignalRuleType handles when a null is used for SecurityMonitoringSignalRuleType. -type NullableSecurityMonitoringSignalRuleType struct { - value *SecurityMonitoringSignalRuleType - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringSignalRuleType) Get() *SecurityMonitoringSignalRuleType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringSignalRuleType) Set(val *SecurityMonitoringSignalRuleType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringSignalRuleType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringSignalRuleType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringSignalRuleType initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringSignalRuleType(val *SecurityMonitoringSignalRuleType) *NullableSecurityMonitoringSignalRuleType { - return &NullableSecurityMonitoringSignalRuleType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringSignalRuleType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringSignalRuleType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_state.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_state.go index 431eda60b..00d5fc06b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_state.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_state.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SecurityMonitoringSignalState The new triage state of the signal. @@ -65,47 +66,3 @@ func (v SecurityMonitoringSignalState) IsValid() bool { func (v SecurityMonitoringSignalState) Ptr() *SecurityMonitoringSignalState { return &v } - -// NullableSecurityMonitoringSignalState handles when a null is used for SecurityMonitoringSignalState. -type NullableSecurityMonitoringSignalState struct { - value *SecurityMonitoringSignalState - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringSignalState) Get() *SecurityMonitoringSignalState { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringSignalState) Set(val *SecurityMonitoringSignalState) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringSignalState) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringSignalState) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringSignalState initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringSignalState(val *SecurityMonitoringSignalState) *NullableSecurityMonitoringSignalState { - return &NullableSecurityMonitoringSignalState{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringSignalState) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringSignalState) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_state_update_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_state_update_attributes.go index bc3b17b6a..b7f9c90b7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_state_update_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_state_update_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -176,7 +177,6 @@ func (o SecurityMonitoringSignalStateUpdateAttributes) MarshalJSON() ([]byte, er // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalStateUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ArchiveComment *string `json:"archive_comment,omitempty"` ArchiveReason *SecurityMonitoringSignalArchiveReason `json:"archive_reason,omitempty"` @@ -184,12 +184,7 @@ func (o *SecurityMonitoringSignalStateUpdateAttributes) UnmarshalJSON(bytes []by Version *int64 `json:"version,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.State == nil { return fmt.Errorf("required field state missing") @@ -200,29 +195,28 @@ func (o *SecurityMonitoringSignalStateUpdateAttributes) UnmarshalJSON(bytes []by } else { return err } - if v := all.ArchiveReason; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.State; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.ArchiveComment = all.ArchiveComment - o.ArchiveReason = all.ArchiveReason - o.State = *all.State + if all.ArchiveReason != nil && !all.ArchiveReason.IsValid() { + hasInvalidField = true + } else { + o.ArchiveReason = all.ArchiveReason + } + if !all.State.IsValid() { + hasInvalidField = true + } else { + o.State = *all.State + } o.Version = all.Version + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_state_update_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_state_update_data.go index da36a0113..4796512e5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_state_update_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_state_update_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -15,6 +16,10 @@ import ( type SecurityMonitoringSignalStateUpdateData struct { // Attributes describing the change of state of a security signal. Attributes SecurityMonitoringSignalStateUpdateAttributes `json:"attributes"` + // The unique ID of the security signal. + Id interface{} `json:"id,omitempty"` + // The type of event. + Type *SecurityMonitoringSignalMetadataType `json:"type,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{} @@ -27,6 +32,8 @@ type SecurityMonitoringSignalStateUpdateData struct { func NewSecurityMonitoringSignalStateUpdateData(attributes SecurityMonitoringSignalStateUpdateAttributes) *SecurityMonitoringSignalStateUpdateData { this := SecurityMonitoringSignalStateUpdateData{} this.Attributes = attributes + var typeVar SecurityMonitoringSignalMetadataType = SECURITYMONITORINGSIGNALMETADATATYPE_SIGNAL_METADATA + this.Type = &typeVar return &this } @@ -35,6 +42,8 @@ func NewSecurityMonitoringSignalStateUpdateData(attributes SecurityMonitoringSig // but it doesn't guarantee that properties required by API are set. func NewSecurityMonitoringSignalStateUpdateDataWithDefaults() *SecurityMonitoringSignalStateUpdateData { this := SecurityMonitoringSignalStateUpdateData{} + var typeVar SecurityMonitoringSignalMetadataType = SECURITYMONITORINGSIGNALMETADATATYPE_SIGNAL_METADATA + this.Type = &typeVar return &this } @@ -61,6 +70,62 @@ func (o *SecurityMonitoringSignalStateUpdateData) SetAttributes(v SecurityMonito o.Attributes = v } +// GetId returns the Id field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalStateUpdateData) GetId() interface{} { + if o == nil || o.Id == nil { + var ret interface{} + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalStateUpdateData) GetIdOk() (*interface{}, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return &o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalStateUpdateData) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given interface{} and assigns it to the Id field. +func (o *SecurityMonitoringSignalStateUpdateData) SetId(v interface{}) { + o.Id = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalStateUpdateData) GetType() SecurityMonitoringSignalMetadataType { + if o == nil || o.Type == nil { + var ret SecurityMonitoringSignalMetadataType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalStateUpdateData) GetTypeOk() (*SecurityMonitoringSignalMetadataType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalStateUpdateData) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given SecurityMonitoringSignalMetadataType and assigns it to the Type field. +func (o *SecurityMonitoringSignalStateUpdateData) SetType(v SecurityMonitoringSignalMetadataType) { + o.Type = &v +} + // MarshalJSON serializes the struct using spec logic. func (o SecurityMonitoringSignalStateUpdateData) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -68,6 +133,12 @@ func (o SecurityMonitoringSignalStateUpdateData) MarshalJSON() ([]byte, error) { return json.Marshal(o.UnparsedObject) } toSerialize["attributes"] = o.Attributes + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -77,38 +148,43 @@ func (o SecurityMonitoringSignalStateUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalStateUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SecurityMonitoringSignalStateUpdateAttributes `json:"attributes"` + Id interface{} `json:"id,omitempty"` + Type *SecurityMonitoringSignalMetadataType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } 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"}) + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) } else { return err } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes + o.Id = all.Id + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_state_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_state_update_request.go index 572ed6282..731cb9289 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_state_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_state_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o SecurityMonitoringSignalStateUpdateRequest) MarshalJSON() ([]byte, error // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalStateUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SecurityMonitoringSignalStateUpdateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *SecurityMonitoringSignalStateUpdateRequest) UnmarshalJSON(bytes []byte) } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_triage_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_triage_attributes.go index 61dac093a..d4d543e9d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_triage_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_triage_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -329,7 +330,6 @@ func (o SecurityMonitoringSignalTriageAttributes) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalTriageAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ArchiveComment *string `json:"archive_comment,omitempty"` ArchiveCommentTimestamp *int64 `json:"archive_comment_timestamp,omitempty"` @@ -342,12 +342,7 @@ func (o *SecurityMonitoringSignalTriageAttributes) UnmarshalJSON(bytes []byte) ( StateUpdateUser *SecurityMonitoringTriageUser `json:"state_update_user,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Assignee == nil { return fmt.Errorf("required field assignee missing") @@ -364,55 +359,42 @@ func (o *SecurityMonitoringSignalTriageAttributes) UnmarshalJSON(bytes []byte) ( } else { return err } - if v := all.ArchiveReason; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.State; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.ArchiveComment = all.ArchiveComment o.ArchiveCommentTimestamp = all.ArchiveCommentTimestamp if all.ArchiveCommentUser != nil && all.ArchiveCommentUser.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ArchiveCommentUser = all.ArchiveCommentUser - o.ArchiveReason = all.ArchiveReason + if all.ArchiveReason != nil && !all.ArchiveReason.IsValid() { + hasInvalidField = true + } else { + o.ArchiveReason = all.ArchiveReason + } if all.Assignee.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Assignee = *all.Assignee o.IncidentIds = *all.IncidentIds - o.State = *all.State + if !all.State.IsValid() { + hasInvalidField = true + } else { + o.State = *all.State + } o.StateUpdateTimestamp = all.StateUpdateTimestamp if all.StateUpdateUser != nil && all.StateUpdateUser.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.StateUpdateUser = all.StateUpdateUser + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_triage_update_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_triage_update_data.go index 2ce09fc05..7c73dea0f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_triage_update_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_triage_update_data.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -14,6 +14,10 @@ import ( type SecurityMonitoringSignalTriageUpdateData struct { // Attributes describing a triage state update operation over a security signal. Attributes *SecurityMonitoringSignalTriageAttributes `json:"attributes,omitempty"` + // The unique ID of the security signal. + Id *string `json:"id,omitempty"` + // The type of event. + Type *SecurityMonitoringSignalMetadataType `json:"type,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{} @@ -25,6 +29,8 @@ type SecurityMonitoringSignalTriageUpdateData struct { // will change when the set of required properties is changed. func NewSecurityMonitoringSignalTriageUpdateData() *SecurityMonitoringSignalTriageUpdateData { this := SecurityMonitoringSignalTriageUpdateData{} + var typeVar SecurityMonitoringSignalMetadataType = SECURITYMONITORINGSIGNALMETADATATYPE_SIGNAL_METADATA + this.Type = &typeVar return &this } @@ -33,6 +39,8 @@ func NewSecurityMonitoringSignalTriageUpdateData() *SecurityMonitoringSignalTria // but it doesn't guarantee that properties required by API are set. func NewSecurityMonitoringSignalTriageUpdateDataWithDefaults() *SecurityMonitoringSignalTriageUpdateData { this := SecurityMonitoringSignalTriageUpdateData{} + var typeVar SecurityMonitoringSignalMetadataType = SECURITYMONITORINGSIGNALMETADATATYPE_SIGNAL_METADATA + this.Type = &typeVar return &this } @@ -64,6 +72,62 @@ func (o *SecurityMonitoringSignalTriageUpdateData) SetAttributes(v SecurityMonit o.Attributes = &v } +// GetId returns the Id field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalTriageUpdateData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalTriageUpdateData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalTriageUpdateData) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *SecurityMonitoringSignalTriageUpdateData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalTriageUpdateData) GetType() SecurityMonitoringSignalMetadataType { + if o == nil || o.Type == nil { + var ret SecurityMonitoringSignalMetadataType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalTriageUpdateData) GetTypeOk() (*SecurityMonitoringSignalMetadataType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalTriageUpdateData) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given SecurityMonitoringSignalMetadataType and assigns it to the Type field. +func (o *SecurityMonitoringSignalTriageUpdateData) SetType(v SecurityMonitoringSignalMetadataType) { + o.Type = &v +} + // MarshalJSON serializes the struct using spec logic. func (o SecurityMonitoringSignalTriageUpdateData) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -73,6 +137,12 @@ func (o SecurityMonitoringSignalTriageUpdateData) MarshalJSON() ([]byte, error) if o.Attributes != nil { toSerialize["attributes"] = o.Attributes } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -82,35 +152,40 @@ func (o SecurityMonitoringSignalTriageUpdateData) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalTriageUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SecurityMonitoringSignalTriageAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *SecurityMonitoringSignalMetadataType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"attributes"}) + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) } else { return err } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes + o.Id = all.Id + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_triage_update_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_triage_update_response.go index 8211d0206..903c8e26b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_triage_update_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_triage_update_response.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o SecurityMonitoringSignalTriageUpdateResponse) MarshalJSON() ([]byte, err // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalTriageUpdateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SecurityMonitoringSignalTriageUpdateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *SecurityMonitoringSignalTriageUpdateResponse) UnmarshalJSON(bytes []byt } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_type.go index b49b64e50..4cb99ec80 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signal_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SecurityMonitoringSignalType The type of event. @@ -61,47 +62,3 @@ func (v SecurityMonitoringSignalType) IsValid() bool { func (v SecurityMonitoringSignalType) Ptr() *SecurityMonitoringSignalType { return &v } - -// NullableSecurityMonitoringSignalType handles when a null is used for SecurityMonitoringSignalType. -type NullableSecurityMonitoringSignalType struct { - value *SecurityMonitoringSignalType - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringSignalType) Get() *SecurityMonitoringSignalType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringSignalType) Set(val *SecurityMonitoringSignalType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringSignalType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringSignalType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringSignalType initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringSignalType(val *SecurityMonitoringSignalType) *NullableSecurityMonitoringSignalType { - return &NullableSecurityMonitoringSignalType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringSignalType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringSignalType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signals_list_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signals_list_response.go index 593a3eec4..28c39c830 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signals_list_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signals_list_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -149,19 +149,13 @@ func (o SecurityMonitoringSignalsListResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalsListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []SecurityMonitoringSignal `json:"data,omitempty"` Links *SecurityMonitoringSignalsListResponseLinks `json:"links,omitempty"` Meta *SecurityMonitoringSignalsListResponseMeta `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -169,26 +163,25 @@ func (o *SecurityMonitoringSignalsListResponse) UnmarshalJSON(bytes []byte) (err } else { return err } + + hasInvalidField := false o.Data = all.Data if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Links = all.Links if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signals_list_response_links.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signals_list_response_links.go index 3294c0722..992ea7e6a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signals_list_response_links.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signals_list_response_links.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -83,17 +83,11 @@ func (o SecurityMonitoringSignalsListResponseLinks) MarshalJSON() ([]byte, error // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalsListResponseLinks) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Next *string `json:"next,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -102,6 +96,7 @@ func (o *SecurityMonitoringSignalsListResponseLinks) UnmarshalJSON(bytes []byte) return err } o.Next = all.Next + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signals_list_response_meta.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signals_list_response_meta.go index 4497bd7c1..5d09b68ac 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signals_list_response_meta.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signals_list_response_meta.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SecurityMonitoringSignalsListResponseMeta) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalsListResponseMeta) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Page *SecurityMonitoringSignalsListResponseMetaPage `json:"page,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *SecurityMonitoringSignalsListResponseMeta) UnmarshalJSON(bytes []byte) } else { return err } + + hasInvalidField := false if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Page = all.Page + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signals_list_response_meta_page.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signals_list_response_meta_page.go index f148a9e82..2b17fce58 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signals_list_response_meta_page.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signals_list_response_meta_page.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -83,17 +83,11 @@ func (o SecurityMonitoringSignalsListResponseMetaPage) MarshalJSON() ([]byte, er // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalsListResponseMetaPage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { After *string `json:"after,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -102,6 +96,7 @@ func (o *SecurityMonitoringSignalsListResponseMetaPage) UnmarshalJSON(bytes []by return err } o.After = all.After + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signals_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signals_sort.go index d2c81dd1e..facc75f26 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signals_sort.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_signals_sort.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SecurityMonitoringSignalsSort The sort parameters used for querying security signals. @@ -63,47 +64,3 @@ func (v SecurityMonitoringSignalsSort) IsValid() bool { func (v SecurityMonitoringSignalsSort) Ptr() *SecurityMonitoringSignalsSort { return &v } - -// NullableSecurityMonitoringSignalsSort handles when a null is used for SecurityMonitoringSignalsSort. -type NullableSecurityMonitoringSignalsSort struct { - value *SecurityMonitoringSignalsSort - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringSignalsSort) Get() *SecurityMonitoringSignalsSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringSignalsSort) Set(val *SecurityMonitoringSignalsSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringSignalsSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringSignalsSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringSignalsSort initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringSignalsSort(val *SecurityMonitoringSignalsSort) *NullableSecurityMonitoringSignalsSort { - return &NullableSecurityMonitoringSignalsSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringSignalsSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringSignalsSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_standard_rule_create_payload.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_standard_rule_create_payload.go index 8b57b034f..c3858115f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_standard_rule_create_payload.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_standard_rule_create_payload.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -344,7 +345,6 @@ func (o SecurityMonitoringStandardRuleCreatePayload) MarshalJSON() ([]byte, erro // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringStandardRuleCreatePayload) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Cases *[]SecurityMonitoringRuleCaseCreate `json:"cases"` Filters []SecurityMonitoringFilter `json:"filters,omitempty"` @@ -358,12 +358,7 @@ func (o *SecurityMonitoringStandardRuleCreatePayload) UnmarshalJSON(bytes []byte Type *SecurityMonitoringRuleTypeCreate `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Cases == nil { return fmt.Errorf("required field cases missing") @@ -389,14 +384,8 @@ func (o *SecurityMonitoringStandardRuleCreatePayload) UnmarshalJSON(bytes []byte } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Cases = *all.Cases o.Filters = all.Filters o.HasExtendedTitle = all.HasExtendedTitle @@ -404,19 +393,24 @@ func (o *SecurityMonitoringStandardRuleCreatePayload) UnmarshalJSON(bytes []byte o.Message = *all.Message o.Name = *all.Name if all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Options = *all.Options o.Queries = *all.Queries o.Tags = all.Tags - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_standard_rule_query.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_standard_rule_query.go index a722641c1..d48c5afc7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_standard_rule_query.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_standard_rule_query.go @@ -5,8 +5,7 @@ package datadogV2 import ( - "encoding/json" - "fmt" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -28,7 +27,7 @@ type SecurityMonitoringStandardRuleQuery struct { // Name of the query. Name *string `json:"name,omitempty"` // Query to run on logs. - Query string `json:"query"` + Query *string `json:"query,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{} @@ -38,9 +37,8 @@ type SecurityMonitoringStandardRuleQuery struct { // 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 NewSecurityMonitoringStandardRuleQuery(query string) *SecurityMonitoringStandardRuleQuery { +func NewSecurityMonitoringStandardRuleQuery() *SecurityMonitoringStandardRuleQuery { this := SecurityMonitoringStandardRuleQuery{} - this.Query = query return &this } @@ -223,27 +221,32 @@ func (o *SecurityMonitoringStandardRuleQuery) SetName(v string) { o.Name = &v } -// GetQuery returns the Query field value. +// GetQuery returns the Query field value if set, zero value otherwise. func (o *SecurityMonitoringStandardRuleQuery) GetQuery() string { - if o == nil { + if o == nil || o.Query == nil { var ret string return ret } - return o.Query + return *o.Query } -// GetQueryOk returns a tuple with the Query field value +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SecurityMonitoringStandardRuleQuery) GetQueryOk() (*string, bool) { - if o == nil { + if o == nil || o.Query == nil { return nil, false } - return &o.Query, true + return o.Query, true } -// SetQuery sets field value. +// HasQuery returns a boolean if a field has been set. +func (o *SecurityMonitoringStandardRuleQuery) HasQuery() bool { + return o != nil && o.Query != nil +} + +// SetQuery gets a reference to the given string and assigns it to the Query field. func (o *SecurityMonitoringStandardRuleQuery) SetQuery(v string) { - o.Query = v + o.Query = &v } // MarshalJSON serializes the struct using spec logic. @@ -270,7 +273,9 @@ func (o SecurityMonitoringStandardRuleQuery) MarshalJSON() ([]byte, error) { if o.Name != nil { toSerialize["name"] = o.Name } - toSerialize["query"] = o.Query + if o.Query != nil { + toSerialize["query"] = o.Query + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -280,7 +285,6 @@ func (o SecurityMonitoringStandardRuleQuery) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringStandardRuleQuery) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Aggregation *SecurityMonitoringRuleQueryAggregation `json:"aggregation,omitempty"` DistinctFields []string `json:"distinctFields,omitempty"` @@ -288,18 +292,10 @@ 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,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Query == nil { - return fmt.Errorf("required field query missing") + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -307,24 +303,27 @@ func (o *SecurityMonitoringStandardRuleQuery) UnmarshalJSON(bytes []byte) (err e } else { return err } - if v := all.Aggregation; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.Aggregation != nil && !all.Aggregation.IsValid() { + hasInvalidField = true + } else { + o.Aggregation = all.Aggregation } - o.Aggregation = all.Aggregation o.DistinctFields = all.DistinctFields o.GroupByFields = all.GroupByFields 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 } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_standard_rule_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_standard_rule_response.go index 4e1cbcc0f..c27805815 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_standard_rule_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_standard_rule_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -676,7 +676,6 @@ func (o SecurityMonitoringStandardRuleResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringStandardRuleResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Cases []SecurityMonitoringRuleCase `json:"cases,omitempty"` ComplianceSignalOptions *CloudConfigurationRuleComplianceSignalOptions `json:"complianceSignalOptions,omitempty"` @@ -699,12 +698,7 @@ func (o *SecurityMonitoringStandardRuleResponse) UnmarshalJSON(bytes []byte) (er Version *int64 `json:"version,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -712,21 +706,11 @@ func (o *SecurityMonitoringStandardRuleResponse) UnmarshalJSON(bytes []byte) (er } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Cases = all.Cases if all.ComplianceSignalOptions != nil && all.ComplianceSignalOptions.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.ComplianceSignalOptions = all.ComplianceSignalOptions o.CreatedAt = all.CreatedAt @@ -741,21 +725,26 @@ func (o *SecurityMonitoringStandardRuleResponse) UnmarshalJSON(bytes []byte) (er o.Message = all.Message o.Name = all.Name if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Options = all.Options o.Queries = all.Queries o.Tags = all.Tags - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } o.UpdateAuthorId = all.UpdateAuthorId o.Version = all.Version + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_triage_user.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_triage_user.go index aa52c996c..cb13df713 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_triage_user.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_security_monitoring_triage_user.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -15,6 +16,8 @@ import ( type SecurityMonitoringTriageUser struct { // The handle for this user account. Handle *string `json:"handle,omitempty"` + // Gravatar icon associated to the user. + Icon *string `json:"icon,omitempty"` // Numerical ID assigned by Datadog to this user account. Id *int64 `json:"id,omitempty"` // The name for this user account. @@ -72,6 +75,34 @@ func (o *SecurityMonitoringTriageUser) SetHandle(v string) { o.Handle = &v } +// GetIcon returns the Icon field value if set, zero value otherwise. +func (o *SecurityMonitoringTriageUser) GetIcon() string { + if o == nil || o.Icon == nil { + var ret string + return ret + } + return *o.Icon +} + +// GetIconOk returns a tuple with the Icon field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringTriageUser) GetIconOk() (*string, bool) { + if o == nil || o.Icon == nil { + return nil, false + } + return o.Icon, true +} + +// HasIcon returns a boolean if a field has been set. +func (o *SecurityMonitoringTriageUser) HasIcon() bool { + return o != nil && o.Icon != nil +} + +// SetIcon gets a reference to the given string and assigns it to the Icon field. +func (o *SecurityMonitoringTriageUser) SetIcon(v string) { + o.Icon = &v +} + // GetId returns the Id field value if set, zero value otherwise. func (o *SecurityMonitoringTriageUser) GetId() int64 { if o == nil || o.Id == nil { @@ -171,6 +202,9 @@ func (o SecurityMonitoringTriageUser) MarshalJSON() ([]byte, error) { if o.Handle != nil { toSerialize["handle"] = o.Handle } + if o.Icon != nil { + toSerialize["icon"] = o.Icon + } if o.Id != nil { toSerialize["id"] = o.Id } @@ -187,34 +221,31 @@ func (o SecurityMonitoringTriageUser) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringTriageUser) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Handle *string `json:"handle,omitempty"` + Icon *string `json:"icon,omitempty"` Id *int64 `json:"id,omitempty"` Name datadog.NullableString `json:"name,omitempty"` Uuid *string `json:"uuid"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } 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"}) + datadog.DeleteKeys(additionalProperties, &[]string{"handle", "icon", "id", "name", "uuid"}) } else { return err } o.Handle = all.Handle + o.Icon = all.Icon o.Id = all.Id o.Name = all.Name o.Uuid = *all.Uuid + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_config_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_config_request.go index acf9363b0..e80bb683e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_config_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_config_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o SensitiveDataScannerConfigRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerConfigRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SensitiveDataScannerReorderConfig `json:"data"` Meta *SensitiveDataScannerMetaVersionOnly `json:"meta"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -129,25 +124,24 @@ func (o *SensitiveDataScannerConfigRequest) UnmarshalJSON(bytes []byte) (err err } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data if all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = *all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_configuration.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_configuration.go index 99c79dcf6..ae9a0015c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_configuration.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_configuration.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -119,18 +119,12 @@ func (o SensitiveDataScannerConfiguration) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerConfiguration) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id,omitempty"` Type *SensitiveDataScannerConfigurationType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -138,19 +132,22 @@ func (o *SensitiveDataScannerConfiguration) UnmarshalJSON(bytes []byte) (err err } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_configuration_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_configuration_data.go index be3630330..0a4ea5fd1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_configuration_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_configuration_data.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SensitiveDataScannerConfigurationData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerConfigurationData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SensitiveDataScannerConfiguration `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *SensitiveDataScannerConfigurationData) UnmarshalJSON(bytes []byte) (err } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_configuration_relationships.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_configuration_relationships.go index 943cf7355..ae44e727f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_configuration_relationships.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_configuration_relationships.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SensitiveDataScannerConfigurationRelationships) MarshalJSON() ([]byte, e // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerConfigurationRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Groups *SensitiveDataScannerGroupList `json:"groups,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *SensitiveDataScannerConfigurationRelationships) UnmarshalJSON(bytes []b } else { return err } + + hasInvalidField := false if all.Groups != nil && all.Groups.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Groups = all.Groups + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_configuration_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_configuration_type.go index f86d37740..02566d6f1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_configuration_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_configuration_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SensitiveDataScannerConfigurationType Sensitive Data Scanner configuration type. @@ -61,47 +62,3 @@ func (v SensitiveDataScannerConfigurationType) IsValid() bool { func (v SensitiveDataScannerConfigurationType) Ptr() *SensitiveDataScannerConfigurationType { return &v } - -// NullableSensitiveDataScannerConfigurationType handles when a null is used for SensitiveDataScannerConfigurationType. -type NullableSensitiveDataScannerConfigurationType struct { - value *SensitiveDataScannerConfigurationType - isSet bool -} - -// Get returns the associated value. -func (v NullableSensitiveDataScannerConfigurationType) Get() *SensitiveDataScannerConfigurationType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSensitiveDataScannerConfigurationType) Set(val *SensitiveDataScannerConfigurationType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSensitiveDataScannerConfigurationType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSensitiveDataScannerConfigurationType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSensitiveDataScannerConfigurationType initializes the struct as if Set has been called. -func NewNullableSensitiveDataScannerConfigurationType(val *SensitiveDataScannerConfigurationType) *NullableSensitiveDataScannerConfigurationType { - return &NullableSensitiveDataScannerConfigurationType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSensitiveDataScannerConfigurationType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSensitiveDataScannerConfigurationType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_create_group_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_create_group_response.go index 3a8422e4c..a71d4f55b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_create_group_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_create_group_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SensitiveDataScannerCreateGroupResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerCreateGroupResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SensitiveDataScannerGroupResponse `json:"data,omitempty"` Meta *SensitiveDataScannerMetaVersionOnly `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,25 +128,24 @@ func (o *SensitiveDataScannerCreateGroupResponse) UnmarshalJSON(bytes []byte) (e } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_create_rule_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_create_rule_response.go index 776be8ccb..ac07df60b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_create_rule_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_create_rule_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SensitiveDataScannerCreateRuleResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerCreateRuleResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SensitiveDataScannerRuleResponse `json:"data,omitempty"` Meta *SensitiveDataScannerMetaVersionOnly `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,25 +128,24 @@ func (o *SensitiveDataScannerCreateRuleResponse) UnmarshalJSON(bytes []byte) (er } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_filter.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_filter.go index 13b998094..f149aa2c7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_filter.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_filter.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SensitiveDataScannerFilter) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Query *string `json:"query,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *SensitiveDataScannerFilter) UnmarshalJSON(bytes []byte) (err error) { return err } o.Query = all.Query + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_get_config_included_item.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_get_config_included_item.go index 0191884c6..5d2944b97 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_get_config_included_item.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_get_config_included_item.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // SensitiveDataScannerGetConfigIncludedItem - An object related to the configuration. @@ -103,53 +103,3 @@ func (obj *SensitiveDataScannerGetConfigIncludedItem) GetActualInstance() interf // all schemas are nil return nil } - -// NullableSensitiveDataScannerGetConfigIncludedItem handles when a null is used for SensitiveDataScannerGetConfigIncludedItem. -type NullableSensitiveDataScannerGetConfigIncludedItem struct { - value *SensitiveDataScannerGetConfigIncludedItem - isSet bool -} - -// Get returns the associated value. -func (v NullableSensitiveDataScannerGetConfigIncludedItem) Get() *SensitiveDataScannerGetConfigIncludedItem { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSensitiveDataScannerGetConfigIncludedItem) Set(val *SensitiveDataScannerGetConfigIncludedItem) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSensitiveDataScannerGetConfigIncludedItem) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableSensitiveDataScannerGetConfigIncludedItem) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSensitiveDataScannerGetConfigIncludedItem initializes the struct as if Set has been called. -func NewNullableSensitiveDataScannerGetConfigIncludedItem(val *SensitiveDataScannerGetConfigIncludedItem) *NullableSensitiveDataScannerGetConfigIncludedItem { - return &NullableSensitiveDataScannerGetConfigIncludedItem{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSensitiveDataScannerGetConfigIncludedItem) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSensitiveDataScannerGetConfigIncludedItem) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_get_config_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_get_config_response.go index a87e24805..a9f97f170 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_get_config_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_get_config_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o SensitiveDataScannerGetConfigResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerGetConfigResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SensitiveDataScannerGetConfigResponseData `json:"data,omitempty"` Included []SensitiveDataScannerGetConfigIncludedItem `json:"included,omitempty"` Meta *SensitiveDataScannerMeta `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,26 +162,25 @@ func (o *SensitiveDataScannerGetConfigResponse) UnmarshalJSON(bytes []byte) (err } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data o.Included = all.Included if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_get_config_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_get_config_response_data.go index a3c902822..87383df5b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_get_config_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_get_config_response_data.go @@ -5,13 +5,15 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // SensitiveDataScannerGetConfigResponseData Response data related to the scanning groups. type SensitiveDataScannerGetConfigResponseData struct { + // Attributes of the Sensitive Data configuration. + Attributes map[string]interface{} `json:"attributes,omitempty"` // ID of the configuration. Id *string `json:"id,omitempty"` // Relationships of the configuration. @@ -44,6 +46,34 @@ func NewSensitiveDataScannerGetConfigResponseDataWithDefaults() *SensitiveDataSc return &this } +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *SensitiveDataScannerGetConfigResponseData) GetAttributes() map[string]interface{} { + if o == nil || o.Attributes == nil { + var ret map[string]interface{} + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SensitiveDataScannerGetConfigResponseData) GetAttributesOk() (*map[string]interface{}, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return &o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *SensitiveDataScannerGetConfigResponseData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given map[string]interface{} and assigns it to the Attributes field. +func (o *SensitiveDataScannerGetConfigResponseData) SetAttributes(v map[string]interface{}) { + o.Attributes = v +} + // GetId returns the Id field value if set, zero value otherwise. func (o *SensitiveDataScannerGetConfigResponseData) GetId() string { if o == nil || o.Id == nil { @@ -134,6 +164,9 @@ func (o SensitiveDataScannerGetConfigResponseData) MarshalJSON() ([]byte, error) if o.UnparsedObject != nil { return json.Marshal(o.UnparsedObject) } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } if o.Id != nil { toSerialize["id"] = o.Id } @@ -152,47 +185,42 @@ func (o SensitiveDataScannerGetConfigResponseData) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerGetConfigResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { + Attributes map[string]interface{} `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Relationships *SensitiveDataScannerConfigurationRelationships `json:"relationships,omitempty"` Type *SensitiveDataScannerConfigurationType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"id", "relationships", "type"}) + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false + 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group.go index d2413168a..d292b83c5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -119,18 +119,12 @@ func (o SensitiveDataScannerGroup) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerGroup) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id,omitempty"` Type *SensitiveDataScannerGroupType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -138,19 +132,22 @@ func (o *SensitiveDataScannerGroup) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_attributes.go index d9a8cc900..b7a0dbd3e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -214,7 +214,6 @@ func (o SensitiveDataScannerGroupAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerGroupAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Description *string `json:"description,omitempty"` Filter *SensitiveDataScannerFilter `json:"filter,omitempty"` @@ -223,12 +222,7 @@ func (o *SensitiveDataScannerGroupAttributes) UnmarshalJSON(bytes []byte) (err e ProductList []SensitiveDataScannerProduct `json:"product_list,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -236,21 +230,24 @@ func (o *SensitiveDataScannerGroupAttributes) UnmarshalJSON(bytes []byte) (err e } else { return err } + + hasInvalidField := false o.Description = all.Description if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Filter = all.Filter o.IsEnabled = all.IsEnabled o.Name = all.Name o.ProductList = all.ProductList + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_create.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_create.go index 2a263eeb5..fae7681c4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_create.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_create.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -139,19 +140,13 @@ func (o SensitiveDataScannerGroupCreate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerGroupCreate) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SensitiveDataScannerGroupAttributes `json:"attributes"` Relationships *SensitiveDataScannerGroupRelationships `json:"relationships,omitempty"` Type *SensitiveDataScannerGroupType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -165,34 +160,29 @@ func (o *SensitiveDataScannerGroupCreate) UnmarshalJSON(bytes []byte) (err error } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_create_request.go index de38663f6..610bd971e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_create_request.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SensitiveDataScannerGroupCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerGroupCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SensitiveDataScannerGroupCreate `json:"data,omitempty"` Meta *SensitiveDataScannerMetaVersionOnly `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,25 +128,24 @@ func (o *SensitiveDataScannerGroupCreateRequest) UnmarshalJSON(bytes []byte) (er } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_data.go index bfa3c42a9..d0fd1e8e9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_data.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SensitiveDataScannerGroupData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerGroupData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SensitiveDataScannerGroup `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *SensitiveDataScannerGroupData) UnmarshalJSON(bytes []byte) (err error) } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_delete_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_delete_request.go index 609724196..261eff641 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_delete_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_delete_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o SensitiveDataScannerGroupDeleteRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerGroupDeleteRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Meta *SensitiveDataScannerMetaVersionOnly `json:"meta"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Meta == nil { return fmt.Errorf("required field meta missing") @@ -98,17 +93,20 @@ func (o *SensitiveDataScannerGroupDeleteRequest) UnmarshalJSON(bytes []byte) (er } else { return err } + + hasInvalidField := false if all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = *all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_delete_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_delete_response.go index 6a463134b..121ac416f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_delete_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_delete_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SensitiveDataScannerGroupDeleteResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerGroupDeleteResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Meta *SensitiveDataScannerMetaVersionOnly `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *SensitiveDataScannerGroupDeleteResponse) UnmarshalJSON(bytes []byte) (e } else { return err } + + hasInvalidField := false if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_included_item.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_included_item.go index 628152a00..b4d05177d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_included_item.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_included_item.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -185,7 +185,6 @@ func (o SensitiveDataScannerGroupIncludedItem) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerGroupIncludedItem) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SensitiveDataScannerGroupAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` @@ -193,12 +192,7 @@ func (o *SensitiveDataScannerGroupIncludedItem) UnmarshalJSON(bytes []byte) (err Type *SensitiveDataScannerGroupType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,35 +200,30 @@ func (o *SensitiveDataScannerGroupIncludedItem) UnmarshalJSON(bytes []byte) (err } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_item.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_item.go index e247a1eee..e47c774e4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_item.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_item.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -119,18 +119,12 @@ func (o SensitiveDataScannerGroupItem) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerGroupItem) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id,omitempty"` Type *SensitiveDataScannerGroupType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -138,19 +132,22 @@ func (o *SensitiveDataScannerGroupItem) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_list.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_list.go index b53a8c9b8..4fa5cd71e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_list.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_list.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SensitiveDataScannerGroupList) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerGroupList) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []SensitiveDataScannerGroupItem `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *SensitiveDataScannerGroupList) UnmarshalJSON(bytes []byte) (err error) return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_relationships.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_relationships.go index 554629294..842826409 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_relationships.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_relationships.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SensitiveDataScannerGroupRelationships) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerGroupRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Configuration *SensitiveDataScannerConfigurationData `json:"configuration,omitempty"` Rules *SensitiveDataScannerRuleData `json:"rules,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,25 +128,24 @@ func (o *SensitiveDataScannerGroupRelationships) UnmarshalJSON(bytes []byte) (er } else { return err } + + hasInvalidField := false if all.Configuration != nil && all.Configuration.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Configuration = all.Configuration if all.Rules != nil && all.Rules.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Rules = all.Rules + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_response.go index ac390bb0c..2957c7482 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -185,7 +185,6 @@ func (o SensitiveDataScannerGroupResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerGroupResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SensitiveDataScannerGroupAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` @@ -193,12 +192,7 @@ func (o *SensitiveDataScannerGroupResponse) UnmarshalJSON(bytes []byte) (err err Type *SensitiveDataScannerGroupType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,35 +200,30 @@ func (o *SensitiveDataScannerGroupResponse) UnmarshalJSON(bytes []byte) (err err } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_type.go index 57499dd28..1b20912e2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SensitiveDataScannerGroupType Sensitive Data Scanner group type. @@ -61,47 +62,3 @@ func (v SensitiveDataScannerGroupType) IsValid() bool { func (v SensitiveDataScannerGroupType) Ptr() *SensitiveDataScannerGroupType { return &v } - -// NullableSensitiveDataScannerGroupType handles when a null is used for SensitiveDataScannerGroupType. -type NullableSensitiveDataScannerGroupType struct { - value *SensitiveDataScannerGroupType - isSet bool -} - -// Get returns the associated value. -func (v NullableSensitiveDataScannerGroupType) Get() *SensitiveDataScannerGroupType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSensitiveDataScannerGroupType) Set(val *SensitiveDataScannerGroupType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSensitiveDataScannerGroupType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSensitiveDataScannerGroupType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSensitiveDataScannerGroupType initializes the struct as if Set has been called. -func NewNullableSensitiveDataScannerGroupType(val *SensitiveDataScannerGroupType) *NullableSensitiveDataScannerGroupType { - return &NullableSensitiveDataScannerGroupType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSensitiveDataScannerGroupType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSensitiveDataScannerGroupType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_update.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_update.go index 27b9ce60a..e6ab31ca6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_update.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_update.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -185,7 +185,6 @@ func (o SensitiveDataScannerGroupUpdate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerGroupUpdate) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SensitiveDataScannerGroupAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` @@ -193,12 +192,7 @@ func (o *SensitiveDataScannerGroupUpdate) UnmarshalJSON(bytes []byte) (err error Type *SensitiveDataScannerGroupType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,35 +200,30 @@ func (o *SensitiveDataScannerGroupUpdate) UnmarshalJSON(bytes []byte) (err error } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_update_request.go index 1348ee4de..763de8e86 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o SensitiveDataScannerGroupUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerGroupUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SensitiveDataScannerGroupUpdate `json:"data"` Meta *SensitiveDataScannerMetaVersionOnly `json:"meta"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -129,25 +124,24 @@ func (o *SensitiveDataScannerGroupUpdateRequest) UnmarshalJSON(bytes []byte) (er } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data if all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = *all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_update_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_update_response.go index 0cb199e40..ce0a64d62 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_update_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_group_update_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SensitiveDataScannerGroupUpdateResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerGroupUpdateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Meta *SensitiveDataScannerMetaVersionOnly `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *SensitiveDataScannerGroupUpdateResponse) UnmarshalJSON(bytes []byte) (e } else { return err } + + hasInvalidField := false if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_meta.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_meta.go index 2d26a01c4..ba2cc9407 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_meta.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_meta.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -18,6 +18,8 @@ type SensitiveDataScannerMeta struct { GroupCountLimit *int64 `json:"group_count_limit,omitempty"` // Whether or not scanned events are highlighted in Logs or RUM for the org. HasHighlightEnabled *bool `json:"has_highlight_enabled,omitempty"` + // Whether or not scanned events have multi-pass enabled. + HasMultiPassEnabled *bool `json:"has_multi_pass_enabled,omitempty"` // Whether or not the org is compliant to the payment card industry standard. IsPciCompliant *bool `json:"is_pci_compliant,omitempty"` // Version of the API. @@ -128,6 +130,34 @@ func (o *SensitiveDataScannerMeta) SetHasHighlightEnabled(v bool) { o.HasHighlightEnabled = &v } +// GetHasMultiPassEnabled returns the HasMultiPassEnabled field value if set, zero value otherwise. +func (o *SensitiveDataScannerMeta) GetHasMultiPassEnabled() bool { + if o == nil || o.HasMultiPassEnabled == nil { + var ret bool + return ret + } + return *o.HasMultiPassEnabled +} + +// GetHasMultiPassEnabledOk returns a tuple with the HasMultiPassEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SensitiveDataScannerMeta) GetHasMultiPassEnabledOk() (*bool, bool) { + if o == nil || o.HasMultiPassEnabled == nil { + return nil, false + } + return o.HasMultiPassEnabled, true +} + +// HasHasMultiPassEnabled returns a boolean if a field has been set. +func (o *SensitiveDataScannerMeta) HasHasMultiPassEnabled() bool { + return o != nil && o.HasMultiPassEnabled != nil +} + +// SetHasMultiPassEnabled gets a reference to the given bool and assigns it to the HasMultiPassEnabled field. +func (o *SensitiveDataScannerMeta) SetHasMultiPassEnabled(v bool) { + o.HasMultiPassEnabled = &v +} + // GetIsPciCompliant returns the IsPciCompliant field value if set, zero value otherwise. func (o *SensitiveDataScannerMeta) GetIsPciCompliant() bool { if o == nil || o.IsPciCompliant == nil { @@ -199,6 +229,9 @@ func (o SensitiveDataScannerMeta) MarshalJSON() ([]byte, error) { if o.HasHighlightEnabled != nil { toSerialize["has_highlight_enabled"] = o.HasHighlightEnabled } + if o.HasMultiPassEnabled != nil { + toSerialize["has_multi_pass_enabled"] = o.HasMultiPassEnabled + } if o.IsPciCompliant != nil { toSerialize["is_pci_compliant"] = o.IsPciCompliant } @@ -214,33 +247,30 @@ func (o SensitiveDataScannerMeta) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerMeta) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CountLimit *int64 `json:"count_limit,omitempty"` GroupCountLimit *int64 `json:"group_count_limit,omitempty"` HasHighlightEnabled *bool `json:"has_highlight_enabled,omitempty"` + HasMultiPassEnabled *bool `json:"has_multi_pass_enabled,omitempty"` IsPciCompliant *bool `json:"is_pci_compliant,omitempty"` Version *int64 `json:"version,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"count_limit", "group_count_limit", "has_highlight_enabled", "is_pci_compliant", "version"}) + datadog.DeleteKeys(additionalProperties, &[]string{"count_limit", "group_count_limit", "has_highlight_enabled", "has_multi_pass_enabled", "is_pci_compliant", "version"}) } else { return err } o.CountLimit = all.CountLimit o.GroupCountLimit = all.GroupCountLimit o.HasHighlightEnabled = all.HasHighlightEnabled + o.HasMultiPassEnabled = all.HasMultiPassEnabled o.IsPciCompliant = all.IsPciCompliant o.Version = all.Version + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_meta_version_only.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_meta_version_only.go index 0bc42821f..0ba5bf7ac 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_meta_version_only.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_meta_version_only.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SensitiveDataScannerMetaVersionOnly) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerMetaVersionOnly) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Version *int64 `json:"version,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *SensitiveDataScannerMetaVersionOnly) UnmarshalJSON(bytes []byte) (err e return err } o.Version = all.Version + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_product.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_product.go index 33f8abae3..76c03a1e7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_product.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_product.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SensitiveDataScannerProduct Datadog product onto which Sensitive Data Scanner can be activated. @@ -67,47 +68,3 @@ func (v SensitiveDataScannerProduct) IsValid() bool { func (v SensitiveDataScannerProduct) Ptr() *SensitiveDataScannerProduct { return &v } - -// NullableSensitiveDataScannerProduct handles when a null is used for SensitiveDataScannerProduct. -type NullableSensitiveDataScannerProduct struct { - value *SensitiveDataScannerProduct - isSet bool -} - -// Get returns the associated value. -func (v NullableSensitiveDataScannerProduct) Get() *SensitiveDataScannerProduct { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSensitiveDataScannerProduct) Set(val *SensitiveDataScannerProduct) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSensitiveDataScannerProduct) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSensitiveDataScannerProduct) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSensitiveDataScannerProduct initializes the struct as if Set has been called. -func NewNullableSensitiveDataScannerProduct(val *SensitiveDataScannerProduct) *NullableSensitiveDataScannerProduct { - return &NullableSensitiveDataScannerProduct{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSensitiveDataScannerProduct) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSensitiveDataScannerProduct) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_reorder_config.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_reorder_config.go index 2069611c9..d96bdd70b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_reorder_config.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_reorder_config.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o SensitiveDataScannerReorderConfig) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerReorderConfig) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id,omitempty"` Relationships *SensitiveDataScannerConfigurationRelationships `json:"relationships,omitempty"` Type *SensitiveDataScannerConfigurationType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *SensitiveDataScannerReorderConfig) UnmarshalJSON(bytes []byte) (err err } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Id = all.Id if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_reorder_groups_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_reorder_groups_response.go index 037dc29ab..6d4807e0b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_reorder_groups_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_reorder_groups_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SensitiveDataScannerReorderGroupsResponse) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerReorderGroupsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Meta *SensitiveDataScannerMeta `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *SensitiveDataScannerReorderGroupsResponse) UnmarshalJSON(bytes []byte) } else { return err } + + hasInvalidField := false if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule.go index c5b503e6f..94f2c4647 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -119,18 +119,12 @@ func (o SensitiveDataScannerRule) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerRule) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id,omitempty"` Type *SensitiveDataScannerRuleType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -138,19 +132,22 @@ func (o *SensitiveDataScannerRule) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_attributes.go index d7d879334..d2619a5e2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -314,7 +314,6 @@ func (o SensitiveDataScannerRuleAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerRuleAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Description *string `json:"description,omitempty"` ExcludedNamespaces []string `json:"excluded_namespaces,omitempty"` @@ -326,12 +325,7 @@ func (o *SensitiveDataScannerRuleAttributes) UnmarshalJSON(bytes []byte) (err er TextReplacement *SensitiveDataScannerTextReplacement `json:"text_replacement,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -339,6 +333,8 @@ func (o *SensitiveDataScannerRuleAttributes) UnmarshalJSON(bytes []byte) (err er } else { return err } + + hasInvalidField := false o.Description = all.Description o.ExcludedNamespaces = all.ExcludedNamespaces o.IsEnabled = all.IsEnabled @@ -347,16 +343,17 @@ func (o *SensitiveDataScannerRuleAttributes) UnmarshalJSON(bytes []byte) (err er o.Pattern = all.Pattern o.Tags = all.Tags if all.TextReplacement != nil && all.TextReplacement.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.TextReplacement = all.TextReplacement + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_create.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_create.go index 0b18c6d1b..d6356113b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_create.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_create.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -133,19 +134,13 @@ func (o SensitiveDataScannerRuleCreate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerRuleCreate) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SensitiveDataScannerRuleAttributes `json:"attributes"` Relationships *SensitiveDataScannerRuleRelationships `json:"relationships"` Type *SensitiveDataScannerRuleType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -162,34 +157,29 @@ func (o *SensitiveDataScannerRuleCreate) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes if all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = *all.Relationships - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_create_request.go index 90e9deea2..34f511fc8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o SensitiveDataScannerRuleCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerRuleCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SensitiveDataScannerRuleCreate `json:"data"` Meta *SensitiveDataScannerMetaVersionOnly `json:"meta"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -129,25 +124,24 @@ func (o *SensitiveDataScannerRuleCreateRequest) UnmarshalJSON(bytes []byte) (err } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data if all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = *all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_data.go index 33dece9ea..63b3a08fc 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_data.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SensitiveDataScannerRuleData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerRuleData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []SensitiveDataScannerRule `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *SensitiveDataScannerRuleData) UnmarshalJSON(bytes []byte) (err error) { return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_delete_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_delete_request.go index c0d3ad3ae..facc540e3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_delete_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_delete_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o SensitiveDataScannerRuleDeleteRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerRuleDeleteRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Meta *SensitiveDataScannerMetaVersionOnly `json:"meta"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Meta == nil { return fmt.Errorf("required field meta missing") @@ -98,17 +93,20 @@ func (o *SensitiveDataScannerRuleDeleteRequest) UnmarshalJSON(bytes []byte) (err } else { return err } + + hasInvalidField := false if all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = *all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_delete_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_delete_response.go index b2c4b2cb9..f2bb35d47 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_delete_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_delete_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SensitiveDataScannerRuleDeleteResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerRuleDeleteResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Meta *SensitiveDataScannerMetaVersionOnly `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *SensitiveDataScannerRuleDeleteResponse) UnmarshalJSON(bytes []byte) (er } else { return err } + + hasInvalidField := false if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_included_item.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_included_item.go index 9f39c74e0..b7797f005 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_included_item.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_included_item.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -185,7 +185,6 @@ func (o SensitiveDataScannerRuleIncludedItem) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerRuleIncludedItem) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SensitiveDataScannerRuleAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` @@ -193,12 +192,7 @@ func (o *SensitiveDataScannerRuleIncludedItem) UnmarshalJSON(bytes []byte) (err Type *SensitiveDataScannerRuleType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,35 +200,30 @@ func (o *SensitiveDataScannerRuleIncludedItem) UnmarshalJSON(bytes []byte) (err } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_relationships.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_relationships.go index 464e818df..0ee099d58 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_relationships.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_relationships.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SensitiveDataScannerRuleRelationships) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerRuleRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Group *SensitiveDataScannerGroupData `json:"group,omitempty"` StandardPattern *SensitiveDataScannerStandardPatternData `json:"standard_pattern,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,25 +128,24 @@ func (o *SensitiveDataScannerRuleRelationships) UnmarshalJSON(bytes []byte) (err } else { return err } + + hasInvalidField := false if all.Group != nil && all.Group.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Group = all.Group if all.StandardPattern != nil && all.StandardPattern.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.StandardPattern = all.StandardPattern + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_response.go index 5ce56a6c6..b838a0601 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -185,7 +185,6 @@ func (o SensitiveDataScannerRuleResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerRuleResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SensitiveDataScannerRuleAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` @@ -193,12 +192,7 @@ func (o *SensitiveDataScannerRuleResponse) UnmarshalJSON(bytes []byte) (err erro Type *SensitiveDataScannerRuleType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,35 +200,30 @@ func (o *SensitiveDataScannerRuleResponse) UnmarshalJSON(bytes []byte) (err erro } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_type.go index 5eaa75f4b..1499fe476 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SensitiveDataScannerRuleType Sensitive Data Scanner rule type. @@ -61,47 +62,3 @@ func (v SensitiveDataScannerRuleType) IsValid() bool { func (v SensitiveDataScannerRuleType) Ptr() *SensitiveDataScannerRuleType { return &v } - -// NullableSensitiveDataScannerRuleType handles when a null is used for SensitiveDataScannerRuleType. -type NullableSensitiveDataScannerRuleType struct { - value *SensitiveDataScannerRuleType - isSet bool -} - -// Get returns the associated value. -func (v NullableSensitiveDataScannerRuleType) Get() *SensitiveDataScannerRuleType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSensitiveDataScannerRuleType) Set(val *SensitiveDataScannerRuleType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSensitiveDataScannerRuleType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSensitiveDataScannerRuleType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSensitiveDataScannerRuleType initializes the struct as if Set has been called. -func NewNullableSensitiveDataScannerRuleType(val *SensitiveDataScannerRuleType) *NullableSensitiveDataScannerRuleType { - return &NullableSensitiveDataScannerRuleType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSensitiveDataScannerRuleType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSensitiveDataScannerRuleType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_update.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_update.go index fbf1261b0..bfd8b2bf1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_update.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_update.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -185,7 +185,6 @@ func (o SensitiveDataScannerRuleUpdate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerRuleUpdate) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SensitiveDataScannerRuleAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` @@ -193,12 +192,7 @@ func (o *SensitiveDataScannerRuleUpdate) UnmarshalJSON(bytes []byte) (err error) Type *SensitiveDataScannerRuleType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,35 +200,30 @@ func (o *SensitiveDataScannerRuleUpdate) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_update_request.go index 3396c31e3..ee653ff34 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -104,18 +105,12 @@ func (o SensitiveDataScannerRuleUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerRuleUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SensitiveDataScannerRuleUpdate `json:"data"` Meta *SensitiveDataScannerMetaVersionOnly `json:"meta"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -129,25 +124,24 @@ func (o *SensitiveDataScannerRuleUpdateRequest) UnmarshalJSON(bytes []byte) (err } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data if all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = *all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_update_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_update_response.go index 96a5c76cb..e3ebe2c63 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_update_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_rule_update_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SensitiveDataScannerRuleUpdateResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerRuleUpdateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Meta *SensitiveDataScannerMetaVersionOnly `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *SensitiveDataScannerRuleUpdateResponse) UnmarshalJSON(bytes []byte) (er } else { return err } + + hasInvalidField := false if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_standard_pattern.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_standard_pattern.go index 993ab0853..e7de08b62 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_standard_pattern.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_standard_pattern.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -119,18 +119,12 @@ func (o SensitiveDataScannerStandardPattern) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerStandardPattern) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Id *string `json:"id,omitempty"` Type *SensitiveDataScannerStandardPatternType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -138,19 +132,22 @@ func (o *SensitiveDataScannerStandardPattern) UnmarshalJSON(bytes []byte) (err e } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_standard_pattern_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_standard_pattern_attributes.go index 632c33442..4cdfb9745 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_standard_pattern_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_standard_pattern_attributes.go @@ -5,13 +5,15 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // SensitiveDataScannerStandardPatternAttributes Attributes of the Sensitive Data Scanner standard pattern. type SensitiveDataScannerStandardPatternAttributes struct { + // Description of the standard pattern. + Description *string `json:"description,omitempty"` // Name of the standard pattern. Name *string `json:"name,omitempty"` // Regex to match. @@ -40,6 +42,34 @@ func NewSensitiveDataScannerStandardPatternAttributesWithDefaults() *SensitiveDa return &this } +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *SensitiveDataScannerStandardPatternAttributes) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SensitiveDataScannerStandardPatternAttributes) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *SensitiveDataScannerStandardPatternAttributes) HasDescription() bool { + return o != nil && o.Description != nil +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *SensitiveDataScannerStandardPatternAttributes) SetDescription(v string) { + o.Description = &v +} + // GetName returns the Name field value if set, zero value otherwise. func (o *SensitiveDataScannerStandardPatternAttributes) GetName() string { if o == nil || o.Name == nil { @@ -130,6 +160,9 @@ func (o SensitiveDataScannerStandardPatternAttributes) MarshalJSON() ([]byte, er if o.UnparsedObject != nil { return json.Marshal(o.UnparsedObject) } + if o.Description != nil { + toSerialize["description"] = o.Description + } if o.Name != nil { toSerialize["name"] = o.Name } @@ -148,29 +181,26 @@ func (o SensitiveDataScannerStandardPatternAttributes) MarshalJSON() ([]byte, er // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerStandardPatternAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { - Name *string `json:"name,omitempty"` - Pattern *string `json:"pattern,omitempty"` - Tags []string `json:"tags,omitempty"` + Description *string `json:"description,omitempty"` + Name *string `json:"name,omitempty"` + Pattern *string `json:"pattern,omitempty"` + Tags []string `json:"tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"name", "pattern", "tags"}) + datadog.DeleteKeys(additionalProperties, &[]string{"description", "name", "pattern", "tags"}) } else { return err } + o.Description = all.Description o.Name = all.Name o.Pattern = all.Pattern o.Tags = all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_standard_pattern_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_standard_pattern_data.go index ffa22ece5..01844e1e8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_standard_pattern_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_standard_pattern_data.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SensitiveDataScannerStandardPatternData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerStandardPatternData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SensitiveDataScannerStandardPattern `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *SensitiveDataScannerStandardPatternData) UnmarshalJSON(bytes []byte) (e } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_standard_pattern_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_standard_pattern_type.go index aecdf49ae..cc8ab1f36 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_standard_pattern_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_standard_pattern_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SensitiveDataScannerStandardPatternType Sensitive Data Scanner standard pattern type. @@ -61,47 +62,3 @@ func (v SensitiveDataScannerStandardPatternType) IsValid() bool { func (v SensitiveDataScannerStandardPatternType) Ptr() *SensitiveDataScannerStandardPatternType { return &v } - -// NullableSensitiveDataScannerStandardPatternType handles when a null is used for SensitiveDataScannerStandardPatternType. -type NullableSensitiveDataScannerStandardPatternType struct { - value *SensitiveDataScannerStandardPatternType - isSet bool -} - -// Get returns the associated value. -func (v NullableSensitiveDataScannerStandardPatternType) Get() *SensitiveDataScannerStandardPatternType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSensitiveDataScannerStandardPatternType) Set(val *SensitiveDataScannerStandardPatternType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSensitiveDataScannerStandardPatternType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSensitiveDataScannerStandardPatternType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSensitiveDataScannerStandardPatternType initializes the struct as if Set has been called. -func NewNullableSensitiveDataScannerStandardPatternType(val *SensitiveDataScannerStandardPatternType) *NullableSensitiveDataScannerStandardPatternType { - return &NullableSensitiveDataScannerStandardPatternType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSensitiveDataScannerStandardPatternType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSensitiveDataScannerStandardPatternType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_standard_patterns_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_standard_patterns_response_data.go index c39f22ec7..30aaa0459 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_standard_patterns_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_standard_patterns_response_data.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SensitiveDataScannerStandardPatternsResponseData) MarshalJSON() ([]byte, // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerStandardPatternsResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []SensitiveDataScannerStandardPatternsResponseItem `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *SensitiveDataScannerStandardPatternsResponseData) UnmarshalJSON(bytes [ return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_standard_patterns_response_item.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_standard_patterns_response_item.go index 0ba301d8f..f72458bcf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_standard_patterns_response_item.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_standard_patterns_response_item.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o SensitiveDataScannerStandardPatternsResponseItem) MarshalJSON() ([]byte, // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerStandardPatternsResponseItem) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SensitiveDataScannerStandardPatternAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *SensitiveDataScannerStandardPatternType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *SensitiveDataScannerStandardPatternsResponseItem) UnmarshalJSON(bytes [ } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_text_replacement.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_text_replacement.go index 04f62a279..e0a22b263 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_text_replacement.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_text_replacement.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -158,19 +158,13 @@ func (o SensitiveDataScannerTextReplacement) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerTextReplacement) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { NumberOfChars *int64 `json:"number_of_chars,omitempty"` ReplacementString *string `json:"replacement_string,omitempty"` Type *SensitiveDataScannerTextReplacementType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -178,20 +172,23 @@ func (o *SensitiveDataScannerTextReplacement) UnmarshalJSON(bytes []byte) (err e } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.NumberOfChars = all.NumberOfChars o.ReplacementString = all.ReplacementString - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_text_replacement_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_text_replacement_type.go index b23add8da..d487f36c8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_text_replacement_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_sensitive_data_scanner_text_replacement_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SensitiveDataScannerTextReplacementType Type of the replacement text. None means no replacement. @@ -74,47 +75,3 @@ func (v SensitiveDataScannerTextReplacementType) IsValid() bool { func (v SensitiveDataScannerTextReplacementType) Ptr() *SensitiveDataScannerTextReplacementType { return &v } - -// NullableSensitiveDataScannerTextReplacementType handles when a null is used for SensitiveDataScannerTextReplacementType. -type NullableSensitiveDataScannerTextReplacementType struct { - value *SensitiveDataScannerTextReplacementType - isSet bool -} - -// Get returns the associated value. -func (v NullableSensitiveDataScannerTextReplacementType) Get() *SensitiveDataScannerTextReplacementType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSensitiveDataScannerTextReplacementType) Set(val *SensitiveDataScannerTextReplacementType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSensitiveDataScannerTextReplacementType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSensitiveDataScannerTextReplacementType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSensitiveDataScannerTextReplacementType initializes the struct as if Set has been called. -func NewNullableSensitiveDataScannerTextReplacementType(val *SensitiveDataScannerTextReplacementType) *NullableSensitiveDataScannerTextReplacementType { - return &NullableSensitiveDataScannerTextReplacementType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSensitiveDataScannerTextReplacementType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSensitiveDataScannerTextReplacementType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_account_create_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_account_create_attributes.go index fd8a284b9..ceee8ec3d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_account_create_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_account_create_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -170,7 +171,6 @@ func (o ServiceAccountCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceAccountCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Email *string `json:"email"` Name *string `json:"name,omitempty"` @@ -178,12 +178,7 @@ func (o *ServiceAccountCreateAttributes) UnmarshalJSON(bytes []byte) (err error) Title *string `json:"title,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Email == nil { return fmt.Errorf("required field email missing") @@ -201,6 +196,7 @@ func (o *ServiceAccountCreateAttributes) UnmarshalJSON(bytes []byte) (err error) o.Name = all.Name o.ServiceAccount = *all.ServiceAccount o.Title = all.Title + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_account_create_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_account_create_data.go index 0d60c77a2..d9ca4e4c1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_account_create_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_account_create_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -139,19 +140,13 @@ func (o ServiceAccountCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceAccountCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *ServiceAccountCreateAttributes `json:"attributes"` Relationships *UserRelationships `json:"relationships,omitempty"` Type *UsersType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -165,34 +160,29 @@ func (o *ServiceAccountCreateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_account_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_account_create_request.go index 27376495d..0e1ca912f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_account_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_account_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o ServiceAccountCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceAccountCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *ServiceAccountCreateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *ServiceAccountCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_create_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_create_response.go index d81feb594..7790de5e7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_create_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_create_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o ServiceDefinitionCreateResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionCreateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []ServiceDefinitionData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *ServiceDefinitionCreateResponse) UnmarshalJSON(bytes []byte) (err error return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_data.go index ac9e0e4c0..80e0191de 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_data.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -14,6 +14,8 @@ import ( type ServiceDefinitionData struct { // Service definition attributes. Attributes *ServiceDefinitionDataAttributes `json:"attributes,omitempty"` + // Service definition id. + Id *string `json:"id,omitempty"` // Service definition type. Type *string `json:"type,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct @@ -66,6 +68,34 @@ func (o *ServiceDefinitionData) SetAttributes(v ServiceDefinitionDataAttributes) o.Attributes = &v } +// GetId returns the Id field value if set, zero value otherwise. +func (o *ServiceDefinitionData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *ServiceDefinitionData) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ServiceDefinitionData) SetId(v string) { + o.Id = &v +} + // GetType returns the Type field value if set, zero value otherwise. func (o *ServiceDefinitionData) GetType() string { if o == nil || o.Type == nil { @@ -103,6 +133,9 @@ func (o ServiceDefinitionData) MarshalJSON() ([]byte, error) { if o.Attributes != nil { toSerialize["attributes"] = o.Attributes } + if o.Id != nil { + toSerialize["id"] = o.Id + } if o.Type != nil { toSerialize["type"] = o.Type } @@ -115,37 +148,36 @@ func (o ServiceDefinitionData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *ServiceDefinitionDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` Type *string `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) } else { return err } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes + o.Id = all.Id o.Type = all.Type + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_data_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_data_attributes.go index 8fa75d890..0101f48e6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_data_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_data_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o ServiceDefinitionDataAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionDataAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Meta *ServiceDefinitionMeta `json:"meta,omitempty"` Schema *ServiceDefinitionSchema `json:"schema,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *ServiceDefinitionDataAttributes) UnmarshalJSON(bytes []byte) (err error } else { return err } + + hasInvalidField := false if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta o.Schema = all.Schema + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_get_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_get_response.go index af8ad68bc..ac025d2c5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_get_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_get_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o ServiceDefinitionGetResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionGetResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *ServiceDefinitionData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *ServiceDefinitionGetResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_meta.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_meta.go index 60ee534a8..dde823953 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_meta.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_meta.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -20,6 +20,12 @@ type ServiceDefinitionMeta struct { IngestionSource *string `json:"ingestion-source,omitempty"` // Last modified time of the service definition. LastModifiedTime *string `json:"last-modified-time,omitempty"` + // User defined origin of the service definition. + Origin *string `json:"origin,omitempty"` + // User defined origin's detail of the service definition. + OriginDetail *string `json:"origin-detail,omitempty"` + // A list of schema validation warnings. + Warnings []ServiceDefinitionMetaWarnings `json:"warnings,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{} @@ -154,6 +160,90 @@ func (o *ServiceDefinitionMeta) SetLastModifiedTime(v string) { o.LastModifiedTime = &v } +// GetOrigin returns the Origin field value if set, zero value otherwise. +func (o *ServiceDefinitionMeta) GetOrigin() string { + if o == nil || o.Origin == nil { + var ret string + return ret + } + return *o.Origin +} + +// GetOriginOk returns a tuple with the Origin field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionMeta) GetOriginOk() (*string, bool) { + if o == nil || o.Origin == nil { + return nil, false + } + return o.Origin, true +} + +// HasOrigin returns a boolean if a field has been set. +func (o *ServiceDefinitionMeta) HasOrigin() bool { + return o != nil && o.Origin != nil +} + +// SetOrigin gets a reference to the given string and assigns it to the Origin field. +func (o *ServiceDefinitionMeta) SetOrigin(v string) { + o.Origin = &v +} + +// GetOriginDetail returns the OriginDetail field value if set, zero value otherwise. +func (o *ServiceDefinitionMeta) GetOriginDetail() string { + if o == nil || o.OriginDetail == nil { + var ret string + return ret + } + return *o.OriginDetail +} + +// GetOriginDetailOk returns a tuple with the OriginDetail field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionMeta) GetOriginDetailOk() (*string, bool) { + if o == nil || o.OriginDetail == nil { + return nil, false + } + return o.OriginDetail, true +} + +// HasOriginDetail returns a boolean if a field has been set. +func (o *ServiceDefinitionMeta) HasOriginDetail() bool { + return o != nil && o.OriginDetail != nil +} + +// SetOriginDetail gets a reference to the given string and assigns it to the OriginDetail field. +func (o *ServiceDefinitionMeta) SetOriginDetail(v string) { + o.OriginDetail = &v +} + +// GetWarnings returns the Warnings field value if set, zero value otherwise. +func (o *ServiceDefinitionMeta) GetWarnings() []ServiceDefinitionMetaWarnings { + if o == nil || o.Warnings == nil { + var ret []ServiceDefinitionMetaWarnings + return ret + } + return o.Warnings +} + +// GetWarningsOk returns a tuple with the Warnings field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionMeta) GetWarningsOk() (*[]ServiceDefinitionMetaWarnings, bool) { + if o == nil || o.Warnings == nil { + return nil, false + } + return &o.Warnings, true +} + +// HasWarnings returns a boolean if a field has been set. +func (o *ServiceDefinitionMeta) HasWarnings() bool { + return o != nil && o.Warnings != nil +} + +// SetWarnings gets a reference to the given []ServiceDefinitionMetaWarnings and assigns it to the Warnings field. +func (o *ServiceDefinitionMeta) SetWarnings(v []ServiceDefinitionMetaWarnings) { + o.Warnings = v +} + // MarshalJSON serializes the struct using spec logic. func (o ServiceDefinitionMeta) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -172,6 +262,15 @@ func (o ServiceDefinitionMeta) MarshalJSON() ([]byte, error) { if o.LastModifiedTime != nil { toSerialize["last-modified-time"] = o.LastModifiedTime } + if o.Origin != nil { + toSerialize["origin"] = o.Origin + } + if o.OriginDetail != nil { + toSerialize["origin-detail"] = o.OriginDetail + } + if o.Warnings != nil { + toSerialize["warnings"] = o.Warnings + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -181,24 +280,21 @@ func (o ServiceDefinitionMeta) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionMeta) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { - GithubHtmlUrl *string `json:"github-html-url,omitempty"` - IngestedSchemaVersion *string `json:"ingested-schema-version,omitempty"` - IngestionSource *string `json:"ingestion-source,omitempty"` - LastModifiedTime *string `json:"last-modified-time,omitempty"` + GithubHtmlUrl *string `json:"github-html-url,omitempty"` + IngestedSchemaVersion *string `json:"ingested-schema-version,omitempty"` + IngestionSource *string `json:"ingestion-source,omitempty"` + LastModifiedTime *string `json:"last-modified-time,omitempty"` + Origin *string `json:"origin,omitempty"` + OriginDetail *string `json:"origin-detail,omitempty"` + Warnings []ServiceDefinitionMetaWarnings `json:"warnings,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"github-html-url", "ingested-schema-version", "ingestion-source", "last-modified-time"}) + datadog.DeleteKeys(additionalProperties, &[]string{"github-html-url", "ingested-schema-version", "ingestion-source", "last-modified-time", "origin", "origin-detail", "warnings"}) } else { return err } @@ -206,6 +302,10 @@ func (o *ServiceDefinitionMeta) UnmarshalJSON(bytes []byte) (err error) { o.IngestedSchemaVersion = all.IngestedSchemaVersion o.IngestionSource = all.IngestionSource o.LastModifiedTime = all.LastModifiedTime + o.Origin = all.Origin + o.OriginDetail = all.OriginDetail + o.Warnings = all.Warnings + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_meta_warnings.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_meta_warnings.go new file mode 100644 index 000000000..14a630aa3 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_meta_warnings.go @@ -0,0 +1,174 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// ServiceDefinitionMetaWarnings Schema validation warnings. +type ServiceDefinitionMetaWarnings struct { + // The warning instance location. + InstanceLocation *string `json:"instance-location,omitempty"` + // The warning keyword location. + KeywordLocation *string `json:"keyword-location,omitempty"` + // The warning message. + Message *string `json:"message,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{} +} + +// NewServiceDefinitionMetaWarnings instantiates a new ServiceDefinitionMetaWarnings 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 NewServiceDefinitionMetaWarnings() *ServiceDefinitionMetaWarnings { + this := ServiceDefinitionMetaWarnings{} + return &this +} + +// NewServiceDefinitionMetaWarningsWithDefaults instantiates a new ServiceDefinitionMetaWarnings 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 NewServiceDefinitionMetaWarningsWithDefaults() *ServiceDefinitionMetaWarnings { + this := ServiceDefinitionMetaWarnings{} + return &this +} + +// GetInstanceLocation returns the InstanceLocation field value if set, zero value otherwise. +func (o *ServiceDefinitionMetaWarnings) GetInstanceLocation() string { + if o == nil || o.InstanceLocation == nil { + var ret string + return ret + } + return *o.InstanceLocation +} + +// GetInstanceLocationOk returns a tuple with the InstanceLocation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionMetaWarnings) GetInstanceLocationOk() (*string, bool) { + if o == nil || o.InstanceLocation == nil { + return nil, false + } + return o.InstanceLocation, true +} + +// HasInstanceLocation returns a boolean if a field has been set. +func (o *ServiceDefinitionMetaWarnings) HasInstanceLocation() bool { + return o != nil && o.InstanceLocation != nil +} + +// SetInstanceLocation gets a reference to the given string and assigns it to the InstanceLocation field. +func (o *ServiceDefinitionMetaWarnings) SetInstanceLocation(v string) { + o.InstanceLocation = &v +} + +// GetKeywordLocation returns the KeywordLocation field value if set, zero value otherwise. +func (o *ServiceDefinitionMetaWarnings) GetKeywordLocation() string { + if o == nil || o.KeywordLocation == nil { + var ret string + return ret + } + return *o.KeywordLocation +} + +// GetKeywordLocationOk returns a tuple with the KeywordLocation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionMetaWarnings) GetKeywordLocationOk() (*string, bool) { + if o == nil || o.KeywordLocation == nil { + return nil, false + } + return o.KeywordLocation, true +} + +// HasKeywordLocation returns a boolean if a field has been set. +func (o *ServiceDefinitionMetaWarnings) HasKeywordLocation() bool { + return o != nil && o.KeywordLocation != nil +} + +// SetKeywordLocation gets a reference to the given string and assigns it to the KeywordLocation field. +func (o *ServiceDefinitionMetaWarnings) SetKeywordLocation(v string) { + o.KeywordLocation = &v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *ServiceDefinitionMetaWarnings) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionMetaWarnings) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *ServiceDefinitionMetaWarnings) HasMessage() bool { + return o != nil && o.Message != nil +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *ServiceDefinitionMetaWarnings) SetMessage(v string) { + o.Message = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceDefinitionMetaWarnings) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.InstanceLocation != nil { + toSerialize["instance-location"] = o.InstanceLocation + } + if o.KeywordLocation != nil { + toSerialize["keyword-location"] = o.KeywordLocation + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceDefinitionMetaWarnings) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + InstanceLocation *string `json:"instance-location,omitempty"` + KeywordLocation *string `json:"keyword-location,omitempty"` + Message *string `json:"message,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"instance-location", "keyword-location", "message"}) + } else { + return err + } + o.InstanceLocation = all.InstanceLocation + o.KeywordLocation = all.KeywordLocation + o.Message = all.Message + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_schema.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_schema.go index f70834862..06452cd03 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_schema.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_schema.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // ServiceDefinitionSchema - Service definition schema. @@ -135,53 +135,3 @@ func (obj *ServiceDefinitionSchema) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableServiceDefinitionSchema handles when a null is used for ServiceDefinitionSchema. -type NullableServiceDefinitionSchema struct { - value *ServiceDefinitionSchema - isSet bool -} - -// Get returns the associated value. -func (v NullableServiceDefinitionSchema) Get() *ServiceDefinitionSchema { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableServiceDefinitionSchema) Set(val *ServiceDefinitionSchema) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableServiceDefinitionSchema) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableServiceDefinitionSchema) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableServiceDefinitionSchema initializes the struct as if Set has been called. -func NewNullableServiceDefinitionSchema(val *ServiceDefinitionSchema) *NullableServiceDefinitionSchema { - return &NullableServiceDefinitionSchema{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableServiceDefinitionSchema) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableServiceDefinitionSchema) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_schema_versions.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_schema_versions.go index eadeef5e7..84f9fec0b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_schema_versions.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_schema_versions.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ServiceDefinitionSchemaVersions Schema versions @@ -65,47 +66,3 @@ func (v ServiceDefinitionSchemaVersions) IsValid() bool { func (v ServiceDefinitionSchemaVersions) Ptr() *ServiceDefinitionSchemaVersions { return &v } - -// NullableServiceDefinitionSchemaVersions handles when a null is used for ServiceDefinitionSchemaVersions. -type NullableServiceDefinitionSchemaVersions struct { - value *ServiceDefinitionSchemaVersions - isSet bool -} - -// Get returns the associated value. -func (v NullableServiceDefinitionSchemaVersions) Get() *ServiceDefinitionSchemaVersions { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableServiceDefinitionSchemaVersions) Set(val *ServiceDefinitionSchemaVersions) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableServiceDefinitionSchemaVersions) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableServiceDefinitionSchemaVersions) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableServiceDefinitionSchemaVersions initializes the struct as if Set has been called. -func NewNullableServiceDefinitionSchemaVersions(val *ServiceDefinitionSchemaVersions) *NullableServiceDefinitionSchemaVersions { - return &NullableServiceDefinitionSchemaVersions{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableServiceDefinitionSchemaVersions) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableServiceDefinitionSchemaVersions) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1.go index 66dc444e9..182dbc2d1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -306,7 +307,6 @@ func (o ServiceDefinitionV1) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV1) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Contact *ServiceDefinitionV1Contact `json:"contact,omitempty"` Extensions map[string]interface{} `json:"extensions,omitempty"` @@ -318,12 +318,7 @@ func (o *ServiceDefinitionV1) UnmarshalJSON(bytes []byte) (err error) { Tags []string `json:"tags,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Info == nil { return fmt.Errorf("required field info missing") @@ -337,53 +332,40 @@ func (o *ServiceDefinitionV1) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.SchemaVersion; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Contact != nil && all.Contact.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Contact = all.Contact o.Extensions = all.Extensions o.ExternalResources = all.ExternalResources if all.Info.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Info = *all.Info if all.Integrations != nil && all.Integrations.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Integrations = all.Integrations if all.Org != nil && all.Org.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Org = all.Org - o.SchemaVersion = *all.SchemaVersion + if !all.SchemaVersion.IsValid() { + hasInvalidField = true + } else { + o.SchemaVersion = *all.SchemaVersion + } o.Tags = all.Tags + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_contact.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_contact.go index c26164af4..145f98eb4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_contact.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_contact.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o ServiceDefinitionV1Contact) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV1Contact) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Email *string `json:"email,omitempty"` Slack *string `json:"slack,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *ServiceDefinitionV1Contact) UnmarshalJSON(bytes []byte) (err error) { } o.Email = all.Email o.Slack = all.Slack + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_info.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_info.go index 3b12377a3..4b705923c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_info.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_info.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -176,7 +177,6 @@ func (o ServiceDefinitionV1Info) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV1Info) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { DdService *string `json:"dd-service"` Description *string `json:"description,omitempty"` @@ -184,12 +184,7 @@ func (o *ServiceDefinitionV1Info) UnmarshalJSON(bytes []byte) (err error) { ServiceTier *string `json:"service-tier,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.DdService == nil { return fmt.Errorf("required field dd-service missing") @@ -204,6 +199,7 @@ func (o *ServiceDefinitionV1Info) UnmarshalJSON(bytes []byte) (err error) { o.Description = all.Description o.DisplayName = all.DisplayName o.ServiceTier = all.ServiceTier + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_integrations.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_integrations.go index a13469354..23c4dcf03 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_integrations.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_integrations.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o ServiceDefinitionV1Integrations) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV1Integrations) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Pagerduty *string `json:"pagerduty,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *ServiceDefinitionV1Integrations) UnmarshalJSON(bytes []byte) (err error return err } o.Pagerduty = all.Pagerduty + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_org.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_org.go index f476fcf21..c20d3611b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_org.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_org.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o ServiceDefinitionV1Org) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV1Org) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Application *string `json:"application,omitempty"` Team *string `json:"team,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *ServiceDefinitionV1Org) UnmarshalJSON(bytes []byte) (err error) { } o.Application = all.Application o.Team = all.Team + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_resource.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_resource.go index 899538de5..b96b3240f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_resource.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_resource.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -131,19 +132,13 @@ func (o ServiceDefinitionV1Resource) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV1Resource) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Name *string `json:"name"` Type *ServiceDefinitionV1ResourceType `json:"type"` Url *string `json:"url"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -160,20 +155,23 @@ func (o *ServiceDefinitionV1Resource) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Name = *all.Name - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } o.Url = *all.Url + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_resource_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_resource_type.go index 7a893aa77..520b93424 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_resource_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_resource_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ServiceDefinitionV1ResourceType Link type. @@ -77,47 +78,3 @@ func (v ServiceDefinitionV1ResourceType) IsValid() bool { func (v ServiceDefinitionV1ResourceType) Ptr() *ServiceDefinitionV1ResourceType { return &v } - -// NullableServiceDefinitionV1ResourceType handles when a null is used for ServiceDefinitionV1ResourceType. -type NullableServiceDefinitionV1ResourceType struct { - value *ServiceDefinitionV1ResourceType - isSet bool -} - -// Get returns the associated value. -func (v NullableServiceDefinitionV1ResourceType) Get() *ServiceDefinitionV1ResourceType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableServiceDefinitionV1ResourceType) Set(val *ServiceDefinitionV1ResourceType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableServiceDefinitionV1ResourceType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableServiceDefinitionV1ResourceType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableServiceDefinitionV1ResourceType initializes the struct as if Set has been called. -func NewNullableServiceDefinitionV1ResourceType(val *ServiceDefinitionV1ResourceType) *NullableServiceDefinitionV1ResourceType { - return &NullableServiceDefinitionV1ResourceType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableServiceDefinitionV1ResourceType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableServiceDefinitionV1ResourceType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_version.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_version.go index 362385c4a..d5896da24 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_version.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v1_version.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ServiceDefinitionV1Version Schema version being used. @@ -61,47 +62,3 @@ func (v ServiceDefinitionV1Version) IsValid() bool { func (v ServiceDefinitionV1Version) Ptr() *ServiceDefinitionV1Version { return &v } - -// NullableServiceDefinitionV1Version handles when a null is used for ServiceDefinitionV1Version. -type NullableServiceDefinitionV1Version struct { - value *ServiceDefinitionV1Version - isSet bool -} - -// Get returns the associated value. -func (v NullableServiceDefinitionV1Version) Get() *ServiceDefinitionV1Version { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableServiceDefinitionV1Version) Set(val *ServiceDefinitionV1Version) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableServiceDefinitionV1Version) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableServiceDefinitionV1Version) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableServiceDefinitionV1Version initializes the struct as if Set has been called. -func NewNullableServiceDefinitionV1Version(val *ServiceDefinitionV1Version) *NullableServiceDefinitionV1Version { - return &NullableServiceDefinitionV1Version{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableServiceDefinitionV1Version) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableServiceDefinitionV1Version) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2.go index 7924b66dd..21e3396a6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -403,7 +404,6 @@ func (o ServiceDefinitionV2) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Contacts []ServiceDefinitionV2Contact `json:"contacts,omitempty"` DdService *string `json:"dd-service"` @@ -418,12 +418,7 @@ func (o *ServiceDefinitionV2) UnmarshalJSON(bytes []byte) (err error) { Team *string `json:"team,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.DdService == nil { return fmt.Errorf("required field dd-service missing") @@ -437,35 +432,34 @@ func (o *ServiceDefinitionV2) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.SchemaVersion; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Contacts = all.Contacts o.DdService = *all.DdService o.DdTeam = all.DdTeam o.Docs = all.Docs o.Extensions = all.Extensions if all.Integrations != nil && all.Integrations.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Integrations = all.Integrations o.Links = all.Links o.Repos = all.Repos - o.SchemaVersion = *all.SchemaVersion + if !all.SchemaVersion.IsValid() { + hasInvalidField = true + } else { + o.SchemaVersion = *all.SchemaVersion + } o.Tags = all.Tags o.Team = all.Team + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_contact.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_contact.go index feb3b449a..8ffac95f6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_contact.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_contact.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // ServiceDefinitionV2Contact - Service owner's contacts information. @@ -135,53 +135,3 @@ func (obj *ServiceDefinitionV2Contact) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableServiceDefinitionV2Contact handles when a null is used for ServiceDefinitionV2Contact. -type NullableServiceDefinitionV2Contact struct { - value *ServiceDefinitionV2Contact - isSet bool -} - -// Get returns the associated value. -func (v NullableServiceDefinitionV2Contact) Get() *ServiceDefinitionV2Contact { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableServiceDefinitionV2Contact) Set(val *ServiceDefinitionV2Contact) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableServiceDefinitionV2Contact) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableServiceDefinitionV2Contact) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableServiceDefinitionV2Contact initializes the struct as if Set has been called. -func NewNullableServiceDefinitionV2Contact(val *ServiceDefinitionV2Contact) *NullableServiceDefinitionV2Contact { - return &NullableServiceDefinitionV2Contact{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableServiceDefinitionV2Contact) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableServiceDefinitionV2Contact) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_doc.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_doc.go index 6cfd02148..e5424289b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_doc.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_doc.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -137,19 +138,13 @@ func (o ServiceDefinitionV2Doc) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Doc) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Name *string `json:"name"` Provider *string `json:"provider,omitempty"` Url *string `json:"url"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -166,6 +161,7 @@ func (o *ServiceDefinitionV2Doc) UnmarshalJSON(bytes []byte) (err error) { o.Name = *all.Name o.Provider = all.Provider o.Url = *all.Url + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1.go index ab6c85246..ed54b7960 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -436,7 +437,6 @@ func (o ServiceDefinitionV2Dot1) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Dot1) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Application *string `json:"application,omitempty"` Contacts []ServiceDefinitionV2Dot1Contact `json:"contacts,omitempty"` @@ -452,12 +452,7 @@ func (o *ServiceDefinitionV2Dot1) UnmarshalJSON(bytes []byte) (err error) { Tier *string `json:"tier,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.DdService == nil { return fmt.Errorf("required field dd-service missing") @@ -471,36 +466,35 @@ func (o *ServiceDefinitionV2Dot1) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.SchemaVersion; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Application = all.Application o.Contacts = all.Contacts o.DdService = *all.DdService o.Description = all.Description o.Extensions = all.Extensions if all.Integrations != nil && all.Integrations.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Integrations = all.Integrations o.Lifecycle = all.Lifecycle o.Links = all.Links - o.SchemaVersion = *all.SchemaVersion + if !all.SchemaVersion.IsValid() { + hasInvalidField = true + } else { + o.SchemaVersion = *all.SchemaVersion + } o.Tags = all.Tags o.Team = all.Team o.Tier = all.Tier + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_contact.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_contact.go index d9908d50d..d5cd7651e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_contact.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_contact.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // ServiceDefinitionV2Dot1Contact - Service owner's contacts information. @@ -135,53 +135,3 @@ func (obj *ServiceDefinitionV2Dot1Contact) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableServiceDefinitionV2Dot1Contact handles when a null is used for ServiceDefinitionV2Dot1Contact. -type NullableServiceDefinitionV2Dot1Contact struct { - value *ServiceDefinitionV2Dot1Contact - isSet bool -} - -// Get returns the associated value. -func (v NullableServiceDefinitionV2Dot1Contact) Get() *ServiceDefinitionV2Dot1Contact { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableServiceDefinitionV2Dot1Contact) Set(val *ServiceDefinitionV2Dot1Contact) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableServiceDefinitionV2Dot1Contact) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableServiceDefinitionV2Dot1Contact) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableServiceDefinitionV2Dot1Contact initializes the struct as if Set has been called. -func NewNullableServiceDefinitionV2Dot1Contact(val *ServiceDefinitionV2Dot1Contact) *NullableServiceDefinitionV2Dot1Contact { - return &NullableServiceDefinitionV2Dot1Contact{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableServiceDefinitionV2Dot1Contact) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableServiceDefinitionV2Dot1Contact) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_email.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_email.go index 86dc4c413..c16cb473d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_email.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_email.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -137,19 +138,13 @@ func (o ServiceDefinitionV2Dot1Email) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Dot1Email) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Contact *string `json:"contact"` Name *string `json:"name,omitempty"` Type *ServiceDefinitionV2Dot1EmailType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Contact == nil { return fmt.Errorf("required field contact missing") @@ -163,20 +158,23 @@ func (o *ServiceDefinitionV2Dot1Email) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Contact = *all.Contact o.Name = all.Name - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_email_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_email_type.go index 3eb24cb97..cd3b84bb3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_email_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_email_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ServiceDefinitionV2Dot1EmailType Contact type. @@ -61,47 +62,3 @@ func (v ServiceDefinitionV2Dot1EmailType) IsValid() bool { func (v ServiceDefinitionV2Dot1EmailType) Ptr() *ServiceDefinitionV2Dot1EmailType { return &v } - -// NullableServiceDefinitionV2Dot1EmailType handles when a null is used for ServiceDefinitionV2Dot1EmailType. -type NullableServiceDefinitionV2Dot1EmailType struct { - value *ServiceDefinitionV2Dot1EmailType - isSet bool -} - -// Get returns the associated value. -func (v NullableServiceDefinitionV2Dot1EmailType) Get() *ServiceDefinitionV2Dot1EmailType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableServiceDefinitionV2Dot1EmailType) Set(val *ServiceDefinitionV2Dot1EmailType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableServiceDefinitionV2Dot1EmailType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableServiceDefinitionV2Dot1EmailType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableServiceDefinitionV2Dot1EmailType initializes the struct as if Set has been called. -func NewNullableServiceDefinitionV2Dot1EmailType(val *ServiceDefinitionV2Dot1EmailType) *NullableServiceDefinitionV2Dot1EmailType { - return &NullableServiceDefinitionV2Dot1EmailType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableServiceDefinitionV2Dot1EmailType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableServiceDefinitionV2Dot1EmailType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_integrations.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_integrations.go index 24af015af..a64f3fedb 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_integrations.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_integrations.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o ServiceDefinitionV2Dot1Integrations) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Dot1Integrations) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Opsgenie *ServiceDefinitionV2Dot1Opsgenie `json:"opsgenie,omitempty"` Pagerduty *ServiceDefinitionV2Dot1Pagerduty `json:"pagerduty,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,25 +128,24 @@ func (o *ServiceDefinitionV2Dot1Integrations) UnmarshalJSON(bytes []byte) (err e } else { return err } + + hasInvalidField := false if all.Opsgenie != nil && all.Opsgenie.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Opsgenie = all.Opsgenie if all.Pagerduty != nil && all.Pagerduty.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Pagerduty = all.Pagerduty + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_link.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_link.go index 27534fd63..d2011f8b8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_link.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_link.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -164,7 +165,6 @@ func (o ServiceDefinitionV2Dot1Link) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Dot1Link) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Name *string `json:"name"` Provider *string `json:"provider,omitempty"` @@ -172,12 +172,7 @@ func (o *ServiceDefinitionV2Dot1Link) UnmarshalJSON(bytes []byte) (err error) { Url *string `json:"url"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -194,21 +189,24 @@ func (o *ServiceDefinitionV2Dot1Link) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Name = *all.Name o.Provider = all.Provider - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } o.Url = *all.Url + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_link_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_link_type.go index be4b04310..b3b4e37e1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_link_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_link_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ServiceDefinitionV2Dot1LinkType Link type. @@ -69,47 +70,3 @@ func (v ServiceDefinitionV2Dot1LinkType) IsValid() bool { func (v ServiceDefinitionV2Dot1LinkType) Ptr() *ServiceDefinitionV2Dot1LinkType { return &v } - -// NullableServiceDefinitionV2Dot1LinkType handles when a null is used for ServiceDefinitionV2Dot1LinkType. -type NullableServiceDefinitionV2Dot1LinkType struct { - value *ServiceDefinitionV2Dot1LinkType - isSet bool -} - -// Get returns the associated value. -func (v NullableServiceDefinitionV2Dot1LinkType) Get() *ServiceDefinitionV2Dot1LinkType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableServiceDefinitionV2Dot1LinkType) Set(val *ServiceDefinitionV2Dot1LinkType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableServiceDefinitionV2Dot1LinkType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableServiceDefinitionV2Dot1LinkType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableServiceDefinitionV2Dot1LinkType initializes the struct as if Set has been called. -func NewNullableServiceDefinitionV2Dot1LinkType(val *ServiceDefinitionV2Dot1LinkType) *NullableServiceDefinitionV2Dot1LinkType { - return &NullableServiceDefinitionV2Dot1LinkType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableServiceDefinitionV2Dot1LinkType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableServiceDefinitionV2Dot1LinkType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_ms_teams.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_ms_teams.go index 4369a883b..62a860a8e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_ms_teams.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_ms_teams.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -137,19 +138,13 @@ func (o ServiceDefinitionV2Dot1MSTeams) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Dot1MSTeams) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Contact *string `json:"contact"` Name *string `json:"name,omitempty"` Type *ServiceDefinitionV2Dot1MSTeamsType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Contact == nil { return fmt.Errorf("required field contact missing") @@ -163,20 +158,23 @@ func (o *ServiceDefinitionV2Dot1MSTeams) UnmarshalJSON(bytes []byte) (err error) } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Contact = *all.Contact o.Name = all.Name - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_ms_teams_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_ms_teams_type.go index 50ff2d673..da44c1b99 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_ms_teams_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_ms_teams_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ServiceDefinitionV2Dot1MSTeamsType Contact type. @@ -61,47 +62,3 @@ func (v ServiceDefinitionV2Dot1MSTeamsType) IsValid() bool { func (v ServiceDefinitionV2Dot1MSTeamsType) Ptr() *ServiceDefinitionV2Dot1MSTeamsType { return &v } - -// NullableServiceDefinitionV2Dot1MSTeamsType handles when a null is used for ServiceDefinitionV2Dot1MSTeamsType. -type NullableServiceDefinitionV2Dot1MSTeamsType struct { - value *ServiceDefinitionV2Dot1MSTeamsType - isSet bool -} - -// Get returns the associated value. -func (v NullableServiceDefinitionV2Dot1MSTeamsType) Get() *ServiceDefinitionV2Dot1MSTeamsType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableServiceDefinitionV2Dot1MSTeamsType) Set(val *ServiceDefinitionV2Dot1MSTeamsType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableServiceDefinitionV2Dot1MSTeamsType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableServiceDefinitionV2Dot1MSTeamsType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableServiceDefinitionV2Dot1MSTeamsType initializes the struct as if Set has been called. -func NewNullableServiceDefinitionV2Dot1MSTeamsType(val *ServiceDefinitionV2Dot1MSTeamsType) *NullableServiceDefinitionV2Dot1MSTeamsType { - return &NullableServiceDefinitionV2Dot1MSTeamsType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableServiceDefinitionV2Dot1MSTeamsType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableServiceDefinitionV2Dot1MSTeamsType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_opsgenie.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_opsgenie.go index 81da0d6d1..ce5181028 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_opsgenie.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_opsgenie.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o ServiceDefinitionV2Dot1Opsgenie) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Dot1Opsgenie) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Region *ServiceDefinitionV2Dot1OpsgenieRegion `json:"region,omitempty"` ServiceUrl *string `json:"service-url"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.ServiceUrl == nil { return fmt.Errorf("required field service-url missing") @@ -132,19 +127,22 @@ func (o *ServiceDefinitionV2Dot1Opsgenie) UnmarshalJSON(bytes []byte) (err error } else { return err } - if v := all.Region; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.Region != nil && !all.Region.IsValid() { + hasInvalidField = true + } else { + o.Region = all.Region } - o.Region = all.Region o.ServiceUrl = *all.ServiceUrl + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_opsgenie_region.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_opsgenie_region.go index 9a6d382e9..cfa49e1ea 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_opsgenie_region.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_opsgenie_region.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ServiceDefinitionV2Dot1OpsgenieRegion Opsgenie instance region. @@ -63,47 +64,3 @@ func (v ServiceDefinitionV2Dot1OpsgenieRegion) IsValid() bool { func (v ServiceDefinitionV2Dot1OpsgenieRegion) Ptr() *ServiceDefinitionV2Dot1OpsgenieRegion { return &v } - -// NullableServiceDefinitionV2Dot1OpsgenieRegion handles when a null is used for ServiceDefinitionV2Dot1OpsgenieRegion. -type NullableServiceDefinitionV2Dot1OpsgenieRegion struct { - value *ServiceDefinitionV2Dot1OpsgenieRegion - isSet bool -} - -// Get returns the associated value. -func (v NullableServiceDefinitionV2Dot1OpsgenieRegion) Get() *ServiceDefinitionV2Dot1OpsgenieRegion { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableServiceDefinitionV2Dot1OpsgenieRegion) Set(val *ServiceDefinitionV2Dot1OpsgenieRegion) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableServiceDefinitionV2Dot1OpsgenieRegion) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableServiceDefinitionV2Dot1OpsgenieRegion) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableServiceDefinitionV2Dot1OpsgenieRegion initializes the struct as if Set has been called. -func NewNullableServiceDefinitionV2Dot1OpsgenieRegion(val *ServiceDefinitionV2Dot1OpsgenieRegion) *NullableServiceDefinitionV2Dot1OpsgenieRegion { - return &NullableServiceDefinitionV2Dot1OpsgenieRegion{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableServiceDefinitionV2Dot1OpsgenieRegion) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableServiceDefinitionV2Dot1OpsgenieRegion) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_pagerduty.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_pagerduty.go index ddc46f08e..539a57fde 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_pagerduty.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_pagerduty.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o ServiceDefinitionV2Dot1Pagerduty) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Dot1Pagerduty) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ServiceUrl *string `json:"service-url,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *ServiceDefinitionV2Dot1Pagerduty) UnmarshalJSON(bytes []byte) (err erro return err } o.ServiceUrl = all.ServiceUrl + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_slack.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_slack.go index b9e429624..6cb6897bf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_slack.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_slack.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -137,19 +138,13 @@ func (o ServiceDefinitionV2Dot1Slack) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Dot1Slack) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Contact *string `json:"contact"` Name *string `json:"name,omitempty"` Type *ServiceDefinitionV2Dot1SlackType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Contact == nil { return fmt.Errorf("required field contact missing") @@ -163,20 +158,23 @@ func (o *ServiceDefinitionV2Dot1Slack) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Contact = *all.Contact o.Name = all.Name - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_slack_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_slack_type.go index 4d13cc983..95232a642 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_slack_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_slack_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ServiceDefinitionV2Dot1SlackType Contact type. @@ -61,47 +62,3 @@ func (v ServiceDefinitionV2Dot1SlackType) IsValid() bool { func (v ServiceDefinitionV2Dot1SlackType) Ptr() *ServiceDefinitionV2Dot1SlackType { return &v } - -// NullableServiceDefinitionV2Dot1SlackType handles when a null is used for ServiceDefinitionV2Dot1SlackType. -type NullableServiceDefinitionV2Dot1SlackType struct { - value *ServiceDefinitionV2Dot1SlackType - isSet bool -} - -// Get returns the associated value. -func (v NullableServiceDefinitionV2Dot1SlackType) Get() *ServiceDefinitionV2Dot1SlackType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableServiceDefinitionV2Dot1SlackType) Set(val *ServiceDefinitionV2Dot1SlackType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableServiceDefinitionV2Dot1SlackType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableServiceDefinitionV2Dot1SlackType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableServiceDefinitionV2Dot1SlackType initializes the struct as if Set has been called. -func NewNullableServiceDefinitionV2Dot1SlackType(val *ServiceDefinitionV2Dot1SlackType) *NullableServiceDefinitionV2Dot1SlackType { - return &NullableServiceDefinitionV2Dot1SlackType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableServiceDefinitionV2Dot1SlackType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableServiceDefinitionV2Dot1SlackType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_version.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_version.go index 2740b561d..9532f8b88 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_version.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_dot1_version.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ServiceDefinitionV2Dot1Version Schema version being used. @@ -61,47 +62,3 @@ func (v ServiceDefinitionV2Dot1Version) IsValid() bool { func (v ServiceDefinitionV2Dot1Version) Ptr() *ServiceDefinitionV2Dot1Version { return &v } - -// NullableServiceDefinitionV2Dot1Version handles when a null is used for ServiceDefinitionV2Dot1Version. -type NullableServiceDefinitionV2Dot1Version struct { - value *ServiceDefinitionV2Dot1Version - isSet bool -} - -// Get returns the associated value. -func (v NullableServiceDefinitionV2Dot1Version) Get() *ServiceDefinitionV2Dot1Version { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableServiceDefinitionV2Dot1Version) Set(val *ServiceDefinitionV2Dot1Version) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableServiceDefinitionV2Dot1Version) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableServiceDefinitionV2Dot1Version) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableServiceDefinitionV2Dot1Version initializes the struct as if Set has been called. -func NewNullableServiceDefinitionV2Dot1Version(val *ServiceDefinitionV2Dot1Version) *NullableServiceDefinitionV2Dot1Version { - return &NullableServiceDefinitionV2Dot1Version{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableServiceDefinitionV2Dot1Version) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableServiceDefinitionV2Dot1Version) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_email.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_email.go index f44c70da9..5c012d136 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_email.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_email.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -137,19 +138,13 @@ func (o ServiceDefinitionV2Email) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Email) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Contact *string `json:"contact"` Name *string `json:"name,omitempty"` Type *ServiceDefinitionV2EmailType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Contact == nil { return fmt.Errorf("required field contact missing") @@ -163,20 +158,23 @@ func (o *ServiceDefinitionV2Email) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Contact = *all.Contact o.Name = all.Name - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_email_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_email_type.go index b622009bd..13ebc0141 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_email_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_email_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ServiceDefinitionV2EmailType Contact type. @@ -61,47 +62,3 @@ func (v ServiceDefinitionV2EmailType) IsValid() bool { func (v ServiceDefinitionV2EmailType) Ptr() *ServiceDefinitionV2EmailType { return &v } - -// NullableServiceDefinitionV2EmailType handles when a null is used for ServiceDefinitionV2EmailType. -type NullableServiceDefinitionV2EmailType struct { - value *ServiceDefinitionV2EmailType - isSet bool -} - -// Get returns the associated value. -func (v NullableServiceDefinitionV2EmailType) Get() *ServiceDefinitionV2EmailType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableServiceDefinitionV2EmailType) Set(val *ServiceDefinitionV2EmailType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableServiceDefinitionV2EmailType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableServiceDefinitionV2EmailType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableServiceDefinitionV2EmailType initializes the struct as if Set has been called. -func NewNullableServiceDefinitionV2EmailType(val *ServiceDefinitionV2EmailType) *NullableServiceDefinitionV2EmailType { - return &NullableServiceDefinitionV2EmailType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableServiceDefinitionV2EmailType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableServiceDefinitionV2EmailType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_integrations.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_integrations.go index 943287230..40992cba3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_integrations.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_integrations.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o ServiceDefinitionV2Integrations) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Integrations) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Opsgenie *ServiceDefinitionV2Opsgenie `json:"opsgenie,omitempty"` Pagerduty *string `json:"pagerduty,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *ServiceDefinitionV2Integrations) UnmarshalJSON(bytes []byte) (err error } else { return err } + + hasInvalidField := false if all.Opsgenie != nil && all.Opsgenie.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Opsgenie = all.Opsgenie o.Pagerduty = all.Pagerduty + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_link.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_link.go index 642c8a0dd..c44ee7069 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_link.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_link.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -131,19 +132,13 @@ func (o ServiceDefinitionV2Link) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Link) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Name *string `json:"name"` Type *ServiceDefinitionV2LinkType `json:"type"` Url *string `json:"url"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -160,20 +155,23 @@ func (o *ServiceDefinitionV2Link) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Name = *all.Name - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } o.Url = *all.Url + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_link_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_link_type.go index 68272f98d..556b67b49 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_link_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_link_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ServiceDefinitionV2LinkType Link type. @@ -77,47 +78,3 @@ func (v ServiceDefinitionV2LinkType) IsValid() bool { func (v ServiceDefinitionV2LinkType) Ptr() *ServiceDefinitionV2LinkType { return &v } - -// NullableServiceDefinitionV2LinkType handles when a null is used for ServiceDefinitionV2LinkType. -type NullableServiceDefinitionV2LinkType struct { - value *ServiceDefinitionV2LinkType - isSet bool -} - -// Get returns the associated value. -func (v NullableServiceDefinitionV2LinkType) Get() *ServiceDefinitionV2LinkType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableServiceDefinitionV2LinkType) Set(val *ServiceDefinitionV2LinkType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableServiceDefinitionV2LinkType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableServiceDefinitionV2LinkType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableServiceDefinitionV2LinkType initializes the struct as if Set has been called. -func NewNullableServiceDefinitionV2LinkType(val *ServiceDefinitionV2LinkType) *NullableServiceDefinitionV2LinkType { - return &NullableServiceDefinitionV2LinkType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableServiceDefinitionV2LinkType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableServiceDefinitionV2LinkType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_ms_teams.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_ms_teams.go index a371e7c72..3bf172e9f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_ms_teams.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_ms_teams.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -137,19 +138,13 @@ func (o ServiceDefinitionV2MSTeams) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2MSTeams) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Contact *string `json:"contact"` Name *string `json:"name,omitempty"` Type *ServiceDefinitionV2MSTeamsType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Contact == nil { return fmt.Errorf("required field contact missing") @@ -163,20 +158,23 @@ func (o *ServiceDefinitionV2MSTeams) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Contact = *all.Contact o.Name = all.Name - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_ms_teams_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_ms_teams_type.go index b66a92215..715f34b4e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_ms_teams_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_ms_teams_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ServiceDefinitionV2MSTeamsType Contact type. @@ -61,47 +62,3 @@ func (v ServiceDefinitionV2MSTeamsType) IsValid() bool { func (v ServiceDefinitionV2MSTeamsType) Ptr() *ServiceDefinitionV2MSTeamsType { return &v } - -// NullableServiceDefinitionV2MSTeamsType handles when a null is used for ServiceDefinitionV2MSTeamsType. -type NullableServiceDefinitionV2MSTeamsType struct { - value *ServiceDefinitionV2MSTeamsType - isSet bool -} - -// Get returns the associated value. -func (v NullableServiceDefinitionV2MSTeamsType) Get() *ServiceDefinitionV2MSTeamsType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableServiceDefinitionV2MSTeamsType) Set(val *ServiceDefinitionV2MSTeamsType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableServiceDefinitionV2MSTeamsType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableServiceDefinitionV2MSTeamsType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableServiceDefinitionV2MSTeamsType initializes the struct as if Set has been called. -func NewNullableServiceDefinitionV2MSTeamsType(val *ServiceDefinitionV2MSTeamsType) *NullableServiceDefinitionV2MSTeamsType { - return &NullableServiceDefinitionV2MSTeamsType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableServiceDefinitionV2MSTeamsType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableServiceDefinitionV2MSTeamsType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_opsgenie.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_opsgenie.go index 0eab94ff3..d12cbe294 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_opsgenie.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_opsgenie.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o ServiceDefinitionV2Opsgenie) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Opsgenie) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Region *ServiceDefinitionV2OpsgenieRegion `json:"region,omitempty"` ServiceUrl *string `json:"service-url"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.ServiceUrl == nil { return fmt.Errorf("required field service-url missing") @@ -132,19 +127,22 @@ func (o *ServiceDefinitionV2Opsgenie) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Region; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.Region != nil && !all.Region.IsValid() { + hasInvalidField = true + } else { + o.Region = all.Region } - o.Region = all.Region o.ServiceUrl = *all.ServiceUrl + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_opsgenie_region.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_opsgenie_region.go index e1d7d1051..f18e8be99 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_opsgenie_region.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_opsgenie_region.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ServiceDefinitionV2OpsgenieRegion Opsgenie instance region. @@ -63,47 +64,3 @@ func (v ServiceDefinitionV2OpsgenieRegion) IsValid() bool { func (v ServiceDefinitionV2OpsgenieRegion) Ptr() *ServiceDefinitionV2OpsgenieRegion { return &v } - -// NullableServiceDefinitionV2OpsgenieRegion handles when a null is used for ServiceDefinitionV2OpsgenieRegion. -type NullableServiceDefinitionV2OpsgenieRegion struct { - value *ServiceDefinitionV2OpsgenieRegion - isSet bool -} - -// Get returns the associated value. -func (v NullableServiceDefinitionV2OpsgenieRegion) Get() *ServiceDefinitionV2OpsgenieRegion { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableServiceDefinitionV2OpsgenieRegion) Set(val *ServiceDefinitionV2OpsgenieRegion) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableServiceDefinitionV2OpsgenieRegion) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableServiceDefinitionV2OpsgenieRegion) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableServiceDefinitionV2OpsgenieRegion initializes the struct as if Set has been called. -func NewNullableServiceDefinitionV2OpsgenieRegion(val *ServiceDefinitionV2OpsgenieRegion) *NullableServiceDefinitionV2OpsgenieRegion { - return &NullableServiceDefinitionV2OpsgenieRegion{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableServiceDefinitionV2OpsgenieRegion) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableServiceDefinitionV2OpsgenieRegion) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_repo.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_repo.go index e91a7c8c9..e48a67e51 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_repo.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_repo.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -137,19 +138,13 @@ func (o ServiceDefinitionV2Repo) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Repo) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Name *string `json:"name"` Provider *string `json:"provider,omitempty"` Url *string `json:"url"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Name == nil { return fmt.Errorf("required field name missing") @@ -166,6 +161,7 @@ func (o *ServiceDefinitionV2Repo) UnmarshalJSON(bytes []byte) (err error) { o.Name = *all.Name o.Provider = all.Provider o.Url = *all.Url + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_slack.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_slack.go index 9fbd057fc..8462b6838 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_slack.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_slack.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -137,19 +138,13 @@ func (o ServiceDefinitionV2Slack) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Slack) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Contact *string `json:"contact"` Name *string `json:"name,omitempty"` Type *ServiceDefinitionV2SlackType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Contact == nil { return fmt.Errorf("required field contact missing") @@ -163,20 +158,23 @@ func (o *ServiceDefinitionV2Slack) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.Contact = *all.Contact o.Name = all.Name - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_slack_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_slack_type.go index d16136a02..7828175ef 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_slack_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_slack_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ServiceDefinitionV2SlackType Contact type. @@ -61,47 +62,3 @@ func (v ServiceDefinitionV2SlackType) IsValid() bool { func (v ServiceDefinitionV2SlackType) Ptr() *ServiceDefinitionV2SlackType { return &v } - -// NullableServiceDefinitionV2SlackType handles when a null is used for ServiceDefinitionV2SlackType. -type NullableServiceDefinitionV2SlackType struct { - value *ServiceDefinitionV2SlackType - isSet bool -} - -// Get returns the associated value. -func (v NullableServiceDefinitionV2SlackType) Get() *ServiceDefinitionV2SlackType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableServiceDefinitionV2SlackType) Set(val *ServiceDefinitionV2SlackType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableServiceDefinitionV2SlackType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableServiceDefinitionV2SlackType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableServiceDefinitionV2SlackType initializes the struct as if Set has been called. -func NewNullableServiceDefinitionV2SlackType(val *ServiceDefinitionV2SlackType) *NullableServiceDefinitionV2SlackType { - return &NullableServiceDefinitionV2SlackType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableServiceDefinitionV2SlackType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableServiceDefinitionV2SlackType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_version.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_version.go index bdeea5b4e..c7a869f67 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_version.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definition_v2_version.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // ServiceDefinitionV2Version Schema version being used. @@ -61,47 +62,3 @@ func (v ServiceDefinitionV2Version) IsValid() bool { func (v ServiceDefinitionV2Version) Ptr() *ServiceDefinitionV2Version { return &v } - -// NullableServiceDefinitionV2Version handles when a null is used for ServiceDefinitionV2Version. -type NullableServiceDefinitionV2Version struct { - value *ServiceDefinitionV2Version - isSet bool -} - -// Get returns the associated value. -func (v NullableServiceDefinitionV2Version) Get() *ServiceDefinitionV2Version { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableServiceDefinitionV2Version) Set(val *ServiceDefinitionV2Version) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableServiceDefinitionV2Version) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableServiceDefinitionV2Version) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableServiceDefinitionV2Version initializes the struct as if Set has been called. -func NewNullableServiceDefinitionV2Version(val *ServiceDefinitionV2Version) *NullableServiceDefinitionV2Version { - return &NullableServiceDefinitionV2Version{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableServiceDefinitionV2Version) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableServiceDefinitionV2Version) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definitions_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definitions_create_request.go index 888789d76..b706cd3a3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definitions_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definitions_create_request.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // ServiceDefinitionsCreateRequest - Create service definitions request. @@ -135,53 +135,3 @@ func (obj *ServiceDefinitionsCreateRequest) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableServiceDefinitionsCreateRequest handles when a null is used for ServiceDefinitionsCreateRequest. -type NullableServiceDefinitionsCreateRequest struct { - value *ServiceDefinitionsCreateRequest - isSet bool -} - -// Get returns the associated value. -func (v NullableServiceDefinitionsCreateRequest) Get() *ServiceDefinitionsCreateRequest { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableServiceDefinitionsCreateRequest) Set(val *ServiceDefinitionsCreateRequest) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableServiceDefinitionsCreateRequest) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableServiceDefinitionsCreateRequest) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableServiceDefinitionsCreateRequest initializes the struct as if Set has been called. -func NewNullableServiceDefinitionsCreateRequest(val *ServiceDefinitionsCreateRequest) *NullableServiceDefinitionsCreateRequest { - return &NullableServiceDefinitionsCreateRequest{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableServiceDefinitionsCreateRequest) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableServiceDefinitionsCreateRequest) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definitions_list_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definitions_list_response.go index 19b636db7..b1cb5aced 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definitions_list_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_service_definitions_list_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o ServiceDefinitionsListResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionsListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []ServiceDefinitionData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *ServiceDefinitionsListResponse) UnmarshalJSON(bytes []byte) (err error) return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_slack_integration_metadata.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_slack_integration_metadata.go index f6c4c4eed..160f1ef2c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_slack_integration_metadata.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_slack_integration_metadata.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o SlackIntegrationMetadata) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SlackIntegrationMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Channels *[]SlackIntegrationMetadataChannelItem `json:"channels"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Channels == nil { return fmt.Errorf("required field channels missing") @@ -99,6 +94,7 @@ func (o *SlackIntegrationMetadata) UnmarshalJSON(bytes []byte) (err error) { return err } o.Channels = *all.Channels + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_slack_integration_metadata_channel_item.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_slack_integration_metadata_channel_item.go index 2a3583761..c762eee36 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_slack_integration_metadata_channel_item.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_slack_integration_metadata_channel_item.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -164,7 +165,6 @@ func (o SlackIntegrationMetadataChannelItem) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SlackIntegrationMetadataChannelItem) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { ChannelId *string `json:"channel_id"` ChannelName *string `json:"channel_name"` @@ -172,12 +172,7 @@ func (o *SlackIntegrationMetadataChannelItem) UnmarshalJSON(bytes []byte) (err e TeamId *string `json:"team_id,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.ChannelId == nil { return fmt.Errorf("required field channel_id missing") @@ -198,6 +193,7 @@ func (o *SlackIntegrationMetadataChannelItem) UnmarshalJSON(bytes []byte) (err e o.ChannelName = *all.ChannelName o.RedirectUrl = *all.RedirectUrl o.TeamId = all.TeamId + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_span.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_span.go new file mode 100644 index 000000000..27eee562b --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_span.go @@ -0,0 +1,191 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// Span Object description of a spans after being processed and stored by Datadog. +type Span struct { + // JSON object containing all span attributes and their associated values. + Attributes *SpansAttributes `json:"attributes,omitempty"` + // Unique ID of the Span. + Id *string `json:"id,omitempty"` + // Type of the span. + Type *SpansType `json:"type,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{} +} + +// NewSpan instantiates a new Span 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 NewSpan() *Span { + this := Span{} + var typeVar SpansType = SPANSTYPE_SPANS + this.Type = &typeVar + return &this +} + +// NewSpanWithDefaults instantiates a new Span 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 NewSpanWithDefaults() *Span { + this := Span{} + var typeVar SpansType = SPANSTYPE_SPANS + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *Span) GetAttributes() SpansAttributes { + if o == nil || o.Attributes == nil { + var ret SpansAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Span) GetAttributesOk() (*SpansAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *Span) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given SpansAttributes and assigns it to the Attributes field. +func (o *Span) SetAttributes(v SpansAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Span) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Span) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Span) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Span) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Span) GetType() SpansType { + if o == nil || o.Type == nil { + var ret SpansType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Span) GetTypeOk() (*SpansType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *Span) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given SpansType and assigns it to the Type field. +func (o *Span) SetType(v SpansType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o Span) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *Span) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *SpansAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *SpansType `json:"type,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_bucket.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_bucket.go new file mode 100644 index 000000000..d8db4e97b --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_bucket.go @@ -0,0 +1,187 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SpansAggregateBucket Spans aggregate. +type SpansAggregateBucket struct { + // A bucket values. + Attributes *SpansAggregateBucketAttributes `json:"attributes,omitempty"` + // ID of the spans aggregate. + Id *string `json:"id,omitempty"` + // The spans aggregate bucket type. + Type *SpansAggregateBucketType `json:"type,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{} +} + +// NewSpansAggregateBucket instantiates a new SpansAggregateBucket 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 NewSpansAggregateBucket() *SpansAggregateBucket { + this := SpansAggregateBucket{} + return &this +} + +// NewSpansAggregateBucketWithDefaults instantiates a new SpansAggregateBucket 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 NewSpansAggregateBucketWithDefaults() *SpansAggregateBucket { + this := SpansAggregateBucket{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *SpansAggregateBucket) GetAttributes() SpansAggregateBucketAttributes { + if o == nil || o.Attributes == nil { + var ret SpansAggregateBucketAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAggregateBucket) GetAttributesOk() (*SpansAggregateBucketAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *SpansAggregateBucket) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given SpansAggregateBucketAttributes and assigns it to the Attributes field. +func (o *SpansAggregateBucket) SetAttributes(v SpansAggregateBucketAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SpansAggregateBucket) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAggregateBucket) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *SpansAggregateBucket) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *SpansAggregateBucket) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SpansAggregateBucket) GetType() SpansAggregateBucketType { + if o == nil || o.Type == nil { + var ret SpansAggregateBucketType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAggregateBucket) GetTypeOk() (*SpansAggregateBucketType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SpansAggregateBucket) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given SpansAggregateBucketType and assigns it to the Type field. +func (o *SpansAggregateBucket) SetType(v SpansAggregateBucketType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SpansAggregateBucket) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SpansAggregateBucket) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *SpansAggregateBucketAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *SpansAggregateBucketType `json:"type,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_bucket_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_bucket_attributes.go new file mode 100644 index 000000000..4425d2e02 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_bucket_attributes.go @@ -0,0 +1,174 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SpansAggregateBucketAttributes A bucket values. +type SpansAggregateBucketAttributes struct { + // The key, value pairs for each group by. + By map[string]interface{} `json:"by,omitempty"` + // The compute data. + Compute interface{} `json:"compute,omitempty"` + // A map of the metric name -> value for regular compute or list of values for a timeseries. + Computes map[string]SpansAggregateBucketValue `json:"computes,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{} +} + +// NewSpansAggregateBucketAttributes instantiates a new SpansAggregateBucketAttributes 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 NewSpansAggregateBucketAttributes() *SpansAggregateBucketAttributes { + this := SpansAggregateBucketAttributes{} + return &this +} + +// NewSpansAggregateBucketAttributesWithDefaults instantiates a new SpansAggregateBucketAttributes 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 NewSpansAggregateBucketAttributesWithDefaults() *SpansAggregateBucketAttributes { + this := SpansAggregateBucketAttributes{} + return &this +} + +// GetBy returns the By field value if set, zero value otherwise. +func (o *SpansAggregateBucketAttributes) GetBy() map[string]interface{} { + if o == nil || o.By == nil { + var ret map[string]interface{} + return ret + } + return o.By +} + +// GetByOk returns a tuple with the By field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAggregateBucketAttributes) GetByOk() (*map[string]interface{}, bool) { + if o == nil || o.By == nil { + return nil, false + } + return &o.By, true +} + +// HasBy returns a boolean if a field has been set. +func (o *SpansAggregateBucketAttributes) HasBy() bool { + return o != nil && o.By != nil +} + +// SetBy gets a reference to the given map[string]interface{} and assigns it to the By field. +func (o *SpansAggregateBucketAttributes) SetBy(v map[string]interface{}) { + o.By = v +} + +// GetCompute returns the Compute field value if set, zero value otherwise. +func (o *SpansAggregateBucketAttributes) GetCompute() interface{} { + if o == nil || o.Compute == nil { + var ret interface{} + return ret + } + return o.Compute +} + +// GetComputeOk returns a tuple with the Compute field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAggregateBucketAttributes) GetComputeOk() (*interface{}, bool) { + if o == nil || o.Compute == nil { + return nil, false + } + return &o.Compute, true +} + +// HasCompute returns a boolean if a field has been set. +func (o *SpansAggregateBucketAttributes) HasCompute() bool { + return o != nil && o.Compute != nil +} + +// SetCompute gets a reference to the given interface{} and assigns it to the Compute field. +func (o *SpansAggregateBucketAttributes) SetCompute(v interface{}) { + o.Compute = v +} + +// GetComputes returns the Computes field value if set, zero value otherwise. +func (o *SpansAggregateBucketAttributes) GetComputes() map[string]SpansAggregateBucketValue { + if o == nil || o.Computes == nil { + var ret map[string]SpansAggregateBucketValue + return ret + } + return o.Computes +} + +// GetComputesOk returns a tuple with the Computes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAggregateBucketAttributes) GetComputesOk() (*map[string]SpansAggregateBucketValue, bool) { + if o == nil || o.Computes == nil { + return nil, false + } + return &o.Computes, true +} + +// HasComputes returns a boolean if a field has been set. +func (o *SpansAggregateBucketAttributes) HasComputes() bool { + return o != nil && o.Computes != nil +} + +// SetComputes gets a reference to the given map[string]SpansAggregateBucketValue and assigns it to the Computes field. +func (o *SpansAggregateBucketAttributes) SetComputes(v map[string]SpansAggregateBucketValue) { + o.Computes = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SpansAggregateBucketAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.By != nil { + toSerialize["by"] = o.By + } + if o.Compute != nil { + toSerialize["compute"] = o.Compute + } + if o.Computes != nil { + toSerialize["computes"] = o.Computes + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SpansAggregateBucketAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + By map[string]interface{} `json:"by,omitempty"` + Compute interface{} `json:"compute,omitempty"` + Computes map[string]SpansAggregateBucketValue `json:"computes,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"by", "compute", "computes"}) + } else { + return err + } + o.By = all.By + o.Compute = all.Compute + o.Computes = all.Computes + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_bucket_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_bucket_type.go new file mode 100644 index 000000000..06ae23a69 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_bucket_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/goccy/go-json" +) + +// SpansAggregateBucketType The spans aggregate bucket type. +type SpansAggregateBucketType string + +// List of SpansAggregateBucketType. +const ( + SPANSAGGREGATEBUCKETTYPE_BUCKET SpansAggregateBucketType = "bucket" +) + +var allowedSpansAggregateBucketTypeEnumValues = []SpansAggregateBucketType{ + SPANSAGGREGATEBUCKETTYPE_BUCKET, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SpansAggregateBucketType) GetAllowedValues() []SpansAggregateBucketType { + return allowedSpansAggregateBucketTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SpansAggregateBucketType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SpansAggregateBucketType(value) + return nil +} + +// NewSpansAggregateBucketTypeFromValue returns a pointer to a valid SpansAggregateBucketType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSpansAggregateBucketTypeFromValue(v string) (*SpansAggregateBucketType, error) { + ev := SpansAggregateBucketType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SpansAggregateBucketType: valid values are %v", v, allowedSpansAggregateBucketTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SpansAggregateBucketType) IsValid() bool { + for _, existing := range allowedSpansAggregateBucketTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SpansAggregateBucketType value. +func (v SpansAggregateBucketType) Ptr() *SpansAggregateBucketType { + return &v +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_bucket_value.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_bucket_value.go new file mode 100644 index 000000000..11d2542de --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_bucket_value.go @@ -0,0 +1,137 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" +) + +// SpansAggregateBucketValue - A bucket value, can be either a timeseries or a single value. +type SpansAggregateBucketValue struct { + SpansAggregateBucketValueSingleString *string + SpansAggregateBucketValueSingleNumber *float64 + SpansAggregateBucketValueTimeseries *SpansAggregateBucketValueTimeseries + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// SpansAggregateBucketValueSingleStringAsSpansAggregateBucketValue is a convenience function that returns string wrapped in SpansAggregateBucketValue. +func SpansAggregateBucketValueSingleStringAsSpansAggregateBucketValue(v *string) SpansAggregateBucketValue { + return SpansAggregateBucketValue{SpansAggregateBucketValueSingleString: v} +} + +// SpansAggregateBucketValueSingleNumberAsSpansAggregateBucketValue is a convenience function that returns float64 wrapped in SpansAggregateBucketValue. +func SpansAggregateBucketValueSingleNumberAsSpansAggregateBucketValue(v *float64) SpansAggregateBucketValue { + return SpansAggregateBucketValue{SpansAggregateBucketValueSingleNumber: v} +} + +// SpansAggregateBucketValueTimeseriesAsSpansAggregateBucketValue is a convenience function that returns SpansAggregateBucketValueTimeseries wrapped in SpansAggregateBucketValue. +func SpansAggregateBucketValueTimeseriesAsSpansAggregateBucketValue(v *SpansAggregateBucketValueTimeseries) SpansAggregateBucketValue { + return SpansAggregateBucketValue{SpansAggregateBucketValueTimeseries: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *SpansAggregateBucketValue) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into SpansAggregateBucketValueSingleString + err = json.Unmarshal(data, &obj.SpansAggregateBucketValueSingleString) + if err == nil { + if obj.SpansAggregateBucketValueSingleString != nil { + jsonSpansAggregateBucketValueSingleString, _ := json.Marshal(obj.SpansAggregateBucketValueSingleString) + if string(jsonSpansAggregateBucketValueSingleString) == "{}" { // empty struct + obj.SpansAggregateBucketValueSingleString = nil + } else { + match++ + } + } else { + obj.SpansAggregateBucketValueSingleString = nil + } + } else { + obj.SpansAggregateBucketValueSingleString = nil + } + + // try to unmarshal data into SpansAggregateBucketValueSingleNumber + err = json.Unmarshal(data, &obj.SpansAggregateBucketValueSingleNumber) + if err == nil { + if obj.SpansAggregateBucketValueSingleNumber != nil { + jsonSpansAggregateBucketValueSingleNumber, _ := json.Marshal(obj.SpansAggregateBucketValueSingleNumber) + if string(jsonSpansAggregateBucketValueSingleNumber) == "{}" { // empty struct + obj.SpansAggregateBucketValueSingleNumber = nil + } else { + match++ + } + } else { + obj.SpansAggregateBucketValueSingleNumber = nil + } + } else { + obj.SpansAggregateBucketValueSingleNumber = nil + } + + // try to unmarshal data into SpansAggregateBucketValueTimeseries + err = json.Unmarshal(data, &obj.SpansAggregateBucketValueTimeseries) + if err == nil { + if obj.SpansAggregateBucketValueTimeseries != nil { + jsonSpansAggregateBucketValueTimeseries, _ := json.Marshal(obj.SpansAggregateBucketValueTimeseries) + if string(jsonSpansAggregateBucketValueTimeseries) == "{}" { // empty struct + obj.SpansAggregateBucketValueTimeseries = nil + } else { + match++ + } + } else { + obj.SpansAggregateBucketValueTimeseries = nil + } + } else { + obj.SpansAggregateBucketValueTimeseries = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.SpansAggregateBucketValueSingleString = nil + obj.SpansAggregateBucketValueSingleNumber = nil + obj.SpansAggregateBucketValueTimeseries = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj SpansAggregateBucketValue) MarshalJSON() ([]byte, error) { + if obj.SpansAggregateBucketValueSingleString != nil { + return json.Marshal(&obj.SpansAggregateBucketValueSingleString) + } + + if obj.SpansAggregateBucketValueSingleNumber != nil { + return json.Marshal(&obj.SpansAggregateBucketValueSingleNumber) + } + + if obj.SpansAggregateBucketValueTimeseries != nil { + return json.Marshal(&obj.SpansAggregateBucketValueTimeseries) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *SpansAggregateBucketValue) GetActualInstance() interface{} { + if obj.SpansAggregateBucketValueSingleString != nil { + return obj.SpansAggregateBucketValueSingleString + } + + if obj.SpansAggregateBucketValueSingleNumber != nil { + return obj.SpansAggregateBucketValueSingleNumber + } + + if obj.SpansAggregateBucketValueTimeseries != nil { + return obj.SpansAggregateBucketValueTimeseries + } + + // all schemas are nil + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_bucket_value_timeseries.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_bucket_value_timeseries.go new file mode 100644 index 000000000..c34547667 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_bucket_value_timeseries.go @@ -0,0 +1,63 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/goccy/go-json" +) + +// SpansAggregateBucketValueTimeseries A timeseries array. +type SpansAggregateBucketValueTimeseries struct { + Items []SpansAggregateBucketValueTimeseriesPoint + + // UnparsedObject contains the raw value of the array if there was an error when deserializing into the struct + UnparsedObject []interface{} `json:"-"` +} + +// NewSpansAggregateBucketValueTimeseries instantiates a new SpansAggregateBucketValueTimeseries 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 NewSpansAggregateBucketValueTimeseries() *SpansAggregateBucketValueTimeseries { + this := SpansAggregateBucketValueTimeseries{} + return &this +} + +// NewSpansAggregateBucketValueTimeseriesWithDefaults instantiates a new SpansAggregateBucketValueTimeseries 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 NewSpansAggregateBucketValueTimeseriesWithDefaults() *SpansAggregateBucketValueTimeseries { + this := SpansAggregateBucketValueTimeseries{} + return &this +} + +// MarshalJSON serializes the struct using spec logic. +func (o SpansAggregateBucketValueTimeseries) MarshalJSON() ([]byte, error) { + toSerialize := make([]interface{}, len(o.Items)) + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + for i, item := range o.Items { + toSerialize[i] = item + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SpansAggregateBucketValueTimeseries) UnmarshalJSON(bytes []byte) (err error) { + if err = json.Unmarshal(bytes, &o.Items); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + if o.Items != nil && len(o.Items) > 0 { + for _, v := range o.Items { + if v.UnparsedObject != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + } + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_bucket_value_timeseries_point.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_bucket_value_timeseries_point.go new file mode 100644 index 000000000..413c343d3 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_bucket_value_timeseries_point.go @@ -0,0 +1,139 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SpansAggregateBucketValueTimeseriesPoint A timeseries point. +type SpansAggregateBucketValueTimeseriesPoint struct { + // The time value for this point. + Time *string `json:"time,omitempty"` + // The value for this point. + Value *float64 `json:"value,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{} +} + +// NewSpansAggregateBucketValueTimeseriesPoint instantiates a new SpansAggregateBucketValueTimeseriesPoint 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 NewSpansAggregateBucketValueTimeseriesPoint() *SpansAggregateBucketValueTimeseriesPoint { + this := SpansAggregateBucketValueTimeseriesPoint{} + return &this +} + +// NewSpansAggregateBucketValueTimeseriesPointWithDefaults instantiates a new SpansAggregateBucketValueTimeseriesPoint 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 NewSpansAggregateBucketValueTimeseriesPointWithDefaults() *SpansAggregateBucketValueTimeseriesPoint { + this := SpansAggregateBucketValueTimeseriesPoint{} + return &this +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *SpansAggregateBucketValueTimeseriesPoint) GetTime() string { + if o == nil || o.Time == nil { + var ret string + return ret + } + return *o.Time +} + +// GetTimeOk returns a tuple with the Time field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAggregateBucketValueTimeseriesPoint) GetTimeOk() (*string, bool) { + if o == nil || o.Time == nil { + return nil, false + } + return o.Time, true +} + +// HasTime returns a boolean if a field has been set. +func (o *SpansAggregateBucketValueTimeseriesPoint) HasTime() bool { + return o != nil && o.Time != nil +} + +// SetTime gets a reference to the given string and assigns it to the Time field. +func (o *SpansAggregateBucketValueTimeseriesPoint) SetTime(v string) { + o.Time = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *SpansAggregateBucketValueTimeseriesPoint) GetValue() float64 { + if o == nil || o.Value == nil { + var ret float64 + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAggregateBucketValueTimeseriesPoint) GetValueOk() (*float64, bool) { + if o == nil || o.Value == nil { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *SpansAggregateBucketValueTimeseriesPoint) HasValue() bool { + return o != nil && o.Value != nil +} + +// SetValue gets a reference to the given float64 and assigns it to the Value field. +func (o *SpansAggregateBucketValueTimeseriesPoint) SetValue(v float64) { + o.Value = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SpansAggregateBucketValueTimeseriesPoint) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Time != nil { + toSerialize["time"] = o.Time + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SpansAggregateBucketValueTimeseriesPoint) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Time *string `json:"time,omitempty"` + Value *float64 `json:"value,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"time", "value"}) + } else { + return err + } + o.Time = all.Time + o.Value = all.Value + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_data.go new file mode 100644 index 000000000..8a9ef02a2 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_data.go @@ -0,0 +1,156 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SpansAggregateData The object containing the query content. +type SpansAggregateData struct { + // The object containing all the query parameters. + Attributes *SpansAggregateRequestAttributes `json:"attributes,omitempty"` + // The type of resource. The value should always be aggregate_request. + Type *SpansAggregateRequestType `json:"type,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{} +} + +// NewSpansAggregateData instantiates a new SpansAggregateData 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 NewSpansAggregateData() *SpansAggregateData { + this := SpansAggregateData{} + var typeVar SpansAggregateRequestType = SPANSAGGREGATEREQUESTTYPE_AGGREGATE_REQUEST + this.Type = &typeVar + return &this +} + +// NewSpansAggregateDataWithDefaults instantiates a new SpansAggregateData 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 NewSpansAggregateDataWithDefaults() *SpansAggregateData { + this := SpansAggregateData{} + var typeVar SpansAggregateRequestType = SPANSAGGREGATEREQUESTTYPE_AGGREGATE_REQUEST + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *SpansAggregateData) GetAttributes() SpansAggregateRequestAttributes { + if o == nil || o.Attributes == nil { + var ret SpansAggregateRequestAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAggregateData) GetAttributesOk() (*SpansAggregateRequestAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *SpansAggregateData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given SpansAggregateRequestAttributes and assigns it to the Attributes field. +func (o *SpansAggregateData) SetAttributes(v SpansAggregateRequestAttributes) { + o.Attributes = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SpansAggregateData) GetType() SpansAggregateRequestType { + if o == nil || o.Type == nil { + var ret SpansAggregateRequestType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAggregateData) GetTypeOk() (*SpansAggregateRequestType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SpansAggregateData) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given SpansAggregateRequestType and assigns it to the Type field. +func (o *SpansAggregateData) SetType(v SpansAggregateRequestType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SpansAggregateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SpansAggregateData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *SpansAggregateRequestAttributes `json:"attributes,omitempty"` + Type *SpansAggregateRequestType `json:"type,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_request.go new file mode 100644 index 000000000..86089dff7 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_request.go @@ -0,0 +1,113 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SpansAggregateRequest The object sent with the request to retrieve a list of aggregated spans from your organization. +type SpansAggregateRequest struct { + // The object containing the query content. + Data *SpansAggregateData `json:"data,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{} +} + +// NewSpansAggregateRequest instantiates a new SpansAggregateRequest 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 NewSpansAggregateRequest() *SpansAggregateRequest { + this := SpansAggregateRequest{} + return &this +} + +// NewSpansAggregateRequestWithDefaults instantiates a new SpansAggregateRequest 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 NewSpansAggregateRequestWithDefaults() *SpansAggregateRequest { + this := SpansAggregateRequest{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *SpansAggregateRequest) GetData() SpansAggregateData { + if o == nil || o.Data == nil { + var ret SpansAggregateData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAggregateRequest) GetDataOk() (*SpansAggregateData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *SpansAggregateRequest) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given SpansAggregateData and assigns it to the Data field. +func (o *SpansAggregateRequest) SetData(v SpansAggregateData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SpansAggregateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SpansAggregateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *SpansAggregateData `json:"data,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_request_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_request_attributes.go new file mode 100644 index 000000000..4ca610bdb --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_request_attributes.go @@ -0,0 +1,222 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SpansAggregateRequestAttributes The object containing all the query parameters. +type SpansAggregateRequestAttributes struct { + // The list of metrics or timeseries to compute for the retrieved buckets. + Compute []SpansCompute `json:"compute,omitempty"` + // The search and filter query settings. + Filter *SpansQueryFilter `json:"filter,omitempty"` + // The rules for the group by. + GroupBy []SpansGroupBy `json:"group_by,omitempty"` + // Global query options that are used during the query. + // Note: You should only supply timezone or time offset but not both otherwise the query will fail. + Options *SpansQueryOptions `json:"options,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{} +} + +// NewSpansAggregateRequestAttributes instantiates a new SpansAggregateRequestAttributes 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 NewSpansAggregateRequestAttributes() *SpansAggregateRequestAttributes { + this := SpansAggregateRequestAttributes{} + return &this +} + +// NewSpansAggregateRequestAttributesWithDefaults instantiates a new SpansAggregateRequestAttributes 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 NewSpansAggregateRequestAttributesWithDefaults() *SpansAggregateRequestAttributes { + this := SpansAggregateRequestAttributes{} + return &this +} + +// GetCompute returns the Compute field value if set, zero value otherwise. +func (o *SpansAggregateRequestAttributes) GetCompute() []SpansCompute { + if o == nil || o.Compute == nil { + var ret []SpansCompute + return ret + } + return o.Compute +} + +// GetComputeOk returns a tuple with the Compute field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAggregateRequestAttributes) GetComputeOk() (*[]SpansCompute, bool) { + if o == nil || o.Compute == nil { + return nil, false + } + return &o.Compute, true +} + +// HasCompute returns a boolean if a field has been set. +func (o *SpansAggregateRequestAttributes) HasCompute() bool { + return o != nil && o.Compute != nil +} + +// SetCompute gets a reference to the given []SpansCompute and assigns it to the Compute field. +func (o *SpansAggregateRequestAttributes) SetCompute(v []SpansCompute) { + o.Compute = v +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *SpansAggregateRequestAttributes) GetFilter() SpansQueryFilter { + if o == nil || o.Filter == nil { + var ret SpansQueryFilter + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAggregateRequestAttributes) GetFilterOk() (*SpansQueryFilter, bool) { + if o == nil || o.Filter == nil { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *SpansAggregateRequestAttributes) HasFilter() bool { + return o != nil && o.Filter != nil +} + +// SetFilter gets a reference to the given SpansQueryFilter and assigns it to the Filter field. +func (o *SpansAggregateRequestAttributes) SetFilter(v SpansQueryFilter) { + o.Filter = &v +} + +// GetGroupBy returns the GroupBy field value if set, zero value otherwise. +func (o *SpansAggregateRequestAttributes) GetGroupBy() []SpansGroupBy { + if o == nil || o.GroupBy == nil { + var ret []SpansGroupBy + return ret + } + return o.GroupBy +} + +// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAggregateRequestAttributes) GetGroupByOk() (*[]SpansGroupBy, bool) { + if o == nil || o.GroupBy == nil { + return nil, false + } + return &o.GroupBy, true +} + +// HasGroupBy returns a boolean if a field has been set. +func (o *SpansAggregateRequestAttributes) HasGroupBy() bool { + return o != nil && o.GroupBy != nil +} + +// SetGroupBy gets a reference to the given []SpansGroupBy and assigns it to the GroupBy field. +func (o *SpansAggregateRequestAttributes) SetGroupBy(v []SpansGroupBy) { + o.GroupBy = v +} + +// GetOptions returns the Options field value if set, zero value otherwise. +func (o *SpansAggregateRequestAttributes) GetOptions() SpansQueryOptions { + if o == nil || o.Options == nil { + var ret SpansQueryOptions + return ret + } + return *o.Options +} + +// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAggregateRequestAttributes) GetOptionsOk() (*SpansQueryOptions, bool) { + if o == nil || o.Options == nil { + return nil, false + } + return o.Options, true +} + +// HasOptions returns a boolean if a field has been set. +func (o *SpansAggregateRequestAttributes) HasOptions() bool { + return o != nil && o.Options != nil +} + +// SetOptions gets a reference to the given SpansQueryOptions and assigns it to the Options field. +func (o *SpansAggregateRequestAttributes) SetOptions(v SpansQueryOptions) { + o.Options = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SpansAggregateRequestAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Compute != nil { + toSerialize["compute"] = o.Compute + } + if o.Filter != nil { + toSerialize["filter"] = o.Filter + } + if o.GroupBy != nil { + toSerialize["group_by"] = o.GroupBy + } + if o.Options != nil { + toSerialize["options"] = o.Options + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SpansAggregateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Compute []SpansCompute `json:"compute,omitempty"` + Filter *SpansQueryFilter `json:"filter,omitempty"` + GroupBy []SpansGroupBy `json:"group_by,omitempty"` + Options *SpansQueryOptions `json:"options,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"compute", "filter", "group_by", "options"}) + } else { + return err + } + + hasInvalidField := false + o.Compute = all.Compute + if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Filter = all.Filter + o.GroupBy = all.GroupBy + if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Options = all.Options + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_request_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_request_type.go new file mode 100644 index 000000000..81f858056 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_request_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/goccy/go-json" +) + +// SpansAggregateRequestType The type of resource. The value should always be aggregate_request. +type SpansAggregateRequestType string + +// List of SpansAggregateRequestType. +const ( + SPANSAGGREGATEREQUESTTYPE_AGGREGATE_REQUEST SpansAggregateRequestType = "aggregate_request" +) + +var allowedSpansAggregateRequestTypeEnumValues = []SpansAggregateRequestType{ + SPANSAGGREGATEREQUESTTYPE_AGGREGATE_REQUEST, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SpansAggregateRequestType) GetAllowedValues() []SpansAggregateRequestType { + return allowedSpansAggregateRequestTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SpansAggregateRequestType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SpansAggregateRequestType(value) + return nil +} + +// NewSpansAggregateRequestTypeFromValue returns a pointer to a valid SpansAggregateRequestType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSpansAggregateRequestTypeFromValue(v string) (*SpansAggregateRequestType, error) { + ev := SpansAggregateRequestType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SpansAggregateRequestType: valid values are %v", v, allowedSpansAggregateRequestTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SpansAggregateRequestType) IsValid() bool { + for _, existing := range allowedSpansAggregateRequestTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SpansAggregateRequestType value. +func (v SpansAggregateRequestType) Ptr() *SpansAggregateRequestType { + return &v +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_response.go new file mode 100644 index 000000000..dc444e811 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_response.go @@ -0,0 +1,148 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SpansAggregateResponse The response object for the spans aggregate API endpoint. +type SpansAggregateResponse struct { + // The list of matching buckets, one item per bucket. + Data []SpansAggregateBucket `json:"data,omitempty"` + // The metadata associated with a request. + Meta *SpansAggregateResponseMetadata `json:"meta,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{} +} + +// NewSpansAggregateResponse instantiates a new SpansAggregateResponse 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 NewSpansAggregateResponse() *SpansAggregateResponse { + this := SpansAggregateResponse{} + return &this +} + +// NewSpansAggregateResponseWithDefaults instantiates a new SpansAggregateResponse 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 NewSpansAggregateResponseWithDefaults() *SpansAggregateResponse { + this := SpansAggregateResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *SpansAggregateResponse) GetData() []SpansAggregateBucket { + if o == nil || o.Data == nil { + var ret []SpansAggregateBucket + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAggregateResponse) GetDataOk() (*[]SpansAggregateBucket, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *SpansAggregateResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given []SpansAggregateBucket and assigns it to the Data field. +func (o *SpansAggregateResponse) SetData(v []SpansAggregateBucket) { + o.Data = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *SpansAggregateResponse) GetMeta() SpansAggregateResponseMetadata { + if o == nil || o.Meta == nil { + var ret SpansAggregateResponseMetadata + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAggregateResponse) GetMetaOk() (*SpansAggregateResponseMetadata, bool) { + if o == nil || o.Meta == nil { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *SpansAggregateResponse) HasMeta() bool { + return o != nil && o.Meta != nil +} + +// SetMeta gets a reference to the given SpansAggregateResponseMetadata and assigns it to the Meta field. +func (o *SpansAggregateResponse) SetMeta(v SpansAggregateResponseMetadata) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SpansAggregateResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SpansAggregateResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data []SpansAggregateBucket `json:"data,omitempty"` + Meta *SpansAggregateResponseMetadata `json:"meta,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "meta"}) + } else { + return err + } + + hasInvalidField := false + o.Data = all.Data + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Meta = all.Meta + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_response_metadata.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_response_metadata.go new file mode 100644 index 000000000..10212fb91 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_response_metadata.go @@ -0,0 +1,220 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SpansAggregateResponseMetadata The metadata associated with a request. +type SpansAggregateResponseMetadata struct { + // The time elapsed in milliseconds. + Elapsed *int64 `json:"elapsed,omitempty"` + // The identifier of the request. + RequestId *string `json:"request_id,omitempty"` + // The status of the response. + Status *SpansAggregateResponseStatus `json:"status,omitempty"` + // A list of warnings (non fatal errors) encountered, partial results might be returned if + // warnings are present in the response. + Warnings []SpansWarning `json:"warnings,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{} +} + +// NewSpansAggregateResponseMetadata instantiates a new SpansAggregateResponseMetadata 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 NewSpansAggregateResponseMetadata() *SpansAggregateResponseMetadata { + this := SpansAggregateResponseMetadata{} + return &this +} + +// NewSpansAggregateResponseMetadataWithDefaults instantiates a new SpansAggregateResponseMetadata 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 NewSpansAggregateResponseMetadataWithDefaults() *SpansAggregateResponseMetadata { + this := SpansAggregateResponseMetadata{} + return &this +} + +// GetElapsed returns the Elapsed field value if set, zero value otherwise. +func (o *SpansAggregateResponseMetadata) GetElapsed() int64 { + if o == nil || o.Elapsed == nil { + var ret int64 + return ret + } + return *o.Elapsed +} + +// GetElapsedOk returns a tuple with the Elapsed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAggregateResponseMetadata) GetElapsedOk() (*int64, bool) { + if o == nil || o.Elapsed == nil { + return nil, false + } + return o.Elapsed, true +} + +// HasElapsed returns a boolean if a field has been set. +func (o *SpansAggregateResponseMetadata) HasElapsed() bool { + return o != nil && o.Elapsed != nil +} + +// SetElapsed gets a reference to the given int64 and assigns it to the Elapsed field. +func (o *SpansAggregateResponseMetadata) SetElapsed(v int64) { + o.Elapsed = &v +} + +// GetRequestId returns the RequestId field value if set, zero value otherwise. +func (o *SpansAggregateResponseMetadata) GetRequestId() string { + if o == nil || o.RequestId == nil { + var ret string + return ret + } + return *o.RequestId +} + +// GetRequestIdOk returns a tuple with the RequestId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAggregateResponseMetadata) GetRequestIdOk() (*string, bool) { + if o == nil || o.RequestId == nil { + return nil, false + } + return o.RequestId, true +} + +// HasRequestId returns a boolean if a field has been set. +func (o *SpansAggregateResponseMetadata) HasRequestId() bool { + return o != nil && o.RequestId != nil +} + +// SetRequestId gets a reference to the given string and assigns it to the RequestId field. +func (o *SpansAggregateResponseMetadata) SetRequestId(v string) { + o.RequestId = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *SpansAggregateResponseMetadata) GetStatus() SpansAggregateResponseStatus { + if o == nil || o.Status == nil { + var ret SpansAggregateResponseStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAggregateResponseMetadata) GetStatusOk() (*SpansAggregateResponseStatus, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *SpansAggregateResponseMetadata) HasStatus() bool { + return o != nil && o.Status != nil +} + +// SetStatus gets a reference to the given SpansAggregateResponseStatus and assigns it to the Status field. +func (o *SpansAggregateResponseMetadata) SetStatus(v SpansAggregateResponseStatus) { + o.Status = &v +} + +// GetWarnings returns the Warnings field value if set, zero value otherwise. +func (o *SpansAggregateResponseMetadata) GetWarnings() []SpansWarning { + if o == nil || o.Warnings == nil { + var ret []SpansWarning + return ret + } + return o.Warnings +} + +// GetWarningsOk returns a tuple with the Warnings field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAggregateResponseMetadata) GetWarningsOk() (*[]SpansWarning, bool) { + if o == nil || o.Warnings == nil { + return nil, false + } + return &o.Warnings, true +} + +// HasWarnings returns a boolean if a field has been set. +func (o *SpansAggregateResponseMetadata) HasWarnings() bool { + return o != nil && o.Warnings != nil +} + +// SetWarnings gets a reference to the given []SpansWarning and assigns it to the Warnings field. +func (o *SpansAggregateResponseMetadata) SetWarnings(v []SpansWarning) { + o.Warnings = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SpansAggregateResponseMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Elapsed != nil { + toSerialize["elapsed"] = o.Elapsed + } + if o.RequestId != nil { + toSerialize["request_id"] = o.RequestId + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Warnings != nil { + toSerialize["warnings"] = o.Warnings + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SpansAggregateResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Elapsed *int64 `json:"elapsed,omitempty"` + RequestId *string `json:"request_id,omitempty"` + Status *SpansAggregateResponseStatus `json:"status,omitempty"` + Warnings []SpansWarning `json:"warnings,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"elapsed", "request_id", "status", "warnings"}) + } else { + return err + } + + hasInvalidField := false + o.Elapsed = all.Elapsed + o.RequestId = all.RequestId + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } + o.Warnings = all.Warnings + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_response_status.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_response_status.go new file mode 100644 index 000000000..ce463994c --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_response_status.go @@ -0,0 +1,66 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "fmt" + + "github.com/goccy/go-json" +) + +// SpansAggregateResponseStatus The status of the response. +type SpansAggregateResponseStatus string + +// List of SpansAggregateResponseStatus. +const ( + SPANSAGGREGATERESPONSESTATUS_DONE SpansAggregateResponseStatus = "done" + SPANSAGGREGATERESPONSESTATUS_TIMEOUT SpansAggregateResponseStatus = "timeout" +) + +var allowedSpansAggregateResponseStatusEnumValues = []SpansAggregateResponseStatus{ + SPANSAGGREGATERESPONSESTATUS_DONE, + SPANSAGGREGATERESPONSESTATUS_TIMEOUT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SpansAggregateResponseStatus) GetAllowedValues() []SpansAggregateResponseStatus { + return allowedSpansAggregateResponseStatusEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SpansAggregateResponseStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SpansAggregateResponseStatus(value) + return nil +} + +// NewSpansAggregateResponseStatusFromValue returns a pointer to a valid SpansAggregateResponseStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSpansAggregateResponseStatusFromValue(v string) (*SpansAggregateResponseStatus, error) { + ev := SpansAggregateResponseStatus(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SpansAggregateResponseStatus: valid values are %v", v, allowedSpansAggregateResponseStatusEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SpansAggregateResponseStatus) IsValid() bool { + for _, existing := range allowedSpansAggregateResponseStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SpansAggregateResponseStatus value. +func (v SpansAggregateResponseStatus) Ptr() *SpansAggregateResponseStatus { + return &v +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_sort.go new file mode 100644 index 000000000..9740cebe7 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_sort.go @@ -0,0 +1,231 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SpansAggregateSort A sort rule. +type SpansAggregateSort struct { + // An aggregation function. + Aggregation *SpansAggregationFunction `json:"aggregation,omitempty"` + // The metric to sort by (only used for `type=measure`). + Metric *string `json:"metric,omitempty"` + // The order to use, ascending or descending. + Order *SpansSortOrder `json:"order,omitempty"` + // The type of sorting algorithm. + Type *SpansAggregateSortType `json:"type,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{} +} + +// NewSpansAggregateSort instantiates a new SpansAggregateSort 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 NewSpansAggregateSort() *SpansAggregateSort { + this := SpansAggregateSort{} + var typeVar SpansAggregateSortType = SPANSAGGREGATESORTTYPE_ALPHABETICAL + this.Type = &typeVar + return &this +} + +// NewSpansAggregateSortWithDefaults instantiates a new SpansAggregateSort 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 NewSpansAggregateSortWithDefaults() *SpansAggregateSort { + this := SpansAggregateSort{} + var typeVar SpansAggregateSortType = SPANSAGGREGATESORTTYPE_ALPHABETICAL + this.Type = &typeVar + return &this +} + +// GetAggregation returns the Aggregation field value if set, zero value otherwise. +func (o *SpansAggregateSort) GetAggregation() SpansAggregationFunction { + if o == nil || o.Aggregation == nil { + var ret SpansAggregationFunction + return ret + } + return *o.Aggregation +} + +// GetAggregationOk returns a tuple with the Aggregation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAggregateSort) GetAggregationOk() (*SpansAggregationFunction, bool) { + if o == nil || o.Aggregation == nil { + return nil, false + } + return o.Aggregation, true +} + +// HasAggregation returns a boolean if a field has been set. +func (o *SpansAggregateSort) HasAggregation() bool { + return o != nil && o.Aggregation != nil +} + +// SetAggregation gets a reference to the given SpansAggregationFunction and assigns it to the Aggregation field. +func (o *SpansAggregateSort) SetAggregation(v SpansAggregationFunction) { + o.Aggregation = &v +} + +// GetMetric returns the Metric field value if set, zero value otherwise. +func (o *SpansAggregateSort) GetMetric() string { + if o == nil || o.Metric == nil { + var ret string + return ret + } + return *o.Metric +} + +// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAggregateSort) GetMetricOk() (*string, bool) { + if o == nil || o.Metric == nil { + return nil, false + } + return o.Metric, true +} + +// HasMetric returns a boolean if a field has been set. +func (o *SpansAggregateSort) HasMetric() bool { + return o != nil && o.Metric != nil +} + +// SetMetric gets a reference to the given string and assigns it to the Metric field. +func (o *SpansAggregateSort) SetMetric(v string) { + o.Metric = &v +} + +// GetOrder returns the Order field value if set, zero value otherwise. +func (o *SpansAggregateSort) GetOrder() SpansSortOrder { + if o == nil || o.Order == nil { + var ret SpansSortOrder + return ret + } + return *o.Order +} + +// GetOrderOk returns a tuple with the Order field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAggregateSort) GetOrderOk() (*SpansSortOrder, bool) { + if o == nil || o.Order == nil { + return nil, false + } + return o.Order, true +} + +// HasOrder returns a boolean if a field has been set. +func (o *SpansAggregateSort) HasOrder() bool { + return o != nil && o.Order != nil +} + +// SetOrder gets a reference to the given SpansSortOrder and assigns it to the Order field. +func (o *SpansAggregateSort) SetOrder(v SpansSortOrder) { + o.Order = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SpansAggregateSort) GetType() SpansAggregateSortType { + if o == nil || o.Type == nil { + var ret SpansAggregateSortType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAggregateSort) GetTypeOk() (*SpansAggregateSortType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SpansAggregateSort) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given SpansAggregateSortType and assigns it to the Type field. +func (o *SpansAggregateSort) SetType(v SpansAggregateSortType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SpansAggregateSort) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Aggregation != nil { + toSerialize["aggregation"] = o.Aggregation + } + if o.Metric != nil { + toSerialize["metric"] = o.Metric + } + if o.Order != nil { + toSerialize["order"] = o.Order + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SpansAggregateSort) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Aggregation *SpansAggregationFunction `json:"aggregation,omitempty"` + Metric *string `json:"metric,omitempty"` + Order *SpansSortOrder `json:"order,omitempty"` + Type *SpansAggregateSortType `json:"type,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"aggregation", "metric", "order", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Aggregation != nil && !all.Aggregation.IsValid() { + hasInvalidField = true + } else { + o.Aggregation = all.Aggregation + } + o.Metric = all.Metric + if all.Order != nil && !all.Order.IsValid() { + hasInvalidField = true + } else { + o.Order = all.Order + } + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_sort_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_sort_type.go new file mode 100644 index 000000000..643bff725 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregate_sort_type.go @@ -0,0 +1,66 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "fmt" + + "github.com/goccy/go-json" +) + +// SpansAggregateSortType The type of sorting algorithm. +type SpansAggregateSortType string + +// List of SpansAggregateSortType. +const ( + SPANSAGGREGATESORTTYPE_ALPHABETICAL SpansAggregateSortType = "alphabetical" + SPANSAGGREGATESORTTYPE_MEASURE SpansAggregateSortType = "measure" +) + +var allowedSpansAggregateSortTypeEnumValues = []SpansAggregateSortType{ + SPANSAGGREGATESORTTYPE_ALPHABETICAL, + SPANSAGGREGATESORTTYPE_MEASURE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SpansAggregateSortType) GetAllowedValues() []SpansAggregateSortType { + return allowedSpansAggregateSortTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SpansAggregateSortType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SpansAggregateSortType(value) + return nil +} + +// NewSpansAggregateSortTypeFromValue returns a pointer to a valid SpansAggregateSortType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSpansAggregateSortTypeFromValue(v string) (*SpansAggregateSortType, error) { + ev := SpansAggregateSortType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SpansAggregateSortType: valid values are %v", v, allowedSpansAggregateSortTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SpansAggregateSortType) IsValid() bool { + for _, existing := range allowedSpansAggregateSortTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SpansAggregateSortType value. +func (v SpansAggregateSortType) Ptr() *SpansAggregateSortType { + return &v +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregation_function.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregation_function.go new file mode 100644 index 000000000..c31b671c1 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_aggregation_function.go @@ -0,0 +1,86 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "fmt" + + "github.com/goccy/go-json" +) + +// SpansAggregationFunction An aggregation function. +type SpansAggregationFunction string + +// List of SpansAggregationFunction. +const ( + SPANSAGGREGATIONFUNCTION_COUNT SpansAggregationFunction = "count" + SPANSAGGREGATIONFUNCTION_CARDINALITY SpansAggregationFunction = "cardinality" + SPANSAGGREGATIONFUNCTION_PERCENTILE_75 SpansAggregationFunction = "pc75" + SPANSAGGREGATIONFUNCTION_PERCENTILE_90 SpansAggregationFunction = "pc90" + SPANSAGGREGATIONFUNCTION_PERCENTILE_95 SpansAggregationFunction = "pc95" + SPANSAGGREGATIONFUNCTION_PERCENTILE_98 SpansAggregationFunction = "pc98" + SPANSAGGREGATIONFUNCTION_PERCENTILE_99 SpansAggregationFunction = "pc99" + SPANSAGGREGATIONFUNCTION_SUM SpansAggregationFunction = "sum" + SPANSAGGREGATIONFUNCTION_MIN SpansAggregationFunction = "min" + SPANSAGGREGATIONFUNCTION_MAX SpansAggregationFunction = "max" + SPANSAGGREGATIONFUNCTION_AVG SpansAggregationFunction = "avg" + SPANSAGGREGATIONFUNCTION_MEDIAN SpansAggregationFunction = "median" +) + +var allowedSpansAggregationFunctionEnumValues = []SpansAggregationFunction{ + SPANSAGGREGATIONFUNCTION_COUNT, + SPANSAGGREGATIONFUNCTION_CARDINALITY, + SPANSAGGREGATIONFUNCTION_PERCENTILE_75, + SPANSAGGREGATIONFUNCTION_PERCENTILE_90, + SPANSAGGREGATIONFUNCTION_PERCENTILE_95, + SPANSAGGREGATIONFUNCTION_PERCENTILE_98, + SPANSAGGREGATIONFUNCTION_PERCENTILE_99, + SPANSAGGREGATIONFUNCTION_SUM, + SPANSAGGREGATIONFUNCTION_MIN, + SPANSAGGREGATIONFUNCTION_MAX, + SPANSAGGREGATIONFUNCTION_AVG, + SPANSAGGREGATIONFUNCTION_MEDIAN, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SpansAggregationFunction) GetAllowedValues() []SpansAggregationFunction { + return allowedSpansAggregationFunctionEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SpansAggregationFunction) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SpansAggregationFunction(value) + return nil +} + +// NewSpansAggregationFunctionFromValue returns a pointer to a valid SpansAggregationFunction +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSpansAggregationFunctionFromValue(v string) (*SpansAggregationFunction, error) { + ev := SpansAggregationFunction(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SpansAggregationFunction: valid values are %v", v, allowedSpansAggregationFunctionEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SpansAggregationFunction) IsValid() bool { + for _, existing := range allowedSpansAggregationFunctionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SpansAggregationFunction value. +func (v SpansAggregationFunction) Ptr() *SpansAggregationFunction { + return &v +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_attributes.go new file mode 100644 index 000000000..d2a022dad --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_attributes.go @@ -0,0 +1,676 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "time" + + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SpansAttributes JSON object containing all span attributes and their associated values. +type SpansAttributes struct { + // JSON object of attributes from your span. + Attributes map[string]interface{} `json:"attributes,omitempty"` + // JSON object of custom spans data. + Custom map[string]interface{} `json:"custom,omitempty"` + // End timestamp of your span. + EndTimestamp *time.Time `json:"end_timestamp,omitempty"` + // Name of the environment from where the spans are being sent. + Env *string `json:"env,omitempty"` + // Name of the machine from where the spans are being sent. + Host *string `json:"host,omitempty"` + // The reason why the span was ingested. + IngestionReason *string `json:"ingestion_reason,omitempty"` + // Id of the span that's parent of this span. + ParentId *string `json:"parent_id,omitempty"` + // Unique identifier of the resource. + ResourceHash *string `json:"resource_hash,omitempty"` + // The name of the resource. + ResourceName *string `json:"resource_name,omitempty"` + // The reason why the span was indexed. + RetainedBy *string `json:"retained_by,omitempty"` + // The name of the application or service generating the span events. + // It is used to switch from APM to Logs, so make sure you define the same + // value when you use both products. + Service *string `json:"service,omitempty"` + // Whether or not the span was collected as a stand-alone span. Always associated to "single_span" ingestion_reason if true. + SingleSpan *bool `json:"single_span,omitempty"` + // Id of the span. + SpanId *string `json:"span_id,omitempty"` + // Start timestamp of your span. + StartTimestamp *time.Time `json:"start_timestamp,omitempty"` + // Array of tags associated with your span. + Tags []string `json:"tags,omitempty"` + // Id of the trace to which the span belongs. + TraceId *string `json:"trace_id,omitempty"` + // The type of the span. + Type *string `json:"type,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{} +} + +// NewSpansAttributes instantiates a new SpansAttributes 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 NewSpansAttributes() *SpansAttributes { + this := SpansAttributes{} + return &this +} + +// NewSpansAttributesWithDefaults instantiates a new SpansAttributes 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 NewSpansAttributesWithDefaults() *SpansAttributes { + this := SpansAttributes{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *SpansAttributes) GetAttributes() map[string]interface{} { + if o == nil || o.Attributes == nil { + var ret map[string]interface{} + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAttributes) GetAttributesOk() (*map[string]interface{}, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return &o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *SpansAttributes) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given map[string]interface{} and assigns it to the Attributes field. +func (o *SpansAttributes) SetAttributes(v map[string]interface{}) { + o.Attributes = v +} + +// GetCustom returns the Custom field value if set, zero value otherwise. +func (o *SpansAttributes) GetCustom() map[string]interface{} { + if o == nil || o.Custom == nil { + var ret map[string]interface{} + return ret + } + return o.Custom +} + +// GetCustomOk returns a tuple with the Custom field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAttributes) GetCustomOk() (*map[string]interface{}, bool) { + if o == nil || o.Custom == nil { + return nil, false + } + return &o.Custom, true +} + +// HasCustom returns a boolean if a field has been set. +func (o *SpansAttributes) HasCustom() bool { + return o != nil && o.Custom != nil +} + +// SetCustom gets a reference to the given map[string]interface{} and assigns it to the Custom field. +func (o *SpansAttributes) SetCustom(v map[string]interface{}) { + o.Custom = v +} + +// GetEndTimestamp returns the EndTimestamp field value if set, zero value otherwise. +func (o *SpansAttributes) GetEndTimestamp() time.Time { + if o == nil || o.EndTimestamp == nil { + var ret time.Time + return ret + } + return *o.EndTimestamp +} + +// GetEndTimestampOk returns a tuple with the EndTimestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAttributes) GetEndTimestampOk() (*time.Time, bool) { + if o == nil || o.EndTimestamp == nil { + return nil, false + } + return o.EndTimestamp, true +} + +// HasEndTimestamp returns a boolean if a field has been set. +func (o *SpansAttributes) HasEndTimestamp() bool { + return o != nil && o.EndTimestamp != nil +} + +// SetEndTimestamp gets a reference to the given time.Time and assigns it to the EndTimestamp field. +func (o *SpansAttributes) SetEndTimestamp(v time.Time) { + o.EndTimestamp = &v +} + +// GetEnv returns the Env field value if set, zero value otherwise. +func (o *SpansAttributes) GetEnv() string { + if o == nil || o.Env == nil { + var ret string + return ret + } + return *o.Env +} + +// GetEnvOk returns a tuple with the Env field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAttributes) GetEnvOk() (*string, bool) { + if o == nil || o.Env == nil { + return nil, false + } + return o.Env, true +} + +// HasEnv returns a boolean if a field has been set. +func (o *SpansAttributes) HasEnv() bool { + return o != nil && o.Env != nil +} + +// SetEnv gets a reference to the given string and assigns it to the Env field. +func (o *SpansAttributes) SetEnv(v string) { + o.Env = &v +} + +// GetHost returns the Host field value if set, zero value otherwise. +func (o *SpansAttributes) GetHost() string { + if o == nil || o.Host == nil { + var ret string + return ret + } + return *o.Host +} + +// GetHostOk returns a tuple with the Host field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAttributes) GetHostOk() (*string, bool) { + if o == nil || o.Host == nil { + return nil, false + } + return o.Host, true +} + +// HasHost returns a boolean if a field has been set. +func (o *SpansAttributes) HasHost() bool { + return o != nil && o.Host != nil +} + +// SetHost gets a reference to the given string and assigns it to the Host field. +func (o *SpansAttributes) SetHost(v string) { + o.Host = &v +} + +// GetIngestionReason returns the IngestionReason field value if set, zero value otherwise. +func (o *SpansAttributes) GetIngestionReason() string { + if o == nil || o.IngestionReason == nil { + var ret string + return ret + } + return *o.IngestionReason +} + +// GetIngestionReasonOk returns a tuple with the IngestionReason field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAttributes) GetIngestionReasonOk() (*string, bool) { + if o == nil || o.IngestionReason == nil { + return nil, false + } + return o.IngestionReason, true +} + +// HasIngestionReason returns a boolean if a field has been set. +func (o *SpansAttributes) HasIngestionReason() bool { + return o != nil && o.IngestionReason != nil +} + +// SetIngestionReason gets a reference to the given string and assigns it to the IngestionReason field. +func (o *SpansAttributes) SetIngestionReason(v string) { + o.IngestionReason = &v +} + +// GetParentId returns the ParentId field value if set, zero value otherwise. +func (o *SpansAttributes) GetParentId() string { + if o == nil || o.ParentId == nil { + var ret string + return ret + } + return *o.ParentId +} + +// GetParentIdOk returns a tuple with the ParentId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAttributes) GetParentIdOk() (*string, bool) { + if o == nil || o.ParentId == nil { + return nil, false + } + return o.ParentId, true +} + +// HasParentId returns a boolean if a field has been set. +func (o *SpansAttributes) HasParentId() bool { + return o != nil && o.ParentId != nil +} + +// SetParentId gets a reference to the given string and assigns it to the ParentId field. +func (o *SpansAttributes) SetParentId(v string) { + o.ParentId = &v +} + +// GetResourceHash returns the ResourceHash field value if set, zero value otherwise. +func (o *SpansAttributes) GetResourceHash() string { + if o == nil || o.ResourceHash == nil { + var ret string + return ret + } + return *o.ResourceHash +} + +// GetResourceHashOk returns a tuple with the ResourceHash field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAttributes) GetResourceHashOk() (*string, bool) { + if o == nil || o.ResourceHash == nil { + return nil, false + } + return o.ResourceHash, true +} + +// HasResourceHash returns a boolean if a field has been set. +func (o *SpansAttributes) HasResourceHash() bool { + return o != nil && o.ResourceHash != nil +} + +// SetResourceHash gets a reference to the given string and assigns it to the ResourceHash field. +func (o *SpansAttributes) SetResourceHash(v string) { + o.ResourceHash = &v +} + +// GetResourceName returns the ResourceName field value if set, zero value otherwise. +func (o *SpansAttributes) GetResourceName() string { + if o == nil || o.ResourceName == nil { + var ret string + return ret + } + return *o.ResourceName +} + +// GetResourceNameOk returns a tuple with the ResourceName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAttributes) GetResourceNameOk() (*string, bool) { + if o == nil || o.ResourceName == nil { + return nil, false + } + return o.ResourceName, true +} + +// HasResourceName returns a boolean if a field has been set. +func (o *SpansAttributes) HasResourceName() bool { + return o != nil && o.ResourceName != nil +} + +// SetResourceName gets a reference to the given string and assigns it to the ResourceName field. +func (o *SpansAttributes) SetResourceName(v string) { + o.ResourceName = &v +} + +// GetRetainedBy returns the RetainedBy field value if set, zero value otherwise. +func (o *SpansAttributes) GetRetainedBy() string { + if o == nil || o.RetainedBy == nil { + var ret string + return ret + } + return *o.RetainedBy +} + +// GetRetainedByOk returns a tuple with the RetainedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAttributes) GetRetainedByOk() (*string, bool) { + if o == nil || o.RetainedBy == nil { + return nil, false + } + return o.RetainedBy, true +} + +// HasRetainedBy returns a boolean if a field has been set. +func (o *SpansAttributes) HasRetainedBy() bool { + return o != nil && o.RetainedBy != nil +} + +// SetRetainedBy gets a reference to the given string and assigns it to the RetainedBy field. +func (o *SpansAttributes) SetRetainedBy(v string) { + o.RetainedBy = &v +} + +// GetService returns the Service field value if set, zero value otherwise. +func (o *SpansAttributes) GetService() string { + if o == nil || o.Service == nil { + var ret string + return ret + } + return *o.Service +} + +// GetServiceOk returns a tuple with the Service field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAttributes) GetServiceOk() (*string, bool) { + if o == nil || o.Service == nil { + return nil, false + } + return o.Service, true +} + +// HasService returns a boolean if a field has been set. +func (o *SpansAttributes) HasService() bool { + return o != nil && o.Service != nil +} + +// SetService gets a reference to the given string and assigns it to the Service field. +func (o *SpansAttributes) SetService(v string) { + o.Service = &v +} + +// GetSingleSpan returns the SingleSpan field value if set, zero value otherwise. +func (o *SpansAttributes) GetSingleSpan() bool { + if o == nil || o.SingleSpan == nil { + var ret bool + return ret + } + return *o.SingleSpan +} + +// GetSingleSpanOk returns a tuple with the SingleSpan field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAttributes) GetSingleSpanOk() (*bool, bool) { + if o == nil || o.SingleSpan == nil { + return nil, false + } + return o.SingleSpan, true +} + +// HasSingleSpan returns a boolean if a field has been set. +func (o *SpansAttributes) HasSingleSpan() bool { + return o != nil && o.SingleSpan != nil +} + +// SetSingleSpan gets a reference to the given bool and assigns it to the SingleSpan field. +func (o *SpansAttributes) SetSingleSpan(v bool) { + o.SingleSpan = &v +} + +// GetSpanId returns the SpanId field value if set, zero value otherwise. +func (o *SpansAttributes) GetSpanId() string { + if o == nil || o.SpanId == nil { + var ret string + return ret + } + return *o.SpanId +} + +// GetSpanIdOk returns a tuple with the SpanId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAttributes) GetSpanIdOk() (*string, bool) { + if o == nil || o.SpanId == nil { + return nil, false + } + return o.SpanId, true +} + +// HasSpanId returns a boolean if a field has been set. +func (o *SpansAttributes) HasSpanId() bool { + return o != nil && o.SpanId != nil +} + +// SetSpanId gets a reference to the given string and assigns it to the SpanId field. +func (o *SpansAttributes) SetSpanId(v string) { + o.SpanId = &v +} + +// GetStartTimestamp returns the StartTimestamp field value if set, zero value otherwise. +func (o *SpansAttributes) GetStartTimestamp() time.Time { + if o == nil || o.StartTimestamp == nil { + var ret time.Time + return ret + } + return *o.StartTimestamp +} + +// GetStartTimestampOk returns a tuple with the StartTimestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAttributes) GetStartTimestampOk() (*time.Time, bool) { + if o == nil || o.StartTimestamp == nil { + return nil, false + } + return o.StartTimestamp, true +} + +// HasStartTimestamp returns a boolean if a field has been set. +func (o *SpansAttributes) HasStartTimestamp() bool { + return o != nil && o.StartTimestamp != nil +} + +// SetStartTimestamp gets a reference to the given time.Time and assigns it to the StartTimestamp field. +func (o *SpansAttributes) SetStartTimestamp(v time.Time) { + o.StartTimestamp = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *SpansAttributes) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAttributes) GetTagsOk() (*[]string, bool) { + if o == nil || o.Tags == nil { + return nil, false + } + return &o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *SpansAttributes) HasTags() bool { + return o != nil && o.Tags != nil +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *SpansAttributes) SetTags(v []string) { + o.Tags = v +} + +// GetTraceId returns the TraceId field value if set, zero value otherwise. +func (o *SpansAttributes) GetTraceId() string { + if o == nil || o.TraceId == nil { + var ret string + return ret + } + return *o.TraceId +} + +// GetTraceIdOk returns a tuple with the TraceId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAttributes) GetTraceIdOk() (*string, bool) { + if o == nil || o.TraceId == nil { + return nil, false + } + return o.TraceId, true +} + +// HasTraceId returns a boolean if a field has been set. +func (o *SpansAttributes) HasTraceId() bool { + return o != nil && o.TraceId != nil +} + +// SetTraceId gets a reference to the given string and assigns it to the TraceId field. +func (o *SpansAttributes) SetTraceId(v string) { + o.TraceId = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SpansAttributes) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansAttributes) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SpansAttributes) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *SpansAttributes) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SpansAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Custom != nil { + toSerialize["custom"] = o.Custom + } + if o.EndTimestamp != nil { + if o.EndTimestamp.Nanosecond() == 0 { + toSerialize["end_timestamp"] = o.EndTimestamp.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["end_timestamp"] = o.EndTimestamp.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Env != nil { + toSerialize["env"] = o.Env + } + if o.Host != nil { + toSerialize["host"] = o.Host + } + if o.IngestionReason != nil { + toSerialize["ingestion_reason"] = o.IngestionReason + } + if o.ParentId != nil { + toSerialize["parent_id"] = o.ParentId + } + if o.ResourceHash != nil { + toSerialize["resource_hash"] = o.ResourceHash + } + if o.ResourceName != nil { + toSerialize["resource_name"] = o.ResourceName + } + if o.RetainedBy != nil { + toSerialize["retained_by"] = o.RetainedBy + } + if o.Service != nil { + toSerialize["service"] = o.Service + } + if o.SingleSpan != nil { + toSerialize["single_span"] = o.SingleSpan + } + if o.SpanId != nil { + toSerialize["span_id"] = o.SpanId + } + if o.StartTimestamp != nil { + if o.StartTimestamp.Nanosecond() == 0 { + toSerialize["start_timestamp"] = o.StartTimestamp.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["start_timestamp"] = o.StartTimestamp.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.TraceId != nil { + toSerialize["trace_id"] = o.TraceId + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SpansAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes map[string]interface{} `json:"attributes,omitempty"` + Custom map[string]interface{} `json:"custom,omitempty"` + EndTimestamp *time.Time `json:"end_timestamp,omitempty"` + Env *string `json:"env,omitempty"` + Host *string `json:"host,omitempty"` + IngestionReason *string `json:"ingestion_reason,omitempty"` + ParentId *string `json:"parent_id,omitempty"` + ResourceHash *string `json:"resource_hash,omitempty"` + ResourceName *string `json:"resource_name,omitempty"` + RetainedBy *string `json:"retained_by,omitempty"` + Service *string `json:"service,omitempty"` + SingleSpan *bool `json:"single_span,omitempty"` + SpanId *string `json:"span_id,omitempty"` + StartTimestamp *time.Time `json:"start_timestamp,omitempty"` + Tags []string `json:"tags,omitempty"` + TraceId *string `json:"trace_id,omitempty"` + Type *string `json:"type,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "custom", "end_timestamp", "env", "host", "ingestion_reason", "parent_id", "resource_hash", "resource_name", "retained_by", "service", "single_span", "span_id", "start_timestamp", "tags", "trace_id", "type"}) + } else { + return err + } + o.Attributes = all.Attributes + o.Custom = all.Custom + o.EndTimestamp = all.EndTimestamp + o.Env = all.Env + o.Host = all.Host + o.IngestionReason = all.IngestionReason + o.ParentId = all.ParentId + o.ResourceHash = all.ResourceHash + o.ResourceName = all.ResourceName + o.RetainedBy = all.RetainedBy + o.Service = all.Service + o.SingleSpan = all.SingleSpan + o.SpanId = all.SpanId + o.StartTimestamp = all.StartTimestamp + o.Tags = all.Tags + o.TraceId = all.TraceId + o.Type = all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_compute.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_compute.go new file mode 100644 index 000000000..29c994d57 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_compute.go @@ -0,0 +1,227 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "fmt" + + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SpansCompute A compute rule to compute metrics or timeseries. +type SpansCompute struct { + // An aggregation function. + Aggregation SpansAggregationFunction `json:"aggregation"` + // The time buckets' size (only used for type=timeseries) + // Defaults to a resolution of 150 points. + Interval *string `json:"interval,omitempty"` + // The metric to use. + Metric *string `json:"metric,omitempty"` + // The type of compute. + Type *SpansComputeType `json:"type,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{} +} + +// NewSpansCompute instantiates a new SpansCompute 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 NewSpansCompute(aggregation SpansAggregationFunction) *SpansCompute { + this := SpansCompute{} + this.Aggregation = aggregation + var typeVar SpansComputeType = SPANSCOMPUTETYPE_TOTAL + this.Type = &typeVar + return &this +} + +// NewSpansComputeWithDefaults instantiates a new SpansCompute 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 NewSpansComputeWithDefaults() *SpansCompute { + this := SpansCompute{} + var typeVar SpansComputeType = SPANSCOMPUTETYPE_TOTAL + this.Type = &typeVar + return &this +} + +// GetAggregation returns the Aggregation field value. +func (o *SpansCompute) GetAggregation() SpansAggregationFunction { + if o == nil { + var ret SpansAggregationFunction + return ret + } + return o.Aggregation +} + +// GetAggregationOk returns a tuple with the Aggregation field value +// and a boolean to check if the value has been set. +func (o *SpansCompute) GetAggregationOk() (*SpansAggregationFunction, bool) { + if o == nil { + return nil, false + } + return &o.Aggregation, true +} + +// SetAggregation sets field value. +func (o *SpansCompute) SetAggregation(v SpansAggregationFunction) { + o.Aggregation = v +} + +// GetInterval returns the Interval field value if set, zero value otherwise. +func (o *SpansCompute) GetInterval() string { + if o == nil || o.Interval == nil { + var ret string + return ret + } + return *o.Interval +} + +// GetIntervalOk returns a tuple with the Interval field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansCompute) GetIntervalOk() (*string, bool) { + if o == nil || o.Interval == nil { + return nil, false + } + return o.Interval, true +} + +// HasInterval returns a boolean if a field has been set. +func (o *SpansCompute) HasInterval() bool { + return o != nil && o.Interval != nil +} + +// SetInterval gets a reference to the given string and assigns it to the Interval field. +func (o *SpansCompute) SetInterval(v string) { + o.Interval = &v +} + +// GetMetric returns the Metric field value if set, zero value otherwise. +func (o *SpansCompute) GetMetric() string { + if o == nil || o.Metric == nil { + var ret string + return ret + } + return *o.Metric +} + +// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansCompute) GetMetricOk() (*string, bool) { + if o == nil || o.Metric == nil { + return nil, false + } + return o.Metric, true +} + +// HasMetric returns a boolean if a field has been set. +func (o *SpansCompute) HasMetric() bool { + return o != nil && o.Metric != nil +} + +// SetMetric gets a reference to the given string and assigns it to the Metric field. +func (o *SpansCompute) SetMetric(v string) { + o.Metric = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SpansCompute) GetType() SpansComputeType { + if o == nil || o.Type == nil { + var ret SpansComputeType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansCompute) GetTypeOk() (*SpansComputeType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SpansCompute) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given SpansComputeType and assigns it to the Type field. +func (o *SpansCompute) SetType(v SpansComputeType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SpansCompute) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["aggregation"] = o.Aggregation + if o.Interval != nil { + toSerialize["interval"] = o.Interval + } + if o.Metric != nil { + toSerialize["metric"] = o.Metric + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SpansCompute) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Aggregation *SpansAggregationFunction `json:"aggregation"` + Interval *string `json:"interval,omitempty"` + Metric *string `json:"metric,omitempty"` + Type *SpansComputeType `json:"type,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + 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"}) + } else { + return err + } + + hasInvalidField := false + if !all.Aggregation.IsValid() { + hasInvalidField = true + } else { + o.Aggregation = *all.Aggregation + } + o.Interval = all.Interval + o.Metric = all.Metric + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_compute_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_compute_type.go new file mode 100644 index 000000000..c1ba05a61 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_compute_type.go @@ -0,0 +1,66 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "fmt" + + "github.com/goccy/go-json" +) + +// SpansComputeType The type of compute. +type SpansComputeType string + +// List of SpansComputeType. +const ( + SPANSCOMPUTETYPE_TIMESERIES SpansComputeType = "timeseries" + SPANSCOMPUTETYPE_TOTAL SpansComputeType = "total" +) + +var allowedSpansComputeTypeEnumValues = []SpansComputeType{ + SPANSCOMPUTETYPE_TIMESERIES, + SPANSCOMPUTETYPE_TOTAL, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SpansComputeType) GetAllowedValues() []SpansComputeType { + return allowedSpansComputeTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SpansComputeType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SpansComputeType(value) + return nil +} + +// NewSpansComputeTypeFromValue returns a pointer to a valid SpansComputeType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSpansComputeTypeFromValue(v string) (*SpansComputeType, error) { + ev := SpansComputeType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SpansComputeType: valid values are %v", v, allowedSpansComputeTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SpansComputeType) IsValid() bool { + for _, existing := range allowedSpansComputeTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SpansComputeType value. +func (v SpansComputeType) Ptr() *SpansComputeType { + return &v +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_group_by.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_group_by.go new file mode 100644 index 000000000..71c7e5d13 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_group_by.go @@ -0,0 +1,295 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "fmt" + + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SpansGroupBy A group by rule. +type SpansGroupBy struct { + // The name of the facet to use (required). + Facet string `json:"facet"` + // Used to perform a histogram computation (only for measure facets). + // Note: At most 100 buckets are allowed, the number of buckets is (max - min)/interval. + Histogram *SpansGroupByHistogram `json:"histogram,omitempty"` + // The maximum buckets to return for this group by. + Limit *int64 `json:"limit,omitempty"` + // The value to use for spans that don't have the facet used to group by. + Missing *SpansGroupByMissing `json:"missing,omitempty"` + // A sort rule. + Sort *SpansAggregateSort `json:"sort,omitempty"` + // A resulting object to put the given computes in over all the matching records. + Total *SpansGroupByTotal `json:"total,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{} +} + +// NewSpansGroupBy instantiates a new SpansGroupBy 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 NewSpansGroupBy(facet string) *SpansGroupBy { + this := SpansGroupBy{} + this.Facet = facet + var limit int64 = 10 + this.Limit = &limit + return &this +} + +// NewSpansGroupByWithDefaults instantiates a new SpansGroupBy 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 NewSpansGroupByWithDefaults() *SpansGroupBy { + this := SpansGroupBy{} + var limit int64 = 10 + this.Limit = &limit + return &this +} + +// GetFacet returns the Facet field value. +func (o *SpansGroupBy) GetFacet() string { + if o == nil { + var ret string + return ret + } + return o.Facet +} + +// GetFacetOk returns a tuple with the Facet field value +// and a boolean to check if the value has been set. +func (o *SpansGroupBy) GetFacetOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Facet, true +} + +// SetFacet sets field value. +func (o *SpansGroupBy) SetFacet(v string) { + o.Facet = v +} + +// GetHistogram returns the Histogram field value if set, zero value otherwise. +func (o *SpansGroupBy) GetHistogram() SpansGroupByHistogram { + if o == nil || o.Histogram == nil { + var ret SpansGroupByHistogram + return ret + } + return *o.Histogram +} + +// GetHistogramOk returns a tuple with the Histogram field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansGroupBy) GetHistogramOk() (*SpansGroupByHistogram, bool) { + if o == nil || o.Histogram == nil { + return nil, false + } + return o.Histogram, true +} + +// HasHistogram returns a boolean if a field has been set. +func (o *SpansGroupBy) HasHistogram() bool { + return o != nil && o.Histogram != nil +} + +// SetHistogram gets a reference to the given SpansGroupByHistogram and assigns it to the Histogram field. +func (o *SpansGroupBy) SetHistogram(v SpansGroupByHistogram) { + o.Histogram = &v +} + +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *SpansGroupBy) GetLimit() int64 { + if o == nil || o.Limit == nil { + var ret int64 + return ret + } + return *o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansGroupBy) GetLimitOk() (*int64, bool) { + if o == nil || o.Limit == nil { + return nil, false + } + return o.Limit, true +} + +// HasLimit returns a boolean if a field has been set. +func (o *SpansGroupBy) HasLimit() bool { + return o != nil && o.Limit != nil +} + +// SetLimit gets a reference to the given int64 and assigns it to the Limit field. +func (o *SpansGroupBy) SetLimit(v int64) { + o.Limit = &v +} + +// GetMissing returns the Missing field value if set, zero value otherwise. +func (o *SpansGroupBy) GetMissing() SpansGroupByMissing { + if o == nil || o.Missing == nil { + var ret SpansGroupByMissing + return ret + } + return *o.Missing +} + +// GetMissingOk returns a tuple with the Missing field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansGroupBy) GetMissingOk() (*SpansGroupByMissing, bool) { + if o == nil || o.Missing == nil { + return nil, false + } + return o.Missing, true +} + +// HasMissing returns a boolean if a field has been set. +func (o *SpansGroupBy) HasMissing() bool { + return o != nil && o.Missing != nil +} + +// SetMissing gets a reference to the given SpansGroupByMissing and assigns it to the Missing field. +func (o *SpansGroupBy) SetMissing(v SpansGroupByMissing) { + o.Missing = &v +} + +// GetSort returns the Sort field value if set, zero value otherwise. +func (o *SpansGroupBy) GetSort() SpansAggregateSort { + if o == nil || o.Sort == nil { + var ret SpansAggregateSort + return ret + } + return *o.Sort +} + +// GetSortOk returns a tuple with the Sort field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansGroupBy) GetSortOk() (*SpansAggregateSort, bool) { + if o == nil || o.Sort == nil { + return nil, false + } + return o.Sort, true +} + +// HasSort returns a boolean if a field has been set. +func (o *SpansGroupBy) HasSort() bool { + return o != nil && o.Sort != nil +} + +// SetSort gets a reference to the given SpansAggregateSort and assigns it to the Sort field. +func (o *SpansGroupBy) SetSort(v SpansAggregateSort) { + o.Sort = &v +} + +// GetTotal returns the Total field value if set, zero value otherwise. +func (o *SpansGroupBy) GetTotal() SpansGroupByTotal { + if o == nil || o.Total == nil { + var ret SpansGroupByTotal + return ret + } + return *o.Total +} + +// GetTotalOk returns a tuple with the Total field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansGroupBy) GetTotalOk() (*SpansGroupByTotal, bool) { + if o == nil || o.Total == nil { + return nil, false + } + return o.Total, true +} + +// HasTotal returns a boolean if a field has been set. +func (o *SpansGroupBy) HasTotal() bool { + return o != nil && o.Total != nil +} + +// SetTotal gets a reference to the given SpansGroupByTotal and assigns it to the Total field. +func (o *SpansGroupBy) SetTotal(v SpansGroupByTotal) { + o.Total = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SpansGroupBy) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["facet"] = o.Facet + if o.Histogram != nil { + toSerialize["histogram"] = o.Histogram + } + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + if o.Missing != nil { + toSerialize["missing"] = o.Missing + } + if o.Sort != nil { + toSerialize["sort"] = o.Sort + } + if o.Total != nil { + toSerialize["total"] = o.Total + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SpansGroupBy) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Facet *string `json:"facet"` + Histogram *SpansGroupByHistogram `json:"histogram,omitempty"` + Limit *int64 `json:"limit,omitempty"` + Missing *SpansGroupByMissing `json:"missing,omitempty"` + Sort *SpansAggregateSort `json:"sort,omitempty"` + Total *SpansGroupByTotal `json:"total,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + 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 + } + + hasInvalidField := false + o.Facet = *all.Facet + if all.Histogram != nil && all.Histogram.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Histogram = all.Histogram + o.Limit = all.Limit + o.Missing = all.Missing + if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Sort = all.Sort + o.Total = all.Total + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_group_by_histogram.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_group_by_histogram.go new file mode 100644 index 000000000..cf2c1dc22 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_group_by_histogram.go @@ -0,0 +1,170 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "fmt" + + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SpansGroupByHistogram Used to perform a histogram computation (only for measure facets). +// Note: At most 100 buckets are allowed, the number of buckets is (max - min)/interval. +type SpansGroupByHistogram struct { + // The bin size of the histogram buckets. + Interval float64 `json:"interval"` + // The maximum value for the measure used in the histogram + // (values greater than this one are filtered out). + Max float64 `json:"max"` + // The minimum value for the measure used in the histogram + // (values smaller than this one are filtered out). + Min float64 `json:"min"` + // 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{} +} + +// NewSpansGroupByHistogram instantiates a new SpansGroupByHistogram 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 NewSpansGroupByHistogram(interval float64, max float64, min float64) *SpansGroupByHistogram { + this := SpansGroupByHistogram{} + this.Interval = interval + this.Max = max + this.Min = min + return &this +} + +// NewSpansGroupByHistogramWithDefaults instantiates a new SpansGroupByHistogram 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 NewSpansGroupByHistogramWithDefaults() *SpansGroupByHistogram { + this := SpansGroupByHistogram{} + return &this +} + +// GetInterval returns the Interval field value. +func (o *SpansGroupByHistogram) GetInterval() float64 { + if o == nil { + var ret float64 + return ret + } + return o.Interval +} + +// GetIntervalOk returns a tuple with the Interval field value +// and a boolean to check if the value has been set. +func (o *SpansGroupByHistogram) GetIntervalOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.Interval, true +} + +// SetInterval sets field value. +func (o *SpansGroupByHistogram) SetInterval(v float64) { + o.Interval = v +} + +// GetMax returns the Max field value. +func (o *SpansGroupByHistogram) GetMax() float64 { + if o == nil { + var ret float64 + return ret + } + return o.Max +} + +// GetMaxOk returns a tuple with the Max field value +// and a boolean to check if the value has been set. +func (o *SpansGroupByHistogram) GetMaxOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.Max, true +} + +// SetMax sets field value. +func (o *SpansGroupByHistogram) SetMax(v float64) { + o.Max = v +} + +// GetMin returns the Min field value. +func (o *SpansGroupByHistogram) GetMin() float64 { + if o == nil { + var ret float64 + return ret + } + return o.Min +} + +// GetMinOk returns a tuple with the Min field value +// and a boolean to check if the value has been set. +func (o *SpansGroupByHistogram) GetMinOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.Min, true +} + +// SetMin sets field value. +func (o *SpansGroupByHistogram) SetMin(v float64) { + o.Min = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SpansGroupByHistogram) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["interval"] = o.Interval + toSerialize["max"] = o.Max + toSerialize["min"] = o.Min + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SpansGroupByHistogram) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Interval *float64 `json:"interval"` + Max *float64 `json:"max"` + Min *float64 `json:"min"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + 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 + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_group_by_missing.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_group_by_missing.go new file mode 100644 index 000000000..c81286265 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_group_by_missing.go @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/goccy/go-json" +) + +// SpansGroupByMissing - The value to use for spans that don't have the facet used to group by. +type SpansGroupByMissing struct { + SpansGroupByMissingString *string + SpansGroupByMissingNumber *float64 + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// SpansGroupByMissingStringAsSpansGroupByMissing is a convenience function that returns string wrapped in SpansGroupByMissing. +func SpansGroupByMissingStringAsSpansGroupByMissing(v *string) SpansGroupByMissing { + return SpansGroupByMissing{SpansGroupByMissingString: v} +} + +// SpansGroupByMissingNumberAsSpansGroupByMissing is a convenience function that returns float64 wrapped in SpansGroupByMissing. +func SpansGroupByMissingNumberAsSpansGroupByMissing(v *float64) SpansGroupByMissing { + return SpansGroupByMissing{SpansGroupByMissingNumber: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *SpansGroupByMissing) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into SpansGroupByMissingString + err = json.Unmarshal(data, &obj.SpansGroupByMissingString) + if err == nil { + if obj.SpansGroupByMissingString != nil { + jsonSpansGroupByMissingString, _ := json.Marshal(obj.SpansGroupByMissingString) + if string(jsonSpansGroupByMissingString) == "{}" { // empty struct + obj.SpansGroupByMissingString = nil + } else { + match++ + } + } else { + obj.SpansGroupByMissingString = nil + } + } else { + obj.SpansGroupByMissingString = nil + } + + // try to unmarshal data into SpansGroupByMissingNumber + err = json.Unmarshal(data, &obj.SpansGroupByMissingNumber) + if err == nil { + if obj.SpansGroupByMissingNumber != nil { + jsonSpansGroupByMissingNumber, _ := json.Marshal(obj.SpansGroupByMissingNumber) + if string(jsonSpansGroupByMissingNumber) == "{}" { // empty struct + obj.SpansGroupByMissingNumber = nil + } else { + match++ + } + } else { + obj.SpansGroupByMissingNumber = nil + } + } else { + obj.SpansGroupByMissingNumber = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.SpansGroupByMissingString = nil + obj.SpansGroupByMissingNumber = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj SpansGroupByMissing) MarshalJSON() ([]byte, error) { + if obj.SpansGroupByMissingString != nil { + return json.Marshal(&obj.SpansGroupByMissingString) + } + + if obj.SpansGroupByMissingNumber != nil { + return json.Marshal(&obj.SpansGroupByMissingNumber) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *SpansGroupByMissing) GetActualInstance() interface{} { + if obj.SpansGroupByMissingString != nil { + return obj.SpansGroupByMissingString + } + + if obj.SpansGroupByMissingNumber != nil { + return obj.SpansGroupByMissingNumber + } + + // all schemas are nil + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_group_by_total.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_group_by_total.go new file mode 100644 index 000000000..a0b7bd2bb --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_group_by_total.go @@ -0,0 +1,137 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" +) + +// SpansGroupByTotal - A resulting object to put the given computes in over all the matching records. +type SpansGroupByTotal struct { + SpansGroupByTotalBoolean *bool + SpansGroupByTotalString *string + SpansGroupByTotalNumber *float64 + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// SpansGroupByTotalBooleanAsSpansGroupByTotal is a convenience function that returns bool wrapped in SpansGroupByTotal. +func SpansGroupByTotalBooleanAsSpansGroupByTotal(v *bool) SpansGroupByTotal { + return SpansGroupByTotal{SpansGroupByTotalBoolean: v} +} + +// SpansGroupByTotalStringAsSpansGroupByTotal is a convenience function that returns string wrapped in SpansGroupByTotal. +func SpansGroupByTotalStringAsSpansGroupByTotal(v *string) SpansGroupByTotal { + return SpansGroupByTotal{SpansGroupByTotalString: v} +} + +// SpansGroupByTotalNumberAsSpansGroupByTotal is a convenience function that returns float64 wrapped in SpansGroupByTotal. +func SpansGroupByTotalNumberAsSpansGroupByTotal(v *float64) SpansGroupByTotal { + return SpansGroupByTotal{SpansGroupByTotalNumber: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *SpansGroupByTotal) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into SpansGroupByTotalBoolean + err = json.Unmarshal(data, &obj.SpansGroupByTotalBoolean) + if err == nil { + if obj.SpansGroupByTotalBoolean != nil { + jsonSpansGroupByTotalBoolean, _ := json.Marshal(obj.SpansGroupByTotalBoolean) + if string(jsonSpansGroupByTotalBoolean) == "{}" { // empty struct + obj.SpansGroupByTotalBoolean = nil + } else { + match++ + } + } else { + obj.SpansGroupByTotalBoolean = nil + } + } else { + obj.SpansGroupByTotalBoolean = nil + } + + // try to unmarshal data into SpansGroupByTotalString + err = json.Unmarshal(data, &obj.SpansGroupByTotalString) + if err == nil { + if obj.SpansGroupByTotalString != nil { + jsonSpansGroupByTotalString, _ := json.Marshal(obj.SpansGroupByTotalString) + if string(jsonSpansGroupByTotalString) == "{}" { // empty struct + obj.SpansGroupByTotalString = nil + } else { + match++ + } + } else { + obj.SpansGroupByTotalString = nil + } + } else { + obj.SpansGroupByTotalString = nil + } + + // try to unmarshal data into SpansGroupByTotalNumber + err = json.Unmarshal(data, &obj.SpansGroupByTotalNumber) + if err == nil { + if obj.SpansGroupByTotalNumber != nil { + jsonSpansGroupByTotalNumber, _ := json.Marshal(obj.SpansGroupByTotalNumber) + if string(jsonSpansGroupByTotalNumber) == "{}" { // empty struct + obj.SpansGroupByTotalNumber = nil + } else { + match++ + } + } else { + obj.SpansGroupByTotalNumber = nil + } + } else { + obj.SpansGroupByTotalNumber = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.SpansGroupByTotalBoolean = nil + obj.SpansGroupByTotalString = nil + obj.SpansGroupByTotalNumber = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj SpansGroupByTotal) MarshalJSON() ([]byte, error) { + if obj.SpansGroupByTotalBoolean != nil { + return json.Marshal(&obj.SpansGroupByTotalBoolean) + } + + if obj.SpansGroupByTotalString != nil { + return json.Marshal(&obj.SpansGroupByTotalString) + } + + if obj.SpansGroupByTotalNumber != nil { + return json.Marshal(&obj.SpansGroupByTotalNumber) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *SpansGroupByTotal) GetActualInstance() interface{} { + if obj.SpansGroupByTotalBoolean != nil { + return obj.SpansGroupByTotalBoolean + } + + if obj.SpansGroupByTotalString != nil { + return obj.SpansGroupByTotalString + } + + if obj.SpansGroupByTotalNumber != nil { + return obj.SpansGroupByTotalNumber + } + + // all schemas are nil + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_request.go new file mode 100644 index 000000000..676e12d8c --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_request.go @@ -0,0 +1,113 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SpansListRequest The request for a spans list. +type SpansListRequest struct { + // The object containing the query content. + Data *SpansListRequestData `json:"data,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{} +} + +// NewSpansListRequest instantiates a new SpansListRequest 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 NewSpansListRequest() *SpansListRequest { + this := SpansListRequest{} + return &this +} + +// NewSpansListRequestWithDefaults instantiates a new SpansListRequest 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 NewSpansListRequestWithDefaults() *SpansListRequest { + this := SpansListRequest{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *SpansListRequest) GetData() SpansListRequestData { + if o == nil || o.Data == nil { + var ret SpansListRequestData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansListRequest) GetDataOk() (*SpansListRequestData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *SpansListRequest) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given SpansListRequestData and assigns it to the Data field. +func (o *SpansListRequest) SetData(v SpansListRequestData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SpansListRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SpansListRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *SpansListRequestData `json:"data,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_request_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_request_attributes.go new file mode 100644 index 000000000..f8d58771d --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_request_attributes.go @@ -0,0 +1,229 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SpansListRequestAttributes The object containing all the query parameters. +type SpansListRequestAttributes struct { + // The search and filter query settings. + Filter *SpansQueryFilter `json:"filter,omitempty"` + // Global query options that are used during the query. + // Note: You should only supply timezone or time offset but not both otherwise the query will fail. + Options *SpansQueryOptions `json:"options,omitempty"` + // Paging attributes for listing spans. + Page *SpansListRequestPage `json:"page,omitempty"` + // Sort parameters when querying spans. + Sort *SpansSort `json:"sort,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{} +} + +// NewSpansListRequestAttributes instantiates a new SpansListRequestAttributes 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 NewSpansListRequestAttributes() *SpansListRequestAttributes { + this := SpansListRequestAttributes{} + return &this +} + +// NewSpansListRequestAttributesWithDefaults instantiates a new SpansListRequestAttributes 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 NewSpansListRequestAttributesWithDefaults() *SpansListRequestAttributes { + this := SpansListRequestAttributes{} + return &this +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *SpansListRequestAttributes) GetFilter() SpansQueryFilter { + if o == nil || o.Filter == nil { + var ret SpansQueryFilter + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansListRequestAttributes) GetFilterOk() (*SpansQueryFilter, bool) { + if o == nil || o.Filter == nil { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *SpansListRequestAttributes) HasFilter() bool { + return o != nil && o.Filter != nil +} + +// SetFilter gets a reference to the given SpansQueryFilter and assigns it to the Filter field. +func (o *SpansListRequestAttributes) SetFilter(v SpansQueryFilter) { + o.Filter = &v +} + +// GetOptions returns the Options field value if set, zero value otherwise. +func (o *SpansListRequestAttributes) GetOptions() SpansQueryOptions { + if o == nil || o.Options == nil { + var ret SpansQueryOptions + return ret + } + return *o.Options +} + +// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansListRequestAttributes) GetOptionsOk() (*SpansQueryOptions, bool) { + if o == nil || o.Options == nil { + return nil, false + } + return o.Options, true +} + +// HasOptions returns a boolean if a field has been set. +func (o *SpansListRequestAttributes) HasOptions() bool { + return o != nil && o.Options != nil +} + +// SetOptions gets a reference to the given SpansQueryOptions and assigns it to the Options field. +func (o *SpansListRequestAttributes) SetOptions(v SpansQueryOptions) { + o.Options = &v +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *SpansListRequestAttributes) GetPage() SpansListRequestPage { + if o == nil || o.Page == nil { + var ret SpansListRequestPage + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansListRequestAttributes) GetPageOk() (*SpansListRequestPage, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *SpansListRequestAttributes) HasPage() bool { + return o != nil && o.Page != nil +} + +// SetPage gets a reference to the given SpansListRequestPage and assigns it to the Page field. +func (o *SpansListRequestAttributes) SetPage(v SpansListRequestPage) { + o.Page = &v +} + +// GetSort returns the Sort field value if set, zero value otherwise. +func (o *SpansListRequestAttributes) GetSort() SpansSort { + if o == nil || o.Sort == nil { + var ret SpansSort + return ret + } + return *o.Sort +} + +// GetSortOk returns a tuple with the Sort field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansListRequestAttributes) GetSortOk() (*SpansSort, bool) { + if o == nil || o.Sort == nil { + return nil, false + } + return o.Sort, true +} + +// HasSort returns a boolean if a field has been set. +func (o *SpansListRequestAttributes) HasSort() bool { + return o != nil && o.Sort != nil +} + +// SetSort gets a reference to the given SpansSort and assigns it to the Sort field. +func (o *SpansListRequestAttributes) SetSort(v SpansSort) { + o.Sort = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SpansListRequestAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Filter != nil { + toSerialize["filter"] = o.Filter + } + if o.Options != nil { + toSerialize["options"] = o.Options + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + if o.Sort != nil { + toSerialize["sort"] = o.Sort + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SpansListRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Filter *SpansQueryFilter `json:"filter,omitempty"` + Options *SpansQueryOptions `json:"options,omitempty"` + Page *SpansListRequestPage `json:"page,omitempty"` + Sort *SpansSort `json:"sort,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"filter", "options", "page", "sort"}) + } else { + return err + } + + hasInvalidField := false + if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Filter = all.Filter + if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Options = all.Options + if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Page = all.Page + if all.Sort != nil && !all.Sort.IsValid() { + hasInvalidField = true + } else { + o.Sort = all.Sort + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_request_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_request_data.go new file mode 100644 index 000000000..81b15cf50 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_request_data.go @@ -0,0 +1,156 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SpansListRequestData The object containing the query content. +type SpansListRequestData struct { + // The object containing all the query parameters. + Attributes *SpansListRequestAttributes `json:"attributes,omitempty"` + // The type of resource. The value should always be search_request. + Type *SpansListRequestType `json:"type,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{} +} + +// NewSpansListRequestData instantiates a new SpansListRequestData 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 NewSpansListRequestData() *SpansListRequestData { + this := SpansListRequestData{} + var typeVar SpansListRequestType = SPANSLISTREQUESTTYPE_SEARCH_REQUEST + this.Type = &typeVar + return &this +} + +// NewSpansListRequestDataWithDefaults instantiates a new SpansListRequestData 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 NewSpansListRequestDataWithDefaults() *SpansListRequestData { + this := SpansListRequestData{} + var typeVar SpansListRequestType = SPANSLISTREQUESTTYPE_SEARCH_REQUEST + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *SpansListRequestData) GetAttributes() SpansListRequestAttributes { + if o == nil || o.Attributes == nil { + var ret SpansListRequestAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansListRequestData) GetAttributesOk() (*SpansListRequestAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *SpansListRequestData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given SpansListRequestAttributes and assigns it to the Attributes field. +func (o *SpansListRequestData) SetAttributes(v SpansListRequestAttributes) { + o.Attributes = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SpansListRequestData) GetType() SpansListRequestType { + if o == nil || o.Type == nil { + var ret SpansListRequestType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansListRequestData) GetTypeOk() (*SpansListRequestType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SpansListRequestData) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given SpansListRequestType and assigns it to the Type field. +func (o *SpansListRequestData) SetType(v SpansListRequestType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SpansListRequestData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SpansListRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *SpansListRequestAttributes `json:"attributes,omitempty"` + Type *SpansListRequestType `json:"type,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_request_page.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_request_page.go new file mode 100644 index 000000000..5ef637b2f --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_request_page.go @@ -0,0 +1,143 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SpansListRequestPage Paging attributes for listing spans. +type SpansListRequestPage struct { + // List following results with a cursor provided in the previous query. + Cursor *string `json:"cursor,omitempty"` + // Maximum number of spans in the response. + Limit *int32 `json:"limit,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{} +} + +// NewSpansListRequestPage instantiates a new SpansListRequestPage 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 NewSpansListRequestPage() *SpansListRequestPage { + this := SpansListRequestPage{} + var limit int32 = 10 + this.Limit = &limit + return &this +} + +// NewSpansListRequestPageWithDefaults instantiates a new SpansListRequestPage 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 NewSpansListRequestPageWithDefaults() *SpansListRequestPage { + this := SpansListRequestPage{} + var limit int32 = 10 + this.Limit = &limit + return &this +} + +// GetCursor returns the Cursor field value if set, zero value otherwise. +func (o *SpansListRequestPage) GetCursor() string { + if o == nil || o.Cursor == nil { + var ret string + return ret + } + return *o.Cursor +} + +// GetCursorOk returns a tuple with the Cursor field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansListRequestPage) GetCursorOk() (*string, bool) { + if o == nil || o.Cursor == nil { + return nil, false + } + return o.Cursor, true +} + +// HasCursor returns a boolean if a field has been set. +func (o *SpansListRequestPage) HasCursor() bool { + return o != nil && o.Cursor != nil +} + +// SetCursor gets a reference to the given string and assigns it to the Cursor field. +func (o *SpansListRequestPage) SetCursor(v string) { + o.Cursor = &v +} + +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *SpansListRequestPage) GetLimit() int32 { + if o == nil || o.Limit == nil { + var ret int32 + return ret + } + return *o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansListRequestPage) GetLimitOk() (*int32, bool) { + if o == nil || o.Limit == nil { + return nil, false + } + return o.Limit, true +} + +// HasLimit returns a boolean if a field has been set. +func (o *SpansListRequestPage) HasLimit() bool { + return o != nil && o.Limit != nil +} + +// SetLimit gets a reference to the given int32 and assigns it to the Limit field. +func (o *SpansListRequestPage) SetLimit(v int32) { + o.Limit = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SpansListRequestPage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Cursor != nil { + toSerialize["cursor"] = o.Cursor + } + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SpansListRequestPage) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Cursor *string `json:"cursor,omitempty"` + Limit *int32 `json:"limit,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"cursor", "limit"}) + } else { + return err + } + o.Cursor = all.Cursor + o.Limit = all.Limit + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_request_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_request_type.go new file mode 100644 index 000000000..f1279a458 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_request_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/goccy/go-json" +) + +// SpansListRequestType The type of resource. The value should always be search_request. +type SpansListRequestType string + +// List of SpansListRequestType. +const ( + SPANSLISTREQUESTTYPE_SEARCH_REQUEST SpansListRequestType = "search_request" +) + +var allowedSpansListRequestTypeEnumValues = []SpansListRequestType{ + SPANSLISTREQUESTTYPE_SEARCH_REQUEST, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SpansListRequestType) GetAllowedValues() []SpansListRequestType { + return allowedSpansListRequestTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SpansListRequestType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SpansListRequestType(value) + return nil +} + +// NewSpansListRequestTypeFromValue returns a pointer to a valid SpansListRequestType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSpansListRequestTypeFromValue(v string) (*SpansListRequestType, error) { + ev := SpansListRequestType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SpansListRequestType: valid values are %v", v, allowedSpansListRequestTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SpansListRequestType) IsValid() bool { + for _, existing := range allowedSpansListRequestTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SpansListRequestType value. +func (v SpansListRequestType) Ptr() *SpansListRequestType { + return &v +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_response.go new file mode 100644 index 000000000..a4a5384a7 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_response.go @@ -0,0 +1,186 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SpansListResponse Response object with all spans matching the request and pagination information. +type SpansListResponse struct { + // Array of spans matching the request. + Data []Span `json:"data,omitempty"` + // Links attributes. + Links *SpansListResponseLinks `json:"links,omitempty"` + // The metadata associated with a request. + Meta *SpansListResponseMetadata `json:"meta,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{} +} + +// NewSpansListResponse instantiates a new SpansListResponse 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 NewSpansListResponse() *SpansListResponse { + this := SpansListResponse{} + return &this +} + +// NewSpansListResponseWithDefaults instantiates a new SpansListResponse 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 NewSpansListResponseWithDefaults() *SpansListResponse { + this := SpansListResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *SpansListResponse) GetData() []Span { + if o == nil || o.Data == nil { + var ret []Span + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansListResponse) GetDataOk() (*[]Span, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *SpansListResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given []Span and assigns it to the Data field. +func (o *SpansListResponse) SetData(v []Span) { + o.Data = v +} + +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *SpansListResponse) GetLinks() SpansListResponseLinks { + if o == nil || o.Links == nil { + var ret SpansListResponseLinks + return ret + } + return *o.Links +} + +// GetLinksOk returns a tuple with the Links field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansListResponse) GetLinksOk() (*SpansListResponseLinks, bool) { + if o == nil || o.Links == nil { + return nil, false + } + return o.Links, true +} + +// HasLinks returns a boolean if a field has been set. +func (o *SpansListResponse) HasLinks() bool { + return o != nil && o.Links != nil +} + +// SetLinks gets a reference to the given SpansListResponseLinks and assigns it to the Links field. +func (o *SpansListResponse) SetLinks(v SpansListResponseLinks) { + o.Links = &v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *SpansListResponse) GetMeta() SpansListResponseMetadata { + if o == nil || o.Meta == nil { + var ret SpansListResponseMetadata + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansListResponse) GetMetaOk() (*SpansListResponseMetadata, bool) { + if o == nil || o.Meta == nil { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *SpansListResponse) HasMeta() bool { + return o != nil && o.Meta != nil +} + +// SetMeta gets a reference to the given SpansListResponseMetadata and assigns it to the Meta field. +func (o *SpansListResponse) SetMeta(v SpansListResponseMetadata) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SpansListResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Links != nil { + toSerialize["links"] = o.Links + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SpansListResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data []Span `json:"data,omitempty"` + Links *SpansListResponseLinks `json:"links,omitempty"` + Meta *SpansListResponseMetadata `json:"meta,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "links", "meta"}) + } else { + return err + } + + hasInvalidField := false + o.Data = all.Data + if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Links = all.Links + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Meta = all.Meta + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_response_links.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_response_links.go new file mode 100644 index 000000000..04b0933cb --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_response_links.go @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SpansListResponseLinks Links attributes. +type SpansListResponseLinks struct { + // Link for the next set of results. Note that the request can also be made using the + // POST endpoint. + Next *string `json:"next,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{} +} + +// NewSpansListResponseLinks instantiates a new SpansListResponseLinks 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 NewSpansListResponseLinks() *SpansListResponseLinks { + this := SpansListResponseLinks{} + return &this +} + +// NewSpansListResponseLinksWithDefaults instantiates a new SpansListResponseLinks 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 NewSpansListResponseLinksWithDefaults() *SpansListResponseLinks { + this := SpansListResponseLinks{} + return &this +} + +// GetNext returns the Next field value if set, zero value otherwise. +func (o *SpansListResponseLinks) GetNext() string { + if o == nil || o.Next == nil { + var ret string + return ret + } + return *o.Next +} + +// GetNextOk returns a tuple with the Next field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansListResponseLinks) GetNextOk() (*string, bool) { + if o == nil || o.Next == nil { + return nil, false + } + return o.Next, true +} + +// HasNext returns a boolean if a field has been set. +func (o *SpansListResponseLinks) HasNext() bool { + return o != nil && o.Next != nil +} + +// SetNext gets a reference to the given string and assigns it to the Next field. +func (o *SpansListResponseLinks) SetNext(v string) { + o.Next = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SpansListResponseLinks) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Next != nil { + toSerialize["next"] = o.Next + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SpansListResponseLinks) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Next *string `json:"next,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"next"}) + } else { + return err + } + o.Next = all.Next + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_response_metadata.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_response_metadata.go new file mode 100644 index 000000000..aab8211d3 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_list_response_metadata.go @@ -0,0 +1,258 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SpansListResponseMetadata The metadata associated with a request. +type SpansListResponseMetadata struct { + // The time elapsed in milliseconds. + Elapsed *int64 `json:"elapsed,omitempty"` + // Paging attributes. + Page *SpansResponseMetadataPage `json:"page,omitempty"` + // The identifier of the request. + RequestId *string `json:"request_id,omitempty"` + // The status of the response. + Status *SpansAggregateResponseStatus `json:"status,omitempty"` + // A list of warnings (non fatal errors) encountered, partial results might be returned if + // warnings are present in the response. + Warnings []SpansWarning `json:"warnings,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{} +} + +// NewSpansListResponseMetadata instantiates a new SpansListResponseMetadata 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 NewSpansListResponseMetadata() *SpansListResponseMetadata { + this := SpansListResponseMetadata{} + return &this +} + +// NewSpansListResponseMetadataWithDefaults instantiates a new SpansListResponseMetadata 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 NewSpansListResponseMetadataWithDefaults() *SpansListResponseMetadata { + this := SpansListResponseMetadata{} + return &this +} + +// GetElapsed returns the Elapsed field value if set, zero value otherwise. +func (o *SpansListResponseMetadata) GetElapsed() int64 { + if o == nil || o.Elapsed == nil { + var ret int64 + return ret + } + return *o.Elapsed +} + +// GetElapsedOk returns a tuple with the Elapsed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansListResponseMetadata) GetElapsedOk() (*int64, bool) { + if o == nil || o.Elapsed == nil { + return nil, false + } + return o.Elapsed, true +} + +// HasElapsed returns a boolean if a field has been set. +func (o *SpansListResponseMetadata) HasElapsed() bool { + return o != nil && o.Elapsed != nil +} + +// SetElapsed gets a reference to the given int64 and assigns it to the Elapsed field. +func (o *SpansListResponseMetadata) SetElapsed(v int64) { + o.Elapsed = &v +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *SpansListResponseMetadata) GetPage() SpansResponseMetadataPage { + if o == nil || o.Page == nil { + var ret SpansResponseMetadataPage + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansListResponseMetadata) GetPageOk() (*SpansResponseMetadataPage, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *SpansListResponseMetadata) HasPage() bool { + return o != nil && o.Page != nil +} + +// SetPage gets a reference to the given SpansResponseMetadataPage and assigns it to the Page field. +func (o *SpansListResponseMetadata) SetPage(v SpansResponseMetadataPage) { + o.Page = &v +} + +// GetRequestId returns the RequestId field value if set, zero value otherwise. +func (o *SpansListResponseMetadata) GetRequestId() string { + if o == nil || o.RequestId == nil { + var ret string + return ret + } + return *o.RequestId +} + +// GetRequestIdOk returns a tuple with the RequestId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansListResponseMetadata) GetRequestIdOk() (*string, bool) { + if o == nil || o.RequestId == nil { + return nil, false + } + return o.RequestId, true +} + +// HasRequestId returns a boolean if a field has been set. +func (o *SpansListResponseMetadata) HasRequestId() bool { + return o != nil && o.RequestId != nil +} + +// SetRequestId gets a reference to the given string and assigns it to the RequestId field. +func (o *SpansListResponseMetadata) SetRequestId(v string) { + o.RequestId = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *SpansListResponseMetadata) GetStatus() SpansAggregateResponseStatus { + if o == nil || o.Status == nil { + var ret SpansAggregateResponseStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansListResponseMetadata) GetStatusOk() (*SpansAggregateResponseStatus, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *SpansListResponseMetadata) HasStatus() bool { + return o != nil && o.Status != nil +} + +// SetStatus gets a reference to the given SpansAggregateResponseStatus and assigns it to the Status field. +func (o *SpansListResponseMetadata) SetStatus(v SpansAggregateResponseStatus) { + o.Status = &v +} + +// GetWarnings returns the Warnings field value if set, zero value otherwise. +func (o *SpansListResponseMetadata) GetWarnings() []SpansWarning { + if o == nil || o.Warnings == nil { + var ret []SpansWarning + return ret + } + return o.Warnings +} + +// GetWarningsOk returns a tuple with the Warnings field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansListResponseMetadata) GetWarningsOk() (*[]SpansWarning, bool) { + if o == nil || o.Warnings == nil { + return nil, false + } + return &o.Warnings, true +} + +// HasWarnings returns a boolean if a field has been set. +func (o *SpansListResponseMetadata) HasWarnings() bool { + return o != nil && o.Warnings != nil +} + +// SetWarnings gets a reference to the given []SpansWarning and assigns it to the Warnings field. +func (o *SpansListResponseMetadata) SetWarnings(v []SpansWarning) { + o.Warnings = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SpansListResponseMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Elapsed != nil { + toSerialize["elapsed"] = o.Elapsed + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + if o.RequestId != nil { + toSerialize["request_id"] = o.RequestId + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Warnings != nil { + toSerialize["warnings"] = o.Warnings + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SpansListResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Elapsed *int64 `json:"elapsed,omitempty"` + Page *SpansResponseMetadataPage `json:"page,omitempty"` + RequestId *string `json:"request_id,omitempty"` + Status *SpansAggregateResponseStatus `json:"status,omitempty"` + Warnings []SpansWarning `json:"warnings,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"elapsed", "page", "request_id", "status", "warnings"}) + } else { + return err + } + + hasInvalidField := false + o.Elapsed = all.Elapsed + if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Page = all.Page + o.RequestId = all.RequestId + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } + o.Warnings = all.Warnings + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_compute.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_compute.go index 1569b346f..60f1263f5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_compute.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_compute.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -144,19 +145,13 @@ func (o SpansMetricCompute) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SpansMetricCompute) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AggregationType *SpansMetricComputeAggregationType `json:"aggregation_type"` IncludePercentiles *bool `json:"include_percentiles,omitempty"` Path *string `json:"path,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.AggregationType == nil { return fmt.Errorf("required field aggregation_type missing") @@ -167,20 +162,23 @@ func (o *SpansMetricCompute) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.AggregationType; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if !all.AggregationType.IsValid() { + hasInvalidField = true + } else { + o.AggregationType = *all.AggregationType } - o.AggregationType = *all.AggregationType o.IncludePercentiles = all.IncludePercentiles o.Path = all.Path + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_compute_aggregation_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_compute_aggregation_type.go index 17cd02ce3..0779d298f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_compute_aggregation_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_compute_aggregation_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SpansMetricComputeAggregationType The type of aggregation to use. @@ -63,47 +64,3 @@ func (v SpansMetricComputeAggregationType) IsValid() bool { func (v SpansMetricComputeAggregationType) Ptr() *SpansMetricComputeAggregationType { return &v } - -// NullableSpansMetricComputeAggregationType handles when a null is used for SpansMetricComputeAggregationType. -type NullableSpansMetricComputeAggregationType struct { - value *SpansMetricComputeAggregationType - isSet bool -} - -// Get returns the associated value. -func (v NullableSpansMetricComputeAggregationType) Get() *SpansMetricComputeAggregationType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSpansMetricComputeAggregationType) Set(val *SpansMetricComputeAggregationType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSpansMetricComputeAggregationType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSpansMetricComputeAggregationType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSpansMetricComputeAggregationType initializes the struct as if Set has been called. -func NewNullableSpansMetricComputeAggregationType(val *SpansMetricComputeAggregationType) *NullableSpansMetricComputeAggregationType { - return &NullableSpansMetricComputeAggregationType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSpansMetricComputeAggregationType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSpansMetricComputeAggregationType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_create_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_create_attributes.go index ff8429417..684b9b149 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_create_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_create_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -143,19 +144,13 @@ func (o SpansMetricCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SpansMetricCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Compute *SpansMetricCompute `json:"compute"` Filter *SpansMetricFilter `json:"filter,omitempty"` GroupBy []SpansMetricGroupBy `json:"group_by,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Compute == nil { return fmt.Errorf("required field compute missing") @@ -166,26 +161,25 @@ func (o *SpansMetricCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Compute.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Compute = *all.Compute if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Filter = all.Filter o.GroupBy = all.GroupBy + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_create_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_create_data.go index 9076257e6..d1701616b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_create_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_create_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -133,19 +134,13 @@ func (o SpansMetricCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SpansMetricCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SpansMetricCreateAttributes `json:"attributes"` Id *string `json:"id"` Type *SpansMetricType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -162,27 +157,26 @@ func (o *SpansMetricCreateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_create_request.go index 29c839305..e5a3461e4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o SpansMetricCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SpansMetricCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SpansMetricCreateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *SpansMetricCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_filter.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_filter.go index e3a6cf38f..936173204 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_filter.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_filter.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -86,17 +86,11 @@ func (o SpansMetricFilter) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SpansMetricFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Query *string `json:"query,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -105,6 +99,7 @@ func (o *SpansMetricFilter) UnmarshalJSON(bytes []byte) (err error) { return err } o.Query = all.Query + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_group_by.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_group_by.go index 033241a35..f63f4dd16 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_group_by.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_group_by.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -110,18 +111,12 @@ func (o SpansMetricGroupBy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SpansMetricGroupBy) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Path *string `json:"path"` TagName *string `json:"tag_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 + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Path == nil { return fmt.Errorf("required field path missing") @@ -134,6 +129,7 @@ func (o *SpansMetricGroupBy) UnmarshalJSON(bytes []byte) (err error) { } o.Path = *all.Path o.TagName = all.TagName + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_response.go index ef6285204..2893a45db 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SpansMetricResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SpansMetricResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SpansMetricResponseData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *SpansMetricResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_response_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_response_attributes.go index bf34f1ce0..aa2167672 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_response_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_response_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o SpansMetricResponseAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SpansMetricResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Compute *SpansMetricResponseCompute `json:"compute,omitempty"` Filter *SpansMetricResponseFilter `json:"filter,omitempty"` GroupBy []SpansMetricResponseGroupBy `json:"group_by,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,26 +162,25 @@ func (o *SpansMetricResponseAttributes) UnmarshalJSON(bytes []byte) (err error) } else { return err } + + hasInvalidField := false if all.Compute != nil && all.Compute.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Compute = all.Compute if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Filter = all.Filter o.GroupBy = all.GroupBy + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_response_compute.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_response_compute.go index d81810db3..de94dc27b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_response_compute.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_response_compute.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -149,19 +149,13 @@ func (o SpansMetricResponseCompute) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SpansMetricResponseCompute) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { AggregationType *SpansMetricComputeAggregationType `json:"aggregation_type,omitempty"` IncludePercentiles *bool `json:"include_percentiles,omitempty"` Path *string `json:"path,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -169,20 +163,23 @@ func (o *SpansMetricResponseCompute) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.AggregationType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.AggregationType != nil && !all.AggregationType.IsValid() { + hasInvalidField = true + } else { + o.AggregationType = all.AggregationType } - o.AggregationType = all.AggregationType o.IncludePercentiles = all.IncludePercentiles o.Path = all.Path + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_response_data.go index 5f007f673..dda3a8665 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_response_data.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o SpansMetricResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SpansMetricResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SpansMetricResponseAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *SpansMetricType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *SpansMetricResponseData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_response_filter.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_response_filter.go index ee68b2e6b..b7a6fa37a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_response_filter.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_response_filter.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SpansMetricResponseFilter) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SpansMetricResponseFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Query *string `json:"query,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *SpansMetricResponseFilter) UnmarshalJSON(bytes []byte) (err error) { return err } o.Query = all.Query + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_response_group_by.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_response_group_by.go index 048279844..5c728c665 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_response_group_by.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_response_group_by.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o SpansMetricResponseGroupBy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SpansMetricResponseGroupBy) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Path *string `json:"path,omitempty"` TagName *string `json:"tag_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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -136,6 +130,7 @@ func (o *SpansMetricResponseGroupBy) UnmarshalJSON(bytes []byte) (err error) { } o.Path = all.Path o.TagName = all.TagName + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_type.go index 9e9380dbb..26110c27d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // SpansMetricType The type of resource. The value should always be spans_metrics. @@ -61,47 +62,3 @@ func (v SpansMetricType) IsValid() bool { func (v SpansMetricType) Ptr() *SpansMetricType { return &v } - -// NullableSpansMetricType handles when a null is used for SpansMetricType. -type NullableSpansMetricType struct { - value *SpansMetricType - isSet bool -} - -// Get returns the associated value. -func (v NullableSpansMetricType) Get() *SpansMetricType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSpansMetricType) Set(val *SpansMetricType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSpansMetricType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSpansMetricType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSpansMetricType initializes the struct as if Set has been called. -func NewNullableSpansMetricType(val *SpansMetricType) *NullableSpansMetricType { - return &NullableSpansMetricType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSpansMetricType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSpansMetricType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_update_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_update_attributes.go index bc12502d5..da1dbf803 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_update_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_update_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o SpansMetricUpdateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SpansMetricUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Compute *SpansMetricUpdateCompute `json:"compute,omitempty"` Filter *SpansMetricFilter `json:"filter,omitempty"` GroupBy []SpansMetricGroupBy `json:"group_by,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,26 +162,25 @@ func (o *SpansMetricUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Compute != nil && all.Compute.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Compute = all.Compute if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Filter = all.Filter o.GroupBy = all.GroupBy + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_update_compute.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_update_compute.go index a6b67e691..b90524d8f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_update_compute.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_update_compute.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -83,17 +83,11 @@ func (o SpansMetricUpdateCompute) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SpansMetricUpdateCompute) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { IncludePercentiles *bool `json:"include_percentiles,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -102,6 +96,7 @@ func (o *SpansMetricUpdateCompute) UnmarshalJSON(bytes []byte) (err error) { return err } o.IncludePercentiles = all.IncludePercentiles + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_update_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_update_data.go index ab69232d7..35855146b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_update_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_update_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o SpansMetricUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SpansMetricUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *SpansMetricUpdateAttributes `json:"attributes"` Type *SpansMetricType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -131,26 +126,25 @@ func (o *SpansMetricUpdateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_update_request.go index 81942979e..a3ffb2861 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metric_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o SpansMetricUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SpansMetricUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *SpansMetricUpdateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *SpansMetricUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metrics_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metrics_response.go index 7175d1208..9e5c1ba07 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metrics_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_metrics_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o SpansMetricsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SpansMetricsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []SpansMetricResponseData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *SpansMetricsResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_query_filter.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_query_filter.go new file mode 100644 index 000000000..5aced09c9 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_query_filter.go @@ -0,0 +1,186 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SpansQueryFilter The search and filter query settings. +type SpansQueryFilter struct { + // The minimum time for the requested spans, supports date-time ISO8601, date math, and regular timestamps (milliseconds). + From *string `json:"from,omitempty"` + // The search query - following the span search syntax. + Query *string `json:"query,omitempty"` + // The maximum time for the requested spans, supports date-time ISO8601, date math, and regular timestamps (milliseconds). + To *string `json:"to,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{} +} + +// NewSpansQueryFilter instantiates a new SpansQueryFilter 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 NewSpansQueryFilter() *SpansQueryFilter { + this := SpansQueryFilter{} + var from string = "now-15m" + this.From = &from + var query string = "*" + this.Query = &query + var to string = "now" + this.To = &to + return &this +} + +// NewSpansQueryFilterWithDefaults instantiates a new SpansQueryFilter 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 NewSpansQueryFilterWithDefaults() *SpansQueryFilter { + this := SpansQueryFilter{} + var from string = "now-15m" + this.From = &from + var query string = "*" + this.Query = &query + var to string = "now" + this.To = &to + return &this +} + +// GetFrom returns the From field value if set, zero value otherwise. +func (o *SpansQueryFilter) GetFrom() string { + if o == nil || o.From == nil { + var ret string + return ret + } + return *o.From +} + +// GetFromOk returns a tuple with the From field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansQueryFilter) GetFromOk() (*string, bool) { + if o == nil || o.From == nil { + return nil, false + } + return o.From, true +} + +// HasFrom returns a boolean if a field has been set. +func (o *SpansQueryFilter) HasFrom() bool { + return o != nil && o.From != nil +} + +// SetFrom gets a reference to the given string and assigns it to the From field. +func (o *SpansQueryFilter) SetFrom(v string) { + o.From = &v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *SpansQueryFilter) GetQuery() string { + if o == nil || o.Query == nil { + var ret string + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansQueryFilter) GetQueryOk() (*string, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *SpansQueryFilter) HasQuery() bool { + return o != nil && o.Query != nil +} + +// SetQuery gets a reference to the given string and assigns it to the Query field. +func (o *SpansQueryFilter) SetQuery(v string) { + o.Query = &v +} + +// GetTo returns the To field value if set, zero value otherwise. +func (o *SpansQueryFilter) GetTo() string { + if o == nil || o.To == nil { + var ret string + return ret + } + return *o.To +} + +// GetToOk returns a tuple with the To field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansQueryFilter) GetToOk() (*string, bool) { + if o == nil || o.To == nil { + return nil, false + } + return o.To, true +} + +// HasTo returns a boolean if a field has been set. +func (o *SpansQueryFilter) HasTo() bool { + return o != nil && o.To != nil +} + +// SetTo gets a reference to the given string and assigns it to the To field. +func (o *SpansQueryFilter) SetTo(v string) { + o.To = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SpansQueryFilter) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.From != nil { + toSerialize["from"] = o.From + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + if o.To != nil { + toSerialize["to"] = o.To + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SpansQueryFilter) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + From *string `json:"from,omitempty"` + Query *string `json:"query,omitempty"` + To *string `json:"to,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"from", "query", "to"}) + } else { + return err + } + o.From = all.From + o.Query = all.Query + o.To = all.To + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_query_options.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_query_options.go new file mode 100644 index 000000000..8997eac8e --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_query_options.go @@ -0,0 +1,144 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SpansQueryOptions Global query options that are used during the query. +// Note: You should only supply timezone or time offset but not both otherwise the query will fail. +type SpansQueryOptions struct { + // The time offset (in seconds) to apply to the query. + TimeOffset *int64 `json:"timeOffset,omitempty"` + // The timezone can be specified as GMT, UTC, an offset from UTC (like UTC+1), or as a Timezone Database identifier (like America/New_York). + Timezone *string `json:"timezone,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{} +} + +// NewSpansQueryOptions instantiates a new SpansQueryOptions 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 NewSpansQueryOptions() *SpansQueryOptions { + this := SpansQueryOptions{} + var timezone string = "UTC" + this.Timezone = &timezone + return &this +} + +// NewSpansQueryOptionsWithDefaults instantiates a new SpansQueryOptions 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 NewSpansQueryOptionsWithDefaults() *SpansQueryOptions { + this := SpansQueryOptions{} + var timezone string = "UTC" + this.Timezone = &timezone + return &this +} + +// GetTimeOffset returns the TimeOffset field value if set, zero value otherwise. +func (o *SpansQueryOptions) GetTimeOffset() int64 { + if o == nil || o.TimeOffset == nil { + var ret int64 + return ret + } + return *o.TimeOffset +} + +// GetTimeOffsetOk returns a tuple with the TimeOffset field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansQueryOptions) GetTimeOffsetOk() (*int64, bool) { + if o == nil || o.TimeOffset == nil { + return nil, false + } + return o.TimeOffset, true +} + +// HasTimeOffset returns a boolean if a field has been set. +func (o *SpansQueryOptions) HasTimeOffset() bool { + return o != nil && o.TimeOffset != nil +} + +// SetTimeOffset gets a reference to the given int64 and assigns it to the TimeOffset field. +func (o *SpansQueryOptions) SetTimeOffset(v int64) { + o.TimeOffset = &v +} + +// GetTimezone returns the Timezone field value if set, zero value otherwise. +func (o *SpansQueryOptions) GetTimezone() string { + if o == nil || o.Timezone == nil { + var ret string + return ret + } + return *o.Timezone +} + +// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansQueryOptions) GetTimezoneOk() (*string, bool) { + if o == nil || o.Timezone == nil { + return nil, false + } + return o.Timezone, true +} + +// HasTimezone returns a boolean if a field has been set. +func (o *SpansQueryOptions) HasTimezone() bool { + return o != nil && o.Timezone != nil +} + +// SetTimezone gets a reference to the given string and assigns it to the Timezone field. +func (o *SpansQueryOptions) SetTimezone(v string) { + o.Timezone = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SpansQueryOptions) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.TimeOffset != nil { + toSerialize["timeOffset"] = o.TimeOffset + } + if o.Timezone != nil { + toSerialize["timezone"] = o.Timezone + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SpansQueryOptions) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + TimeOffset *int64 `json:"timeOffset,omitempty"` + Timezone *string `json:"timezone,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"timeOffset", "timezone"}) + } else { + return err + } + o.TimeOffset = all.TimeOffset + o.Timezone = all.Timezone + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_response_metadata_page.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_response_metadata_page.go new file mode 100644 index 000000000..6135c5b2b --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_response_metadata_page.go @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SpansResponseMetadataPage Paging attributes. +type SpansResponseMetadataPage struct { + // The cursor to use to get the next results, if any. To make the next request, use the same + // parameters with the addition of the `page[cursor]`. + After *string `json:"after,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{} +} + +// NewSpansResponseMetadataPage instantiates a new SpansResponseMetadataPage 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 NewSpansResponseMetadataPage() *SpansResponseMetadataPage { + this := SpansResponseMetadataPage{} + return &this +} + +// NewSpansResponseMetadataPageWithDefaults instantiates a new SpansResponseMetadataPage 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 NewSpansResponseMetadataPageWithDefaults() *SpansResponseMetadataPage { + this := SpansResponseMetadataPage{} + return &this +} + +// GetAfter returns the After field value if set, zero value otherwise. +func (o *SpansResponseMetadataPage) GetAfter() string { + if o == nil || o.After == nil { + var ret string + return ret + } + return *o.After +} + +// GetAfterOk returns a tuple with the After field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansResponseMetadataPage) GetAfterOk() (*string, bool) { + if o == nil || o.After == nil { + return nil, false + } + return o.After, true +} + +// HasAfter returns a boolean if a field has been set. +func (o *SpansResponseMetadataPage) HasAfter() bool { + return o != nil && o.After != nil +} + +// SetAfter gets a reference to the given string and assigns it to the After field. +func (o *SpansResponseMetadataPage) SetAfter(v string) { + o.After = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SpansResponseMetadataPage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.After != nil { + toSerialize["after"] = o.After + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SpansResponseMetadataPage) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + After *string `json:"after,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"after"}) + } else { + return err + } + o.After = all.After + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_sort.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_sort.go new file mode 100644 index 000000000..87598cf28 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_sort.go @@ -0,0 +1,66 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "fmt" + + "github.com/goccy/go-json" +) + +// SpansSort Sort parameters when querying spans. +type SpansSort string + +// List of SpansSort. +const ( + SPANSSORT_TIMESTAMP_ASCENDING SpansSort = "timestamp" + SPANSSORT_TIMESTAMP_DESCENDING SpansSort = "-timestamp" +) + +var allowedSpansSortEnumValues = []SpansSort{ + SPANSSORT_TIMESTAMP_ASCENDING, + SPANSSORT_TIMESTAMP_DESCENDING, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SpansSort) GetAllowedValues() []SpansSort { + return allowedSpansSortEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SpansSort) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SpansSort(value) + return nil +} + +// NewSpansSortFromValue returns a pointer to a valid SpansSort +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSpansSortFromValue(v string) (*SpansSort, error) { + ev := SpansSort(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SpansSort: valid values are %v", v, allowedSpansSortEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SpansSort) IsValid() bool { + for _, existing := range allowedSpansSortEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SpansSort value. +func (v SpansSort) Ptr() *SpansSort { + return &v +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_sort_order.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_sort_order.go new file mode 100644 index 000000000..abe47b08d --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_sort_order.go @@ -0,0 +1,66 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "fmt" + + "github.com/goccy/go-json" +) + +// SpansSortOrder The order to use, ascending or descending. +type SpansSortOrder string + +// List of SpansSortOrder. +const ( + SPANSSORTORDER_ASCENDING SpansSortOrder = "asc" + SPANSSORTORDER_DESCENDING SpansSortOrder = "desc" +) + +var allowedSpansSortOrderEnumValues = []SpansSortOrder{ + SPANSSORTORDER_ASCENDING, + SPANSSORTORDER_DESCENDING, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SpansSortOrder) GetAllowedValues() []SpansSortOrder { + return allowedSpansSortOrderEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SpansSortOrder) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SpansSortOrder(value) + return nil +} + +// NewSpansSortOrderFromValue returns a pointer to a valid SpansSortOrder +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSpansSortOrderFromValue(v string) (*SpansSortOrder, error) { + ev := SpansSortOrder(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SpansSortOrder: valid values are %v", v, allowedSpansSortOrderEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SpansSortOrder) IsValid() bool { + for _, existing := range allowedSpansSortOrderEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SpansSortOrder value. +func (v SpansSortOrder) Ptr() *SpansSortOrder { + return &v +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_type.go new file mode 100644 index 000000000..0ba9811ba --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/goccy/go-json" +) + +// SpansType Type of the span. +type SpansType string + +// List of SpansType. +const ( + SPANSTYPE_SPANS SpansType = "spans" +) + +var allowedSpansTypeEnumValues = []SpansType{ + SPANSTYPE_SPANS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SpansType) GetAllowedValues() []SpansType { + return allowedSpansTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SpansType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SpansType(value) + return nil +} + +// NewSpansTypeFromValue returns a pointer to a valid SpansType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSpansTypeFromValue(v string) (*SpansType, error) { + ev := SpansType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SpansType: valid values are %v", v, allowedSpansTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SpansType) IsValid() bool { + for _, existing := range allowedSpansTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SpansType value. +func (v SpansType) Ptr() *SpansType { + return &v +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_warning.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_warning.go new file mode 100644 index 000000000..e785d019f --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_spans_warning.go @@ -0,0 +1,174 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SpansWarning A warning message indicating something that went wrong with the query. +type SpansWarning struct { + // A unique code for this type of warning. + Code *string `json:"code,omitempty"` + // A detailed explanation of this specific warning. + Detail *string `json:"detail,omitempty"` + // A short human-readable summary of the warning. + Title *string `json:"title,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{} +} + +// NewSpansWarning instantiates a new SpansWarning 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 NewSpansWarning() *SpansWarning { + this := SpansWarning{} + return &this +} + +// NewSpansWarningWithDefaults instantiates a new SpansWarning 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 NewSpansWarningWithDefaults() *SpansWarning { + this := SpansWarning{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *SpansWarning) GetCode() string { + if o == nil || o.Code == nil { + var ret string + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansWarning) GetCodeOk() (*string, bool) { + if o == nil || o.Code == nil { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *SpansWarning) HasCode() bool { + return o != nil && o.Code != nil +} + +// SetCode gets a reference to the given string and assigns it to the Code field. +func (o *SpansWarning) SetCode(v string) { + o.Code = &v +} + +// GetDetail returns the Detail field value if set, zero value otherwise. +func (o *SpansWarning) GetDetail() string { + if o == nil || o.Detail == nil { + var ret string + return ret + } + return *o.Detail +} + +// GetDetailOk returns a tuple with the Detail field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansWarning) GetDetailOk() (*string, bool) { + if o == nil || o.Detail == nil { + return nil, false + } + return o.Detail, true +} + +// HasDetail returns a boolean if a field has been set. +func (o *SpansWarning) HasDetail() bool { + return o != nil && o.Detail != nil +} + +// SetDetail gets a reference to the given string and assigns it to the Detail field. +func (o *SpansWarning) SetDetail(v string) { + o.Detail = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *SpansWarning) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpansWarning) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *SpansWarning) HasTitle() bool { + return o != nil && o.Title != nil +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *SpansWarning) SetTitle(v string) { + o.Title = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SpansWarning) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Code != nil { + toSerialize["code"] = o.Code + } + if o.Detail != nil { + toSerialize["detail"] = o.Detail + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SpansWarning) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Code *string `json:"code,omitempty"` + Detail *string `json:"detail,omitempty"` + Title *string `json:"title,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"code", "detail", "title"}) + } else { + return err + } + o.Code = all.Code + o.Detail = all.Detail + o.Title = all.Title + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team.go index 31306031d..2cd4922da 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -166,7 +167,6 @@ func (o Team) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Team) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *TeamAttributes `json:"attributes"` Id *string `json:"id"` @@ -174,12 +174,7 @@ func (o *Team) UnmarshalJSON(bytes []byte) (err error) { Type *TeamType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -196,35 +191,30 @@ func (o *Team) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_attributes.go index da0f3dced..223551fca 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_attributes.go @@ -5,21 +5,28 @@ package datadogV2 import ( - "encoding/json" "fmt" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // TeamAttributes Team attributes type TeamAttributes struct { + // Unicode representation of the avatar for the team, limited to a single grapheme + Avatar datadog.NullableString `json:"avatar,omitempty"` + // Banner selection for the team + Banner datadog.NullableInt64 `json:"banner,omitempty"` // Creation date of the team CreatedAt *time.Time `json:"created_at,omitempty"` // Free-form markdown description/content for the team's homepage Description datadog.NullableString `json:"description,omitempty"` // The team's identifier Handle string `json:"handle"` + // Collection of hidden modules for the team + HiddenModules []string `json:"hidden_modules,omitempty"` // The number of links belonging to the team LinkCount *int32 `json:"link_count,omitempty"` // Modification date of the team @@ -30,6 +37,8 @@ type TeamAttributes struct { Summary datadog.NullableString `json:"summary,omitempty"` // The number of users belonging to the team UserCount *int32 `json:"user_count,omitempty"` + // Collection of visible modules for the team + VisibleModules []string `json:"visible_modules,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{} @@ -54,6 +63,84 @@ func NewTeamAttributesWithDefaults() *TeamAttributes { return &this } +// GetAvatar returns the Avatar field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TeamAttributes) GetAvatar() string { + if o == nil || o.Avatar.Get() == nil { + var ret string + return ret + } + return *o.Avatar.Get() +} + +// GetAvatarOk returns a tuple with the Avatar field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *TeamAttributes) GetAvatarOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Avatar.Get(), o.Avatar.IsSet() +} + +// HasAvatar returns a boolean if a field has been set. +func (o *TeamAttributes) HasAvatar() bool { + return o != nil && o.Avatar.IsSet() +} + +// SetAvatar gets a reference to the given datadog.NullableString and assigns it to the Avatar field. +func (o *TeamAttributes) SetAvatar(v string) { + o.Avatar.Set(&v) +} + +// SetAvatarNil sets the value for Avatar to be an explicit nil. +func (o *TeamAttributes) SetAvatarNil() { + o.Avatar.Set(nil) +} + +// UnsetAvatar ensures that no value is present for Avatar, not even an explicit nil. +func (o *TeamAttributes) UnsetAvatar() { + o.Avatar.Unset() +} + +// GetBanner returns the Banner field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TeamAttributes) GetBanner() int64 { + if o == nil || o.Banner.Get() == nil { + var ret int64 + return ret + } + return *o.Banner.Get() +} + +// GetBannerOk returns a tuple with the Banner field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *TeamAttributes) GetBannerOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.Banner.Get(), o.Banner.IsSet() +} + +// HasBanner returns a boolean if a field has been set. +func (o *TeamAttributes) HasBanner() bool { + return o != nil && o.Banner.IsSet() +} + +// SetBanner gets a reference to the given datadog.NullableInt64 and assigns it to the Banner field. +func (o *TeamAttributes) SetBanner(v int64) { + o.Banner.Set(&v) +} + +// SetBannerNil sets the value for Banner to be an explicit nil. +func (o *TeamAttributes) SetBannerNil() { + o.Banner.Set(nil) +} + +// UnsetBanner ensures that no value is present for Banner, not even an explicit nil. +func (o *TeamAttributes) UnsetBanner() { + o.Banner.Unset() +} + // GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. func (o *TeamAttributes) GetCreatedAt() time.Time { if o == nil || o.CreatedAt == nil { @@ -144,6 +231,34 @@ func (o *TeamAttributes) SetHandle(v string) { o.Handle = v } +// GetHiddenModules returns the HiddenModules field value if set, zero value otherwise. +func (o *TeamAttributes) GetHiddenModules() []string { + if o == nil || o.HiddenModules == nil { + var ret []string + return ret + } + return o.HiddenModules +} + +// GetHiddenModulesOk returns a tuple with the HiddenModules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamAttributes) GetHiddenModulesOk() (*[]string, bool) { + if o == nil || o.HiddenModules == nil { + return nil, false + } + return &o.HiddenModules, true +} + +// HasHiddenModules returns a boolean if a field has been set. +func (o *TeamAttributes) HasHiddenModules() bool { + return o != nil && o.HiddenModules != nil +} + +// SetHiddenModules gets a reference to the given []string and assigns it to the HiddenModules field. +func (o *TeamAttributes) SetHiddenModules(v []string) { + o.HiddenModules = v +} + // GetLinkCount returns the LinkCount field value if set, zero value otherwise. func (o *TeamAttributes) GetLinkCount() int32 { if o == nil || o.LinkCount == nil { @@ -290,12 +405,46 @@ func (o *TeamAttributes) SetUserCount(v int32) { o.UserCount = &v } +// GetVisibleModules returns the VisibleModules field value if set, zero value otherwise. +func (o *TeamAttributes) GetVisibleModules() []string { + if o == nil || o.VisibleModules == nil { + var ret []string + return ret + } + return o.VisibleModules +} + +// GetVisibleModulesOk returns a tuple with the VisibleModules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamAttributes) GetVisibleModulesOk() (*[]string, bool) { + if o == nil || o.VisibleModules == nil { + return nil, false + } + return &o.VisibleModules, true +} + +// HasVisibleModules returns a boolean if a field has been set. +func (o *TeamAttributes) HasVisibleModules() bool { + return o != nil && o.VisibleModules != nil +} + +// SetVisibleModules gets a reference to the given []string and assigns it to the VisibleModules field. +func (o *TeamAttributes) SetVisibleModules(v []string) { + o.VisibleModules = v +} + // MarshalJSON serializes the struct using spec logic. func (o TeamAttributes) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.UnparsedObject != nil { return json.Marshal(o.UnparsedObject) } + if o.Avatar.IsSet() { + toSerialize["avatar"] = o.Avatar.Get() + } + if o.Banner.IsSet() { + toSerialize["banner"] = o.Banner.Get() + } if o.CreatedAt != nil { if o.CreatedAt.Nanosecond() == 0 { toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") @@ -307,6 +456,9 @@ func (o TeamAttributes) MarshalJSON() ([]byte, error) { toSerialize["description"] = o.Description.Get() } toSerialize["handle"] = o.Handle + if o.HiddenModules != nil { + toSerialize["hidden_modules"] = o.HiddenModules + } if o.LinkCount != nil { toSerialize["link_count"] = o.LinkCount } @@ -324,6 +476,9 @@ func (o TeamAttributes) MarshalJSON() ([]byte, error) { if o.UserCount != nil { toSerialize["user_count"] = o.UserCount } + if o.VisibleModules != nil { + toSerialize["visible_modules"] = o.VisibleModules + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -333,24 +488,22 @@ func (o TeamAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { - CreatedAt *time.Time `json:"created_at,omitempty"` - Description datadog.NullableString `json:"description,omitempty"` - Handle *string `json:"handle"` - LinkCount *int32 `json:"link_count,omitempty"` - ModifiedAt *time.Time `json:"modified_at,omitempty"` - Name *string `json:"name"` - Summary datadog.NullableString `json:"summary,omitempty"` - UserCount *int32 `json:"user_count,omitempty"` + Avatar datadog.NullableString `json:"avatar,omitempty"` + Banner datadog.NullableInt64 `json:"banner,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + Description datadog.NullableString `json:"description,omitempty"` + Handle *string `json:"handle"` + HiddenModules []string `json:"hidden_modules,omitempty"` + LinkCount *int32 `json:"link_count,omitempty"` + ModifiedAt *time.Time `json:"modified_at,omitempty"` + Name *string `json:"name"` + Summary datadog.NullableString `json:"summary,omitempty"` + UserCount *int32 `json:"user_count,omitempty"` + VisibleModules []string `json:"visible_modules,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Handle == nil { return fmt.Errorf("required field handle missing") @@ -360,18 +513,23 @@ func (o *TeamAttributes) UnmarshalJSON(bytes []byte) (err error) { } 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"}) + datadog.DeleteKeys(additionalProperties, &[]string{"avatar", "banner", "created_at", "description", "handle", "hidden_modules", "link_count", "modified_at", "name", "summary", "user_count", "visible_modules"}) } else { return err } + o.Avatar = all.Avatar + o.Banner = all.Banner o.CreatedAt = all.CreatedAt o.Description = all.Description o.Handle = *all.Handle + o.HiddenModules = all.HiddenModules o.LinkCount = all.LinkCount o.ModifiedAt = all.ModifiedAt o.Name = *all.Name o.Summary = all.Summary o.UserCount = all.UserCount + o.VisibleModules = all.VisibleModules + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_create.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_create.go index 832d5966e..d60d8d3a4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_create.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_create.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -139,19 +140,13 @@ func (o TeamCreate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamCreate) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *TeamCreateAttributes `json:"attributes"` Relationships *TeamCreateRelationships `json:"relationships,omitempty"` Type *TeamType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -165,34 +160,29 @@ func (o *TeamCreate) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_create_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_create_attributes.go index da514fde9..43ab95ced 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_create_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_create_attributes.go @@ -5,20 +5,29 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // TeamCreateAttributes Team creation attributes type TeamCreateAttributes struct { + // Unicode representation of the avatar for the team, limited to a single grapheme + Avatar datadog.NullableString `json:"avatar,omitempty"` + // Banner selection for the team + Banner datadog.NullableInt64 `json:"banner,omitempty"` // Free-form markdown description/content for the team's homepage Description *string `json:"description,omitempty"` // The team's identifier Handle string `json:"handle"` + // Collection of hidden modules for the team + HiddenModules []string `json:"hidden_modules,omitempty"` // The name of the team Name string `json:"name"` + // Collection of visible modules for the team + VisibleModules []string `json:"visible_modules,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{} @@ -43,6 +52,84 @@ func NewTeamCreateAttributesWithDefaults() *TeamCreateAttributes { return &this } +// GetAvatar returns the Avatar field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TeamCreateAttributes) GetAvatar() string { + if o == nil || o.Avatar.Get() == nil { + var ret string + return ret + } + return *o.Avatar.Get() +} + +// GetAvatarOk returns a tuple with the Avatar field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *TeamCreateAttributes) GetAvatarOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Avatar.Get(), o.Avatar.IsSet() +} + +// HasAvatar returns a boolean if a field has been set. +func (o *TeamCreateAttributes) HasAvatar() bool { + return o != nil && o.Avatar.IsSet() +} + +// SetAvatar gets a reference to the given datadog.NullableString and assigns it to the Avatar field. +func (o *TeamCreateAttributes) SetAvatar(v string) { + o.Avatar.Set(&v) +} + +// SetAvatarNil sets the value for Avatar to be an explicit nil. +func (o *TeamCreateAttributes) SetAvatarNil() { + o.Avatar.Set(nil) +} + +// UnsetAvatar ensures that no value is present for Avatar, not even an explicit nil. +func (o *TeamCreateAttributes) UnsetAvatar() { + o.Avatar.Unset() +} + +// GetBanner returns the Banner field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TeamCreateAttributes) GetBanner() int64 { + if o == nil || o.Banner.Get() == nil { + var ret int64 + return ret + } + return *o.Banner.Get() +} + +// GetBannerOk returns a tuple with the Banner field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *TeamCreateAttributes) GetBannerOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.Banner.Get(), o.Banner.IsSet() +} + +// HasBanner returns a boolean if a field has been set. +func (o *TeamCreateAttributes) HasBanner() bool { + return o != nil && o.Banner.IsSet() +} + +// SetBanner gets a reference to the given datadog.NullableInt64 and assigns it to the Banner field. +func (o *TeamCreateAttributes) SetBanner(v int64) { + o.Banner.Set(&v) +} + +// SetBannerNil sets the value for Banner to be an explicit nil. +func (o *TeamCreateAttributes) SetBannerNil() { + o.Banner.Set(nil) +} + +// UnsetBanner ensures that no value is present for Banner, not even an explicit nil. +func (o *TeamCreateAttributes) UnsetBanner() { + o.Banner.Unset() +} + // GetDescription returns the Description field value if set, zero value otherwise. func (o *TeamCreateAttributes) GetDescription() string { if o == nil || o.Description == nil { @@ -94,6 +181,34 @@ func (o *TeamCreateAttributes) SetHandle(v string) { o.Handle = v } +// GetHiddenModules returns the HiddenModules field value if set, zero value otherwise. +func (o *TeamCreateAttributes) GetHiddenModules() []string { + if o == nil || o.HiddenModules == nil { + var ret []string + return ret + } + return o.HiddenModules +} + +// GetHiddenModulesOk returns a tuple with the HiddenModules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamCreateAttributes) GetHiddenModulesOk() (*[]string, bool) { + if o == nil || o.HiddenModules == nil { + return nil, false + } + return &o.HiddenModules, true +} + +// HasHiddenModules returns a boolean if a field has been set. +func (o *TeamCreateAttributes) HasHiddenModules() bool { + return o != nil && o.HiddenModules != nil +} + +// SetHiddenModules gets a reference to the given []string and assigns it to the HiddenModules field. +func (o *TeamCreateAttributes) SetHiddenModules(v []string) { + o.HiddenModules = v +} + // GetName returns the Name field value. func (o *TeamCreateAttributes) GetName() string { if o == nil { @@ -117,17 +232,57 @@ func (o *TeamCreateAttributes) SetName(v string) { o.Name = v } +// GetVisibleModules returns the VisibleModules field value if set, zero value otherwise. +func (o *TeamCreateAttributes) GetVisibleModules() []string { + if o == nil || o.VisibleModules == nil { + var ret []string + return ret + } + return o.VisibleModules +} + +// GetVisibleModulesOk returns a tuple with the VisibleModules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamCreateAttributes) GetVisibleModulesOk() (*[]string, bool) { + if o == nil || o.VisibleModules == nil { + return nil, false + } + return &o.VisibleModules, true +} + +// HasVisibleModules returns a boolean if a field has been set. +func (o *TeamCreateAttributes) HasVisibleModules() bool { + return o != nil && o.VisibleModules != nil +} + +// SetVisibleModules gets a reference to the given []string and assigns it to the VisibleModules field. +func (o *TeamCreateAttributes) SetVisibleModules(v []string) { + o.VisibleModules = v +} + // MarshalJSON serializes the struct using spec logic. func (o TeamCreateAttributes) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.UnparsedObject != nil { return json.Marshal(o.UnparsedObject) } + if o.Avatar.IsSet() { + toSerialize["avatar"] = o.Avatar.Get() + } + if o.Banner.IsSet() { + toSerialize["banner"] = o.Banner.Get() + } if o.Description != nil { toSerialize["description"] = o.Description } toSerialize["handle"] = o.Handle + if o.HiddenModules != nil { + toSerialize["hidden_modules"] = o.HiddenModules + } toSerialize["name"] = o.Name + if o.VisibleModules != nil { + toSerialize["visible_modules"] = o.VisibleModules + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -137,19 +292,17 @@ func (o TeamCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { - Description *string `json:"description,omitempty"` - Handle *string `json:"handle"` - Name *string `json:"name"` + Avatar datadog.NullableString `json:"avatar,omitempty"` + Banner datadog.NullableInt64 `json:"banner,omitempty"` + Description *string `json:"description,omitempty"` + Handle *string `json:"handle"` + HiddenModules []string `json:"hidden_modules,omitempty"` + Name *string `json:"name"` + VisibleModules []string `json:"visible_modules,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Handle == nil { return fmt.Errorf("required field handle missing") @@ -159,13 +312,18 @@ func (o *TeamCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"description", "handle", "name"}) + datadog.DeleteKeys(additionalProperties, &[]string{"avatar", "banner", "description", "handle", "hidden_modules", "name", "visible_modules"}) } else { return err } + o.Avatar = all.Avatar + o.Banner = all.Banner o.Description = all.Description o.Handle = *all.Handle + o.HiddenModules = all.HiddenModules o.Name = *all.Name + o.VisibleModules = all.VisibleModules + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_create_relationships.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_create_relationships.go index a17f806c2..8dd925eaf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_create_relationships.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_create_relationships.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o TeamCreateRelationships) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamCreateRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Users *RelationshipToUsers `json:"users,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *TeamCreateRelationships) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Users != nil && all.Users.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Users = all.Users + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_create_request.go index f5ea30136..95a45104f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o TeamCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *TeamCreate `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *TeamCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_included.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_included.go index 2012df576..635c7ae3d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_included.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_included.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // TeamIncluded - Included resources related to the team @@ -135,53 +135,3 @@ func (obj *TeamIncluded) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableTeamIncluded handles when a null is used for TeamIncluded. -type NullableTeamIncluded struct { - value *TeamIncluded - isSet bool -} - -// Get returns the associated value. -func (v NullableTeamIncluded) Get() *TeamIncluded { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTeamIncluded) Set(val *TeamIncluded) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTeamIncluded) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableTeamIncluded) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTeamIncluded initializes the struct as if Set has been called. -func NewNullableTeamIncluded(val *TeamIncluded) *NullableTeamIncluded { - return &NullableTeamIncluded{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTeamIncluded) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTeamIncluded) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_link.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_link.go index de6a7fea3..b1831d1a0 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_link.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_link.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -133,19 +134,13 @@ func (o TeamLink) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamLink) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *TeamLinkAttributes `json:"attributes"` Id *string `json:"id"` Type *TeamLinkType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -162,27 +157,26 @@ func (o *TeamLink) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_link_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_link_attributes.go index f45558519..8c8c0294c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_link_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_link_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -170,7 +171,6 @@ func (o TeamLinkAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamLinkAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Label *string `json:"label"` Position *int32 `json:"position,omitempty"` @@ -178,12 +178,7 @@ func (o *TeamLinkAttributes) UnmarshalJSON(bytes []byte) (err error) { Url *string `json:"url"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Label == nil { return fmt.Errorf("required field label missing") @@ -201,6 +196,7 @@ func (o *TeamLinkAttributes) UnmarshalJSON(bytes []byte) (err error) { o.Position = all.Position o.TeamId = all.TeamId o.Url = *all.Url + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_link_create.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_link_create.go index 0e0861dcc..d7463135b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_link_create.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_link_create.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o TeamLinkCreate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamLinkCreate) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *TeamLinkAttributes `json:"attributes"` Type *TeamLinkType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -131,26 +126,25 @@ func (o *TeamLinkCreate) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_link_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_link_create_request.go index 61991ee2c..2da5e873f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_link_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_link_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o TeamLinkCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamLinkCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *TeamLinkCreate `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *TeamLinkCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_link_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_link_response.go index babcbca50..5a4ff3dac 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_link_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_link_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o TeamLinkResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamLinkResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *TeamLink `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *TeamLinkResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_link_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_link_type.go index d3913fa0b..0571e3509 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_link_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_link_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // TeamLinkType Team link type @@ -61,47 +62,3 @@ func (v TeamLinkType) IsValid() bool { func (v TeamLinkType) Ptr() *TeamLinkType { return &v } - -// NullableTeamLinkType handles when a null is used for TeamLinkType. -type NullableTeamLinkType struct { - value *TeamLinkType - isSet bool -} - -// Get returns the associated value. -func (v NullableTeamLinkType) Get() *TeamLinkType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTeamLinkType) Set(val *TeamLinkType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTeamLinkType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTeamLinkType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTeamLinkType initializes the struct as if Set has been called. -func NewNullableTeamLinkType(val *TeamLinkType) *NullableTeamLinkType { - return &NullableTeamLinkType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTeamLinkType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTeamLinkType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_links_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_links_response.go index fd0d63786..aa50b037d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_links_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_links_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o TeamLinksResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamLinksResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []TeamLink `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *TeamLinksResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting.go index 8fc01b52a..79d79ff7a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -139,19 +140,13 @@ func (o TeamPermissionSetting) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamPermissionSetting) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *TeamPermissionSettingAttributes `json:"attributes,omitempty"` Id *string `json:"id"` Type *TeamPermissionSettingType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -165,27 +160,26 @@ func (o *TeamPermissionSetting) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_attributes.go index 2440f2f4e..4c3318b55 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -214,7 +214,6 @@ func (o TeamPermissionSettingAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamPermissionSettingAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Action *TeamPermissionSettingSerializerAction `json:"action,omitempty"` Editable *bool `json:"editable,omitempty"` @@ -223,12 +222,7 @@ func (o *TeamPermissionSettingAttributes) UnmarshalJSON(bytes []byte) (err error Value *TeamPermissionSettingValue `json:"value,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -236,30 +230,29 @@ func (o *TeamPermissionSettingAttributes) UnmarshalJSON(bytes []byte) (err error } else { return err } - if v := all.Action; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Value; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.Action != nil && !all.Action.IsValid() { + hasInvalidField = true + } else { + o.Action = all.Action } - o.Action = all.Action o.Editable = all.Editable o.Options = all.Options o.Title = all.Title - o.Value = all.Value + if all.Value != nil && !all.Value.IsValid() { + hasInvalidField = true + } else { + o.Value = all.Value + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_response.go index 36b19afae..205430b49 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o TeamPermissionSettingResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamPermissionSettingResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *TeamPermissionSetting `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *TeamPermissionSettingResponse) UnmarshalJSON(bytes []byte) (err error) } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_serializer_action.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_serializer_action.go index 283f21127..d0475e04b 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_serializer_action.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_serializer_action.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // TeamPermissionSettingSerializerAction The identifier for the action @@ -63,47 +64,3 @@ func (v TeamPermissionSettingSerializerAction) IsValid() bool { func (v TeamPermissionSettingSerializerAction) Ptr() *TeamPermissionSettingSerializerAction { return &v } - -// NullableTeamPermissionSettingSerializerAction handles when a null is used for TeamPermissionSettingSerializerAction. -type NullableTeamPermissionSettingSerializerAction struct { - value *TeamPermissionSettingSerializerAction - isSet bool -} - -// Get returns the associated value. -func (v NullableTeamPermissionSettingSerializerAction) Get() *TeamPermissionSettingSerializerAction { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTeamPermissionSettingSerializerAction) Set(val *TeamPermissionSettingSerializerAction) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTeamPermissionSettingSerializerAction) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTeamPermissionSettingSerializerAction) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTeamPermissionSettingSerializerAction initializes the struct as if Set has been called. -func NewNullableTeamPermissionSettingSerializerAction(val *TeamPermissionSettingSerializerAction) *NullableTeamPermissionSettingSerializerAction { - return &NullableTeamPermissionSettingSerializerAction{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTeamPermissionSettingSerializerAction) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTeamPermissionSettingSerializerAction) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_type.go index e14693ef2..a701d4f3d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // TeamPermissionSettingType Team permission setting type @@ -61,47 +62,3 @@ func (v TeamPermissionSettingType) IsValid() bool { func (v TeamPermissionSettingType) Ptr() *TeamPermissionSettingType { return &v } - -// NullableTeamPermissionSettingType handles when a null is used for TeamPermissionSettingType. -type NullableTeamPermissionSettingType struct { - value *TeamPermissionSettingType - isSet bool -} - -// Get returns the associated value. -func (v NullableTeamPermissionSettingType) Get() *TeamPermissionSettingType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTeamPermissionSettingType) Set(val *TeamPermissionSettingType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTeamPermissionSettingType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTeamPermissionSettingType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTeamPermissionSettingType initializes the struct as if Set has been called. -func NewNullableTeamPermissionSettingType(val *TeamPermissionSettingType) *NullableTeamPermissionSettingType { - return &NullableTeamPermissionSettingType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTeamPermissionSettingType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTeamPermissionSettingType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_update.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_update.go index d1aeed69e..4cb51ee5a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_update.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_update.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -112,18 +113,12 @@ func (o TeamPermissionSettingUpdate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamPermissionSettingUpdate) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *TeamPermissionSettingUpdateAttributes `json:"attributes,omitempty"` Type *TeamPermissionSettingType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -134,26 +129,25 @@ func (o *TeamPermissionSettingUpdate) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_update_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_update_attributes.go index 7c21775ac..72ecdbdef 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_update_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_update_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o TeamPermissionSettingUpdateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamPermissionSettingUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Value *TeamPermissionSettingValue `json:"value,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,18 +94,21 @@ func (o *TeamPermissionSettingUpdateAttributes) UnmarshalJSON(bytes []byte) (err } else { return err } - if v := all.Value; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.Value != nil && !all.Value.IsValid() { + hasInvalidField = true + } else { + o.Value = all.Value } - o.Value = all.Value + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_update_request.go index 265ad3b2a..e5acfc82f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o TeamPermissionSettingUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamPermissionSettingUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *TeamPermissionSettingUpdate `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *TeamPermissionSettingUpdateRequest) UnmarshalJSON(bytes []byte) (err er } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_value.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_value.go index 94aa31aa9..4b0c0b056 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_value.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_setting_value.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // TeamPermissionSettingValue What type of user is allowed to perform the specified action @@ -69,47 +70,3 @@ func (v TeamPermissionSettingValue) IsValid() bool { func (v TeamPermissionSettingValue) Ptr() *TeamPermissionSettingValue { return &v } - -// NullableTeamPermissionSettingValue handles when a null is used for TeamPermissionSettingValue. -type NullableTeamPermissionSettingValue struct { - value *TeamPermissionSettingValue - isSet bool -} - -// Get returns the associated value. -func (v NullableTeamPermissionSettingValue) Get() *TeamPermissionSettingValue { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTeamPermissionSettingValue) Set(val *TeamPermissionSettingValue) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTeamPermissionSettingValue) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTeamPermissionSettingValue) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTeamPermissionSettingValue initializes the struct as if Set has been called. -func NewNullableTeamPermissionSettingValue(val *TeamPermissionSettingValue) *NullableTeamPermissionSettingValue { - return &NullableTeamPermissionSettingValue{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTeamPermissionSettingValue) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTeamPermissionSettingValue) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_settings_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_settings_response.go index b374b8cc6..b6ce922db 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_settings_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_permission_settings_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o TeamPermissionSettingsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamPermissionSettingsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []TeamPermissionSetting `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *TeamPermissionSettingsResponse) UnmarshalJSON(bytes []byte) (err error) return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_relationships.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_relationships.go index 53963f1cb..2304903f6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_relationships.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_relationships.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o TeamRelationships) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { TeamLinks *RelationshipToTeamLinks `json:"team_links,omitempty"` UserTeamPermissions *RelationshipToUserTeamPermission `json:"user_team_permissions,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,25 +128,24 @@ func (o *TeamRelationships) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.TeamLinks != nil && all.TeamLinks.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.TeamLinks = all.TeamLinks if all.UserTeamPermissions != nil && all.UserTeamPermissions.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.UserTeamPermissions = all.UserTeamPermissions + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_relationships_links.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_relationships_links.go new file mode 100644 index 000000000..2fed5cf2a --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_relationships_links.go @@ -0,0 +1,104 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamRelationshipsLinks Links attributes. +type TeamRelationshipsLinks struct { + // Related link. + Related *string `json:"related,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{} +} + +// NewTeamRelationshipsLinks instantiates a new TeamRelationshipsLinks 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 NewTeamRelationshipsLinks() *TeamRelationshipsLinks { + this := TeamRelationshipsLinks{} + return &this +} + +// NewTeamRelationshipsLinksWithDefaults instantiates a new TeamRelationshipsLinks 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 NewTeamRelationshipsLinksWithDefaults() *TeamRelationshipsLinks { + this := TeamRelationshipsLinks{} + return &this +} + +// GetRelated returns the Related field value if set, zero value otherwise. +func (o *TeamRelationshipsLinks) GetRelated() string { + if o == nil || o.Related == nil { + var ret string + return ret + } + return *o.Related +} + +// GetRelatedOk returns a tuple with the Related field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamRelationshipsLinks) GetRelatedOk() (*string, bool) { + if o == nil || o.Related == nil { + return nil, false + } + return o.Related, true +} + +// HasRelated returns a boolean if a field has been set. +func (o *TeamRelationshipsLinks) HasRelated() bool { + return o != nil && o.Related != nil +} + +// SetRelated gets a reference to the given string and assigns it to the Related field. +func (o *TeamRelationshipsLinks) SetRelated(v string) { + o.Related = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamRelationshipsLinks) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Related != nil { + toSerialize["related"] = o.Related + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamRelationshipsLinks) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Related *string `json:"related,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"related"}) + } else { + return err + } + o.Related = all.Related + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_response.go index 87189bc22..32d747acf 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -13,7 +13,7 @@ import ( // TeamResponse Response with a team type TeamResponse struct { // A team - Data *TeamData `json:"data,omitempty"` + Data *Team `json:"data,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{} @@ -37,9 +37,9 @@ func NewTeamResponseWithDefaults() *TeamResponse { } // GetData returns the Data field value if set, zero value otherwise. -func (o *TeamResponse) GetData() TeamData { +func (o *TeamResponse) GetData() Team { if o == nil || o.Data == nil { - var ret TeamData + var ret Team return ret } return *o.Data @@ -47,7 +47,7 @@ func (o *TeamResponse) GetData() TeamData { // GetDataOk returns a tuple with the Data field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *TeamResponse) GetDataOk() (*TeamData, bool) { +func (o *TeamResponse) GetDataOk() (*Team, bool) { if o == nil || o.Data == nil { return nil, false } @@ -59,8 +59,8 @@ func (o *TeamResponse) HasData() bool { return o != nil && o.Data != nil } -// SetData gets a reference to the given TeamData and assigns it to the Data field. -func (o *TeamResponse) SetData(v TeamData) { +// SetData gets a reference to the given Team and assigns it to the Data field. +func (o *TeamResponse) SetData(v Team) { o.Data = &v } @@ -82,17 +82,11 @@ func (o TeamResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { - Data *TeamData `json:"data,omitempty"` + Data *Team `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *TeamResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_type.go index 4fbd381b2..7689a5c6a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // TeamType Team type @@ -61,47 +62,3 @@ func (v TeamType) IsValid() bool { func (v TeamType) Ptr() *TeamType { return &v } - -// NullableTeamType handles when a null is used for TeamType. -type NullableTeamType struct { - value *TeamType - isSet bool -} - -// Get returns the associated value. -func (v NullableTeamType) Get() *TeamType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTeamType) Set(val *TeamType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTeamType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTeamType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTeamType initializes the struct as if Set has been called. -func NewNullableTeamType(val *TeamType) *NullableTeamType { - return &NullableTeamType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTeamType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTeamType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_update.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_update.go index b1c00556d..b6781316e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_update.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_update.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -139,19 +140,13 @@ func (o TeamUpdate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamUpdate) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *TeamUpdateAttributes `json:"attributes"` Relationships *TeamUpdateRelationships `json:"relationships,omitempty"` Type *TeamType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -165,34 +160,29 @@ func (o *TeamUpdate) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_update_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_update_attributes.go index 48430abd9..71584c027 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_update_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_update_attributes.go @@ -5,22 +5,31 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // TeamUpdateAttributes Team update attributes type TeamUpdateAttributes struct { + // Unicode representation of the avatar for the team, limited to a single grapheme + Avatar datadog.NullableString `json:"avatar,omitempty"` + // Banner selection for the team + Banner datadog.NullableInt64 `json:"banner,omitempty"` // An identifier for the color representing the team Color *int32 `json:"color,omitempty"` // Free-form markdown description/content for the team's homepage Description *string `json:"description,omitempty"` // The team's identifier Handle string `json:"handle"` + // Collection of hidden modules for the team + HiddenModules []string `json:"hidden_modules,omitempty"` // The name of the team Name string `json:"name"` + // Collection of visible modules for the team + VisibleModules []string `json:"visible_modules,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{} @@ -45,6 +54,84 @@ func NewTeamUpdateAttributesWithDefaults() *TeamUpdateAttributes { return &this } +// GetAvatar returns the Avatar field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TeamUpdateAttributes) GetAvatar() string { + if o == nil || o.Avatar.Get() == nil { + var ret string + return ret + } + return *o.Avatar.Get() +} + +// GetAvatarOk returns a tuple with the Avatar field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *TeamUpdateAttributes) GetAvatarOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Avatar.Get(), o.Avatar.IsSet() +} + +// HasAvatar returns a boolean if a field has been set. +func (o *TeamUpdateAttributes) HasAvatar() bool { + return o != nil && o.Avatar.IsSet() +} + +// SetAvatar gets a reference to the given datadog.NullableString and assigns it to the Avatar field. +func (o *TeamUpdateAttributes) SetAvatar(v string) { + o.Avatar.Set(&v) +} + +// SetAvatarNil sets the value for Avatar to be an explicit nil. +func (o *TeamUpdateAttributes) SetAvatarNil() { + o.Avatar.Set(nil) +} + +// UnsetAvatar ensures that no value is present for Avatar, not even an explicit nil. +func (o *TeamUpdateAttributes) UnsetAvatar() { + o.Avatar.Unset() +} + +// GetBanner returns the Banner field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TeamUpdateAttributes) GetBanner() int64 { + if o == nil || o.Banner.Get() == nil { + var ret int64 + return ret + } + return *o.Banner.Get() +} + +// GetBannerOk returns a tuple with the Banner field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *TeamUpdateAttributes) GetBannerOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.Banner.Get(), o.Banner.IsSet() +} + +// HasBanner returns a boolean if a field has been set. +func (o *TeamUpdateAttributes) HasBanner() bool { + return o != nil && o.Banner.IsSet() +} + +// SetBanner gets a reference to the given datadog.NullableInt64 and assigns it to the Banner field. +func (o *TeamUpdateAttributes) SetBanner(v int64) { + o.Banner.Set(&v) +} + +// SetBannerNil sets the value for Banner to be an explicit nil. +func (o *TeamUpdateAttributes) SetBannerNil() { + o.Banner.Set(nil) +} + +// UnsetBanner ensures that no value is present for Banner, not even an explicit nil. +func (o *TeamUpdateAttributes) UnsetBanner() { + o.Banner.Unset() +} + // GetColor returns the Color field value if set, zero value otherwise. func (o *TeamUpdateAttributes) GetColor() int32 { if o == nil || o.Color == nil { @@ -124,6 +211,34 @@ func (o *TeamUpdateAttributes) SetHandle(v string) { o.Handle = v } +// GetHiddenModules returns the HiddenModules field value if set, zero value otherwise. +func (o *TeamUpdateAttributes) GetHiddenModules() []string { + if o == nil || o.HiddenModules == nil { + var ret []string + return ret + } + return o.HiddenModules +} + +// GetHiddenModulesOk returns a tuple with the HiddenModules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamUpdateAttributes) GetHiddenModulesOk() (*[]string, bool) { + if o == nil || o.HiddenModules == nil { + return nil, false + } + return &o.HiddenModules, true +} + +// HasHiddenModules returns a boolean if a field has been set. +func (o *TeamUpdateAttributes) HasHiddenModules() bool { + return o != nil && o.HiddenModules != nil +} + +// SetHiddenModules gets a reference to the given []string and assigns it to the HiddenModules field. +func (o *TeamUpdateAttributes) SetHiddenModules(v []string) { + o.HiddenModules = v +} + // GetName returns the Name field value. func (o *TeamUpdateAttributes) GetName() string { if o == nil { @@ -147,12 +262,46 @@ func (o *TeamUpdateAttributes) SetName(v string) { o.Name = v } +// GetVisibleModules returns the VisibleModules field value if set, zero value otherwise. +func (o *TeamUpdateAttributes) GetVisibleModules() []string { + if o == nil || o.VisibleModules == nil { + var ret []string + return ret + } + return o.VisibleModules +} + +// GetVisibleModulesOk returns a tuple with the VisibleModules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamUpdateAttributes) GetVisibleModulesOk() (*[]string, bool) { + if o == nil || o.VisibleModules == nil { + return nil, false + } + return &o.VisibleModules, true +} + +// HasVisibleModules returns a boolean if a field has been set. +func (o *TeamUpdateAttributes) HasVisibleModules() bool { + return o != nil && o.VisibleModules != nil +} + +// SetVisibleModules gets a reference to the given []string and assigns it to the VisibleModules field. +func (o *TeamUpdateAttributes) SetVisibleModules(v []string) { + o.VisibleModules = v +} + // MarshalJSON serializes the struct using spec logic. func (o TeamUpdateAttributes) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.UnparsedObject != nil { return json.Marshal(o.UnparsedObject) } + if o.Avatar.IsSet() { + toSerialize["avatar"] = o.Avatar.Get() + } + if o.Banner.IsSet() { + toSerialize["banner"] = o.Banner.Get() + } if o.Color != nil { toSerialize["color"] = o.Color } @@ -160,7 +309,13 @@ func (o TeamUpdateAttributes) MarshalJSON() ([]byte, error) { toSerialize["description"] = o.Description } toSerialize["handle"] = o.Handle + if o.HiddenModules != nil { + toSerialize["hidden_modules"] = o.HiddenModules + } toSerialize["name"] = o.Name + if o.VisibleModules != nil { + toSerialize["visible_modules"] = o.VisibleModules + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -170,20 +325,18 @@ func (o TeamUpdateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { - Color *int32 `json:"color,omitempty"` - Description *string `json:"description,omitempty"` - Handle *string `json:"handle"` - Name *string `json:"name"` + Avatar datadog.NullableString `json:"avatar,omitempty"` + Banner datadog.NullableInt64 `json:"banner,omitempty"` + Color *int32 `json:"color,omitempty"` + Description *string `json:"description,omitempty"` + Handle *string `json:"handle"` + HiddenModules []string `json:"hidden_modules,omitempty"` + Name *string `json:"name"` + VisibleModules []string `json:"visible_modules,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Handle == nil { return fmt.Errorf("required field handle missing") @@ -193,14 +346,19 @@ func (o *TeamUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"color", "description", "handle", "name"}) + datadog.DeleteKeys(additionalProperties, &[]string{"avatar", "banner", "color", "description", "handle", "hidden_modules", "name", "visible_modules"}) } else { return err } + o.Avatar = all.Avatar + o.Banner = all.Banner o.Color = all.Color o.Description = all.Description o.Handle = *all.Handle + o.HiddenModules = all.HiddenModules o.Name = *all.Name + o.VisibleModules = all.VisibleModules + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_update_relationships.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_update_relationships.go index dacd61ea6..6c653f513 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_update_relationships.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_update_relationships.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o TeamUpdateRelationships) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamUpdateRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { TeamLinks *RelationshipToTeamLinks `json:"team_links,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *TeamUpdateRelationships) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.TeamLinks != nil && all.TeamLinks.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.TeamLinks = all.TeamLinks + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_update_request.go index 5c2e4c667..bf9c1c494 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_team_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o TeamUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *TeamUpdate `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *TeamUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_teams_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_teams_response.go index 47dbb7081..a96b4e095 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_teams_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_teams_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -16,6 +16,10 @@ type TeamsResponse struct { Data []Team `json:"data,omitempty"` // Resources related to the team Included []TeamIncluded `json:"included,omitempty"` + // Teams response links. + Links *TeamsResponseLinks `json:"links,omitempty"` + // Teams response metadata. + Meta *TeamsResponseMeta `json:"meta,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{} @@ -94,6 +98,62 @@ func (o *TeamsResponse) SetIncluded(v []TeamIncluded) { o.Included = v } +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *TeamsResponse) GetLinks() TeamsResponseLinks { + if o == nil || o.Links == nil { + var ret TeamsResponseLinks + return ret + } + return *o.Links +} + +// GetLinksOk returns a tuple with the Links field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsResponse) GetLinksOk() (*TeamsResponseLinks, bool) { + if o == nil || o.Links == nil { + return nil, false + } + return o.Links, true +} + +// HasLinks returns a boolean if a field has been set. +func (o *TeamsResponse) HasLinks() bool { + return o != nil && o.Links != nil +} + +// SetLinks gets a reference to the given TeamsResponseLinks and assigns it to the Links field. +func (o *TeamsResponse) SetLinks(v TeamsResponseLinks) { + o.Links = &v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *TeamsResponse) GetMeta() TeamsResponseMeta { + if o == nil || o.Meta == nil { + var ret TeamsResponseMeta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsResponse) GetMetaOk() (*TeamsResponseMeta, bool) { + if o == nil || o.Meta == nil { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *TeamsResponse) HasMeta() bool { + return o != nil && o.Meta != nil +} + +// SetMeta gets a reference to the given TeamsResponseMeta and assigns it to the Meta field. +func (o *TeamsResponse) SetMeta(v TeamsResponseMeta) { + o.Meta = &v +} + // MarshalJSON serializes the struct using spec logic. func (o TeamsResponse) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -106,6 +166,12 @@ func (o TeamsResponse) MarshalJSON() ([]byte, error) { if o.Included != nil { toSerialize["included"] = o.Included } + if o.Links != nil { + toSerialize["links"] = o.Links + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -115,30 +181,41 @@ func (o TeamsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { - Data []Team `json:"data,omitempty"` - Included []TeamIncluded `json:"included,omitempty"` + Data []Team `json:"data,omitempty"` + Included []TeamIncluded `json:"included,omitempty"` + Links *TeamsResponseLinks `json:"links,omitempty"` + Meta *TeamsResponseMeta `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"data", "included"}) + datadog.DeleteKeys(additionalProperties, &[]string{"data", "included", "links", "meta"}) } else { return err } + + hasInvalidField := false o.Data = all.Data o.Included = all.Included + if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Links = all.Links + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_teams_response_links.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_teams_response_links.go new file mode 100644 index 000000000..54c75fbbc --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_teams_response_links.go @@ -0,0 +1,266 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamsResponseLinks Teams response links. +type TeamsResponseLinks struct { + // First link. + First *string `json:"first,omitempty"` + // Last link. + Last datadog.NullableString `json:"last,omitempty"` + // Next link. + Next *string `json:"next,omitempty"` + // Previous link. + Prev datadog.NullableString `json:"prev,omitempty"` + // Current link. + Self *string `json:"self,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{} +} + +// NewTeamsResponseLinks instantiates a new TeamsResponseLinks 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 NewTeamsResponseLinks() *TeamsResponseLinks { + this := TeamsResponseLinks{} + return &this +} + +// NewTeamsResponseLinksWithDefaults instantiates a new TeamsResponseLinks 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 NewTeamsResponseLinksWithDefaults() *TeamsResponseLinks { + this := TeamsResponseLinks{} + return &this +} + +// GetFirst returns the First field value if set, zero value otherwise. +func (o *TeamsResponseLinks) GetFirst() string { + if o == nil || o.First == nil { + var ret string + return ret + } + return *o.First +} + +// GetFirstOk returns a tuple with the First field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsResponseLinks) GetFirstOk() (*string, bool) { + if o == nil || o.First == nil { + return nil, false + } + return o.First, true +} + +// HasFirst returns a boolean if a field has been set. +func (o *TeamsResponseLinks) HasFirst() bool { + return o != nil && o.First != nil +} + +// SetFirst gets a reference to the given string and assigns it to the First field. +func (o *TeamsResponseLinks) SetFirst(v string) { + o.First = &v +} + +// GetLast returns the Last field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TeamsResponseLinks) GetLast() string { + if o == nil || o.Last.Get() == nil { + var ret string + return ret + } + return *o.Last.Get() +} + +// GetLastOk returns a tuple with the Last field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *TeamsResponseLinks) GetLastOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Last.Get(), o.Last.IsSet() +} + +// HasLast returns a boolean if a field has been set. +func (o *TeamsResponseLinks) HasLast() bool { + return o != nil && o.Last.IsSet() +} + +// SetLast gets a reference to the given datadog.NullableString and assigns it to the Last field. +func (o *TeamsResponseLinks) SetLast(v string) { + o.Last.Set(&v) +} + +// SetLastNil sets the value for Last to be an explicit nil. +func (o *TeamsResponseLinks) SetLastNil() { + o.Last.Set(nil) +} + +// UnsetLast ensures that no value is present for Last, not even an explicit nil. +func (o *TeamsResponseLinks) UnsetLast() { + o.Last.Unset() +} + +// GetNext returns the Next field value if set, zero value otherwise. +func (o *TeamsResponseLinks) GetNext() string { + if o == nil || o.Next == nil { + var ret string + return ret + } + return *o.Next +} + +// GetNextOk returns a tuple with the Next field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsResponseLinks) GetNextOk() (*string, bool) { + if o == nil || o.Next == nil { + return nil, false + } + return o.Next, true +} + +// HasNext returns a boolean if a field has been set. +func (o *TeamsResponseLinks) HasNext() bool { + return o != nil && o.Next != nil +} + +// SetNext gets a reference to the given string and assigns it to the Next field. +func (o *TeamsResponseLinks) SetNext(v string) { + o.Next = &v +} + +// GetPrev returns the Prev field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TeamsResponseLinks) GetPrev() string { + if o == nil || o.Prev.Get() == nil { + var ret string + return ret + } + return *o.Prev.Get() +} + +// GetPrevOk returns a tuple with the Prev field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *TeamsResponseLinks) GetPrevOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Prev.Get(), o.Prev.IsSet() +} + +// HasPrev returns a boolean if a field has been set. +func (o *TeamsResponseLinks) HasPrev() bool { + return o != nil && o.Prev.IsSet() +} + +// SetPrev gets a reference to the given datadog.NullableString and assigns it to the Prev field. +func (o *TeamsResponseLinks) SetPrev(v string) { + o.Prev.Set(&v) +} + +// SetPrevNil sets the value for Prev to be an explicit nil. +func (o *TeamsResponseLinks) SetPrevNil() { + o.Prev.Set(nil) +} + +// UnsetPrev ensures that no value is present for Prev, not even an explicit nil. +func (o *TeamsResponseLinks) UnsetPrev() { + o.Prev.Unset() +} + +// GetSelf returns the Self field value if set, zero value otherwise. +func (o *TeamsResponseLinks) GetSelf() string { + if o == nil || o.Self == nil { + var ret string + return ret + } + return *o.Self +} + +// GetSelfOk returns a tuple with the Self field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsResponseLinks) GetSelfOk() (*string, bool) { + if o == nil || o.Self == nil { + return nil, false + } + return o.Self, true +} + +// HasSelf returns a boolean if a field has been set. +func (o *TeamsResponseLinks) HasSelf() bool { + return o != nil && o.Self != nil +} + +// SetSelf gets a reference to the given string and assigns it to the Self field. +func (o *TeamsResponseLinks) SetSelf(v string) { + o.Self = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamsResponseLinks) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.First != nil { + toSerialize["first"] = o.First + } + if o.Last.IsSet() { + toSerialize["last"] = o.Last.Get() + } + if o.Next != nil { + toSerialize["next"] = o.Next + } + if o.Prev.IsSet() { + toSerialize["prev"] = o.Prev.Get() + } + if o.Self != nil { + toSerialize["self"] = o.Self + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamsResponseLinks) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + First *string `json:"first,omitempty"` + Last datadog.NullableString `json:"last,omitempty"` + Next *string `json:"next,omitempty"` + Prev datadog.NullableString `json:"prev,omitempty"` + Self *string `json:"self,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"first", "last", "next", "prev", "self"}) + } else { + return err + } + o.First = all.First + o.Last = all.Last + o.Next = all.Next + o.Prev = all.Prev + o.Self = all.Self + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_teams_response_meta.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_teams_response_meta.go new file mode 100644 index 000000000..c5574d257 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_teams_response_meta.go @@ -0,0 +1,113 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamsResponseMeta Teams response metadata. +type TeamsResponseMeta struct { + // Teams response metadata. + Pagination *TeamsResponseMetaPagination `json:"pagination,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{} +} + +// NewTeamsResponseMeta instantiates a new TeamsResponseMeta 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 NewTeamsResponseMeta() *TeamsResponseMeta { + this := TeamsResponseMeta{} + return &this +} + +// NewTeamsResponseMetaWithDefaults instantiates a new TeamsResponseMeta 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 NewTeamsResponseMetaWithDefaults() *TeamsResponseMeta { + this := TeamsResponseMeta{} + return &this +} + +// GetPagination returns the Pagination field value if set, zero value otherwise. +func (o *TeamsResponseMeta) GetPagination() TeamsResponseMetaPagination { + if o == nil || o.Pagination == nil { + var ret TeamsResponseMetaPagination + return ret + } + return *o.Pagination +} + +// GetPaginationOk returns a tuple with the Pagination field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsResponseMeta) GetPaginationOk() (*TeamsResponseMetaPagination, bool) { + if o == nil || o.Pagination == nil { + return nil, false + } + return o.Pagination, true +} + +// HasPagination returns a boolean if a field has been set. +func (o *TeamsResponseMeta) HasPagination() bool { + return o != nil && o.Pagination != nil +} + +// SetPagination gets a reference to the given TeamsResponseMetaPagination and assigns it to the Pagination field. +func (o *TeamsResponseMeta) SetPagination(v TeamsResponseMetaPagination) { + o.Pagination = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamsResponseMeta) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Pagination != nil { + toSerialize["pagination"] = o.Pagination + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamsResponseMeta) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Pagination *TeamsResponseMetaPagination `json:"pagination,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"pagination"}) + } else { + return err + } + + hasInvalidField := false + if all.Pagination != nil && all.Pagination.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Pagination = all.Pagination + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_teams_response_meta_pagination.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_teams_response_meta_pagination.go new file mode 100644 index 000000000..6b76140d0 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_teams_response_meta_pagination.go @@ -0,0 +1,349 @@ +// Unless explicitly stated otherwise all files in this repository 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 ( + "github.com/goccy/go-json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamsResponseMetaPagination Teams response metadata. +type TeamsResponseMetaPagination struct { + // The first offset. + FirstOffset *int64 `json:"first_offset,omitempty"` + // The last offset. + LastOffset *int64 `json:"last_offset,omitempty"` + // Pagination limit. + Limit *int64 `json:"limit,omitempty"` + // The next offset. + NextOffset *int64 `json:"next_offset,omitempty"` + // The offset. + Offset *int64 `json:"offset,omitempty"` + // The previous offset. + PrevOffset *int64 `json:"prev_offset,omitempty"` + // Total results. + Total *int64 `json:"total,omitempty"` + // Offset type. + Type *string `json:"type,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{} +} + +// NewTeamsResponseMetaPagination instantiates a new TeamsResponseMetaPagination 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 NewTeamsResponseMetaPagination() *TeamsResponseMetaPagination { + this := TeamsResponseMetaPagination{} + return &this +} + +// NewTeamsResponseMetaPaginationWithDefaults instantiates a new TeamsResponseMetaPagination 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 NewTeamsResponseMetaPaginationWithDefaults() *TeamsResponseMetaPagination { + this := TeamsResponseMetaPagination{} + return &this +} + +// GetFirstOffset returns the FirstOffset field value if set, zero value otherwise. +func (o *TeamsResponseMetaPagination) GetFirstOffset() int64 { + if o == nil || o.FirstOffset == nil { + var ret int64 + return ret + } + return *o.FirstOffset +} + +// GetFirstOffsetOk returns a tuple with the FirstOffset field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsResponseMetaPagination) GetFirstOffsetOk() (*int64, bool) { + if o == nil || o.FirstOffset == nil { + return nil, false + } + return o.FirstOffset, true +} + +// HasFirstOffset returns a boolean if a field has been set. +func (o *TeamsResponseMetaPagination) HasFirstOffset() bool { + return o != nil && o.FirstOffset != nil +} + +// SetFirstOffset gets a reference to the given int64 and assigns it to the FirstOffset field. +func (o *TeamsResponseMetaPagination) SetFirstOffset(v int64) { + o.FirstOffset = &v +} + +// GetLastOffset returns the LastOffset field value if set, zero value otherwise. +func (o *TeamsResponseMetaPagination) GetLastOffset() int64 { + if o == nil || o.LastOffset == nil { + var ret int64 + return ret + } + return *o.LastOffset +} + +// GetLastOffsetOk returns a tuple with the LastOffset field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsResponseMetaPagination) GetLastOffsetOk() (*int64, bool) { + if o == nil || o.LastOffset == nil { + return nil, false + } + return o.LastOffset, true +} + +// HasLastOffset returns a boolean if a field has been set. +func (o *TeamsResponseMetaPagination) HasLastOffset() bool { + return o != nil && o.LastOffset != nil +} + +// SetLastOffset gets a reference to the given int64 and assigns it to the LastOffset field. +func (o *TeamsResponseMetaPagination) SetLastOffset(v int64) { + o.LastOffset = &v +} + +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *TeamsResponseMetaPagination) GetLimit() int64 { + if o == nil || o.Limit == nil { + var ret int64 + return ret + } + return *o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsResponseMetaPagination) GetLimitOk() (*int64, bool) { + if o == nil || o.Limit == nil { + return nil, false + } + return o.Limit, true +} + +// HasLimit returns a boolean if a field has been set. +func (o *TeamsResponseMetaPagination) HasLimit() bool { + return o != nil && o.Limit != nil +} + +// SetLimit gets a reference to the given int64 and assigns it to the Limit field. +func (o *TeamsResponseMetaPagination) SetLimit(v int64) { + o.Limit = &v +} + +// GetNextOffset returns the NextOffset field value if set, zero value otherwise. +func (o *TeamsResponseMetaPagination) GetNextOffset() int64 { + if o == nil || o.NextOffset == nil { + var ret int64 + return ret + } + return *o.NextOffset +} + +// GetNextOffsetOk returns a tuple with the NextOffset field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsResponseMetaPagination) GetNextOffsetOk() (*int64, bool) { + if o == nil || o.NextOffset == nil { + return nil, false + } + return o.NextOffset, true +} + +// HasNextOffset returns a boolean if a field has been set. +func (o *TeamsResponseMetaPagination) HasNextOffset() bool { + return o != nil && o.NextOffset != nil +} + +// SetNextOffset gets a reference to the given int64 and assigns it to the NextOffset field. +func (o *TeamsResponseMetaPagination) SetNextOffset(v int64) { + o.NextOffset = &v +} + +// GetOffset returns the Offset field value if set, zero value otherwise. +func (o *TeamsResponseMetaPagination) GetOffset() int64 { + if o == nil || o.Offset == nil { + var ret int64 + return ret + } + return *o.Offset +} + +// GetOffsetOk returns a tuple with the Offset field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsResponseMetaPagination) GetOffsetOk() (*int64, bool) { + if o == nil || o.Offset == nil { + return nil, false + } + return o.Offset, true +} + +// HasOffset returns a boolean if a field has been set. +func (o *TeamsResponseMetaPagination) HasOffset() bool { + return o != nil && o.Offset != nil +} + +// SetOffset gets a reference to the given int64 and assigns it to the Offset field. +func (o *TeamsResponseMetaPagination) SetOffset(v int64) { + o.Offset = &v +} + +// GetPrevOffset returns the PrevOffset field value if set, zero value otherwise. +func (o *TeamsResponseMetaPagination) GetPrevOffset() int64 { + if o == nil || o.PrevOffset == nil { + var ret int64 + return ret + } + return *o.PrevOffset +} + +// GetPrevOffsetOk returns a tuple with the PrevOffset field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsResponseMetaPagination) GetPrevOffsetOk() (*int64, bool) { + if o == nil || o.PrevOffset == nil { + return nil, false + } + return o.PrevOffset, true +} + +// HasPrevOffset returns a boolean if a field has been set. +func (o *TeamsResponseMetaPagination) HasPrevOffset() bool { + return o != nil && o.PrevOffset != nil +} + +// SetPrevOffset gets a reference to the given int64 and assigns it to the PrevOffset field. +func (o *TeamsResponseMetaPagination) SetPrevOffset(v int64) { + o.PrevOffset = &v +} + +// GetTotal returns the Total field value if set, zero value otherwise. +func (o *TeamsResponseMetaPagination) GetTotal() int64 { + if o == nil || o.Total == nil { + var ret int64 + return ret + } + return *o.Total +} + +// GetTotalOk returns a tuple with the Total field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsResponseMetaPagination) GetTotalOk() (*int64, bool) { + if o == nil || o.Total == nil { + return nil, false + } + return o.Total, true +} + +// HasTotal returns a boolean if a field has been set. +func (o *TeamsResponseMetaPagination) HasTotal() bool { + return o != nil && o.Total != nil +} + +// SetTotal gets a reference to the given int64 and assigns it to the Total field. +func (o *TeamsResponseMetaPagination) SetTotal(v int64) { + o.Total = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *TeamsResponseMetaPagination) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsResponseMetaPagination) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *TeamsResponseMetaPagination) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *TeamsResponseMetaPagination) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamsResponseMetaPagination) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.FirstOffset != nil { + toSerialize["first_offset"] = o.FirstOffset + } + if o.LastOffset != nil { + toSerialize["last_offset"] = o.LastOffset + } + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + if o.NextOffset != nil { + toSerialize["next_offset"] = o.NextOffset + } + if o.Offset != nil { + toSerialize["offset"] = o.Offset + } + if o.PrevOffset != nil { + toSerialize["prev_offset"] = o.PrevOffset + } + if o.Total != nil { + toSerialize["total"] = o.Total + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamsResponseMetaPagination) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + FirstOffset *int64 `json:"first_offset,omitempty"` + LastOffset *int64 `json:"last_offset,omitempty"` + Limit *int64 `json:"limit,omitempty"` + NextOffset *int64 `json:"next_offset,omitempty"` + Offset *int64 `json:"offset,omitempty"` + PrevOffset *int64 `json:"prev_offset,omitempty"` + Total *int64 `json:"total,omitempty"` + Type *string `json:"type,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"first_offset", "last_offset", "limit", "next_offset", "offset", "prev_offset", "total", "type"}) + } else { + return err + } + o.FirstOffset = all.FirstOffset + o.LastOffset = all.LastOffset + o.Limit = all.Limit + o.NextOffset = all.NextOffset + o.Offset = all.Offset + o.PrevOffset = all.PrevOffset + o.Total = all.Total + o.Type = all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_formula_query_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_formula_query_request.go index a75104bfc..ebaadcc40 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_formula_query_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_formula_query_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o TimeseriesFormulaQueryRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TimeseriesFormulaQueryRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *TimeseriesFormulaRequest `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *TimeseriesFormulaQueryRequest) UnmarshalJSON(bytes []byte) (err error) } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_formula_query_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_formula_query_response.go index b17626865..8457020ac 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_formula_query_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_formula_query_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o TimeseriesFormulaQueryResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TimeseriesFormulaQueryResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *TimeseriesResponse `json:"data,omitempty"` Errors *string `json:"errors,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *TimeseriesFormulaQueryResponse) UnmarshalJSON(bytes []byte) (err error) } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data o.Errors = all.Errors + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_formula_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_formula_request.go index 21b0fa88f..adfb12d04 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_formula_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_formula_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o TimeseriesFormulaRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TimeseriesFormulaRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *TimeseriesFormulaRequestAttributes `json:"attributes"` Type *TimeseriesFormulaRequestType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -131,26 +126,25 @@ func (o *TimeseriesFormulaRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_formula_request_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_formula_request_attributes.go index 7014e2688..752ac01dd 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_formula_request_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_formula_request_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -200,7 +201,6 @@ func (o TimeseriesFormulaRequestAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TimeseriesFormulaRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Formulas []QueryFormula `json:"formulas,omitempty"` From *int64 `json:"from"` @@ -209,12 +209,7 @@ func (o *TimeseriesFormulaRequestAttributes) UnmarshalJSON(bytes []byte) (err er To *int64 `json:"to"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.From == nil { return fmt.Errorf("required field from missing") @@ -236,6 +231,7 @@ func (o *TimeseriesFormulaRequestAttributes) UnmarshalJSON(bytes []byte) (err er o.Interval = all.Interval o.Queries = *all.Queries o.To = *all.To + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_formula_request_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_formula_request_type.go index 239172cdf..ed26119d2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_formula_request_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_formula_request_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // TimeseriesFormulaRequestType The type of the resource. The value should always be timeseries_request. @@ -61,47 +62,3 @@ func (v TimeseriesFormulaRequestType) IsValid() bool { func (v TimeseriesFormulaRequestType) Ptr() *TimeseriesFormulaRequestType { return &v } - -// NullableTimeseriesFormulaRequestType handles when a null is used for TimeseriesFormulaRequestType. -type NullableTimeseriesFormulaRequestType struct { - value *TimeseriesFormulaRequestType - isSet bool -} - -// Get returns the associated value. -func (v NullableTimeseriesFormulaRequestType) Get() *TimeseriesFormulaRequestType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTimeseriesFormulaRequestType) Set(val *TimeseriesFormulaRequestType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTimeseriesFormulaRequestType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTimeseriesFormulaRequestType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTimeseriesFormulaRequestType initializes the struct as if Set has been called. -func NewNullableTimeseriesFormulaRequestType(val *TimeseriesFormulaRequestType) *NullableTimeseriesFormulaRequestType { - return &NullableTimeseriesFormulaRequestType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTimeseriesFormulaRequestType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTimeseriesFormulaRequestType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_formula_response_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_formula_response_type.go index 10cd0fb6f..a471025e4 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_formula_response_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_formula_response_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // TimeseriesFormulaResponseType The type of the resource. The value should always be timeseries_response. @@ -61,47 +62,3 @@ func (v TimeseriesFormulaResponseType) IsValid() bool { func (v TimeseriesFormulaResponseType) Ptr() *TimeseriesFormulaResponseType { return &v } - -// NullableTimeseriesFormulaResponseType handles when a null is used for TimeseriesFormulaResponseType. -type NullableTimeseriesFormulaResponseType struct { - value *TimeseriesFormulaResponseType - isSet bool -} - -// Get returns the associated value. -func (v NullableTimeseriesFormulaResponseType) Get() *TimeseriesFormulaResponseType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTimeseriesFormulaResponseType) Set(val *TimeseriesFormulaResponseType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTimeseriesFormulaResponseType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTimeseriesFormulaResponseType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTimeseriesFormulaResponseType initializes the struct as if Set has been called. -func NewNullableTimeseriesFormulaResponseType(val *TimeseriesFormulaResponseType) *NullableTimeseriesFormulaResponseType { - return &NullableTimeseriesFormulaResponseType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTimeseriesFormulaResponseType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTimeseriesFormulaResponseType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_query.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_query.go index 98ea9a995..50fa5b688 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_query.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_query.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // TimeseriesQuery - An individual timeseries query to one of the basic Datadog data sources. @@ -103,53 +103,3 @@ func (obj *TimeseriesQuery) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableTimeseriesQuery handles when a null is used for TimeseriesQuery. -type NullableTimeseriesQuery struct { - value *TimeseriesQuery - isSet bool -} - -// Get returns the associated value. -func (v NullableTimeseriesQuery) Get() *TimeseriesQuery { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTimeseriesQuery) Set(val *TimeseriesQuery) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTimeseriesQuery) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableTimeseriesQuery) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTimeseriesQuery initializes the struct as if Set has been called. -func NewNullableTimeseriesQuery(val *TimeseriesQuery) *NullableTimeseriesQuery { - return &NullableTimeseriesQuery{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTimeseriesQuery) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTimeseriesQuery) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_response.go index 8d052b2e5..82f622dfd 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -119,18 +119,12 @@ func (o TimeseriesResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TimeseriesResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *TimeseriesResponseAttributes `json:"attributes,omitempty"` Type *TimeseriesFormulaResponseType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -138,26 +132,25 @@ func (o *TimeseriesResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_response_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_response_attributes.go index abeffba24..06e0b3da7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_response_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_response_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o TimeseriesResponseAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TimeseriesResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Series []TimeseriesResponseSeries `json:"series,omitempty"` Times []int64 `json:"times,omitempty"` Values [][]*float64 `json:"values,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *TimeseriesResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { o.Series = all.Series o.Times = all.Times o.Values = all.Values + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_response_series.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_response_series.go index 0e3a9a90d..d7e55d8b2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_response_series.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_timeseries_response_series.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -151,19 +151,13 @@ func (o TimeseriesResponseSeries) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TimeseriesResponseSeries) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { GroupTags []string `json:"group_tags,omitempty"` QueryIndex *int32 `json:"query_index,omitempty"` Unit []Unit `json:"unit,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -174,6 +168,7 @@ func (o *TimeseriesResponseSeries) UnmarshalJSON(bytes []byte) (err error) { o.GroupTags = all.GroupTags o.QueryIndex = all.QueryIndex o.Unit = all.Unit + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_unit.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_unit.go index 9b6e42e2c..4ef3b0e33 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_unit.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_unit.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -214,7 +214,6 @@ func (o Unit) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Unit) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Family *string `json:"family,omitempty"` Name *string `json:"name,omitempty"` @@ -223,12 +222,7 @@ func (o *Unit) UnmarshalJSON(bytes []byte) (err error) { ShortName *string `json:"short_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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -241,6 +235,7 @@ func (o *Unit) UnmarshalJSON(bytes []byte) (err error) { o.Plural = all.Plural o.ScaleFactor = all.ScaleFactor o.ShortName = all.ShortName + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_application_security_monitoring_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_application_security_monitoring_response.go index 625007849..106c99e42 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_application_security_monitoring_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_application_security_monitoring_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageApplicationSecurityMonitoringResponse) MarshalJSON() ([]byte, error // UnmarshalJSON deserializes the given payload. func (o *UsageApplicationSecurityMonitoringResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []UsageDataObject `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageApplicationSecurityMonitoringResponse) UnmarshalJSON(bytes []byte) return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_attributes_object.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_attributes_object.go index cd4bb6903..5dbeca890 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_attributes_object.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_attributes_object.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -18,6 +18,8 @@ type UsageAttributesObject struct { ProductFamily *string `json:"product_family,omitempty"` // The organization public ID. PublicId *string `json:"public_id,omitempty"` + // The region of the Datadog instance that the organization belongs to. + Region *string `json:"region,omitempty"` // List of usage data reported for each requested hour. Timeseries []UsageTimeSeriesObject `json:"timeseries,omitempty"` // Usage type that is being measured. @@ -128,6 +130,34 @@ func (o *UsageAttributesObject) SetPublicId(v string) { o.PublicId = &v } +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *UsageAttributesObject) GetRegion() string { + if o == nil || o.Region == nil { + var ret string + return ret + } + return *o.Region +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributesObject) GetRegionOk() (*string, bool) { + if o == nil || o.Region == nil { + return nil, false + } + return o.Region, true +} + +// HasRegion returns a boolean if a field has been set. +func (o *UsageAttributesObject) HasRegion() bool { + return o != nil && o.Region != nil +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *UsageAttributesObject) SetRegion(v string) { + o.Region = &v +} + // GetTimeseries returns the Timeseries field value if set, zero value otherwise. func (o *UsageAttributesObject) GetTimeseries() []UsageTimeSeriesObject { if o == nil || o.Timeseries == nil { @@ -199,6 +229,9 @@ func (o UsageAttributesObject) MarshalJSON() ([]byte, error) { if o.PublicId != nil { toSerialize["public_id"] = o.PublicId } + if o.Region != nil { + toSerialize["region"] = o.Region + } if o.Timeseries != nil { toSerialize["timeseries"] = o.Timeseries } @@ -214,44 +247,43 @@ func (o UsageAttributesObject) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageAttributesObject) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { OrgName *string `json:"org_name,omitempty"` ProductFamily *string `json:"product_family,omitempty"` PublicId *string `json:"public_id,omitempty"` + Region *string `json:"region,omitempty"` Timeseries []UsageTimeSeriesObject `json:"timeseries,omitempty"` UsageType *HourlyUsageType `json:"usage_type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"org_name", "product_family", "public_id", "timeseries", "usage_type"}) + datadog.DeleteKeys(additionalProperties, &[]string{"org_name", "product_family", "public_id", "region", "timeseries", "usage_type"}) } else { return err } - if v := all.UsageType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false o.OrgName = all.OrgName o.ProductFamily = all.ProductFamily o.PublicId = all.PublicId + o.Region = all.Region o.Timeseries = all.Timeseries - o.UsageType = all.UsageType + if all.UsageType != nil && !all.UsageType.IsValid() { + hasInvalidField = true + } else { + o.UsageType = all.UsageType + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_data_object.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_data_object.go index f756aa2a9..46f8266b6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_data_object.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_data_object.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -152,19 +152,13 @@ func (o UsageDataObject) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageDataObject) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *UsageAttributesObject `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Type *UsageTimeSeriesType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -172,27 +166,26 @@ func (o *UsageDataObject) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_lambda_traced_invocations_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_lambda_traced_invocations_response.go index 1c5991c26..82cd8e1c9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_lambda_traced_invocations_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_lambda_traced_invocations_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageLambdaTracedInvocationsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageLambdaTracedInvocationsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []UsageDataObject `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageLambdaTracedInvocationsResponse) UnmarshalJSON(bytes []byte) (err return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_observability_pipelines_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_observability_pipelines_response.go index b56efb084..57b79a3a3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_observability_pipelines_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_observability_pipelines_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UsageObservabilityPipelinesResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageObservabilityPipelinesResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []UsageDataObject `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UsageObservabilityPipelinesResponse) UnmarshalJSON(bytes []byte) (err e return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_time_series_object.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_time_series_object.go index e9c15d00a..590283b01 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_time_series_object.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_time_series_object.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -131,18 +132,12 @@ func (o UsageTimeSeriesObject) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsageTimeSeriesObject) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Timestamp *time.Time `json:"timestamp,omitempty"` Value datadog.NullableInt64 `json:"value,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -152,6 +147,7 @@ func (o *UsageTimeSeriesObject) UnmarshalJSON(bytes []byte) (err error) { } o.Timestamp = all.Timestamp o.Value = all.Value + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_time_series_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_time_series_type.go index 629762714..f0a681518 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_time_series_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_usage_time_series_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // UsageTimeSeriesType Type of usage data. @@ -61,47 +62,3 @@ func (v UsageTimeSeriesType) IsValid() bool { func (v UsageTimeSeriesType) Ptr() *UsageTimeSeriesType { return &v } - -// NullableUsageTimeSeriesType handles when a null is used for UsageTimeSeriesType. -type NullableUsageTimeSeriesType struct { - value *UsageTimeSeriesType - isSet bool -} - -// Get returns the associated value. -func (v NullableUsageTimeSeriesType) Get() *UsageTimeSeriesType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableUsageTimeSeriesType) Set(val *UsageTimeSeriesType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableUsageTimeSeriesType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableUsageTimeSeriesType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableUsageTimeSeriesType initializes the struct as if Set has been called. -func NewNullableUsageTimeSeriesType(val *UsageTimeSeriesType) *NullableUsageTimeSeriesType { - return &NullableUsageTimeSeriesType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableUsageTimeSeriesType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableUsageTimeSeriesType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user.go index 9ac7ad95b..4998c951d 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -185,7 +185,6 @@ func (o User) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *User) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *UserAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` @@ -193,12 +192,7 @@ func (o *User) UnmarshalJSON(bytes []byte) (err error) { Type *UsersType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -206,35 +200,30 @@ func (o *User) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = all.Type + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_attributes.go index 6eb47fa12..a8134a7e2 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -443,7 +444,6 @@ func (o UserAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CreatedAt *time.Time `json:"created_at,omitempty"` Disabled *bool `json:"disabled,omitempty"` @@ -458,12 +458,7 @@ func (o *UserAttributes) UnmarshalJSON(bytes []byte) (err error) { Verified *bool `json:"verified,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -482,6 +477,7 @@ func (o *UserAttributes) UnmarshalJSON(bytes []byte) (err error) { o.Status = all.Status o.Title = all.Title o.Verified = all.Verified + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_create_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_create_attributes.go index 81c1e2cdf..7ea6368f0 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_create_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_create_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -143,19 +144,13 @@ func (o UserCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Email *string `json:"email"` Name *string `json:"name,omitempty"` Title *string `json:"title,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Email == nil { return fmt.Errorf("required field email missing") @@ -169,6 +164,7 @@ func (o *UserCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { o.Email = *all.Email o.Name = all.Name o.Title = all.Title + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_create_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_create_data.go index 1ae679113..ee6647cfa 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_create_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_create_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -139,19 +140,13 @@ func (o UserCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *UserCreateAttributes `json:"attributes"` Relationships *UserRelationships `json:"relationships,omitempty"` Type *UsersType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -165,34 +160,29 @@ func (o *UserCreateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_create_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_create_request.go index a006b1235..e6198f2d6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_create_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_create_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o UserCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *UserCreateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *UserCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitation_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitation_data.go index 5c3c56a85..f566bd55c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitation_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitation_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -106,18 +107,12 @@ func (o UserInvitationData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserInvitationData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Relationships *UserInvitationRelationships `json:"relationships"` Type *UserInvitationsType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Relationships == nil { return fmt.Errorf("required field relationships missing") @@ -131,26 +126,25 @@ func (o *UserInvitationData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = *all.Relationships - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitation_data_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitation_data_attributes.go index 03c687130..01ce4ee5f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitation_data_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitation_data_attributes.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "time" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -190,7 +191,6 @@ func (o UserInvitationDataAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserInvitationDataAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { CreatedAt *time.Time `json:"created_at,omitempty"` ExpiresAt *time.Time `json:"expires_at,omitempty"` @@ -198,12 +198,7 @@ func (o *UserInvitationDataAttributes) UnmarshalJSON(bytes []byte) (err error) { Uuid *string `json:"uuid,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -215,6 +210,7 @@ func (o *UserInvitationDataAttributes) UnmarshalJSON(bytes []byte) (err error) { o.ExpiresAt = all.ExpiresAt o.InviteType = all.InviteType o.Uuid = all.Uuid + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitation_relationships.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitation_relationships.go index 820d7c9d7..a71991033 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitation_relationships.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitation_relationships.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o UserInvitationRelationships) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserInvitationRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { User *RelationshipToUser `json:"user"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.User == nil { return fmt.Errorf("required field user missing") @@ -98,17 +93,20 @@ func (o *UserInvitationRelationships) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.User.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.User = *all.User + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitation_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitation_response.go index 7060e73d3..cf13ea263 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitation_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitation_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UserInvitationResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserInvitationResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *UserInvitationResponseData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *UserInvitationResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitation_response_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitation_response_data.go index de39bea6c..9d6445c89 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitation_response_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitation_response_data.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -16,6 +16,8 @@ type UserInvitationResponseData struct { Attributes *UserInvitationDataAttributes `json:"attributes,omitempty"` // ID of the user invitation. Id *string `json:"id,omitempty"` + // Relationships data for user invitation. + Relationships *UserInvitationRelationships `json:"relationships,omitempty"` // User invitations type. Type *UserInvitationsType `json:"type,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct @@ -100,6 +102,34 @@ func (o *UserInvitationResponseData) SetId(v string) { o.Id = &v } +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *UserInvitationResponseData) GetRelationships() UserInvitationRelationships { + if o == nil || o.Relationships == nil { + var ret UserInvitationRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserInvitationResponseData) GetRelationshipsOk() (*UserInvitationRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *UserInvitationResponseData) HasRelationships() bool { + return o != nil && o.Relationships != nil +} + +// SetRelationships gets a reference to the given UserInvitationRelationships and assigns it to the Relationships field. +func (o *UserInvitationResponseData) SetRelationships(v UserInvitationRelationships) { + o.Relationships = &v +} + // GetType returns the Type field value if set, zero value otherwise. func (o *UserInvitationResponseData) GetType() UserInvitationsType { if o == nil || o.Type == nil { @@ -140,6 +170,9 @@ func (o UserInvitationResponseData) MarshalJSON() ([]byte, error) { if o.Id != nil { toSerialize["id"] = o.Id } + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } if o.Type != nil { toSerialize["type"] = o.Type } @@ -152,47 +185,45 @@ func (o UserInvitationResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserInvitationResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { - Attributes *UserInvitationDataAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Type *UserInvitationsType `json:"type,omitempty"` + Attributes *UserInvitationDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Relationships *UserInvitationRelationships `json:"relationships,omitempty"` + Type *UserInvitationsType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) } else { return err } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = all.Relationships + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitations_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitations_request.go index 54192d01f..ca60cf7d8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitations_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitations_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o UserInvitationsRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserInvitationsRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *[]UserInvitationData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -99,6 +94,7 @@ func (o *UserInvitationsRequest) UnmarshalJSON(bytes []byte) (err error) { return err } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitations_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitations_response.go index e86fce031..1decbd112 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitations_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitations_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UserInvitationsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserInvitationsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []UserInvitationResponseData `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UserInvitationsResponse) UnmarshalJSON(bytes []byte) (err error) { return err } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitations_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitations_type.go index fcfff9a11..610082f3f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitations_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_invitations_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // UserInvitationsType User invitations type. @@ -61,47 +62,3 @@ func (v UserInvitationsType) IsValid() bool { func (v UserInvitationsType) Ptr() *UserInvitationsType { return &v } - -// NullableUserInvitationsType handles when a null is used for UserInvitationsType. -type NullableUserInvitationsType struct { - value *UserInvitationsType - isSet bool -} - -// Get returns the associated value. -func (v NullableUserInvitationsType) Get() *UserInvitationsType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableUserInvitationsType) Set(val *UserInvitationsType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableUserInvitationsType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableUserInvitationsType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableUserInvitationsType initializes the struct as if Set has been called. -func NewNullableUserInvitationsType(val *UserInvitationsType) *NullableUserInvitationsType { - return &NullableUserInvitationsType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableUserInvitationsType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableUserInvitationsType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_relationships.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_relationships.go index caac51b8a..6f2461dca 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_relationships.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_relationships.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UserRelationships) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Roles *RelationshipToRoles `json:"roles,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *UserRelationships) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Roles != nil && all.Roles.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Roles = all.Roles + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_response.go index 4b8344865..25c052fc0 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -115,18 +115,12 @@ func (o UserResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *User `json:"data,omitempty"` Included []UserResponseIncludedItem `json:"included,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -134,18 +128,21 @@ func (o *UserResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data o.Included = all.Included + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_response_included_item.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_response_included_item.go index 5054a52f6..b25e4c2b5 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_response_included_item.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_response_included_item.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" ) // UserResponseIncludedItem - An object related to a user. @@ -135,53 +135,3 @@ func (obj *UserResponseIncludedItem) GetActualInstance() interface{} { // all schemas are nil return nil } - -// NullableUserResponseIncludedItem handles when a null is used for UserResponseIncludedItem. -type NullableUserResponseIncludedItem struct { - value *UserResponseIncludedItem - isSet bool -} - -// Get returns the associated value. -func (v NullableUserResponseIncludedItem) Get() *UserResponseIncludedItem { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableUserResponseIncludedItem) Set(val *UserResponseIncludedItem) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableUserResponseIncludedItem) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableUserResponseIncludedItem) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableUserResponseIncludedItem initializes the struct as if Set has been called. -func NewNullableUserResponseIncludedItem(val *UserResponseIncludedItem) *NullableUserResponseIncludedItem { - return &NullableUserResponseIncludedItem{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableUserResponseIncludedItem) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableUserResponseIncludedItem) 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/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_response_relationships.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_response_relationships.go index d184099d4..3d4040bf1 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_response_relationships.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_response_relationships.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -181,7 +181,6 @@ func (o UserResponseRelationships) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserResponseRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Org *RelationshipToOrganization `json:"org,omitempty"` OtherOrgs *RelationshipToOrganizations `json:"other_orgs,omitempty"` @@ -189,12 +188,7 @@ func (o *UserResponseRelationships) UnmarshalJSON(bytes []byte) (err error) { Roles *RelationshipToRoles `json:"roles,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -202,41 +196,32 @@ func (o *UserResponseRelationships) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Org != nil && all.Org.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Org = all.Org if all.OtherOrgs != nil && all.OtherOrgs.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.OtherOrgs = all.OtherOrgs if all.OtherUsers != nil && all.OtherUsers.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.OtherUsers = all.OtherUsers if all.Roles != nil && all.Roles.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Roles = all.Roles + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team.go index 517515a93..327f8e8a3 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -172,7 +173,6 @@ func (o UserTeam) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserTeam) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *UserTeamAttributes `json:"attributes,omitempty"` Id *string `json:"id"` @@ -180,12 +180,7 @@ func (o *UserTeam) UnmarshalJSON(bytes []byte) (err error) { Type *UserTeamType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -199,35 +194,30 @@ func (o *UserTeam) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } 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 { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_attributes.go index ca70bbf08..9495436c6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -93,17 +93,11 @@ func (o UserTeamAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserTeamAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Role NullableUserTeamRole `json:"role,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -111,18 +105,21 @@ func (o *UserTeamAttributes) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Role; v.Get() != nil && !v.Get().IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + + hasInvalidField := false + if all.Role.Get() != nil && !all.Role.Get().IsValid() { + hasInvalidField = true + } else { + o.Role = all.Role } - o.Role = all.Role + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_create.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_create.go index 3bff2e8bf..7c6d8547e 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_create.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_create.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -145,19 +146,13 @@ func (o UserTeamCreate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserTeamCreate) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *UserTeamAttributes `json:"attributes,omitempty"` Relationships *UserTeamRelationships `json:"relationships,omitempty"` Type *UserTeamType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -168,34 +163,29 @@ func (o *UserTeamCreate) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Relationships = all.Relationships - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_permission.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_permission.go index fc2065989..5e93917c6 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_permission.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_permission.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -139,19 +140,13 @@ func (o UserTeamPermission) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserTeamPermission) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *UserTeamPermissionAttributes `json:"attributes,omitempty"` Id *string `json:"id"` Type *UserTeamPermissionType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Id == nil { return fmt.Errorf("required field id missing") @@ -165,27 +160,26 @@ func (o *UserTeamPermission) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_permission_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_permission_attributes.go index c7d91c78b..76ce2e4eb 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_permission_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_permission_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UserTeamPermissionAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserTeamPermissionAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Permissions interface{} `json:"permissions,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -101,6 +95,7 @@ func (o *UserTeamPermissionAttributes) UnmarshalJSON(bytes []byte) (err error) { return err } o.Permissions = all.Permissions + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_permission_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_permission_type.go index 2093170b2..589cb807a 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_permission_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_permission_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // UserTeamPermissionType User team permission type @@ -61,47 +62,3 @@ func (v UserTeamPermissionType) IsValid() bool { func (v UserTeamPermissionType) Ptr() *UserTeamPermissionType { return &v } - -// NullableUserTeamPermissionType handles when a null is used for UserTeamPermissionType. -type NullableUserTeamPermissionType struct { - value *UserTeamPermissionType - isSet bool -} - -// Get returns the associated value. -func (v NullableUserTeamPermissionType) Get() *UserTeamPermissionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableUserTeamPermissionType) Set(val *UserTeamPermissionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableUserTeamPermissionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableUserTeamPermissionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableUserTeamPermissionType initializes the struct as if Set has been called. -func NewNullableUserTeamPermissionType(val *UserTeamPermissionType) *NullableUserTeamPermissionType { - return &NullableUserTeamPermissionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableUserTeamPermissionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableUserTeamPermissionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_relationships.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_relationships.go index 956f5f0aa..9988b3ef9 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_relationships.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_relationships.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UserTeamRelationships) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserTeamRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { User *RelationshipToUserTeamUser `json:"user,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *UserTeamRelationships) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.User != nil && all.User.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.User = all.User + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_request.go index edb8f2ddb..e59d08595 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o UserTeamRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserTeamRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *UserTeamCreate `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *UserTeamRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_response.go index 23dbb2f6d..7ae9c44cd 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -82,17 +82,11 @@ func (o UserTeamResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserTeamResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *UserTeam `json:"data,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -100,17 +94,20 @@ func (o *UserTeamResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_role.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_role.go index 245069fdc..80721bc9f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_role.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_role.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // UserTeamRole The user's role within the team diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_type.go index b6cb7f556..ba4df941f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // UserTeamType Team membership type @@ -61,47 +62,3 @@ func (v UserTeamType) IsValid() bool { func (v UserTeamType) Ptr() *UserTeamType { return &v } - -// NullableUserTeamType handles when a null is used for UserTeamType. -type NullableUserTeamType struct { - value *UserTeamType - isSet bool -} - -// Get returns the associated value. -func (v NullableUserTeamType) Get() *UserTeamType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableUserTeamType) Set(val *UserTeamType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableUserTeamType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableUserTeamType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableUserTeamType initializes the struct as if Set has been called. -func NewNullableUserTeamType(val *UserTeamType) *NullableUserTeamType { - return &NullableUserTeamType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableUserTeamType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableUserTeamType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_update.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_update.go index c49b55a87..236e1ea61 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_update.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_update.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -112,18 +113,12 @@ func (o UserTeamUpdate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserTeamUpdate) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *UserTeamAttributes `json:"attributes,omitempty"` Type *UserTeamType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Type == nil { return fmt.Errorf("required field type missing") @@ -134,26 +129,25 @@ func (o *UserTeamUpdate) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = all.Attributes - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_update_request.go index 4d26935a6..e7b566a07 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o UserTeamUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserTeamUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *UserTeamUpdate `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *UserTeamUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_user_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_user_type.go index d699d9850..b76f7178f 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_user_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_team_user_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // UserTeamUserType User team user type @@ -61,47 +62,3 @@ func (v UserTeamUserType) IsValid() bool { func (v UserTeamUserType) Ptr() *UserTeamUserType { return &v } - -// NullableUserTeamUserType handles when a null is used for UserTeamUserType. -type NullableUserTeamUserType struct { - value *UserTeamUserType - isSet bool -} - -// Get returns the associated value. -func (v NullableUserTeamUserType) Get() *UserTeamUserType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableUserTeamUserType) Set(val *UserTeamUserType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableUserTeamUserType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableUserTeamUserType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableUserTeamUserType initializes the struct as if Set has been called. -func NewNullableUserTeamUserType(val *UserTeamUserType) *NullableUserTeamUserType { - return &NullableUserTeamUserType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableUserTeamUserType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableUserTeamUserType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_teams_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_teams_response.go index 6a56cb052..691e876c7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_teams_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_teams_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -14,6 +14,10 @@ import ( type UserTeamsResponse struct { // Team memberships response data Data []UserTeam `json:"data,omitempty"` + // Teams response links. + Links *TeamsResponseLinks `json:"links,omitempty"` + // Teams response metadata. + Meta *TeamsResponseMeta `json:"meta,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{} @@ -64,6 +68,62 @@ func (o *UserTeamsResponse) SetData(v []UserTeam) { o.Data = v } +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *UserTeamsResponse) GetLinks() TeamsResponseLinks { + if o == nil || o.Links == nil { + var ret TeamsResponseLinks + return ret + } + return *o.Links +} + +// GetLinksOk returns a tuple with the Links field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserTeamsResponse) GetLinksOk() (*TeamsResponseLinks, bool) { + if o == nil || o.Links == nil { + return nil, false + } + return o.Links, true +} + +// HasLinks returns a boolean if a field has been set. +func (o *UserTeamsResponse) HasLinks() bool { + return o != nil && o.Links != nil +} + +// SetLinks gets a reference to the given TeamsResponseLinks and assigns it to the Links field. +func (o *UserTeamsResponse) SetLinks(v TeamsResponseLinks) { + o.Links = &v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *UserTeamsResponse) GetMeta() TeamsResponseMeta { + if o == nil || o.Meta == nil { + var ret TeamsResponseMeta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserTeamsResponse) GetMetaOk() (*TeamsResponseMeta, bool) { + if o == nil || o.Meta == nil { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *UserTeamsResponse) HasMeta() bool { + return o != nil && o.Meta != nil +} + +// SetMeta gets a reference to the given TeamsResponseMeta and assigns it to the Meta field. +func (o *UserTeamsResponse) SetMeta(v TeamsResponseMeta) { + o.Meta = &v +} + // MarshalJSON serializes the struct using spec logic. func (o UserTeamsResponse) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -73,6 +133,12 @@ func (o UserTeamsResponse) MarshalJSON() ([]byte, error) { if o.Data != nil { toSerialize["data"] = o.Data } + if o.Links != nil { + toSerialize["links"] = o.Links + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -82,28 +148,39 @@ func (o UserTeamsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserTeamsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { - Data []UserTeam `json:"data,omitempty"` + Data []UserTeam `json:"data,omitempty"` + Links *TeamsResponseLinks `json:"links,omitempty"` + Meta *TeamsResponseMeta `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + datadog.DeleteKeys(additionalProperties, &[]string{"data", "links", "meta"}) } else { return err } + + hasInvalidField := false o.Data = all.Data + if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Links = all.Links + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_update_attributes.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_update_attributes.go index be14b65cb..c5337bce7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_update_attributes.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_update_attributes.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o UserUpdateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Disabled *bool `json:"disabled,omitempty"` 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 + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -171,6 +165,7 @@ func (o *UserUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { o.Disabled = all.Disabled o.Email = all.Email o.Name = all.Name + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_update_data.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_update_data.go index 694802b0b..29cf8abd8 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_update_data.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_update_data.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -133,19 +134,13 @@ func (o UserUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Attributes *UserUpdateAttributes `json:"attributes"` Id *string `json:"id"` Type *UsersType `json:"type"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Attributes == nil { return fmt.Errorf("required field attributes missing") @@ -162,27 +157,26 @@ func (o *UserUpdateData) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } + + hasInvalidField := false if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Attributes = *all.Attributes o.Id = *all.Id - o.Type = *all.Type + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_update_request.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_update_request.go index 6d34df348..feccb799c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_update_request.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_user_update_request.go @@ -5,9 +5,10 @@ package datadogV2 import ( - "encoding/json" "fmt" + "github.com/goccy/go-json" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -77,17 +78,11 @@ func (o UserUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data *UserUpdateData `json:"data"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } if all.Data == nil { return fmt.Errorf("required field data missing") @@ -98,17 +93,20 @@ func (o *UserUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Data = *all.Data + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_users_response.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_users_response.go index 696fca27c..49ec45773 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_users_response.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_users_response.go @@ -5,7 +5,7 @@ package datadogV2 import ( - "encoding/json" + "github.com/goccy/go-json" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -148,19 +148,13 @@ func (o UsersResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UsersResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} all := struct { Data []User `json:"data,omitempty"` Included []UserResponseIncludedItem `json:"included,omitempty"` Meta *ResponseMetaAttributes `json:"meta,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil + return json.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { @@ -168,19 +162,22 @@ func (o *UsersResponse) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false o.Data = all.Data o.Included = all.Included if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw + hasInvalidField = true } o.Meta = all.Meta + if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return json.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_users_type.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_users_type.go index bb816dca8..407dd6a39 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_users_type.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/model_users_type.go @@ -5,8 +5,9 @@ package datadogV2 import ( - "encoding/json" "fmt" + + "github.com/goccy/go-json" ) // UsersType Users resource type. @@ -61,47 +62,3 @@ func (v UsersType) IsValid() bool { func (v UsersType) Ptr() *UsersType { return &v } - -// NullableUsersType handles when a null is used for UsersType. -type NullableUsersType struct { - value *UsersType - isSet bool -} - -// Get returns the associated value. -func (v NullableUsersType) Get() *UsersType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableUsersType) Set(val *UsersType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableUsersType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableUsersType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableUsersType initializes the struct as if Set has been called. -func NewNullableUsersType(val *UsersType) *NullableUsersType { - return &NullableUsersType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableUsersType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableUsersType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/doc.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/doc.go index fcd3ec125..0e09c9ba7 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/doc.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/doc.go @@ -4,7 +4,7 @@ // // Requirements // -// • Go 1.17+ +// • Go 1.19+ // // Layout // diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/run-tests.sh b/vendor/github.com/DataDog/datadog-api-client-go/v2/run-tests.sh index 4a818057b..ea1614247 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/run-tests.sh +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/run-tests.sh @@ -24,7 +24,7 @@ fi # unfortunately there's no better way to fix this than change directory # this might get solved in Go 1.14: https://github.com/golang/go/issues/30515 cd "$(mktemp -d)" -GO111MODULE=on go install honnef.co/go/tools/cmd/staticcheck@v0.3.3 +GO111MODULE=on go install honnef.co/go/tools/cmd/staticcheck@v0.4.3 GO111MODULE=on go install gotest.tools/gotestsum@latest cd - diff --git a/vendor/github.com/DataDog/datadog-api-client-go/v2/version.go b/vendor/github.com/DataDog/datadog-api-client-go/v2/version.go index ead3c63db..78e2b587c 100644 --- a/vendor/github.com/DataDog/datadog-api-client-go/v2/version.go +++ b/vendor/github.com/DataDog/datadog-api-client-go/v2/version.go @@ -1,4 +1,4 @@ package client // Version used in User-Agent header. -const Version = "2.14.0" +const Version = "2.16.0" diff --git a/vendor/github.com/IBM/sarama/.pre-commit-config.yaml b/vendor/github.com/IBM/sarama/.pre-commit-config.yaml new file mode 100644 index 000000000..d7271ee2e --- /dev/null +++ b/vendor/github.com/IBM/sarama/.pre-commit-config.yaml @@ -0,0 +1,33 @@ +fail_fast: false +default_install_hook_types: [pre-commit, commit-msg] +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: check-merge-conflict + - id: check-yaml + - id: end-of-file-fixer + - id: fix-byte-order-marker + - id: mixed-line-ending + - id: trailing-whitespace + - repo: local + hooks: + - id: conventional-commit-msg-validation + name: commit message conventional validation + language: pygrep + entry: '^(?:fixup! )?(breaking|build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\w\-\.]+\))?(!)?: ([\w `])+([\s\S]*)' + args: [--multiline, --negate] + stages: [commit-msg] + - id: commit-msg-needs-to-be-signed-off + name: commit message needs to be signed off + language: pygrep + entry: "^Signed-off-by:" + args: [--multiline, --negate] + stages: [commit-msg] + - id: gofmt + name: gofmt + description: Format files with gofmt. + entry: gofmt -l + language: golang + files: \.go$ + args: [] diff --git a/vendor/github.com/IBM/sarama/CHANGELOG.md b/vendor/github.com/IBM/sarama/CHANGELOG.md index 3737fc327..10f3ebf21 100644 --- a/vendor/github.com/IBM/sarama/CHANGELOG.md +++ b/vendor/github.com/IBM/sarama/CHANGELOG.md @@ -1,5 +1,38 @@ # Changelog +## Version 1.40.1 (2023-07-27) + +## What's Changed +### :tada: New Features / Improvements +* Use buffer pools for decompression by @ronanh in https://github.com/IBM/sarama/pull/2484 +* feat: support for Kerberos authentication with a credentials cache. by @mrogaski in https://github.com/IBM/sarama/pull/2457 +### :bug: Fixes +* Fix some retry issues by @hindessm in https://github.com/IBM/sarama/pull/2517 +* fix: admin retry logic by @hindessm in https://github.com/IBM/sarama/pull/2519 +* Add some retry logic to more admin client functions by @hindessm in https://github.com/IBM/sarama/pull/2520 +* fix: concurrent issue on updateMetadataMs by @napallday in https://github.com/IBM/sarama/pull/2522 +* fix(test): allow testing of skipped test without IsTransactional panic by @hindessm in https://github.com/IBM/sarama/pull/2525 +### :package: Dependency updates +* chore(deps): bump the golang-org-x group with 2 updates by @dependabot in https://github.com/IBM/sarama/pull/2509 +* chore(deps): bump github.com/klauspost/compress from 1.15.14 to 1.16.6 by @dependabot in https://github.com/IBM/sarama/pull/2513 +* chore(deps): bump github.com/stretchr/testify from 1.8.1 to 1.8.3 by @dependabot in https://github.com/IBM/sarama/pull/2512 +### :wrench: Maintenance +* chore(ci): migrate probot-stale to actions/stale by @dnwe in https://github.com/IBM/sarama/pull/2496 +* chore(ci): bump golangci version, cleanup, depguard config by @EladLeev in https://github.com/IBM/sarama/pull/2504 +* Clean up some typos and docs/help mistakes by @hindessm in https://github.com/IBM/sarama/pull/2514 +### :heavy_plus_sign: Other Changes +* chore(ci): add simple apidiff workflow by @dnwe in https://github.com/IBM/sarama/pull/2497 +* chore(ci): bump actions/setup-go from 3 to 4 by @dependabot in https://github.com/IBM/sarama/pull/2508 +* fix(comments): PauseAll and ResumeAll by @napallday in https://github.com/IBM/sarama/pull/2523 + +## New Contributors +* @EladLeev made their first contribution in https://github.com/IBM/sarama/pull/2504 +* @hindessm made their first contribution in https://github.com/IBM/sarama/pull/2514 +* @ronanh made their first contribution in https://github.com/IBM/sarama/pull/2484 +* @mrogaski made their first contribution in https://github.com/IBM/sarama/pull/2457 + +**Full Changelog**: https://github.com/IBM/sarama/compare/v1.40.0...v1.40.1 + ## Version 1.40.0 (2023-07-17) ## What's Changed diff --git a/vendor/github.com/IBM/sarama/CONTRIBUTING.md b/vendor/github.com/IBM/sarama/CONTRIBUTING.md index 173b2a384..bb88127c0 100644 --- a/vendor/github.com/IBM/sarama/CONTRIBUTING.md +++ b/vendor/github.com/IBM/sarama/CONTRIBUTING.md @@ -1,11 +1,28 @@ -## Contributing +# Contributing [fork]: https://github.com/IBM/sarama/fork [pr]: https://github.com/IBM/sarama/compare [released]: https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license Hi there! We are thrilled that you would like to contribute to Sarama. -Your help is essential for keeping it great. +Contributions are always welcome, both reporting issues and submitting pull requests! + +## Reporting issues + +Please make sure to include any potentially useful information in the issue, so we can pinpoint the issue faster without going back and forth. + +- What SHA of Sarama are you running? If this is not the latest SHA on the main branch, please try if the problem persists with the latest version. +- You can set `sarama.Logger` to a [log.Logger](http://golang.org/pkg/log/#Logger) instance to capture debug output. Please include it in your issue description. +- Also look at the logs of the Kafka broker you are connected to. If you see anything out of the ordinary, please include it. + +Also, please include the following information about your environment, so we can help you faster: + +- What version of Kafka are you using? +- What version of Go are you using? +- What are the values of your Producer/Consumer/Client configuration? + + +## Contributing a change Contributions to this project are [released][released] to the public under the project's [opensource license](LICENSE.md). By contributing to this project you agree to the [Developer Certificate of Origin](https://developercertificate.org/) (DCO). @@ -19,12 +36,26 @@ feat: this is my commit message Signed-off-by: Random J Developer ``` -Git even has a `-s` command line option to append this automatically to your commit message: +Git even has a `-s` command line option to append this automatically to your +commit message: ``` $ git commit -s -m 'This is my commit message' ``` +Because this library is in production use by many people and applications, we code review all additions. +To make the review process go as smooth as possible, please consider the following. + +- If you plan to work on something major, please open an issue to discuss the design first. +- Don't break backwards compatibility. If you really have to, open an issue to discuss this first. +- Make sure to use the `go fmt` command to format your code according to the standards. Even better, set up your editor to do this for you when saving. +- Run [go vet](https://golang.org/cmd/vet/) to detect any suspicious constructs in your code that could be bugs. +- Explicitly handle all error return values. If you really want to ignore an error value, you can assign it to `_`. You can use [errcheck](https://github.com/kisielk/errcheck) to verify whether you have handled all errors. +- You may also want to run [golint](https://github.com/golang/lint) as well to detect style problems. +- Add tests that cover the changes you made. Make sure to run `go test` with the `-race` argument to test for race conditions. +- Make sure your code is supported by all the Go versions we support. + You can rely on GitHub Actions for testing older Go versions. + ## Submitting a pull request 0. [Fork][fork] and clone the repository diff --git a/vendor/github.com/IBM/sarama/Dockerfile.kafka b/vendor/github.com/IBM/sarama/Dockerfile.kafka index 90fdb1669..b11d899b9 100644 --- a/vendor/github.com/IBM/sarama/Dockerfile.kafka +++ b/vendor/github.com/IBM/sarama/Dockerfile.kafka @@ -16,12 +16,28 @@ RUN cd /etc/java/java-11-openjdk/*/conf/security \ && echo 'networkaddress.cache.ttl=0' >> java.security \ && echo 'networkaddress.cache.negative.ttl=0' >> java.security +ARG SCALA_VERSION="2.13" +ARG KAFKA_VERSION="3.5.1" + # https://github.com/apache/kafka/blob/53eeaad946cd053e9eb1a762972d4efeacb8e4fc/tests/docker/Dockerfile#L65-L69 ARG KAFKA_MIRROR="https://s3-us-west-2.amazonaws.com/kafka-packages" -RUN mkdir -p "/opt/kafka-2.8.2" && chmod a+rw /opt/kafka-2.8.2 && curl -s "$KAFKA_MIRROR/kafka_2.12-2.8.2.tgz" | tar xz --strip-components=1 -C "/opt/kafka-2.8.2" -RUN mkdir -p "/opt/kafka-3.1.2" && chmod a+rw /opt/kafka-3.1.2 && curl -s "$KAFKA_MIRROR/kafka_2.12-3.1.2.tgz" | tar xz --strip-components=1 -C "/opt/kafka-3.1.2" -RUN mkdir -p "/opt/kafka-3.2.3" && chmod a+rw /opt/kafka-3.2.3 && curl -s "$KAFKA_MIRROR/kafka_2.12-3.2.3.tgz" | tar xz --strip-components=1 -C "/opt/kafka-3.2.3" -RUN mkdir -p "/opt/kafka-3.3.2" && chmod a+rw /opt/kafka-3.3.2 && curl -s "$KAFKA_MIRROR/kafka_2.12-3.3.2.tgz" | tar xz --strip-components=1 -C "/opt/kafka-3.3.2" +RUN mkdir -p "/opt/kafka-${KAFKA_VERSION}" \ + && chmod a+rw "/opt/kafka-${KAFKA_VERSION}" \ + && curl -s "$KAFKA_MIRROR/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz" | tar xz --strip-components=1 -C "/opt/kafka-${KAFKA_VERSION}" + +# older kafka versions depend upon jaxb-api being bundled with the JDK, but it +# was removed from Java 11 so work around that by including it in the kafka +# libs dir regardless +RUN cd /tmp \ + && curl -sLO "https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api/2.3.0/jaxb-api-2.3.0.jar" \ + && for DIR in /opt/kafka-*; do cp -v jaxb-api-2.3.0.jar $DIR/libs/ ; done \ + && rm -f jaxb-api-2.3.0.jar + +WORKDIR /opt/kafka-${KAFKA_VERSION} + +ENV JAVA_MAJOR_VERSION=11 + +RUN sed -e "s/JAVA_MAJOR_VERSION=.*/JAVA_MAJOR_VERSION=${JAVA_MAJOR_VERSION}/" -i"" ./bin/kafka-run-class.sh COPY entrypoint.sh / diff --git a/vendor/github.com/IBM/sarama/README.md b/vendor/github.com/IBM/sarama/README.md index a1f6137e5..1b233847e 100644 --- a/vendor/github.com/IBM/sarama/README.md +++ b/vendor/github.com/IBM/sarama/README.md @@ -25,7 +25,7 @@ A changelog is available [here](CHANGELOG.md). ## Contributing -- Get started by checking our [contribution guidelines](https://github.com/IBM/sarama/blob/main/.github/CONTRIBUTING.md). +- Get started by checking our [contribution guidelines](https://github.com/IBM/sarama/blob/main/CONTRIBUTING.md). - Read the [Sarama wiki](https://github.com/IBM/sarama/wiki) for more technical and design details. - The [Kafka Protocol Specification](https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol) contains a wealth of useful information. - For more general issues, there is [a google group](https://groups.google.com/forum/#!forum/kafka-clients) for Kafka client developers. diff --git a/vendor/github.com/IBM/sarama/acl_create_request.go b/vendor/github.com/IBM/sarama/acl_create_request.go index 449102f74..e581c984a 100644 --- a/vendor/github.com/IBM/sarama/acl_create_request.go +++ b/vendor/github.com/IBM/sarama/acl_create_request.go @@ -51,6 +51,10 @@ func (c *CreateAclsRequest) headerVersion() int16 { return 1 } +func (c *CreateAclsRequest) isValidVersion() bool { + return c.Version >= 0 && c.Version <= 1 +} + func (c *CreateAclsRequest) requiredVersion() KafkaVersion { switch c.Version { case 1: diff --git a/vendor/github.com/IBM/sarama/acl_create_response.go b/vendor/github.com/IBM/sarama/acl_create_response.go index 21d6c340c..d123ba863 100644 --- a/vendor/github.com/IBM/sarama/acl_create_response.go +++ b/vendor/github.com/IBM/sarama/acl_create_response.go @@ -4,6 +4,7 @@ import "time" // CreateAclsResponse is a an acl response creation type type CreateAclsResponse struct { + Version int16 ThrottleTime time.Duration AclCreationResponses []*AclCreationResponse } @@ -52,15 +53,28 @@ func (c *CreateAclsResponse) key() int16 { } func (c *CreateAclsResponse) version() int16 { - return 0 + return c.Version } func (c *CreateAclsResponse) headerVersion() int16 { return 0 } +func (c *CreateAclsResponse) isValidVersion() bool { + return c.Version >= 0 && c.Version <= 1 +} + func (c *CreateAclsResponse) requiredVersion() KafkaVersion { - return V0_11_0_0 + switch c.Version { + case 1: + return V2_0_0_0 + default: + return V0_11_0_0 + } +} + +func (r *CreateAclsResponse) throttleTime() time.Duration { + return r.ThrottleTime } // AclCreationResponse is an acl creation response type diff --git a/vendor/github.com/IBM/sarama/acl_delete_request.go b/vendor/github.com/IBM/sarama/acl_delete_request.go index 5e5c03bc2..abeb4425e 100644 --- a/vendor/github.com/IBM/sarama/acl_delete_request.go +++ b/vendor/github.com/IBM/sarama/acl_delete_request.go @@ -52,6 +52,10 @@ func (d *DeleteAclsRequest) headerVersion() int16 { return 1 } +func (d *DeleteAclsRequest) isValidVersion() bool { + return d.Version >= 0 && d.Version <= 1 +} + func (d *DeleteAclsRequest) requiredVersion() KafkaVersion { switch d.Version { case 1: diff --git a/vendor/github.com/IBM/sarama/acl_delete_response.go b/vendor/github.com/IBM/sarama/acl_delete_response.go index cd33749d5..2e2850b32 100644 --- a/vendor/github.com/IBM/sarama/acl_delete_response.go +++ b/vendor/github.com/IBM/sarama/acl_delete_response.go @@ -60,8 +60,21 @@ func (d *DeleteAclsResponse) headerVersion() int16 { return 0 } +func (d *DeleteAclsResponse) isValidVersion() bool { + return d.Version >= 0 && d.Version <= 1 +} + func (d *DeleteAclsResponse) requiredVersion() KafkaVersion { - return V0_11_0_0 + switch d.Version { + case 1: + return V2_0_0_0 + default: + return V0_11_0_0 + } +} + +func (r *DeleteAclsResponse) throttleTime() time.Duration { + return r.ThrottleTime } // FilterResponse is a filter response type diff --git a/vendor/github.com/IBM/sarama/acl_describe_request.go b/vendor/github.com/IBM/sarama/acl_describe_request.go index 98edb6740..7d65bef14 100644 --- a/vendor/github.com/IBM/sarama/acl_describe_request.go +++ b/vendor/github.com/IBM/sarama/acl_describe_request.go @@ -29,6 +29,10 @@ func (d *DescribeAclsRequest) headerVersion() int16 { return 1 } +func (d *DescribeAclsRequest) isValidVersion() bool { + return d.Version >= 0 && d.Version <= 1 +} + func (d *DescribeAclsRequest) requiredVersion() KafkaVersion { switch d.Version { case 1: diff --git a/vendor/github.com/IBM/sarama/acl_describe_response.go b/vendor/github.com/IBM/sarama/acl_describe_response.go index 3255fd485..f89a53b66 100644 --- a/vendor/github.com/IBM/sarama/acl_describe_response.go +++ b/vendor/github.com/IBM/sarama/acl_describe_response.go @@ -81,6 +81,10 @@ func (d *DescribeAclsResponse) headerVersion() int16 { return 0 } +func (d *DescribeAclsResponse) isValidVersion() bool { + return d.Version >= 0 && d.Version <= 1 +} + func (d *DescribeAclsResponse) requiredVersion() KafkaVersion { switch d.Version { case 1: @@ -89,3 +93,7 @@ func (d *DescribeAclsResponse) requiredVersion() KafkaVersion { return V0_11_0_0 } } + +func (r *DescribeAclsResponse) throttleTime() time.Duration { + return r.ThrottleTime +} diff --git a/vendor/github.com/IBM/sarama/add_offsets_to_txn_request.go b/vendor/github.com/IBM/sarama/add_offsets_to_txn_request.go index a96af9341..6d3df9bed 100644 --- a/vendor/github.com/IBM/sarama/add_offsets_to_txn_request.go +++ b/vendor/github.com/IBM/sarama/add_offsets_to_txn_request.go @@ -2,6 +2,7 @@ package sarama // AddOffsetsToTxnRequest adds offsets to a transaction request type AddOffsetsToTxnRequest struct { + Version int16 TransactionalID string ProducerID int64 ProducerEpoch int16 @@ -45,13 +46,26 @@ func (a *AddOffsetsToTxnRequest) key() int16 { } func (a *AddOffsetsToTxnRequest) version() int16 { - return 0 + return a.Version } func (a *AddOffsetsToTxnRequest) headerVersion() int16 { return 1 } +func (a *AddOffsetsToTxnRequest) isValidVersion() bool { + return a.Version >= 0 && a.Version <= 2 +} + func (a *AddOffsetsToTxnRequest) requiredVersion() KafkaVersion { - return V0_11_0_0 + switch a.Version { + case 2: + return V2_7_0_0 + case 1: + return V2_0_0_0 + case 0: + return V0_11_0_0 + default: + return V2_7_0_0 + } } diff --git a/vendor/github.com/IBM/sarama/add_offsets_to_txn_response.go b/vendor/github.com/IBM/sarama/add_offsets_to_txn_response.go index bb61973d1..136460508 100644 --- a/vendor/github.com/IBM/sarama/add_offsets_to_txn_response.go +++ b/vendor/github.com/IBM/sarama/add_offsets_to_txn_response.go @@ -6,6 +6,7 @@ import ( // AddOffsetsToTxnResponse is a response type for adding offsets to txns type AddOffsetsToTxnResponse struct { + Version int16 ThrottleTime time.Duration Err KError } @@ -37,13 +38,30 @@ func (a *AddOffsetsToTxnResponse) key() int16 { } func (a *AddOffsetsToTxnResponse) version() int16 { - return 0 + return a.Version } func (a *AddOffsetsToTxnResponse) headerVersion() int16 { return 0 } +func (a *AddOffsetsToTxnResponse) isValidVersion() bool { + return a.Version >= 0 && a.Version <= 2 +} + func (a *AddOffsetsToTxnResponse) requiredVersion() KafkaVersion { - return V0_11_0_0 + switch a.Version { + case 2: + return V2_7_0_0 + case 1: + return V2_0_0_0 + case 0: + return V0_11_0_0 + default: + return V2_7_0_0 + } +} + +func (r *AddOffsetsToTxnResponse) throttleTime() time.Duration { + return r.ThrottleTime } diff --git a/vendor/github.com/IBM/sarama/add_partitions_to_txn_request.go b/vendor/github.com/IBM/sarama/add_partitions_to_txn_request.go index 1d6da75f5..3e2c63c64 100644 --- a/vendor/github.com/IBM/sarama/add_partitions_to_txn_request.go +++ b/vendor/github.com/IBM/sarama/add_partitions_to_txn_request.go @@ -2,6 +2,7 @@ package sarama // AddPartitionsToTxnRequest is a add partition request type AddPartitionsToTxnRequest struct { + Version int16 TransactionalID string ProducerID int64 ProducerEpoch int16 @@ -69,13 +70,24 @@ func (a *AddPartitionsToTxnRequest) key() int16 { } func (a *AddPartitionsToTxnRequest) version() int16 { - return 0 + return a.Version } func (a *AddPartitionsToTxnRequest) headerVersion() int16 { return 1 } +func (a *AddPartitionsToTxnRequest) isValidVersion() bool { + return a.Version >= 0 && a.Version <= 2 +} + func (a *AddPartitionsToTxnRequest) requiredVersion() KafkaVersion { - return V0_11_0_0 + switch a.Version { + case 2: + return V2_7_0_0 + case 1: + return V2_0_0_0 + default: + return V0_11_0_0 + } } diff --git a/vendor/github.com/IBM/sarama/add_partitions_to_txn_response.go b/vendor/github.com/IBM/sarama/add_partitions_to_txn_response.go index 098956507..8ef0a2a2c 100644 --- a/vendor/github.com/IBM/sarama/add_partitions_to_txn_response.go +++ b/vendor/github.com/IBM/sarama/add_partitions_to_txn_response.go @@ -6,6 +6,7 @@ import ( // AddPartitionsToTxnResponse is a partition errors to transaction type type AddPartitionsToTxnResponse struct { + Version int16 ThrottleTime time.Duration Errors map[string][]*PartitionError } @@ -34,6 +35,7 @@ func (a *AddPartitionsToTxnResponse) encode(pe packetEncoder) error { } func (a *AddPartitionsToTxnResponse) decode(pd packetDecoder, version int16) (err error) { + a.Version = version throttleTime, err := pd.getInt32() if err != nil { return err @@ -76,15 +78,30 @@ func (a *AddPartitionsToTxnResponse) key() int16 { } func (a *AddPartitionsToTxnResponse) version() int16 { - return 0 + return a.Version } func (a *AddPartitionsToTxnResponse) headerVersion() int16 { return 0 } +func (a *AddPartitionsToTxnResponse) isValidVersion() bool { + return a.Version >= 0 && a.Version <= 2 +} + func (a *AddPartitionsToTxnResponse) requiredVersion() KafkaVersion { - return V0_11_0_0 + switch a.Version { + case 2: + return V2_7_0_0 + case 1: + return V2_0_0_0 + default: + return V0_11_0_0 + } +} + +func (r *AddPartitionsToTxnResponse) throttleTime() time.Duration { + return r.ThrottleTime } // PartitionError is a partition error type diff --git a/vendor/github.com/IBM/sarama/admin.go b/vendor/github.com/IBM/sarama/admin.go index 29eeca1c6..ff680972a 100644 --- a/vendor/github.com/IBM/sarama/admin.go +++ b/vendor/github.com/IBM/sarama/admin.go @@ -238,11 +238,15 @@ func (ca *clusterAdmin) CreateTopic(topic string, detail *TopicDetail, validateO Timeout: ca.conf.Admin.Timeout, } - if ca.conf.Version.IsAtLeast(V0_11_0_0) { - request.Version = 1 - } - if ca.conf.Version.IsAtLeast(V1_0_0_0) { + if ca.conf.Version.IsAtLeast(V2_0_0_0) { + // Version 3 is the same as version 2 (brokers response before throttling) + request.Version = 3 + } else if ca.conf.Version.IsAtLeast(V0_11_0_0) { + // Version 2 is the same as version 1 (response has ThrottleTime) request.Version = 2 + } else if ca.conf.Version.IsAtLeast(V0_10_2_0) { + // Version 1 adds validateOnly. + request.Version = 1 } return ca.retryOnError(isErrNoController, func() error { @@ -424,7 +428,12 @@ func (ca *clusterAdmin) DeleteTopic(topic string) error { Timeout: ca.conf.Admin.Timeout, } - if ca.conf.Version.IsAtLeast(V0_11_0_0) { + // Versions 0, 1, 2, and 3 are the same. + if ca.conf.Version.IsAtLeast(V2_1_0_0) { + request.Version = 3 + } else if ca.conf.Version.IsAtLeast(V2_0_0_0) { + request.Version = 2 + } else if ca.conf.Version.IsAtLeast(V0_11_0_0) { request.Version = 1 } @@ -468,6 +477,9 @@ func (ca *clusterAdmin) CreatePartitions(topic string, count int32, assignment [ Timeout: ca.conf.Admin.Timeout, ValidateOnly: validateOnly, } + if ca.conf.Version.IsAtLeast(V2_0_0_0) { + request.Version = 1 + } return ca.retryOnError(isErrNoController, func() error { b, err := ca.Controller() @@ -605,6 +617,9 @@ func (ca *clusterAdmin) DeleteRecords(topic string, partitionOffsets map[int32]i Topics: topics, Timeout: ca.conf.Admin.Timeout, } + if ca.conf.Version.IsAtLeast(V2_0_0_0) { + request.Version = 1 + } rsp, err := broker.DeleteRecords(request) if err != nil { errs = append(errs, err) @@ -710,6 +725,9 @@ func (ca *clusterAdmin) AlterConfig(resourceType ConfigResourceType, name string Resources: resources, ValidateOnly: validateOnly, } + if ca.conf.Version.IsAtLeast(V2_0_0_0) { + request.Version = 1 + } var ( b *Broker @@ -909,8 +927,19 @@ func (ca *clusterAdmin) DescribeConsumerGroups(groups []string) (result []*Group describeReq := &DescribeGroupsRequest{ Groups: brokerGroups, } + if ca.conf.Version.IsAtLeast(V2_4_0_0) { + // Starting in version 4, the response will include group.instance.id info for members. describeReq.Version = 4 + } else if ca.conf.Version.IsAtLeast(V2_3_0_0) { + // Starting in version 3, authorized operations can be requested. + describeReq.Version = 3 + } else if ca.conf.Version.IsAtLeast(V2_0_0_0) { + // Version 2 is the same as version 0. + describeReq.Version = 2 + } else if ca.conf.Version.IsAtLeast(V1_1_0_0) { + // Version 1 is the same as version 0. + describeReq.Version = 1 } response, err := broker.DescribeGroups(describeReq) if err != nil { @@ -937,7 +966,22 @@ func (ca *clusterAdmin) ListConsumerGroups() (allGroups map[string]string, err e defer wg.Done() _ = b.Open(conf) // Ensure that broker is opened - response, err := b.ListGroups(&ListGroupsRequest{}) + request := &ListGroupsRequest{} + if ca.conf.Version.IsAtLeast(V2_6_0_0) { + // Version 4 adds the StatesFilter field (KIP-518). + request.Version = 4 + } else if ca.conf.Version.IsAtLeast(V2_4_0_0) { + // Version 3 is the first flexible version. + request.Version = 3 + } else if ca.conf.Version.IsAtLeast(V2_0_0_0) { + // Version 2 is the same as version 0. + request.Version = 2 + } else if ca.conf.Version.IsAtLeast(V0_11_0_0) { + // Version 1 is the same as version 0. + request.Version = 1 + } + + response, err := b.ListGroups(request) if err != nil { errChan <- err return @@ -978,9 +1022,28 @@ func (ca *clusterAdmin) ListConsumerGroupOffsets(group string, topicPartitions m partitions: topicPartitions, } - if ca.conf.Version.IsAtLeast(V0_10_2_0) { + if ca.conf.Version.IsAtLeast(V2_5_0_0) { + // Version 7 is adding the require stable flag. + request.Version = 7 + } else if ca.conf.Version.IsAtLeast(V2_4_0_0) { + // Version 6 is the first flexible version. + request.Version = 6 + } else if ca.conf.Version.IsAtLeast(V2_1_0_0) { + // Version 3, 4, and 5 are the same as version 2. + request.Version = 5 + } else if ca.conf.Version.IsAtLeast(V2_0_0_0) { + request.Version = 4 + } else if ca.conf.Version.IsAtLeast(V0_11_0_0) { + request.Version = 3 + } else if ca.conf.Version.IsAtLeast(V0_10_2_0) { + // Starting in version 2, the request can contain a null topics array to indicate that offsets + // for all topics should be fetched. It also returns a top level error code + // for group or coordinator level errors. request.Version = 2 - } else if ca.conf.Version.IsAtLeast(V0_8_2_2) { + } else if ca.conf.Version.IsAtLeast(V0_8_2_0) { + // In version 0, the request read offsets from ZK. + // + // Starting in version 1, the broker supports fetching offsets from the internal __consumer_offsets topic. request.Version = 1 } @@ -1024,6 +1087,9 @@ func (ca *clusterAdmin) DeleteConsumerGroup(group string) error { request := &DeleteGroupsRequest{ Groups: []string{group}, } + if ca.conf.Version.IsAtLeast(V2_0_0_0) { + request.Version = 1 + } resp, err := coordinator.DeleteGroups(request) if err != nil { @@ -1061,7 +1127,11 @@ func (ca *clusterAdmin) DescribeLogDirs(brokerIds []int32) (allLogDirs map[int32 defer wg.Done() _ = b.Open(conf) // Ensure that broker is opened - response, err := b.DescribeLogDirs(&DescribeLogDirsRequest{}) + request := &DescribeLogDirsRequest{} + if ca.conf.Version.IsAtLeast(V2_0_0_0) { + request.Version = 1 + } + response, err := b.DescribeLogDirs(request) if err != nil { errChan <- err return @@ -1208,6 +1278,10 @@ func (ca *clusterAdmin) AlterClientQuotas(entity []QuotaEntityComponent, op Clie } func (ca *clusterAdmin) RemoveMemberFromConsumerGroup(groupId string, groupInstanceIds []string) (*LeaveGroupResponse, error) { + if !ca.conf.Version.IsAtLeast(V2_4_0_0) { + return nil, ConfigurationError("Removing members from a consumer group headers requires Kafka version of at least v2.4.0") + } + controller, err := ca.client.Coordinator(groupId) if err != nil { return nil, err diff --git a/vendor/github.com/IBM/sarama/alter_client_quotas_request.go b/vendor/github.com/IBM/sarama/alter_client_quotas_request.go index f528512d0..a7fa0cbd1 100644 --- a/vendor/github.com/IBM/sarama/alter_client_quotas_request.go +++ b/vendor/github.com/IBM/sarama/alter_client_quotas_request.go @@ -12,6 +12,7 @@ package sarama // validate_only => BOOLEAN type AlterClientQuotasRequest struct { + Version int16 Entries []AlterClientQuotasEntry // The quota configuration entries to alter. ValidateOnly bool // Whether the alteration should be validated, but not performed. } @@ -182,13 +183,17 @@ func (a *AlterClientQuotasRequest) key() int16 { } func (a *AlterClientQuotasRequest) version() int16 { - return 0 + return a.Version } func (a *AlterClientQuotasRequest) headerVersion() int16 { return 1 } +func (a *AlterClientQuotasRequest) isValidVersion() bool { + return a.Version == 0 +} + func (a *AlterClientQuotasRequest) requiredVersion() KafkaVersion { return V2_6_0_0 } diff --git a/vendor/github.com/IBM/sarama/alter_client_quotas_response.go b/vendor/github.com/IBM/sarama/alter_client_quotas_response.go index ccd27d5f5..cce997cae 100644 --- a/vendor/github.com/IBM/sarama/alter_client_quotas_response.go +++ b/vendor/github.com/IBM/sarama/alter_client_quotas_response.go @@ -14,6 +14,7 @@ import ( // entity_name => NULLABLE_STRING type AlterClientQuotasResponse struct { + Version int16 ThrottleTime time.Duration // The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. Entries []AlterClientQuotasEntryResponse // The quota configuration entries altered. } @@ -133,13 +134,21 @@ func (a *AlterClientQuotasResponse) key() int16 { } func (a *AlterClientQuotasResponse) version() int16 { - return 0 + return a.Version } func (a *AlterClientQuotasResponse) headerVersion() int16 { return 0 } +func (a *AlterClientQuotasResponse) isValidVersion() bool { + return a.Version == 0 +} + func (a *AlterClientQuotasResponse) requiredVersion() KafkaVersion { return V2_6_0_0 } + +func (r *AlterClientQuotasResponse) throttleTime() time.Duration { + return r.ThrottleTime +} diff --git a/vendor/github.com/IBM/sarama/alter_configs_request.go b/vendor/github.com/IBM/sarama/alter_configs_request.go index 8b94b1f3f..ee1ab6445 100644 --- a/vendor/github.com/IBM/sarama/alter_configs_request.go +++ b/vendor/github.com/IBM/sarama/alter_configs_request.go @@ -2,6 +2,7 @@ package sarama // AlterConfigsRequest is an alter config request type type AlterConfigsRequest struct { + Version int16 Resources []*AlterConfigsResource ValidateOnly bool } @@ -114,13 +115,24 @@ func (a *AlterConfigsRequest) key() int16 { } func (a *AlterConfigsRequest) version() int16 { - return 0 + return a.Version } func (a *AlterConfigsRequest) headerVersion() int16 { return 1 } +func (a *AlterConfigsRequest) isValidVersion() bool { + return a.Version >= 0 && a.Version <= 1 +} + func (a *AlterConfigsRequest) requiredVersion() KafkaVersion { - return V0_11_0_0 + switch a.Version { + case 1: + return V2_0_0_0 + case 0: + return V0_11_0_0 + default: + return V2_0_0_0 + } } diff --git a/vendor/github.com/IBM/sarama/alter_configs_response.go b/vendor/github.com/IBM/sarama/alter_configs_response.go index 84cd86c72..658f32e9a 100644 --- a/vendor/github.com/IBM/sarama/alter_configs_response.go +++ b/vendor/github.com/IBM/sarama/alter_configs_response.go @@ -4,6 +4,7 @@ import "time" // AlterConfigsResponse is a response type for alter config type AlterConfigsResponse struct { + Version int16 ThrottleTime time.Duration Resources []*AlterConfigsResourceResponse } @@ -100,17 +101,32 @@ func (a *AlterConfigsResourceResponse) decode(pd packetDecoder, version int16) e } func (a *AlterConfigsResponse) key() int16 { - return 32 + return 33 } func (a *AlterConfigsResponse) version() int16 { - return 0 + return a.Version } func (a *AlterConfigsResponse) headerVersion() int16 { return 0 } +func (a *AlterConfigsResponse) isValidVersion() bool { + return a.Version >= 0 && a.Version <= 1 +} + func (a *AlterConfigsResponse) requiredVersion() KafkaVersion { - return V0_11_0_0 + switch a.Version { + case 1: + return V2_0_0_0 + case 0: + return V0_11_0_0 + default: + return V2_0_0_0 + } +} + +func (r *AlterConfigsResponse) throttleTime() time.Duration { + return r.ThrottleTime } diff --git a/vendor/github.com/IBM/sarama/alter_partition_reassignments_request.go b/vendor/github.com/IBM/sarama/alter_partition_reassignments_request.go index f0a2f9dd5..f898f87a2 100644 --- a/vendor/github.com/IBM/sarama/alter_partition_reassignments_request.go +++ b/vendor/github.com/IBM/sarama/alter_partition_reassignments_request.go @@ -113,6 +113,10 @@ func (r *AlterPartitionReassignmentsRequest) headerVersion() int16 { return 2 } +func (r *AlterPartitionReassignmentsRequest) isValidVersion() bool { + return r.Version == 0 +} + func (r *AlterPartitionReassignmentsRequest) requiredVersion() KafkaVersion { return V2_4_0_0 } diff --git a/vendor/github.com/IBM/sarama/alter_partition_reassignments_response.go b/vendor/github.com/IBM/sarama/alter_partition_reassignments_response.go index b3f9a15fe..1ee56b40e 100644 --- a/vendor/github.com/IBM/sarama/alter_partition_reassignments_response.go +++ b/vendor/github.com/IBM/sarama/alter_partition_reassignments_response.go @@ -1,5 +1,7 @@ package sarama +import "time" + type alterPartitionReassignmentsErrorBlock struct { errorCode KError errorMessage *string @@ -152,6 +154,14 @@ func (r *AlterPartitionReassignmentsResponse) headerVersion() int16 { return 1 } +func (r *AlterPartitionReassignmentsResponse) isValidVersion() bool { + return r.Version == 0 +} + func (r *AlterPartitionReassignmentsResponse) requiredVersion() KafkaVersion { return V2_4_0_0 } + +func (r *AlterPartitionReassignmentsResponse) throttleTime() time.Duration { + return time.Duration(r.ThrottleTimeMs) * time.Millisecond +} diff --git a/vendor/github.com/IBM/sarama/alter_user_scram_credentials_request.go b/vendor/github.com/IBM/sarama/alter_user_scram_credentials_request.go index 0530d8946..f29f164cf 100644 --- a/vendor/github.com/IBM/sarama/alter_user_scram_credentials_request.go +++ b/vendor/github.com/IBM/sarama/alter_user_scram_credentials_request.go @@ -137,6 +137,10 @@ func (r *AlterUserScramCredentialsRequest) headerVersion() int16 { return 2 } +func (r *AlterUserScramCredentialsRequest) isValidVersion() bool { + return r.Version == 0 +} + func (r *AlterUserScramCredentialsRequest) requiredVersion() KafkaVersion { return V2_7_0_0 } diff --git a/vendor/github.com/IBM/sarama/alter_user_scram_credentials_response.go b/vendor/github.com/IBM/sarama/alter_user_scram_credentials_response.go index 31e167b5e..75eac0cec 100644 --- a/vendor/github.com/IBM/sarama/alter_user_scram_credentials_response.go +++ b/vendor/github.com/IBM/sarama/alter_user_scram_credentials_response.go @@ -89,6 +89,14 @@ func (r *AlterUserScramCredentialsResponse) headerVersion() int16 { return 2 } +func (r *AlterUserScramCredentialsResponse) isValidVersion() bool { + return r.Version == 0 +} + func (r *AlterUserScramCredentialsResponse) requiredVersion() KafkaVersion { return V2_7_0_0 } + +func (r *AlterUserScramCredentialsResponse) throttleTime() time.Duration { + return r.ThrottleTime +} diff --git a/vendor/github.com/IBM/sarama/api_versions_request.go b/vendor/github.com/IBM/sarama/api_versions_request.go index e5b3baf64..f94174daf 100644 --- a/vendor/github.com/IBM/sarama/api_versions_request.go +++ b/vendor/github.com/IBM/sarama/api_versions_request.go @@ -57,13 +57,21 @@ func (r *ApiVersionsRequest) headerVersion() int16 { return 1 } +func (r *ApiVersionsRequest) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 3 +} + func (r *ApiVersionsRequest) requiredVersion() KafkaVersion { switch r.Version { - case 0: - return V0_10_0_0 case 3: return V2_4_0_0 - default: + case 2: + return V2_0_0_0 + case 1: + return V0_11_0_0 + case 0: return V0_10_0_0 + default: + return V2_4_0_0 } } diff --git a/vendor/github.com/IBM/sarama/api_versions_response.go b/vendor/github.com/IBM/sarama/api_versions_response.go index ade911c59..457c79a95 100644 --- a/vendor/github.com/IBM/sarama/api_versions_response.go +++ b/vendor/github.com/IBM/sarama/api_versions_response.go @@ -1,5 +1,7 @@ package sarama +import "time" + // ApiVersionsResponseKey contains the APIs supported by the broker. type ApiVersionsResponseKey struct { // Version defines the protocol version to use for encode and decode @@ -144,13 +146,25 @@ func (r *ApiVersionsResponse) headerVersion() int16 { return 0 } +func (r *ApiVersionsResponse) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 3 +} + func (r *ApiVersionsResponse) requiredVersion() KafkaVersion { switch r.Version { - case 0: - return V0_10_0_0 case 3: return V2_4_0_0 - default: + case 2: + return V2_0_0_0 + case 1: + return V0_11_0_0 + case 0: return V0_10_0_0 + default: + return V2_4_0_0 } } + +func (r *ApiVersionsResponse) throttleTime() time.Duration { + return time.Duration(r.ThrottleTimeMs) * time.Millisecond +} diff --git a/vendor/github.com/IBM/sarama/broker.go b/vendor/github.com/IBM/sarama/broker.go index 7ed987fe3..ff8cc8125 100644 --- a/vendor/github.com/IBM/sarama/broker.go +++ b/vendor/github.com/IBM/sarama/broker.go @@ -58,6 +58,8 @@ type Broker struct { kerberosAuthenticator GSSAPIKerberosAuth clientSessionReauthenticationTimeMs int64 + + throttleTimer *time.Timer } // SASLMechanism specifies the SASL mechanism the client uses to authenticate with the broker @@ -369,6 +371,7 @@ func (b *Broker) Rack() string { // GetMetadata send a metadata request and returns a metadata response or error func (b *Broker) GetMetadata(request *MetadataRequest) (*MetadataResponse, error) { response := new(MetadataResponse) + response.Version = request.Version // Required to ensure use of the correct response header version err := b.sendAndReceive(request, response) if err != nil { @@ -456,7 +459,7 @@ func (b *Broker) AsyncProduce(request *ProduceRequest, cb ProduceCallback) error } // Well-formed response - b.updateThrottleMetric(res.ThrottleTime) + b.handleThrottledResponse(res) cb(res, nil) }, } @@ -479,7 +482,6 @@ func (b *Broker) Produce(request *ProduceRequest) (*ProduceResponse, error) { } else { response = new(ProduceResponse) err = b.sendAndReceive(request, response) - b.updateThrottleMetric(response.ThrottleTime) } if err != nil { @@ -586,6 +588,7 @@ func (b *Broker) Heartbeat(request *HeartbeatRequest) (*HeartbeatResponse, error // ListGroups return a list group response or error func (b *Broker) ListGroups(request *ListGroupsRequest) (*ListGroupsResponse, error) { response := new(ListGroupsResponse) + response.Version = request.Version // Required to ensure use of the correct response header version err := b.sendAndReceive(request, response) if err != nil { @@ -944,7 +947,7 @@ func (b *Broker) write(buf []byte) (n int, err error) { return b.conn.Write(buf) } -// b.lock must be haled by caller +// b.lock must be held by caller func (b *Broker) send(rb protocolBody, promiseResponse bool, responseHeaderVersion int16) (*responsePromise, error) { var promise *responsePromise if promiseResponse { @@ -1000,6 +1003,9 @@ func (b *Broker) sendInternal(rb protocolBody, promise *responsePromise) error { return err } + // check and wait if throttled + b.waitIfThrottled() + requestTime := time.Now() // Will be decremented in responseReceiver (except error or request with NoResponse) b.addRequestInFlightMetrics(1) @@ -1042,7 +1048,14 @@ func (b *Broker) sendAndReceive(req protocolBody, res protocolBody) error { return nil } - return handleResponsePromise(req, res, promise, b.metricRegistry) + err = handleResponsePromise(req, res, promise, b.metricRegistry) + if err != nil { + return err + } + if res != nil { + b.handleThrottledResponse(res) + } + return nil } func handleResponsePromise(req protocolBody, res protocolBody, promise *responsePromise, metricRegistry metrics.Registry) error { @@ -1060,7 +1073,12 @@ func (b *Broker) decode(pd packetDecoder, version int16) (err error) { return err } - host, err := pd.getString() + var host string + if version < 9 { + host, err = pd.getString() + } else { + host, err = pd.getCompactString() + } if err != nil { return err } @@ -1070,11 +1088,13 @@ func (b *Broker) decode(pd packetDecoder, version int16) (err error) { return err } - if version >= 1 { + if version >= 1 && version < 9 { b.rack, err = pd.getNullableString() - if err != nil { - return err - } + } else if version >= 9 { + b.rack, err = pd.getCompactNullableString() + } + if err != nil { + return err } b.addr = net.JoinHostPort(host, fmt.Sprint(port)) @@ -1082,6 +1102,13 @@ func (b *Broker) decode(pd packetDecoder, version int16) (err error) { return err } + if version >= 9 { + _, err := pd.getEmptyTaggedFieldArray() + if err != nil { + return err + } + } + return nil } @@ -1098,7 +1125,11 @@ func (b *Broker) encode(pe packetEncoder, version int16) (err error) { pe.putInt32(b.id) - err = pe.putString(host) + if version < 9 { + err = pe.putString(host) + } else { + err = pe.putCompactString(host) + } if err != nil { return err } @@ -1106,12 +1137,20 @@ func (b *Broker) encode(pe packetEncoder, version int16) (err error) { pe.putInt32(int32(port)) if version >= 1 { - err = pe.putNullableString(b.rack) + if version < 9 { + err = pe.putNullableString(b.rack) + } else { + err = pe.putNullableCompactString(b.rack) + } if err != nil { return err } } + if version >= 9 { + pe.putEmptyTaggedFieldArray() + } + return nil } @@ -1635,16 +1674,48 @@ func (b *Broker) updateProtocolMetrics(rb protocolBody) { } } -func (b *Broker) updateThrottleMetric(throttleTime time.Duration) { - if throttleTime != time.Duration(0) { - DebugLogger.Printf( - "producer/broker/%d ProduceResponse throttled %v\n", - b.ID(), throttleTime) - if b.brokerThrottleTime != nil { - throttleTimeInMs := int64(throttleTime / time.Millisecond) - b.brokerThrottleTime.Update(throttleTimeInMs) +type throttleSupport interface { + throttleTime() time.Duration +} + +func (b *Broker) handleThrottledResponse(resp protocolBody) { + throttledResponse, ok := resp.(throttleSupport) + if !ok { + return + } + throttleTime := throttledResponse.throttleTime() + if throttleTime == time.Duration(0) { + return + } + DebugLogger.Printf( + "broker/%d %T throttled %v\n", b.ID(), resp, throttleTime) + b.setThrottle(throttleTime) + b.updateThrottleMetric(throttleTime) +} + +func (b *Broker) setThrottle(throttleTime time.Duration) { + if b.throttleTimer != nil { + // if there is an existing timer stop/clear it + if !b.throttleTimer.Stop() { + <-b.throttleTimer.C } } + b.throttleTimer = time.NewTimer(throttleTime) +} + +func (b *Broker) waitIfThrottled() { + if b.throttleTimer != nil { + DebugLogger.Printf("broker/%d waiting for throttle timer\n", b.ID()) + <-b.throttleTimer.C + b.throttleTimer = nil + } +} + +func (b *Broker) updateThrottleMetric(throttleTime time.Duration) { + if b.brokerThrottleTime != nil { + throttleTimeInMs := int64(throttleTime / time.Millisecond) + b.brokerThrottleTime.Update(throttleTimeInMs) + } } func (b *Broker) registerMetrics() { diff --git a/vendor/github.com/IBM/sarama/client.go b/vendor/github.com/IBM/sarama/client.go index d9fb77d64..b3d356954 100644 --- a/vendor/github.com/IBM/sarama/client.go +++ b/vendor/github.com/IBM/sarama/client.go @@ -1,13 +1,18 @@ package sarama import ( + "context" "errors" "math" "math/rand" + "net" "sort" + "strings" "sync" "sync/atomic" "time" + + "golang.org/x/net/proxy" ) // Client is a generic Kafka client. It manages connections to one or more Kafka brokers. @@ -158,7 +163,6 @@ type client struct { cachedPartitionsResults map[string][maxPartitionIndex][]int32 lock sync.RWMutex // protects access to the maps that hold cluster state. - } // NewClient creates a new Client. It connects to one of the given broker addresses @@ -191,6 +195,14 @@ func NewClient(addrs []string, conf *Config) (Client, error) { transactionCoordinators: make(map[string]int32), } + if conf.Net.ResolveCanonicalBootstrapServers { + var err error + addrs, err = client.resolveCanonicalNames(addrs) + if err != nil { + return nil, err + } + } + client.randomizeSeedBrokers(addrs) if conf.Metadata.Full { @@ -239,12 +251,26 @@ func (client *client) Broker(brokerID int32) (*Broker, error) { } func (client *client) InitProducerID() (*InitProducerIDResponse, error) { + // FIXME: this InitProducerID seems to only be called from client_test.go (TestInitProducerIDConnectionRefused) and has been superceded by transaction_manager.go? brokerErrors := make([]error, 0) for broker := client.anyBroker(); broker != nil; broker = client.anyBroker() { - var response *InitProducerIDResponse - req := &InitProducerIDRequest{} + request := &InitProducerIDRequest{} + + if client.conf.Version.IsAtLeast(V2_7_0_0) { + // Version 4 adds the support for new error code PRODUCER_FENCED. + request.Version = 4 + } else if client.conf.Version.IsAtLeast(V2_5_0_0) { + // Version 3 adds ProducerId and ProducerEpoch, allowing producers to try to resume after an INVALID_PRODUCER_EPOCH error + request.Version = 3 + } else if client.conf.Version.IsAtLeast(V2_4_0_0) { + // Version 2 is the first flexible version. + request.Version = 2 + } else if client.conf.Version.IsAtLeast(V2_0_0_0) { + // Version 1 is the same as version 0. + request.Version = 1 + } - response, err := broker.InitProducerID(req) + response, err := broker.InitProducerID(request) if err == nil { return response, nil } else { @@ -886,9 +912,21 @@ func (client *client) getOffset(topic string, partitionID int32, time int64) (in } request := &OffsetRequest{} - if client.conf.Version.IsAtLeast(V0_10_1_0) { + if client.conf.Version.IsAtLeast(V2_1_0_0) { + // Version 4 adds the current leader epoch, which is used for fencing. + request.Version = 4 + } else if client.conf.Version.IsAtLeast(V2_0_0_0) { + // Version 3 is the same as version 2. + request.Version = 3 + } else if client.conf.Version.IsAtLeast(V0_11_0_0) { + // Version 2 adds the isolation level, which is used for transactional reads. + request.Version = 2 + } else if client.conf.Version.IsAtLeast(V0_10_1_0) { + // Version 1 removes MaxNumOffsets. From this version forward, only a single + // offset can be returned. request.Version = 1 } + request.AddBlock(topic, partitionID, time, 1) response, err := broker.GetAvailableOffsets(request) @@ -1174,9 +1212,14 @@ func (client *client) findCoordinator(coordinatorKey string, coordinatorType Coo request.CoordinatorKey = coordinatorKey request.CoordinatorType = coordinatorType + // Version 1 adds KeyType. if client.conf.Version.IsAtLeast(V0_11_0_0) { request.Version = 1 } + // Version 2 is the same as version 1. + if client.conf.Version.IsAtLeast(V2_0_0_0) { + request.Version = 2 + } response, err := broker.FindCoordinator(request) if err != nil { @@ -1227,6 +1270,53 @@ func (client *client) findCoordinator(coordinatorKey string, coordinatorType Coo return retry(Wrap(ErrOutOfBrokers, brokerErrors...)) } +func (client *client) resolveCanonicalNames(addrs []string) ([]string, error) { + ctx := context.Background() + + dialer := client.Config().getDialer() + resolver := net.Resolver{ + Dial: func(ctx context.Context, network, address string) (net.Conn, error) { + // dial func should only be called once, so switching within is acceptable + switch d := dialer.(type) { + case proxy.ContextDialer: + return d.DialContext(ctx, network, address) + default: + // we have no choice but to ignore the context + return d.Dial(network, address) + } + }, + } + + canonicalAddrs := make(map[string]struct{}, len(addrs)) // dedupe as we go + for _, addr := range addrs { + host, port, err := net.SplitHostPort(addr) + if err != nil { + return nil, err // message includes addr + } + + ips, err := resolver.LookupHost(ctx, host) + if err != nil { + return nil, err // message includes host + } + for _, ip := range ips { + ptrs, err := resolver.LookupAddr(ctx, ip) + if err != nil { + return nil, err // message includes ip + } + + // unlike the Java client, we do not further check that PTRs resolve + ptr := strings.TrimSuffix(ptrs[0], ".") // trailing dot breaks GSSAPI + canonicalAddrs[net.JoinHostPort(ptr, port)] = struct{}{} + } + } + + addrs = make([]string, 0, len(canonicalAddrs)) + for addr := range canonicalAddrs { + addrs = append(addrs, addr) + } + return addrs, nil +} + // nopCloserClient embeds an existing Client, but disables // the Close method (yet all other methods pass // through unchanged). This is for use in larger structs diff --git a/vendor/github.com/IBM/sarama/compress.go b/vendor/github.com/IBM/sarama/compress.go index 504007a49..a7bd525bc 100644 --- a/vendor/github.com/IBM/sarama/compress.go +++ b/vendor/github.com/IBM/sarama/compress.go @@ -2,11 +2,11 @@ package sarama import ( "bytes" - "compress/gzip" "fmt" "sync" snappy "github.com/eapache/go-xerial-snappy" + "github.com/klauspost/compress/gzip" "github.com/pierrec/lz4/v4" ) diff --git a/vendor/github.com/IBM/sarama/config.go b/vendor/github.com/IBM/sarama/config.go index eb27d98ac..f9299a8c9 100644 --- a/vendor/github.com/IBM/sarama/config.go +++ b/vendor/github.com/IBM/sarama/config.go @@ -1,7 +1,6 @@ package sarama import ( - "compress/gzip" "crypto/tls" "fmt" "io" @@ -9,6 +8,7 @@ import ( "regexp" "time" + "github.com/klauspost/compress/gzip" "github.com/rcrowley/go-metrics" "golang.org/x/net/proxy" ) @@ -50,6 +50,15 @@ type Config struct { ReadTimeout time.Duration // How long to wait for a response. WriteTimeout time.Duration // How long to wait for a transmit. + // ResolveCanonicalBootstrapServers turns each bootstrap broker address + // into a set of IPs, then does a reverse lookup on each one to get its + // canonical hostname. This list of hostnames then replaces the + // original address list. Similar to the `client.dns.lookup` option in + // the JVM client, this is especially useful with GSSAPI, where it + // allows providing an alias record instead of individual broker + // hostnames. Defaults to false. + ResolveCanonicalBootstrapServers bool + TLS struct { // Whether or not to use TLS when connecting to the broker // (defaults to false). @@ -272,7 +281,6 @@ type Config struct { // Consumer is the namespace for configuration related to consuming messages, // used by the Consumer. Consumer struct { - // Group is the namespace for configuring consumer group. Group struct { Session struct { @@ -505,7 +513,7 @@ func NewConfig() *Config { c.Net.ReadTimeout = 30 * time.Second c.Net.WriteTimeout = 30 * time.Second c.Net.SASL.Handshake = true - c.Net.SASL.Version = SASLHandshakeV0 + c.Net.SASL.Version = SASLHandshakeV1 c.Metadata.Retry.Max = 3 c.Metadata.Retry.Backoff = 250 * time.Millisecond @@ -847,7 +855,7 @@ func (c *Config) Validate() error { func (c *Config) getDialer() proxy.Dialer { if c.Net.Proxy.Enable { - Logger.Printf("using proxy %s", c.Net.Proxy.Dialer) + Logger.Println("using proxy") return c.Net.Proxy.Dialer } else { return &net.Dialer{ diff --git a/vendor/github.com/IBM/sarama/consumer.go b/vendor/github.com/IBM/sarama/consumer.go index 4d08b3dda..60556a566 100644 --- a/vendor/github.com/IBM/sarama/consumer.go +++ b/vendor/github.com/IBM/sarama/consumer.go @@ -920,7 +920,7 @@ func (bc *brokerConsumer) subscriptionManager() { } // subscriptionConsumer ensures we will get nil right away if no new subscriptions is available -// this is a the main loop that fetches Kafka messages +// this is the main loop that fetches Kafka messages func (bc *brokerConsumer) subscriptionConsumer() { for newSubscriptions := range bc.newSubscriptions { bc.updateSubscriptions(newSubscriptions) @@ -942,6 +942,7 @@ func (bc *brokerConsumer) subscriptionConsumer() { // if there isn't response, it means that not fetch was made // so we don't need to handle any response if response == nil { + time.Sleep(partitionConsumersBatchTimeout) continue } @@ -1067,20 +1068,35 @@ func (bc *brokerConsumer) fetchNewMessages() (*FetchResponse, error) { MinBytes: bc.consumer.conf.Consumer.Fetch.Min, MaxWaitTime: int32(bc.consumer.conf.Consumer.MaxWaitTime / time.Millisecond), } + // Version 1 is the same as version 0. if bc.consumer.conf.Version.IsAtLeast(V0_9_0_0) { request.Version = 1 } + // Starting in Version 2, the requestor must be able to handle Kafka Log + // Message format version 1. if bc.consumer.conf.Version.IsAtLeast(V0_10_0_0) { request.Version = 2 } + // Version 3 adds MaxBytes. Starting in version 3, the partition ordering in + // the request is now relevant. Partitions will be processed in the order + // they appear in the request. if bc.consumer.conf.Version.IsAtLeast(V0_10_1_0) { request.Version = 3 request.MaxBytes = MaxResponseSize } + // Version 4 adds IsolationLevel. Starting in version 4, the reqestor must be + // able to handle Kafka log message format version 2. + // Version 5 adds LogStartOffset to indicate the earliest available offset of + // partition data that can be consumed. if bc.consumer.conf.Version.IsAtLeast(V0_11_0_0) { - request.Version = 4 + request.Version = 5 request.Isolation = bc.consumer.conf.Consumer.IsolationLevel } + // Version 6 is the same as version 5. + if bc.consumer.conf.Version.IsAtLeast(V1_0_0_0) { + request.Version = 6 + } + // Version 7 adds incremental fetch request support. if bc.consumer.conf.Version.IsAtLeast(V1_1_0_0) { request.Version = 7 // We do not currently implement KIP-227 FetchSessions. Setting the id to 0 @@ -1089,9 +1105,17 @@ func (bc *brokerConsumer) fetchNewMessages() (*FetchResponse, error) { request.SessionID = 0 request.SessionEpoch = -1 } + // Version 8 is the same as version 7. + if bc.consumer.conf.Version.IsAtLeast(V2_0_0_0) { + request.Version = 8 + } + // Version 9 adds CurrentLeaderEpoch, as described in KIP-320. + // Version 10 indicates that we can use the ZStd compression algorithm, as + // described in KIP-110. if bc.consumer.conf.Version.IsAtLeast(V2_1_0_0) { request.Version = 10 } + // Version 11 adds RackID for KIP-392 fetch from closest replica if bc.consumer.conf.Version.IsAtLeast(V2_3_0_0) { request.Version = 11 request.RackID = bc.consumer.conf.RackID diff --git a/vendor/github.com/IBM/sarama/consumer_group.go b/vendor/github.com/IBM/sarama/consumer_group.go index 68f463976..a0a1e1a41 100644 --- a/vendor/github.com/IBM/sarama/consumer_group.go +++ b/vendor/github.com/IBM/sarama/consumer_group.go @@ -141,8 +141,8 @@ func newConsumerGroup(groupID string, client Client) (ConsumerGroup, error) { userData: config.Consumer.Group.Member.UserData, metricRegistry: newCleanupRegistry(config.MetricRegistry), } - if client.Config().Consumer.Group.InstanceId != "" && config.Version.IsAtLeast(V2_3_0_0) { - cg.groupInstanceId = &client.Config().Consumer.Group.InstanceId + if config.Consumer.Group.InstanceId != "" && config.Version.IsAtLeast(V2_3_0_0) { + cg.groupInstanceId = &config.Consumer.Group.InstanceId } return cg, nil } @@ -210,11 +210,6 @@ func (c *consumerGroup) Consume(ctx context.Context, topics []string, handler Co return err } - // loop check topic partition numbers changed - // will trigger rebalance when any topic partitions number had changed - // avoid Consume function called again that will generate more than loopCheckPartitionNumbers coroutine - go c.loopCheckPartitionNumbers(topics, sess) - // Wait for session exit signal <-sess.ctx.Done() @@ -318,8 +313,10 @@ func (c *consumerGroup) newSession(ctx context.Context, topics []string, handler } return c.retryNewSession(ctx, topics, handler, retries, true) case ErrMemberIdRequired: - // from JoinGroupRequest v4, if client start with empty member id, - // it need to get member id from response and send another join request to join group + // from JoinGroupRequest v4 onwards (due to KIP-394) if the client starts + // with an empty member id, it needs to get the assigned id from the + // response and send another join request with that id to actually join the + // group c.memberID = join.MemberId return c.retryNewSession(ctx, topics, handler, retries+1 /*keep retry time*/, false) case ErrFencedInstancedId: @@ -345,13 +342,15 @@ func (c *consumerGroup) newSession(ctx context.Context, topics []string, handler // Prepare distribution plan if we joined as the leader var plan BalanceStrategyPlan var members map[string]ConsumerGroupMemberMetadata + var allSubscribedTopicPartitions map[string][]int32 + var allSubscribedTopics []string if join.LeaderId == join.MemberId { members, err = join.GetMembers() if err != nil { return nil, err } - plan, err = c.balance(strategy, members) + allSubscribedTopicPartitions, allSubscribedTopics, plan, err = c.balance(strategy, members) if err != nil { return nil, err } @@ -419,7 +418,17 @@ func (c *consumerGroup) newSession(ctx context.Context, topics []string, handler } } - return newConsumerGroupSession(ctx, c, claims, join.MemberId, join.GenerationId, handler) + session, err := newConsumerGroupSession(ctx, c, claims, join.MemberId, join.GenerationId, handler) + if err != nil { + return nil, err + } + + // only the leader needs to check whether there are newly-added partitions in order to trigger a rebalance + if join.LeaderId == join.MemberId { + go c.loopCheckPartitionNumbers(allSubscribedTopicPartitions, allSubscribedTopics, session) + } + + return session, err } func (c *consumerGroup) joinGroupRequest(coordinator *Broker, topics []string) (*JoinGroupResponse, error) { @@ -433,7 +442,23 @@ func (c *consumerGroup) joinGroupRequest(coordinator *Broker, topics []string) ( req.Version = 1 req.RebalanceTimeout = int32(c.config.Consumer.Group.Rebalance.Timeout / time.Millisecond) } - if c.groupInstanceId != nil { + if c.config.Version.IsAtLeast(V0_11_0_0) { + req.Version = 2 + } + if c.config.Version.IsAtLeast(V0_11_0_0) { + req.Version = 2 + } + if c.config.Version.IsAtLeast(V2_0_0_0) { + req.Version = 3 + } + // from JoinGroupRequest v4 onwards (due to KIP-394) the client will actually + // send two JoinGroupRequests, once with the empty member id, and then again + // with the assigned id from the first response. This is handled via the + // ErrMemberIdRequired case. + if c.config.Version.IsAtLeast(V2_2_0_0) { + req.Version = 4 + } + if c.config.Version.IsAtLeast(V2_3_0_0) { req.Version = 5 req.GroupInstanceId = c.groupInstanceId } @@ -482,12 +507,19 @@ func (c *consumerGroup) syncGroupRequest( GenerationId: generationID, } + // Versions 1 and 2 are the same as version 0. + if c.config.Version.IsAtLeast(V0_11_0_0) { + req.Version = 1 + } + if c.config.Version.IsAtLeast(V2_0_0_0) { + req.Version = 2 + } + // Starting from version 3, we add a new field called groupInstanceId to indicate member identity across restarts. if c.config.Version.IsAtLeast(V2_3_0_0) { req.Version = 3 - } - if c.groupInstanceId != nil { req.GroupInstanceId = c.groupInstanceId } + for memberID, topics := range plan { assignment := &ConsumerGroupMemberAssignment{Topics: topics} userDataBytes, err := strategy.AssignmentData(memberID, topics, generationID) @@ -516,7 +548,16 @@ func (c *consumerGroup) heartbeatRequest(coordinator *Broker, memberID string, g MemberId: memberID, GenerationId: generationID, } - if c.groupInstanceId != nil { + + // Version 1 and version 2 are the same as version 0. + if c.config.Version.IsAtLeast(V0_11_0_0) { + req.Version = 1 + } + if c.config.Version.IsAtLeast(V2_0_0_0) { + req.Version = 2 + } + // Starting from version 3, we add a new field called groupInstanceId to indicate member identity across restarts. + if c.config.Version.IsAtLeast(V2_3_0_0) { req.Version = 3 req.GroupInstanceId = c.groupInstanceId } @@ -524,23 +565,36 @@ func (c *consumerGroup) heartbeatRequest(coordinator *Broker, memberID string, g return coordinator.Heartbeat(req) } -func (c *consumerGroup) balance(strategy BalanceStrategy, members map[string]ConsumerGroupMemberMetadata) (BalanceStrategyPlan, error) { - topics := make(map[string][]int32) +func (c *consumerGroup) balance(strategy BalanceStrategy, members map[string]ConsumerGroupMemberMetadata) (map[string][]int32, []string, BalanceStrategyPlan, error) { + topicPartitions := make(map[string][]int32) for _, meta := range members { for _, topic := range meta.Topics { - topics[topic] = nil + topicPartitions[topic] = nil } } - for topic := range topics { + allSubscribedTopics := make([]string, 0, len(topicPartitions)) + for topic := range topicPartitions { + allSubscribedTopics = append(allSubscribedTopics, topic) + } + + // refresh metadata for all the subscribed topics in the consumer group + // to avoid using stale metadata to assigning partitions + err := c.client.RefreshMetadata(allSubscribedTopics...) + if err != nil { + return nil, nil, nil, err + } + + for topic := range topicPartitions { partitions, err := c.client.Partitions(topic) if err != nil { - return nil, err + return nil, nil, nil, err } - topics[topic] = partitions + topicPartitions[topic] = partitions } - return strategy.Plan(members, topics) + plan, err := strategy.Plan(members, topicPartitions) + return topicPartitions, allSubscribedTopics, plan, err } // Leaves the cluster, called by Close. @@ -556,32 +610,43 @@ func (c *consumerGroup) leave() error { return err } - // KIP-345 if groupInstanceId is set, don not leave group when consumer closed. - // Since we do not discover ApiVersion for brokers, LeaveGroupRequest still use the old version request for now - if c.groupInstanceId == nil { - resp, err := coordinator.LeaveGroup(&LeaveGroupRequest{ - GroupId: c.groupID, + // as per KIP-345 if groupInstanceId is set, i.e. static membership is in action, then do not leave group when consumer closed, just clear memberID + if c.groupInstanceId != nil { + c.memberID = "" + return nil + } + req := &LeaveGroupRequest{ + GroupId: c.groupID, + MemberId: c.memberID, + } + if c.config.Version.IsAtLeast(V0_11_0_0) { + req.Version = 1 + } + if c.config.Version.IsAtLeast(V2_0_0_0) { + req.Version = 2 + } + if c.config.Version.IsAtLeast(V2_4_0_0) { + req.Version = 3 + req.Members = append(req.Members, MemberIdentity{ MemberId: c.memberID, }) - if err != nil { - _ = coordinator.Close() - return err - } + } - // Unset memberID - c.memberID = "" + resp, err := coordinator.LeaveGroup(req) + if err != nil { + _ = coordinator.Close() + return err + } - // Check response - switch resp.Err { - case ErrRebalanceInProgress, ErrUnknownMemberId, ErrNoError: - return nil - default: - return resp.Err - } - } else { - c.memberID = "" + // clear the memberID + c.memberID = "" + + switch resp.Err { + case ErrRebalanceInProgress, ErrUnknownMemberId, ErrNoError: + return nil + default: + return resp.Err } - return nil } func (c *consumerGroup) handleError(err error, topic string, partition int32) { @@ -615,24 +680,29 @@ func (c *consumerGroup) handleError(err error, topic string, partition int32) { } } -func (c *consumerGroup) loopCheckPartitionNumbers(topics []string, session *consumerGroupSession) { +func (c *consumerGroup) loopCheckPartitionNumbers(allSubscribedTopicPartitions map[string][]int32, topics []string, session *consumerGroupSession) { if c.config.Metadata.RefreshFrequency == time.Duration(0) { return } - pause := time.NewTicker(c.config.Metadata.RefreshFrequency) + defer session.cancel() - defer pause.Stop() - var oldTopicToPartitionNum map[string]int - var err error - if oldTopicToPartitionNum, err = c.topicToPartitionNumbers(topics); err != nil { - return + + oldTopicToPartitionNum := make(map[string]int, len(allSubscribedTopicPartitions)) + for topic, partitions := range allSubscribedTopicPartitions { + oldTopicToPartitionNum[topic] = len(partitions) } + + pause := time.NewTicker(c.config.Metadata.RefreshFrequency) + defer pause.Stop() for { if newTopicToPartitionNum, err := c.topicToPartitionNumbers(topics); err != nil { return } else { for topic, num := range oldTopicToPartitionNum { if newTopicToPartitionNum[topic] != num { + Logger.Printf( + "consumergroup/%s loop check partition number goroutine find partitions in topics %s changed from %d to %d\n", + c.groupID, topics, num, newTopicToPartitionNum[topic]) return // trigger the end of the session on exit } } @@ -641,7 +711,7 @@ func (c *consumerGroup) loopCheckPartitionNumbers(topics []string, session *cons case <-pause.C: case <-session.ctx.Done(): Logger.Printf( - "consumergroup/%s loop check partition number coroutine will exit, topics %s\n", + "consumergroup/%s loop check partition number goroutine will exit, topics %s\n", c.groupID, topics) // if session closed by other, should be exited return @@ -1016,7 +1086,7 @@ type ConsumerGroupClaim interface { // InitialOffset returns the initial offset that was used as a starting point for this claim. InitialOffset() int64 - // HighWaterMarkOffset returns the high water mark offset of the partition, + // HighWaterMarkOffset returns the high watermark offset of the partition, // i.e. the offset that will be used for the next message that will be produced. // You can use this to determine how far behind the processing is. HighWaterMarkOffset() int64 diff --git a/vendor/github.com/IBM/sarama/consumer_metadata_request.go b/vendor/github.com/IBM/sarama/consumer_metadata_request.go index 5c18e048a..ef6b9e721 100644 --- a/vendor/github.com/IBM/sarama/consumer_metadata_request.go +++ b/vendor/github.com/IBM/sarama/consumer_metadata_request.go @@ -2,6 +2,7 @@ package sarama // ConsumerMetadataRequest is used for metadata requests type ConsumerMetadataRequest struct { + Version int16 ConsumerGroup string } @@ -9,6 +10,7 @@ func (r *ConsumerMetadataRequest) encode(pe packetEncoder) error { tmp := new(FindCoordinatorRequest) tmp.CoordinatorKey = r.ConsumerGroup tmp.CoordinatorType = CoordinatorGroup + tmp.Version = r.Version return tmp.encode(pe) } @@ -26,13 +28,24 @@ func (r *ConsumerMetadataRequest) key() int16 { } func (r *ConsumerMetadataRequest) version() int16 { - return 0 + return r.Version } func (r *ConsumerMetadataRequest) headerVersion() int16 { return 1 } +func (r *ConsumerMetadataRequest) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 2 +} + func (r *ConsumerMetadataRequest) requiredVersion() KafkaVersion { - return V0_8_2_0 + switch r.Version { + case 2: + return V2_0_0_0 + case 1: + return V0_11_0_0 + default: + return V0_8_2_0 + } } diff --git a/vendor/github.com/IBM/sarama/consumer_metadata_response.go b/vendor/github.com/IBM/sarama/consumer_metadata_response.go index 7fe0cf971..d99209e3b 100644 --- a/vendor/github.com/IBM/sarama/consumer_metadata_response.go +++ b/vendor/github.com/IBM/sarama/consumer_metadata_response.go @@ -7,6 +7,7 @@ import ( // ConsumerMetadataResponse holds the response for a consumer group meta data requests type ConsumerMetadataResponse struct { + Version int16 Err KError Coordinator *Broker CoordinatorID int32 // deprecated: use Coordinator.ID() @@ -53,7 +54,7 @@ func (r *ConsumerMetadataResponse) encode(pe packetEncoder) error { } tmp := &FindCoordinatorResponse{ - Version: 0, + Version: r.Version, Err: r.Err, Coordinator: r.Coordinator, } @@ -70,13 +71,24 @@ func (r *ConsumerMetadataResponse) key() int16 { } func (r *ConsumerMetadataResponse) version() int16 { - return 0 + return r.Version } func (r *ConsumerMetadataResponse) headerVersion() int16 { return 0 } +func (r *ConsumerMetadataResponse) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 2 +} + func (r *ConsumerMetadataResponse) requiredVersion() KafkaVersion { - return V0_8_2_0 + switch r.Version { + case 2: + return V2_0_0_0 + case 1: + return V0_11_0_0 + default: + return V0_8_2_0 + } } diff --git a/vendor/github.com/IBM/sarama/create_partitions_request.go b/vendor/github.com/IBM/sarama/create_partitions_request.go index 46fb04402..3f5512656 100644 --- a/vendor/github.com/IBM/sarama/create_partitions_request.go +++ b/vendor/github.com/IBM/sarama/create_partitions_request.go @@ -3,6 +3,7 @@ package sarama import "time" type CreatePartitionsRequest struct { + Version int16 TopicPartitions map[string]*TopicPartition Timeout time.Duration ValidateOnly bool @@ -64,15 +65,26 @@ func (r *CreatePartitionsRequest) key() int16 { } func (r *CreatePartitionsRequest) version() int16 { - return 0 + return r.Version } func (r *CreatePartitionsRequest) headerVersion() int16 { return 1 } +func (r *CreatePartitionsRequest) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 1 +} + func (r *CreatePartitionsRequest) requiredVersion() KafkaVersion { - return V1_0_0_0 + switch r.Version { + case 1: + return V2_0_0_0 + case 0: + return V1_0_0_0 + default: + return V2_0_0_0 + } } type TopicPartition struct { diff --git a/vendor/github.com/IBM/sarama/create_partitions_response.go b/vendor/github.com/IBM/sarama/create_partitions_response.go index 235787f13..c9e7ea72c 100644 --- a/vendor/github.com/IBM/sarama/create_partitions_response.go +++ b/vendor/github.com/IBM/sarama/create_partitions_response.go @@ -6,6 +6,7 @@ import ( ) type CreatePartitionsResponse struct { + Version int16 ThrottleTime time.Duration TopicPartitionErrors map[string]*TopicPartitionError } @@ -60,15 +61,30 @@ func (r *CreatePartitionsResponse) key() int16 { } func (r *CreatePartitionsResponse) version() int16 { - return 0 + return r.Version } func (r *CreatePartitionsResponse) headerVersion() int16 { return 0 } +func (r *CreatePartitionsResponse) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 1 +} + func (r *CreatePartitionsResponse) requiredVersion() KafkaVersion { - return V1_0_0_0 + switch r.Version { + case 1: + return V2_0_0_0 + case 0: + return V1_0_0_0 + default: + return V2_0_0_0 + } +} + +func (r *CreatePartitionsResponse) throttleTime() time.Duration { + return r.ThrottleTime } type TopicPartitionError struct { diff --git a/vendor/github.com/IBM/sarama/create_topics_request.go b/vendor/github.com/IBM/sarama/create_topics_request.go index 287acd069..7bad5427e 100644 --- a/vendor/github.com/IBM/sarama/create_topics_request.go +++ b/vendor/github.com/IBM/sarama/create_topics_request.go @@ -83,14 +83,22 @@ func (r *CreateTopicsRequest) headerVersion() int16 { return 1 } +func (c *CreateTopicsRequest) isValidVersion() bool { + return c.Version >= 0 && c.Version <= 3 +} + func (c *CreateTopicsRequest) requiredVersion() KafkaVersion { switch c.Version { + case 3: + return V2_0_0_0 case 2: - return V1_0_0_0 - case 1: return V0_11_0_0 - default: + case 1: + return V0_10_2_0 + case 0: return V0_10_1_0 + default: + return V2_8_0_0 } } diff --git a/vendor/github.com/IBM/sarama/create_topics_response.go b/vendor/github.com/IBM/sarama/create_topics_response.go index 6b940bff0..d8c9a174e 100644 --- a/vendor/github.com/IBM/sarama/create_topics_response.go +++ b/vendor/github.com/IBM/sarama/create_topics_response.go @@ -74,17 +74,29 @@ func (c *CreateTopicsResponse) headerVersion() int16 { return 0 } +func (c *CreateTopicsResponse) isValidVersion() bool { + return c.Version >= 0 && c.Version <= 3 +} + func (c *CreateTopicsResponse) requiredVersion() KafkaVersion { switch c.Version { + case 3: + return V2_0_0_0 case 2: - return V1_0_0_0 - case 1: return V0_11_0_0 - default: + case 1: + return V0_10_2_0 + case 0: return V0_10_1_0 + default: + return V2_8_0_0 } } +func (r *CreateTopicsResponse) throttleTime() time.Duration { + return r.ThrottleTime +} + type TopicError struct { Err KError ErrMsg *string diff --git a/vendor/github.com/IBM/sarama/decompress.go b/vendor/github.com/IBM/sarama/decompress.go index a01cefaa5..0a0998329 100644 --- a/vendor/github.com/IBM/sarama/decompress.go +++ b/vendor/github.com/IBM/sarama/decompress.go @@ -2,11 +2,11 @@ package sarama import ( "bytes" - "compress/gzip" "fmt" "sync" snappy "github.com/eapache/go-xerial-snappy" + "github.com/klauspost/compress/gzip" "github.com/pierrec/lz4/v4" ) diff --git a/vendor/github.com/IBM/sarama/delete_groups_request.go b/vendor/github.com/IBM/sarama/delete_groups_request.go index 4ac8bbee4..2fdfc3386 100644 --- a/vendor/github.com/IBM/sarama/delete_groups_request.go +++ b/vendor/github.com/IBM/sarama/delete_groups_request.go @@ -1,7 +1,8 @@ package sarama type DeleteGroupsRequest struct { - Groups []string + Version int16 + Groups []string } func (r *DeleteGroupsRequest) encode(pe packetEncoder) error { @@ -18,15 +19,26 @@ func (r *DeleteGroupsRequest) key() int16 { } func (r *DeleteGroupsRequest) version() int16 { - return 0 + return r.Version } func (r *DeleteGroupsRequest) headerVersion() int16 { return 1 } +func (r *DeleteGroupsRequest) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 1 +} + func (r *DeleteGroupsRequest) requiredVersion() KafkaVersion { - return V1_1_0_0 + switch r.Version { + case 1: + return V2_0_0_0 + case 0: + return V1_1_0_0 + default: + return V2_0_0_0 + } } func (r *DeleteGroupsRequest) AddGroup(group string) { diff --git a/vendor/github.com/IBM/sarama/delete_groups_response.go b/vendor/github.com/IBM/sarama/delete_groups_response.go index 5e7b1ed36..e490f8314 100644 --- a/vendor/github.com/IBM/sarama/delete_groups_response.go +++ b/vendor/github.com/IBM/sarama/delete_groups_response.go @@ -5,6 +5,7 @@ import ( ) type DeleteGroupsResponse struct { + Version int16 ThrottleTime time.Duration GroupErrorCodes map[string]KError } @@ -62,13 +63,28 @@ func (r *DeleteGroupsResponse) key() int16 { } func (r *DeleteGroupsResponse) version() int16 { - return 0 + return r.Version } func (r *DeleteGroupsResponse) headerVersion() int16 { return 0 } +func (r *DeleteGroupsResponse) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 1 +} + func (r *DeleteGroupsResponse) requiredVersion() KafkaVersion { - return V1_1_0_0 + switch r.Version { + case 1: + return V2_0_0_0 + case 0: + return V1_1_0_0 + default: + return V2_0_0_0 + } +} + +func (r *DeleteGroupsResponse) throttleTime() time.Duration { + return r.ThrottleTime } diff --git a/vendor/github.com/IBM/sarama/delete_offsets_request.go b/vendor/github.com/IBM/sarama/delete_offsets_request.go index 339c7857c..06b864d18 100644 --- a/vendor/github.com/IBM/sarama/delete_offsets_request.go +++ b/vendor/github.com/IBM/sarama/delete_offsets_request.go @@ -1,6 +1,7 @@ package sarama type DeleteOffsetsRequest struct { + Version int16 Group string partitions map[string][]int32 } @@ -72,13 +73,17 @@ func (r *DeleteOffsetsRequest) key() int16 { } func (r *DeleteOffsetsRequest) version() int16 { - return 0 + return r.Version } func (r *DeleteOffsetsRequest) headerVersion() int16 { return 1 } +func (r *DeleteOffsetsRequest) isValidVersion() bool { + return r.Version == 0 +} + func (r *DeleteOffsetsRequest) requiredVersion() KafkaVersion { return V2_4_0_0 } diff --git a/vendor/github.com/IBM/sarama/delete_offsets_response.go b/vendor/github.com/IBM/sarama/delete_offsets_response.go index d59ae0f8c..86c6c51f6 100644 --- a/vendor/github.com/IBM/sarama/delete_offsets_response.go +++ b/vendor/github.com/IBM/sarama/delete_offsets_response.go @@ -5,6 +5,7 @@ import ( ) type DeleteOffsetsResponse struct { + Version int16 // The top-level error code, or 0 if there was no error. ErrorCode KError ThrottleTime time.Duration @@ -100,13 +101,21 @@ func (r *DeleteOffsetsResponse) key() int16 { } func (r *DeleteOffsetsResponse) version() int16 { - return 0 + return r.Version } func (r *DeleteOffsetsResponse) headerVersion() int16 { return 0 } +func (r *DeleteOffsetsResponse) isValidVersion() bool { + return r.Version == 0 +} + func (r *DeleteOffsetsResponse) requiredVersion() KafkaVersion { return V2_4_0_0 } + +func (r *DeleteOffsetsResponse) throttleTime() time.Duration { + return r.ThrottleTime +} diff --git a/vendor/github.com/IBM/sarama/delete_records_request.go b/vendor/github.com/IBM/sarama/delete_records_request.go index dc106b17d..3ca2146af 100644 --- a/vendor/github.com/IBM/sarama/delete_records_request.go +++ b/vendor/github.com/IBM/sarama/delete_records_request.go @@ -13,6 +13,7 @@ import ( // id(int32) offset(int64) type DeleteRecordsRequest struct { + Version int16 Topics map[string]*DeleteRecordsRequestTopic Timeout time.Duration } @@ -74,15 +75,24 @@ func (d *DeleteRecordsRequest) key() int16 { } func (d *DeleteRecordsRequest) version() int16 { - return 0 + return d.Version } func (d *DeleteRecordsRequest) headerVersion() int16 { return 1 } +func (d *DeleteRecordsRequest) isValidVersion() bool { + return d.Version >= 0 && d.Version <= 1 +} + func (d *DeleteRecordsRequest) requiredVersion() KafkaVersion { - return V0_11_0_0 + switch d.Version { + case 1: + return V2_0_0_0 + default: + return V0_11_0_0 + } } type DeleteRecordsRequestTopic struct { diff --git a/vendor/github.com/IBM/sarama/delete_records_response.go b/vendor/github.com/IBM/sarama/delete_records_response.go index d530b4c7e..2d7db885b 100644 --- a/vendor/github.com/IBM/sarama/delete_records_response.go +++ b/vendor/github.com/IBM/sarama/delete_records_response.go @@ -77,15 +77,28 @@ func (d *DeleteRecordsResponse) key() int16 { } func (d *DeleteRecordsResponse) version() int16 { - return 0 + return d.Version } func (d *DeleteRecordsResponse) headerVersion() int16 { return 0 } +func (d *DeleteRecordsResponse) isValidVersion() bool { + return d.Version >= 0 && d.Version <= 1 +} + func (d *DeleteRecordsResponse) requiredVersion() KafkaVersion { - return V0_11_0_0 + switch d.Version { + case 1: + return V2_0_0_0 + default: + return V0_11_0_0 + } +} + +func (r *DeleteRecordsResponse) throttleTime() time.Duration { + return r.ThrottleTime } type DeleteRecordsResponseTopic struct { diff --git a/vendor/github.com/IBM/sarama/delete_topics_request.go b/vendor/github.com/IBM/sarama/delete_topics_request.go index ba6780a8e..252c0d025 100644 --- a/vendor/github.com/IBM/sarama/delete_topics_request.go +++ b/vendor/github.com/IBM/sarama/delete_topics_request.go @@ -42,11 +42,21 @@ func (d *DeleteTopicsRequest) headerVersion() int16 { return 1 } +func (d *DeleteTopicsRequest) isValidVersion() bool { + return d.Version >= 0 && d.Version <= 3 +} + func (d *DeleteTopicsRequest) requiredVersion() KafkaVersion { switch d.Version { + case 3: + return V2_1_0_0 + case 2: + return V2_0_0_0 case 1: return V0_11_0_0 - default: + case 0: return V0_10_1_0 + default: + return V2_2_0_0 } } diff --git a/vendor/github.com/IBM/sarama/delete_topics_response.go b/vendor/github.com/IBM/sarama/delete_topics_response.go index 733961a89..556da6892 100644 --- a/vendor/github.com/IBM/sarama/delete_topics_response.go +++ b/vendor/github.com/IBM/sarama/delete_topics_response.go @@ -72,11 +72,25 @@ func (d *DeleteTopicsResponse) headerVersion() int16 { return 0 } +func (d *DeleteTopicsResponse) isValidVersion() bool { + return d.Version >= 0 && d.Version <= 3 +} + func (d *DeleteTopicsResponse) requiredVersion() KafkaVersion { switch d.Version { + case 3: + return V2_1_0_0 + case 2: + return V2_0_0_0 case 1: return V0_11_0_0 - default: + case 0: return V0_10_1_0 + default: + return V2_2_0_0 } } + +func (r *DeleteTopicsResponse) throttleTime() time.Duration { + return r.ThrottleTime +} diff --git a/vendor/github.com/IBM/sarama/describe_client_quotas_request.go b/vendor/github.com/IBM/sarama/describe_client_quotas_request.go index 17a82051c..8869145c3 100644 --- a/vendor/github.com/IBM/sarama/describe_client_quotas_request.go +++ b/vendor/github.com/IBM/sarama/describe_client_quotas_request.go @@ -11,6 +11,7 @@ package sarama // Components: the components to filter on // Strict: whether the filter only includes specified components type DescribeClientQuotasRequest struct { + Version int16 Components []QuotaFilterComponent Strict bool } @@ -129,13 +130,17 @@ func (d *DescribeClientQuotasRequest) key() int16 { } func (d *DescribeClientQuotasRequest) version() int16 { - return 0 + return d.Version } func (d *DescribeClientQuotasRequest) headerVersion() int16 { return 1 } +func (d *DescribeClientQuotasRequest) isValidVersion() bool { + return d.Version == 0 +} + func (d *DescribeClientQuotasRequest) requiredVersion() KafkaVersion { return V2_6_0_0 } diff --git a/vendor/github.com/IBM/sarama/describe_client_quotas_response.go b/vendor/github.com/IBM/sarama/describe_client_quotas_response.go index 555da0c48..e9bf658ad 100644 --- a/vendor/github.com/IBM/sarama/describe_client_quotas_response.go +++ b/vendor/github.com/IBM/sarama/describe_client_quotas_response.go @@ -17,6 +17,7 @@ import ( // value => FLOAT64 type DescribeClientQuotasResponse struct { + Version int16 ThrottleTime time.Duration // The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. ErrorCode KError // The error code, or `0` if the quota description succeeded. ErrorMsg *string // The error message, or `null` if the quota description succeeded. @@ -223,13 +224,21 @@ func (d *DescribeClientQuotasResponse) key() int16 { } func (d *DescribeClientQuotasResponse) version() int16 { - return 0 + return d.Version } func (d *DescribeClientQuotasResponse) headerVersion() int16 { return 0 } +func (d *DescribeClientQuotasResponse) isValidVersion() bool { + return d.Version == 0 +} + func (d *DescribeClientQuotasResponse) requiredVersion() KafkaVersion { return V2_6_0_0 } + +func (r *DescribeClientQuotasResponse) throttleTime() time.Duration { + return r.ThrottleTime +} diff --git a/vendor/github.com/IBM/sarama/describe_configs_request.go b/vendor/github.com/IBM/sarama/describe_configs_request.go index 4c3488031..d0ab0d6ef 100644 --- a/vendor/github.com/IBM/sarama/describe_configs_request.go +++ b/vendor/github.com/IBM/sarama/describe_configs_request.go @@ -103,13 +103,19 @@ func (r *DescribeConfigsRequest) headerVersion() int16 { return 1 } +func (r *DescribeConfigsRequest) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 2 +} + func (r *DescribeConfigsRequest) requiredVersion() KafkaVersion { switch r.Version { - case 1: - return V1_1_0_0 case 2: return V2_0_0_0 - default: + case 1: + return V1_1_0_0 + case 0: return V0_11_0_0 + default: + return V2_0_0_0 } } diff --git a/vendor/github.com/IBM/sarama/describe_configs_response.go b/vendor/github.com/IBM/sarama/describe_configs_response.go index 4968f4854..8aed5de85 100644 --- a/vendor/github.com/IBM/sarama/describe_configs_response.go +++ b/vendor/github.com/IBM/sarama/describe_configs_response.go @@ -116,17 +116,27 @@ func (r *DescribeConfigsResponse) headerVersion() int16 { return 0 } +func (r *DescribeConfigsResponse) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 2 +} + func (r *DescribeConfigsResponse) requiredVersion() KafkaVersion { switch r.Version { - case 1: - return V1_0_0_0 case 2: return V2_0_0_0 - default: + case 1: + return V1_1_0_0 + case 0: return V0_11_0_0 + default: + return V2_0_0_0 } } +func (r *DescribeConfigsResponse) throttleTime() time.Duration { + return r.ThrottleTime +} + func (r *ResourceResponse) encode(pe packetEncoder, version int16) (err error) { pe.putInt16(r.ErrorCode) diff --git a/vendor/github.com/IBM/sarama/describe_groups_request.go b/vendor/github.com/IBM/sarama/describe_groups_request.go index fc8e6b588..c43262e86 100644 --- a/vendor/github.com/IBM/sarama/describe_groups_request.go +++ b/vendor/github.com/IBM/sarama/describe_groups_request.go @@ -42,18 +42,25 @@ func (r *DescribeGroupsRequest) headerVersion() int16 { return 1 } +func (r *DescribeGroupsRequest) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 4 +} + func (r *DescribeGroupsRequest) requiredVersion() KafkaVersion { switch r.Version { - case 1: - return V1_1_0_0 - case 2: - return V2_0_0_0 + case 4: + return V2_4_0_0 case 3: return V2_3_0_0 - case 4: + case 2: + return V2_0_0_0 + case 1: + return V0_11_0_0 + case 0: + return V0_9_0_0 + default: return V2_4_0_0 } - return V0_9_0_0 } func (r *DescribeGroupsRequest) AddGroup(group string) { diff --git a/vendor/github.com/IBM/sarama/describe_groups_response.go b/vendor/github.com/IBM/sarama/describe_groups_response.go index 12bf93e15..dbc46dd08 100644 --- a/vendor/github.com/IBM/sarama/describe_groups_response.go +++ b/vendor/github.com/IBM/sarama/describe_groups_response.go @@ -1,5 +1,7 @@ package sarama +import "time" + type DescribeGroupsResponse struct { // Version defines the protocol version to use for encode and decode Version int16 @@ -63,18 +65,29 @@ func (r *DescribeGroupsResponse) headerVersion() int16 { return 0 } +func (r *DescribeGroupsResponse) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 4 +} + func (r *DescribeGroupsResponse) requiredVersion() KafkaVersion { switch r.Version { - case 1: - return V1_1_0_0 - case 2: - return V2_0_0_0 + case 4: + return V2_4_0_0 case 3: return V2_3_0_0 - case 4: + case 2: + return V2_0_0_0 + case 1: + return V0_11_0_0 + case 0: + return V0_9_0_0 + default: return V2_4_0_0 } - return V0_9_0_0 +} + +func (r *DescribeGroupsResponse) throttleTime() time.Duration { + return time.Duration(r.ThrottleTimeMs) * time.Millisecond } // GroupDescription contains each described group. diff --git a/vendor/github.com/IBM/sarama/describe_log_dirs_request.go b/vendor/github.com/IBM/sarama/describe_log_dirs_request.go index c0bf04e04..a6613c320 100644 --- a/vendor/github.com/IBM/sarama/describe_log_dirs_request.go +++ b/vendor/github.com/IBM/sarama/describe_log_dirs_request.go @@ -82,6 +82,13 @@ func (r *DescribeLogDirsRequest) headerVersion() int16 { return 1 } +func (r *DescribeLogDirsRequest) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 1 +} + func (r *DescribeLogDirsRequest) requiredVersion() KafkaVersion { + if r.Version > 0 { + return V2_0_0_0 + } return V1_0_0_0 } diff --git a/vendor/github.com/IBM/sarama/describe_log_dirs_response.go b/vendor/github.com/IBM/sarama/describe_log_dirs_response.go index 411da38ad..41b4968da 100644 --- a/vendor/github.com/IBM/sarama/describe_log_dirs_response.go +++ b/vendor/github.com/IBM/sarama/describe_log_dirs_response.go @@ -65,10 +65,21 @@ func (r *DescribeLogDirsResponse) headerVersion() int16 { return 0 } +func (r *DescribeLogDirsResponse) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 1 +} + func (r *DescribeLogDirsResponse) requiredVersion() KafkaVersion { + if r.Version > 0 { + return V2_0_0_0 + } return V1_0_0_0 } +func (r *DescribeLogDirsResponse) throttleTime() time.Duration { + return r.ThrottleTime +} + type DescribeLogDirsResponseDirMetadata struct { ErrorCode KError diff --git a/vendor/github.com/IBM/sarama/describe_user_scram_credentials_request.go b/vendor/github.com/IBM/sarama/describe_user_scram_credentials_request.go index b5b59404b..a6265de5f 100644 --- a/vendor/github.com/IBM/sarama/describe_user_scram_credentials_request.go +++ b/vendor/github.com/IBM/sarama/describe_user_scram_credentials_request.go @@ -65,6 +65,10 @@ func (r *DescribeUserScramCredentialsRequest) headerVersion() int16 { return 2 } +func (r *DescribeUserScramCredentialsRequest) isValidVersion() bool { + return r.Version == 0 +} + func (r *DescribeUserScramCredentialsRequest) requiredVersion() KafkaVersion { return V2_7_0_0 } diff --git a/vendor/github.com/IBM/sarama/describe_user_scram_credentials_response.go b/vendor/github.com/IBM/sarama/describe_user_scram_credentials_response.go index 2656c2faa..a55c3f0ee 100644 --- a/vendor/github.com/IBM/sarama/describe_user_scram_credentials_response.go +++ b/vendor/github.com/IBM/sarama/describe_user_scram_credentials_response.go @@ -163,6 +163,14 @@ func (r *DescribeUserScramCredentialsResponse) headerVersion() int16 { return 2 } +func (r *DescribeUserScramCredentialsResponse) isValidVersion() bool { + return r.Version == 0 +} + func (r *DescribeUserScramCredentialsResponse) requiredVersion() KafkaVersion { return V2_7_0_0 } + +func (r *DescribeUserScramCredentialsResponse) throttleTime() time.Duration { + return r.ThrottleTime +} diff --git a/vendor/github.com/IBM/sarama/docker-compose.yml b/vendor/github.com/IBM/sarama/docker-compose.yml index 22ee21bf9..4fdf1a517 100644 --- a/vendor/github.com/IBM/sarama/docker-compose.yml +++ b/vendor/github.com/IBM/sarama/docker-compose.yml @@ -1,6 +1,7 @@ -version: '3.7' +version: '3.9' services: zookeeper-1: + hostname: 'zookeeper-1' image: 'docker.io/library/zookeeper:3.6.3' restart: always environment: @@ -12,6 +13,7 @@ services: ZOO_MAX_CLIENT_CNXNS: '0' ZOO_4LW_COMMANDS_WHITELIST: 'mntr,conf,ruok' zookeeper-2: + hostname: 'zookeeper-2' image: 'docker.io/library/zookeeper:3.6.3' restart: always environment: @@ -23,6 +25,7 @@ services: ZOO_MAX_CLIENT_CNXNS: '0' ZOO_4LW_COMMANDS_WHITELIST: 'mntr,conf,ruok' zookeeper-3: + hostname: 'zookeeper-3' image: 'docker.io/library/zookeeper:3.6.3' restart: always environment: @@ -34,13 +37,34 @@ services: ZOO_MAX_CLIENT_CNXNS: '0' ZOO_4LW_COMMANDS_WHITELIST: 'mntr,conf,ruok' kafka-1: - image: 'sarama/fv-kafka' + hostname: 'kafka-1' + image: 'sarama/fv-kafka-${KAFKA_VERSION:-3.5.1}' build: context: . dockerfile: Dockerfile.kafka + args: + KAFKA_VERSION: ${KAFKA_VERSION:-3.5.1} + SCALA_VERSION: ${SCALA_VERSION:-2.13} + healthcheck: + test: + [ + 'CMD', + '/opt/kafka-${KAFKA_VERSION:-3.5.1}/bin/kafka-broker-api-versions.sh', + '--bootstrap-server', + 'kafka-1:9091', + ] + interval: 15s + timeout: 15s + retries: 10 + start_period: 360s + depends_on: + - zookeeper-1 + - zookeeper-2 + - zookeeper-3 + - toxiproxy restart: always environment: - KAFKA_VERSION: ${KAFKA_VERSION:-3.3.2} + KAFKA_VERSION: ${KAFKA_VERSION:-3.5.1} KAFKA_CFG_ZOOKEEPER_CONNECT: 'zookeeper-1:2181,zookeeper-2:2181,zookeeper-3:2181' KAFKA_CFG_LISTENERS: 'LISTENER_INTERNAL://:9091,LISTENER_LOCAL://:29091' KAFKA_CFG_ADVERTISED_LISTENERS: 'LISTENER_INTERNAL://kafka-1:9091,LISTENER_LOCAL://localhost:29091' @@ -55,14 +79,37 @@ services: KAFKA_CFG_REPLICA_SELECTOR_CLASS: 'org.apache.kafka.common.replica.RackAwareReplicaSelector' KAFKA_CFG_DELETE_TOPIC_ENABLE: 'true' KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: 'false' + KAFKA_CFG_GROUP_INITIAL_REBALANCE_DELAY_MS: 0 + KAFKA_JVM_PERFORMANCE_OPTS: "-XX:+IgnoreUnrecognizedVMOptions" kafka-2: - image: 'sarama/fv-kafka' + hostname: 'kafka-2' + image: 'sarama/fv-kafka-${KAFKA_VERSION:-3.5.1}' build: context: . dockerfile: Dockerfile.kafka + args: + KAFKA_VERSION: ${KAFKA_VERSION:-3.5.1} + SCALA_VERSION: ${SCALA_VERSION:-2.13} + healthcheck: + test: + [ + 'CMD', + '/opt/kafka-${KAFKA_VERSION:-3.5.1}/bin/kafka-broker-api-versions.sh', + '--bootstrap-server', + 'kafka-2:9091', + ] + interval: 15s + timeout: 15s + retries: 10 + start_period: 360s + depends_on: + - zookeeper-1 + - zookeeper-2 + - zookeeper-3 + - toxiproxy restart: always environment: - KAFKA_VERSION: ${KAFKA_VERSION:-3.3.2} + KAFKA_VERSION: ${KAFKA_VERSION:-3.5.1} KAFKA_CFG_ZOOKEEPER_CONNECT: 'zookeeper-1:2181,zookeeper-2:2181,zookeeper-3:2181' KAFKA_CFG_LISTENERS: 'LISTENER_INTERNAL://:9091,LISTENER_LOCAL://:29092' KAFKA_CFG_ADVERTISED_LISTENERS: 'LISTENER_INTERNAL://kafka-2:9091,LISTENER_LOCAL://localhost:29092' @@ -77,14 +124,37 @@ services: KAFKA_CFG_REPLICA_SELECTOR_CLASS: 'org.apache.kafka.common.replica.RackAwareReplicaSelector' KAFKA_CFG_DELETE_TOPIC_ENABLE: 'true' KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: 'false' + KAFKA_CFG_GROUP_INITIAL_REBALANCE_DELAY_MS: 0 + KAFKA_JVM_PERFORMANCE_OPTS: "-XX:+IgnoreUnrecognizedVMOptions" kafka-3: - image: 'sarama/fv-kafka' + hostname: 'kafka-3' + image: 'sarama/fv-kafka-${KAFKA_VERSION:-3.5.1}' build: context: . dockerfile: Dockerfile.kafka + args: + KAFKA_VERSION: ${KAFKA_VERSION:-3.5.1} + SCALA_VERSION: ${SCALA_VERSION:-2.13} + healthcheck: + test: + [ + 'CMD', + '/opt/kafka-${KAFKA_VERSION:-3.5.1}/bin/kafka-broker-api-versions.sh', + '--bootstrap-server', + 'kafka-3:9091', + ] + interval: 15s + timeout: 15s + retries: 10 + start_period: 360s + depends_on: + - zookeeper-1 + - zookeeper-2 + - zookeeper-3 + - toxiproxy restart: always environment: - KAFKA_VERSION: ${KAFKA_VERSION:-3.3.2} + KAFKA_VERSION: ${KAFKA_VERSION:-3.5.1} KAFKA_CFG_ZOOKEEPER_CONNECT: 'zookeeper-1:2181,zookeeper-2:2181,zookeeper-3:2181' KAFKA_CFG_LISTENERS: 'LISTENER_INTERNAL://:9091,LISTENER_LOCAL://:29093' KAFKA_CFG_ADVERTISED_LISTENERS: 'LISTENER_INTERNAL://kafka-3:9091,LISTENER_LOCAL://localhost:29093' @@ -99,14 +169,37 @@ services: KAFKA_CFG_REPLICA_SELECTOR_CLASS: 'org.apache.kafka.common.replica.RackAwareReplicaSelector' KAFKA_CFG_DELETE_TOPIC_ENABLE: 'true' KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: 'false' + KAFKA_CFG_GROUP_INITIAL_REBALANCE_DELAY_MS: 0 + KAFKA_JVM_PERFORMANCE_OPTS: "-XX:+IgnoreUnrecognizedVMOptions" kafka-4: - image: 'sarama/fv-kafka' + hostname: 'kafka-4' + image: 'sarama/fv-kafka-${KAFKA_VERSION:-3.5.1}' build: context: . dockerfile: Dockerfile.kafka + args: + KAFKA_VERSION: ${KAFKA_VERSION:-3.5.1} + SCALA_VERSION: ${SCALA_VERSION:-2.13} + healthcheck: + test: + [ + 'CMD', + '/opt/kafka-${KAFKA_VERSION:-3.5.1}/bin/kafka-broker-api-versions.sh', + '--bootstrap-server', + 'kafka-4:9091', + ] + interval: 15s + timeout: 15s + retries: 10 + start_period: 360s + depends_on: + - zookeeper-1 + - zookeeper-2 + - zookeeper-3 + - toxiproxy restart: always environment: - KAFKA_VERSION: ${KAFKA_VERSION:-3.3.2} + KAFKA_VERSION: ${KAFKA_VERSION:-3.5.1} KAFKA_CFG_ZOOKEEPER_CONNECT: 'zookeeper-1:2181,zookeeper-2:2181,zookeeper-3:2181' KAFKA_CFG_LISTENERS: 'LISTENER_INTERNAL://:9091,LISTENER_LOCAL://:29094' KAFKA_CFG_ADVERTISED_LISTENERS: 'LISTENER_INTERNAL://kafka-4:9091,LISTENER_LOCAL://localhost:29094' @@ -121,14 +214,37 @@ services: KAFKA_CFG_REPLICA_SELECTOR_CLASS: 'org.apache.kafka.common.replica.RackAwareReplicaSelector' KAFKA_CFG_DELETE_TOPIC_ENABLE: 'true' KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: 'false' + KAFKA_CFG_GROUP_INITIAL_REBALANCE_DELAY_MS: 0 + KAFKA_JVM_PERFORMANCE_OPTS: "-XX:+IgnoreUnrecognizedVMOptions" kafka-5: - image: 'sarama/fv-kafka' + hostname: 'kafka-5' + image: 'sarama/fv-kafka-${KAFKA_VERSION:-3.5.1}' build: context: . dockerfile: Dockerfile.kafka + args: + KAFKA_VERSION: ${KAFKA_VERSION:-3.5.1} + SCALA_VERSION: ${SCALA_VERSION:-2.13} + healthcheck: + test: + [ + 'CMD', + '/opt/kafka-${KAFKA_VERSION:-3.5.1}/bin/kafka-broker-api-versions.sh', + '--bootstrap-server', + 'kafka-5:9091', + ] + interval: 15s + timeout: 15s + retries: 10 + start_period: 360s + depends_on: + - zookeeper-1 + - zookeeper-2 + - zookeeper-3 + - toxiproxy restart: always environment: - KAFKA_VERSION: ${KAFKA_VERSION:-3.3.2} + KAFKA_VERSION: ${KAFKA_VERSION:-3.5.1} KAFKA_CFG_ZOOKEEPER_CONNECT: 'zookeeper-1:2181,zookeeper-2:2181,zookeeper-3:2181' KAFKA_CFG_LISTENERS: 'LISTENER_INTERNAL://:9091,LISTENER_LOCAL://:29095' KAFKA_CFG_ADVERTISED_LISTENERS: 'LISTENER_INTERNAL://kafka-5:9091,LISTENER_LOCAL://localhost:29095' @@ -143,8 +259,17 @@ services: KAFKA_CFG_REPLICA_SELECTOR_CLASS: 'org.apache.kafka.common.replica.RackAwareReplicaSelector' KAFKA_CFG_DELETE_TOPIC_ENABLE: 'true' KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: 'false' + KAFKA_CFG_GROUP_INITIAL_REBALANCE_DELAY_MS: 0 + KAFKA_JVM_PERFORMANCE_OPTS: "-XX:+IgnoreUnrecognizedVMOptions" toxiproxy: + hostname: 'toxiproxy' image: 'ghcr.io/shopify/toxiproxy:2.4.0' + healthcheck: + test: ['CMD', '/toxiproxy-cli', 'l'] + interval: 15s + timeout: 15s + retries: 3 + start_period: 30s ports: # The tests themselves actually start the proxies on these ports - '29091:29091' @@ -152,5 +277,6 @@ services: - '29093:29093' - '29094:29094' - '29095:29095' + # This is the toxiproxy API port - '8474:8474' diff --git a/vendor/github.com/IBM/sarama/end_txn_request.go b/vendor/github.com/IBM/sarama/end_txn_request.go index 6635425dd..638099a5d 100644 --- a/vendor/github.com/IBM/sarama/end_txn_request.go +++ b/vendor/github.com/IBM/sarama/end_txn_request.go @@ -1,6 +1,7 @@ package sarama type EndTxnRequest struct { + Version int16 TransactionalID string ProducerID int64 ProducerEpoch int16 @@ -42,13 +43,24 @@ func (a *EndTxnRequest) key() int16 { } func (a *EndTxnRequest) version() int16 { - return 0 + return a.Version } func (r *EndTxnRequest) headerVersion() int16 { return 1 } +func (a *EndTxnRequest) isValidVersion() bool { + return a.Version >= 0 && a.Version <= 2 +} + func (a *EndTxnRequest) requiredVersion() KafkaVersion { - return V0_11_0_0 + switch a.Version { + case 2: + return V2_7_0_0 + case 1: + return V2_0_0_0 + default: + return V0_11_0_0 + } } diff --git a/vendor/github.com/IBM/sarama/end_txn_response.go b/vendor/github.com/IBM/sarama/end_txn_response.go index dd2a04504..54597df8c 100644 --- a/vendor/github.com/IBM/sarama/end_txn_response.go +++ b/vendor/github.com/IBM/sarama/end_txn_response.go @@ -5,6 +5,7 @@ import ( ) type EndTxnResponse struct { + Version int16 ThrottleTime time.Duration Err KError } @@ -36,13 +37,28 @@ func (e *EndTxnResponse) key() int16 { } func (e *EndTxnResponse) version() int16 { - return 0 + return e.Version } func (r *EndTxnResponse) headerVersion() int16 { return 0 } +func (e *EndTxnResponse) isValidVersion() bool { + return e.Version >= 0 && e.Version <= 2 +} + func (e *EndTxnResponse) requiredVersion() KafkaVersion { - return V0_11_0_0 + switch e.Version { + case 2: + return V2_7_0_0 + case 1: + return V2_0_0_0 + default: + return V0_11_0_0 + } +} + +func (r *EndTxnResponse) throttleTime() time.Duration { + return r.ThrottleTime } diff --git a/vendor/github.com/IBM/sarama/entrypoint.sh b/vendor/github.com/IBM/sarama/entrypoint.sh index 7b344fae8..7f405f92d 100644 --- a/vendor/github.com/IBM/sarama/entrypoint.sh +++ b/vendor/github.com/IBM/sarama/entrypoint.sh @@ -1,6 +1,6 @@ #!/bin/bash -KAFKA_VERSION="${KAFKA_VERSION:-3.3.2}" +KAFKA_VERSION="${KAFKA_VERSION:-3.5.1}" KAFKA_HOME="/opt/kafka-${KAFKA_VERSION}" if [ ! -d "${KAFKA_HOME}" ]; then @@ -11,7 +11,9 @@ fi cd "${KAFKA_HOME}" || exit 1 # discard all empty/commented lines -sed -e '/^#/d' -e '/^$/d' -i"" config/server.properties +sed -e '/^#/d' -e '/^$/d' -i".orig" config/server.properties + +echo "########################################################################" >>config/server.properties # emulate kafka_configure_from_environment_variables from bitnami/bitnami-docker-kafka for var in "${!KAFKA_CFG_@}"; do diff --git a/vendor/github.com/IBM/sarama/fetch_request.go b/vendor/github.com/IBM/sarama/fetch_request.go index 26adead4e..d1fd81384 100644 --- a/vendor/github.com/IBM/sarama/fetch_request.go +++ b/vendor/github.com/IBM/sarama/fetch_request.go @@ -275,30 +275,34 @@ func (r *FetchRequest) headerVersion() int16 { return 1 } +func (r *FetchRequest) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 11 +} + func (r *FetchRequest) requiredVersion() KafkaVersion { switch r.Version { - case 0: - return MinVersion - case 1: - return V0_9_0_0 - case 2: - return V0_10_0_0 - case 3: - return V0_10_1_0 - case 4, 5: - return V0_11_0_0 - case 6: - return V1_0_0_0 - case 7: - return V1_1_0_0 - case 8: - return V2_0_0_0 - case 9, 10: - return V2_1_0_0 case 11: return V2_3_0_0 + case 9, 10: + return V2_1_0_0 + case 8: + return V2_0_0_0 + case 7: + return V1_1_0_0 + case 6: + return V1_0_0_0 + case 4, 5: + return V0_11_0_0 + case 3: + return V0_10_1_0 + case 2: + return V0_10_0_0 + case 1: + return V0_9_0_0 + case 0: + return V0_8_2_0 default: - return MaxVersion + return V2_3_0_0 } } diff --git a/vendor/github.com/IBM/sarama/fetch_response.go b/vendor/github.com/IBM/sarama/fetch_response.go index 3d449c85e..02e8ca473 100644 --- a/vendor/github.com/IBM/sarama/fetch_response.go +++ b/vendor/github.com/IBM/sarama/fetch_response.go @@ -386,33 +386,41 @@ func (r *FetchResponse) headerVersion() int16 { return 0 } +func (r *FetchResponse) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 11 +} + func (r *FetchResponse) requiredVersion() KafkaVersion { switch r.Version { - case 0: - return MinVersion - case 1: - return V0_9_0_0 - case 2: - return V0_10_0_0 - case 3: - return V0_10_1_0 - case 4, 5: - return V0_11_0_0 - case 6: - return V1_0_0_0 - case 7: - return V1_1_0_0 - case 8: - return V2_0_0_0 - case 9, 10: - return V2_1_0_0 case 11: return V2_3_0_0 + case 9, 10: + return V2_1_0_0 + case 8: + return V2_0_0_0 + case 7: + return V1_1_0_0 + case 6: + return V1_0_0_0 + case 4, 5: + return V0_11_0_0 + case 3: + return V0_10_1_0 + case 2: + return V0_10_0_0 + case 1: + return V0_9_0_0 + case 0: + return V0_8_2_0 default: - return MaxVersion + return V2_3_0_0 } } +func (r *FetchResponse) throttleTime() time.Duration { + return r.ThrottleTime +} + func (r *FetchResponse) GetBlock(topic string, partition int32) *FetchResponseBlock { if r.Blocks == nil { return nil diff --git a/vendor/github.com/IBM/sarama/find_coordinator_request.go b/vendor/github.com/IBM/sarama/find_coordinator_request.go index 597bcbf78..4758835a1 100644 --- a/vendor/github.com/IBM/sarama/find_coordinator_request.go +++ b/vendor/github.com/IBM/sarama/find_coordinator_request.go @@ -55,8 +55,14 @@ func (r *FindCoordinatorRequest) headerVersion() int16 { return 1 } +func (f *FindCoordinatorRequest) isValidVersion() bool { + return f.Version >= 0 && f.Version <= 2 +} + func (f *FindCoordinatorRequest) requiredVersion() KafkaVersion { switch f.Version { + case 2: + return V2_0_0_0 case 1: return V0_11_0_0 default: diff --git a/vendor/github.com/IBM/sarama/find_coordinator_response.go b/vendor/github.com/IBM/sarama/find_coordinator_response.go index 83a648ad4..11b9920d0 100644 --- a/vendor/github.com/IBM/sarama/find_coordinator_response.go +++ b/vendor/github.com/IBM/sarama/find_coordinator_response.go @@ -86,11 +86,21 @@ func (r *FindCoordinatorResponse) headerVersion() int16 { return 0 } +func (f *FindCoordinatorResponse) isValidVersion() bool { + return f.Version >= 0 && f.Version <= 2 +} + func (f *FindCoordinatorResponse) requiredVersion() KafkaVersion { switch f.Version { + case 2: + return V2_0_0_0 case 1: return V0_11_0_0 default: return V0_8_2_0 } } + +func (r *FindCoordinatorResponse) throttleTime() time.Duration { + return r.ThrottleTime +} diff --git a/vendor/github.com/IBM/sarama/heartbeat_request.go b/vendor/github.com/IBM/sarama/heartbeat_request.go index 511910e71..9f740f26c 100644 --- a/vendor/github.com/IBM/sarama/heartbeat_request.go +++ b/vendor/github.com/IBM/sarama/heartbeat_request.go @@ -60,10 +60,21 @@ func (r *HeartbeatRequest) headerVersion() int16 { return 1 } +func (r *HeartbeatRequest) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 3 +} + func (r *HeartbeatRequest) requiredVersion() KafkaVersion { - switch { - case r.Version >= 3: + switch r.Version { + case 3: + return V2_3_0_0 + case 2: + return V2_0_0_0 + case 1: + return V0_11_0_0 + case 0: + return V0_8_2_0 + default: return V2_3_0_0 } - return V0_9_0_0 } diff --git a/vendor/github.com/IBM/sarama/heartbeat_response.go b/vendor/github.com/IBM/sarama/heartbeat_response.go index 95ef97f47..a58718d7b 100644 --- a/vendor/github.com/IBM/sarama/heartbeat_response.go +++ b/vendor/github.com/IBM/sarama/heartbeat_response.go @@ -1,5 +1,7 @@ package sarama +import "time" + type HeartbeatResponse struct { Version int16 ThrottleTime int32 @@ -43,10 +45,25 @@ func (r *HeartbeatResponse) headerVersion() int16 { return 0 } +func (r *HeartbeatResponse) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 3 +} + func (r *HeartbeatResponse) requiredVersion() KafkaVersion { switch r.Version { - case 1, 2, 3: + case 3: + return V2_3_0_0 + case 2: + return V2_0_0_0 + case 1: + return V0_11_0_0 + case 0: + return V0_8_2_0 + default: return V2_3_0_0 } - return V0_9_0_0 +} + +func (r *HeartbeatResponse) throttleTime() time.Duration { + return time.Duration(r.ThrottleTime) * time.Millisecond } diff --git a/vendor/github.com/IBM/sarama/incremental_alter_configs_request.go b/vendor/github.com/IBM/sarama/incremental_alter_configs_request.go index c4d05a972..b1b490a28 100644 --- a/vendor/github.com/IBM/sarama/incremental_alter_configs_request.go +++ b/vendor/github.com/IBM/sarama/incremental_alter_configs_request.go @@ -11,6 +11,7 @@ const ( // IncrementalAlterConfigsRequest is an incremental alter config request type type IncrementalAlterConfigsRequest struct { + Version int16 Resources []*IncrementalAlterConfigsResource ValidateOnly bool } @@ -161,13 +162,17 @@ func (a *IncrementalAlterConfigsRequest) key() int16 { } func (a *IncrementalAlterConfigsRequest) version() int16 { - return 0 + return a.Version } func (a *IncrementalAlterConfigsRequest) headerVersion() int16 { return 1 } +func (a *IncrementalAlterConfigsRequest) isValidVersion() bool { + return a.Version == 0 +} + func (a *IncrementalAlterConfigsRequest) requiredVersion() KafkaVersion { return V2_3_0_0 } diff --git a/vendor/github.com/IBM/sarama/incremental_alter_configs_response.go b/vendor/github.com/IBM/sarama/incremental_alter_configs_response.go index 3e8c4500c..3a2df2f60 100644 --- a/vendor/github.com/IBM/sarama/incremental_alter_configs_response.go +++ b/vendor/github.com/IBM/sarama/incremental_alter_configs_response.go @@ -4,6 +4,7 @@ import "time" // IncrementalAlterConfigsResponse is a response type for incremental alter config type IncrementalAlterConfigsResponse struct { + Version int16 ThrottleTime time.Duration Resources []*AlterConfigsResourceResponse } @@ -54,13 +55,21 @@ func (a *IncrementalAlterConfigsResponse) key() int16 { } func (a *IncrementalAlterConfigsResponse) version() int16 { - return 0 + return a.Version } func (a *IncrementalAlterConfigsResponse) headerVersion() int16 { return 0 } +func (a *IncrementalAlterConfigsResponse) isValidVersion() bool { + return a.Version == 0 +} + func (a *IncrementalAlterConfigsResponse) requiredVersion() KafkaVersion { return V2_3_0_0 } + +func (r *IncrementalAlterConfigsResponse) throttleTime() time.Duration { + return r.ThrottleTime +} diff --git a/vendor/github.com/IBM/sarama/init_producer_id_request.go b/vendor/github.com/IBM/sarama/init_producer_id_request.go index 33ce5fa41..dee50fb9f 100644 --- a/vendor/github.com/IBM/sarama/init_producer_id_request.go +++ b/vendor/github.com/IBM/sarama/init_producer_id_request.go @@ -84,19 +84,23 @@ func (i *InitProducerIDRequest) headerVersion() int16 { return 1 } +func (i *InitProducerIDRequest) isValidVersion() bool { + return i.Version >= 0 && i.Version <= 4 +} + func (i *InitProducerIDRequest) requiredVersion() KafkaVersion { switch i.Version { - case 2: - // Added tagged fields - return V2_4_0_0 + case 4: + return V2_7_0_0 case 3: - // Added ProducerID/Epoch return V2_5_0_0 - case 0: - fallthrough + case 2: + return V2_4_0_0 case 1: - fallthrough - default: + return V2_0_0_0 + case 0: return V0_11_0_0 + default: + return V2_7_0_0 } } diff --git a/vendor/github.com/IBM/sarama/init_producer_id_response.go b/vendor/github.com/IBM/sarama/init_producer_id_response.go index 006070189..256077189 100644 --- a/vendor/github.com/IBM/sarama/init_producer_id_response.go +++ b/vendor/github.com/IBM/sarama/init_producer_id_response.go @@ -69,17 +69,25 @@ func (i *InitProducerIDResponse) headerVersion() int16 { return 0 } +func (i *InitProducerIDResponse) isValidVersion() bool { + return i.Version >= 0 && i.Version <= 4 +} + func (i *InitProducerIDResponse) requiredVersion() KafkaVersion { switch i.Version { - case 2: - fallthrough + case 4: + return V2_7_0_0 case 3: + return V2_5_0_0 + case 2: return V2_4_0_0 - case 0: - fallthrough case 1: - fallthrough + return V2_0_0_0 default: return V0_11_0_0 } } + +func (r *InitProducerIDResponse) throttleTime() time.Duration { + return r.ThrottleTime +} diff --git a/vendor/github.com/IBM/sarama/join_group_request.go b/vendor/github.com/IBM/sarama/join_group_request.go index 432338cd5..b574ce475 100644 --- a/vendor/github.com/IBM/sarama/join_group_request.go +++ b/vendor/github.com/IBM/sarama/join_group_request.go @@ -150,16 +150,26 @@ func (r *JoinGroupRequest) headerVersion() int16 { return 1 } +func (r *JoinGroupRequest) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 5 +} + func (r *JoinGroupRequest) requiredVersion() KafkaVersion { switch r.Version { - case 4, 5: + case 5: return V2_3_0_0 - case 2, 3: + case 4: + return V2_2_0_0 + case 3: + return V2_0_0_0 + case 2: return V0_11_0_0 case 1: return V0_10_1_0 + case 0: + return V0_10_0_0 default: - return V0_9_0_0 + return V2_3_0_0 } } diff --git a/vendor/github.com/IBM/sarama/join_group_response.go b/vendor/github.com/IBM/sarama/join_group_response.go index d8aa1f002..76645242e 100644 --- a/vendor/github.com/IBM/sarama/join_group_response.go +++ b/vendor/github.com/IBM/sarama/join_group_response.go @@ -1,5 +1,7 @@ package sarama +import "time" + type JoinGroupResponse struct { Version int16 ThrottleTime int32 @@ -145,15 +147,29 @@ func (r *JoinGroupResponse) headerVersion() int16 { return 0 } +func (r *JoinGroupResponse) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 5 +} + func (r *JoinGroupResponse) requiredVersion() KafkaVersion { switch r.Version { - case 3, 4, 5: + case 5: return V2_3_0_0 + case 4: + return V2_2_0_0 + case 3: + return V2_0_0_0 case 2: return V0_11_0_0 case 1: return V0_10_1_0 + case 0: + return V0_10_0_0 default: - return V0_9_0_0 + return V2_3_0_0 } } + +func (r *JoinGroupResponse) throttleTime() time.Duration { + return time.Duration(r.ThrottleTime) * time.Millisecond +} diff --git a/vendor/github.com/IBM/sarama/leave_group_request.go b/vendor/github.com/IBM/sarama/leave_group_request.go index 741b7290a..9222e5104 100644 --- a/vendor/github.com/IBM/sarama/leave_group_request.go +++ b/vendor/github.com/IBM/sarama/leave_group_request.go @@ -81,10 +81,21 @@ func (r *LeaveGroupRequest) headerVersion() int16 { return 1 } +func (r *LeaveGroupRequest) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 3 +} + func (r *LeaveGroupRequest) requiredVersion() KafkaVersion { switch r.Version { - case 1, 2, 3: - return V2_3_0_0 + case 3: + return V2_4_0_0 + case 2: + return V2_0_0_0 + case 1: + return V0_11_0_0 + case 0: + return V0_9_0_0 + default: + return V2_4_0_0 } - return V0_9_0_0 } diff --git a/vendor/github.com/IBM/sarama/leave_group_response.go b/vendor/github.com/IBM/sarama/leave_group_response.go index 18ed357e8..f24c24867 100644 --- a/vendor/github.com/IBM/sarama/leave_group_response.go +++ b/vendor/github.com/IBM/sarama/leave_group_response.go @@ -1,5 +1,7 @@ package sarama +import "time" + type MemberResponse struct { MemberId string GroupInstanceId *string @@ -83,10 +85,25 @@ func (r *LeaveGroupResponse) headerVersion() int16 { return 0 } +func (r *LeaveGroupResponse) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 3 +} + func (r *LeaveGroupResponse) requiredVersion() KafkaVersion { switch r.Version { - case 1, 2, 3: - return V2_3_0_0 + case 3: + return V2_4_0_0 + case 2: + return V2_0_0_0 + case 1: + return V0_11_0_0 + case 0: + return V0_9_0_0 + default: + return V2_4_0_0 } - return V0_9_0_0 +} + +func (r *LeaveGroupResponse) throttleTime() time.Duration { + return time.Duration(r.ThrottleTime) * time.Millisecond } diff --git a/vendor/github.com/IBM/sarama/list_groups_request.go b/vendor/github.com/IBM/sarama/list_groups_request.go index 4553b2d2e..4d5f9e40d 100644 --- a/vendor/github.com/IBM/sarama/list_groups_request.go +++ b/vendor/github.com/IBM/sarama/list_groups_request.go @@ -1,12 +1,47 @@ package sarama -type ListGroupsRequest struct{} +type ListGroupsRequest struct { + Version int16 + StatesFilter []string // version 4 or later +} func (r *ListGroupsRequest) encode(pe packetEncoder) error { + if r.Version >= 4 { + pe.putCompactArrayLength(len(r.StatesFilter)) + for _, filter := range r.StatesFilter { + err := pe.putCompactString(filter) + if err != nil { + return err + } + } + } + if r.Version >= 3 { + pe.putEmptyTaggedFieldArray() + } return nil } func (r *ListGroupsRequest) decode(pd packetDecoder, version int16) (err error) { + r.Version = version + if r.Version >= 4 { + filterLen, err := pd.getCompactArrayLength() + if err != nil { + return err + } + if filterLen > 0 { + r.StatesFilter = make([]string, filterLen) + for i := 0; i < filterLen; i++ { + if r.StatesFilter[i], err = pd.getCompactString(); err != nil { + return err + } + } + } + } + if r.Version >= 3 { + if _, err = pd.getEmptyTaggedFieldArray(); err != nil { + return err + } + } return nil } @@ -15,13 +50,33 @@ func (r *ListGroupsRequest) key() int16 { } func (r *ListGroupsRequest) version() int16 { - return 0 + return r.Version } func (r *ListGroupsRequest) headerVersion() int16 { + if r.Version >= 3 { + return 2 + } return 1 } +func (r *ListGroupsRequest) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 4 +} + func (r *ListGroupsRequest) requiredVersion() KafkaVersion { - return V0_9_0_0 + switch r.Version { + case 4: + return V2_6_0_0 + case 3: + return V2_4_0_0 + case 2: + return V2_0_0_0 + case 1: + return V0_11_0_0 + case 0: + return V0_9_0_0 + default: + return V2_6_0_0 + } } diff --git a/vendor/github.com/IBM/sarama/list_groups_response.go b/vendor/github.com/IBM/sarama/list_groups_response.go index 777bae7e6..62948c31f 100644 --- a/vendor/github.com/IBM/sarama/list_groups_response.go +++ b/vendor/github.com/IBM/sarama/list_groups_response.go @@ -1,22 +1,52 @@ package sarama type ListGroupsResponse struct { - Err KError - Groups map[string]string + Version int16 + ThrottleTime int32 + Err KError + Groups map[string]string + GroupsData map[string]GroupData // version 4 or later +} + +type GroupData struct { + GroupState string // version 4 or later } func (r *ListGroupsResponse) encode(pe packetEncoder) error { + if r.Version >= 1 { + pe.putInt32(r.ThrottleTime) + } + pe.putInt16(int16(r.Err)) - if err := pe.putArrayLength(len(r.Groups)); err != nil { - return err - } - for groupId, protocolType := range r.Groups { - if err := pe.putString(groupId); err != nil { + if r.Version <= 2 { + if err := pe.putArrayLength(len(r.Groups)); err != nil { return err } - if err := pe.putString(protocolType); err != nil { - return err + for groupId, protocolType := range r.Groups { + if err := pe.putString(groupId); err != nil { + return err + } + if err := pe.putString(protocolType); err != nil { + return err + } + } + } else { + pe.putCompactArrayLength(len(r.Groups)) + for groupId, protocolType := range r.Groups { + if err := pe.putCompactString(groupId); err != nil { + return err + } + if err := pe.putCompactString(protocolType); err != nil { + return err + } + + if r.Version >= 4 { + groupData := r.GroupsData[groupId] + if err := pe.putCompactString(groupData.GroupState); err != nil { + return err + } + } } } @@ -24,6 +54,14 @@ func (r *ListGroupsResponse) encode(pe packetEncoder) error { } func (r *ListGroupsResponse) decode(pd packetDecoder, version int16) error { + r.Version = version + if r.Version >= 1 { + var err error + if r.ThrottleTime, err = pd.getInt32(); err != nil { + return err + } + } + kerr, err := pd.getInt16() if err != nil { return err @@ -31,26 +69,68 @@ func (r *ListGroupsResponse) decode(pd packetDecoder, version int16) error { r.Err = KError(kerr) - n, err := pd.getArrayLength() + var n int + if r.Version <= 2 { + n, err = pd.getArrayLength() + } else { + n, err = pd.getCompactArrayLength() + } if err != nil { return err } - if n == 0 { - return nil - } - r.Groups = make(map[string]string) for i := 0; i < n; i++ { - groupId, err := pd.getString() - if err != nil { - return err + if i == 0 { + r.Groups = make(map[string]string) + if r.Version >= 4 { + r.GroupsData = make(map[string]GroupData) + } } - protocolType, err := pd.getString() - if err != nil { - return err + + var groupId, protocolType string + if r.Version <= 2 { + groupId, err = pd.getString() + if err != nil { + return err + } + protocolType, err = pd.getString() + if err != nil { + return err + } + } else { + groupId, err = pd.getCompactString() + if err != nil { + return err + } + protocolType, err = pd.getCompactString() + if err != nil { + return err + } } r.Groups[groupId] = protocolType + + if r.Version >= 4 { + groupState, err := pd.getCompactString() + if err != nil { + return err + } + r.GroupsData[groupId] = GroupData{ + GroupState: groupState, + } + } + + if r.Version >= 3 { + if _, err = pd.getEmptyTaggedFieldArray(); err != nil { + return err + } + } + } + + if r.Version >= 3 { + if _, err = pd.getEmptyTaggedFieldArray(); err != nil { + return err + } } return nil @@ -61,13 +141,33 @@ func (r *ListGroupsResponse) key() int16 { } func (r *ListGroupsResponse) version() int16 { - return 0 + return r.Version } func (r *ListGroupsResponse) headerVersion() int16 { + if r.Version >= 3 { + return 1 + } return 0 } +func (r *ListGroupsResponse) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 4 +} + func (r *ListGroupsResponse) requiredVersion() KafkaVersion { - return V0_9_0_0 + switch r.Version { + case 4: + return V2_6_0_0 + case 3: + return V2_4_0_0 + case 2: + return V2_0_0_0 + case 1: + return V0_11_0_0 + case 0: + return V0_9_0_0 + default: + return V2_6_0_0 + } } diff --git a/vendor/github.com/IBM/sarama/list_partition_reassignments_request.go b/vendor/github.com/IBM/sarama/list_partition_reassignments_request.go index c1ffa9ba0..c7ad5e981 100644 --- a/vendor/github.com/IBM/sarama/list_partition_reassignments_request.go +++ b/vendor/github.com/IBM/sarama/list_partition_reassignments_request.go @@ -83,6 +83,10 @@ func (r *ListPartitionReassignmentsRequest) headerVersion() int16 { return 2 } +func (r *ListPartitionReassignmentsRequest) isValidVersion() bool { + return r.Version == 0 +} + func (r *ListPartitionReassignmentsRequest) requiredVersion() KafkaVersion { return V2_4_0_0 } diff --git a/vendor/github.com/IBM/sarama/list_partition_reassignments_response.go b/vendor/github.com/IBM/sarama/list_partition_reassignments_response.go index 4baa6a08e..426f1c771 100644 --- a/vendor/github.com/IBM/sarama/list_partition_reassignments_response.go +++ b/vendor/github.com/IBM/sarama/list_partition_reassignments_response.go @@ -1,5 +1,7 @@ package sarama +import "time" + type PartitionReplicaReassignmentsStatus struct { Replicas []int32 AddingReplicas []int32 @@ -164,6 +166,14 @@ func (r *ListPartitionReassignmentsResponse) headerVersion() int16 { return 1 } +func (r *ListPartitionReassignmentsResponse) isValidVersion() bool { + return r.Version == 0 +} + func (r *ListPartitionReassignmentsResponse) requiredVersion() KafkaVersion { return V2_4_0_0 } + +func (r *ListPartitionReassignmentsResponse) throttleTime() time.Duration { + return time.Duration(r.ThrottleTimeMs) * time.Millisecond +} diff --git a/vendor/github.com/IBM/sarama/metadata_request.go b/vendor/github.com/IBM/sarama/metadata_request.go index a1b6ac09c..e76073ea0 100644 --- a/vendor/github.com/IBM/sarama/metadata_request.go +++ b/vendor/github.com/IBM/sarama/metadata_request.go @@ -1,22 +1,44 @@ package sarama +import "encoding/base64" + +type Uuid [16]byte + +func (u Uuid) String() string { + return base64.URLEncoding.WithPadding(base64.NoPadding).EncodeToString(u[:]) +} + +var NullUUID = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + type MetadataRequest struct { // Version defines the protocol version to use for encode and decode Version int16 // Topics contains the topics to fetch metadata for. Topics []string // AllowAutoTopicCreation contains a If this is true, the broker may auto-create topics that we requested which do not already exist, if it is configured to do so. - AllowAutoTopicCreation bool + AllowAutoTopicCreation bool + IncludeClusterAuthorizedOperations bool // version 8 and up + IncludeTopicAuthorizedOperations bool // version 8 and up } func NewMetadataRequest(version KafkaVersion, topics []string) *MetadataRequest { m := &MetadataRequest{Topics: topics} - if version.IsAtLeast(V2_1_0_0) { + if version.IsAtLeast(V2_8_0_0) { + m.Version = 10 + } else if version.IsAtLeast(V2_4_0_0) { + m.Version = 9 + } else if version.IsAtLeast(V2_4_0_0) { + m.Version = 8 + } else if version.IsAtLeast(V2_1_0_0) { m.Version = 7 } else if version.IsAtLeast(V2_0_0_0) { m.Version = 6 } else if version.IsAtLeast(V1_0_0_0) { m.Version = 5 + } else if version.IsAtLeast(V0_11_0_0) { + m.Version = 4 + } else if version.IsAtLeast(V0_10_1_0) { + m.Version = 2 } else if version.IsAtLeast(V0_10_0_0) { m.Version = 1 } @@ -24,46 +46,124 @@ func NewMetadataRequest(version KafkaVersion, topics []string) *MetadataRequest } func (r *MetadataRequest) encode(pe packetEncoder) (err error) { - if r.Version < 0 || r.Version > 12 { + if r.Version < 0 || r.Version > 10 { return PacketEncodingError{"invalid or unsupported MetadataRequest version field"} } if r.Version == 0 || len(r.Topics) > 0 { - err := pe.putArrayLength(len(r.Topics)) - if err != nil { - return err - } - - for i := range r.Topics { - err = pe.putString(r.Topics[i]) + if r.Version < 9 { + err := pe.putArrayLength(len(r.Topics)) if err != nil { return err } + + for i := range r.Topics { + err = pe.putString(r.Topics[i]) + if err != nil { + return err + } + } + } else if r.Version == 9 { + pe.putCompactArrayLength(len(r.Topics)) + for _, topicName := range r.Topics { + if err := pe.putCompactString(topicName); err != nil { + return err + } + pe.putEmptyTaggedFieldArray() + } + } else { // r.Version = 10 + pe.putCompactArrayLength(len(r.Topics)) + for _, topicName := range r.Topics { + if err := pe.putRawBytes(NullUUID); err != nil { + return err + } + // Avoid implicit memory aliasing in for loop + tn := topicName + if err := pe.putNullableCompactString(&tn); err != nil { + return err + } + pe.putEmptyTaggedFieldArray() + } } } else { - pe.putInt32(-1) + if r.Version < 9 { + pe.putInt32(-1) + } else { + pe.putCompactArrayLength(-1) + } } - if r.Version >= 4 { + if r.Version > 3 { pe.putBool(r.AllowAutoTopicCreation) } - + if r.Version > 7 { + pe.putBool(r.IncludeClusterAuthorizedOperations) + pe.putBool(r.IncludeTopicAuthorizedOperations) + } + if r.Version > 8 { + pe.putEmptyTaggedFieldArray() + } return nil } func (r *MetadataRequest) decode(pd packetDecoder, version int16) (err error) { r.Version = version - size, err := pd.getInt32() - if err != nil { - return err - } - if size > 0 { - r.Topics = make([]string, size) + if r.Version < 9 { + size, err := pd.getInt32() + if err != nil { + return err + } + if size > 0 { + r.Topics = make([]string, size) + for i := range r.Topics { + topic, err := pd.getString() + if err != nil { + return err + } + r.Topics[i] = topic + } + } + } else if r.Version == 9 { + size, err := pd.getCompactArrayLength() + if err != nil { + return err + } + if size > 0 { + r.Topics = make([]string, size) + } for i := range r.Topics { - topic, err := pd.getString() + topic, err := pd.getCompactString() if err != nil { return err } r.Topics[i] = topic + if _, err := pd.getEmptyTaggedFieldArray(); err != nil { + return err + } + } + } else { // version 10+ + size, err := pd.getCompactArrayLength() + if err != nil { + return err + } + + if size > 0 { + r.Topics = make([]string, size) + } + for i := range r.Topics { + if _, err = pd.getRawBytes(16); err != nil { // skip UUID + return err + } + topic, err := pd.getCompactNullableString() + if err != nil { + return err + } + if topic != nil { + r.Topics[i] = *topic + } + + if _, err := pd.getEmptyTaggedFieldArray(); err != nil { + return err + } } } @@ -73,6 +173,23 @@ func (r *MetadataRequest) decode(pd packetDecoder, version int16) (err error) { } } + if r.Version > 7 { + includeClusterAuthz, err := pd.getBool() + if err != nil { + return err + } + r.IncludeClusterAuthorizedOperations = includeClusterAuthz + includeTopicAuthz, err := pd.getBool() + if err != nil { + return err + } + r.IncludeTopicAuthorizedOperations = includeTopicAuthz + } + if r.Version > 8 { + if _, err := pd.getEmptyTaggedFieldArray(); err != nil { + return err + } + } return nil } @@ -85,24 +202,39 @@ func (r *MetadataRequest) version() int16 { } func (r *MetadataRequest) headerVersion() int16 { + if r.Version >= 9 { + return 2 + } return 1 } +func (r *MetadataRequest) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 10 +} + func (r *MetadataRequest) requiredVersion() KafkaVersion { switch r.Version { - case 1: - return V0_10_0_0 - case 2: - return V0_10_1_0 - case 3, 4: - return V0_11_0_0 - case 5: - return V1_0_0_0 - case 6: - return V2_0_0_0 + case 10: + return V2_8_0_0 + case 9: + return V2_4_0_0 + case 8: + return V2_3_0_0 case 7: return V2_1_0_0 + case 6: + return V2_0_0_0 + case 5: + return V1_0_0_0 + case 3, 4: + return V0_11_0_0 + case 2: + return V0_10_1_0 + case 1: + return V0_10_0_0 + case 0: + return V0_8_2_0 default: - return MinVersion + return V2_8_0_0 } } diff --git a/vendor/github.com/IBM/sarama/metadata_response.go b/vendor/github.com/IBM/sarama/metadata_response.go index 10a56877d..dfb5d3a5b 100644 --- a/vendor/github.com/IBM/sarama/metadata_response.go +++ b/vendor/github.com/IBM/sarama/metadata_response.go @@ -1,5 +1,7 @@ package sarama +import "time" + // PartitionMetadata contains each partition in the topic. type PartitionMetadata struct { // Version defines the protocol version to use for encode and decode @@ -42,16 +44,38 @@ func (p *PartitionMetadata) decode(pd packetDecoder, version int16) (err error) } } - if p.Replicas, err = pd.getInt32Array(); err != nil { + if p.Version < 9 { + p.Replicas, err = pd.getInt32Array() + } else { + p.Replicas, err = pd.getCompactInt32Array() + } + if err != nil { return err } - if p.Isr, err = pd.getInt32Array(); err != nil { + if p.Version < 9 { + p.Isr, err = pd.getInt32Array() + } else { + p.Isr, err = pd.getCompactInt32Array() + } + if err != nil { return err } if p.Version >= 5 { - if p.OfflineReplicas, err = pd.getInt32Array(); err != nil { + if p.Version < 9 { + p.OfflineReplicas, err = pd.getInt32Array() + } else { + p.OfflineReplicas, err = pd.getCompactInt32Array() + } + if err != nil { + return err + } + } + + if p.Version >= 9 { + _, err = pd.getEmptyTaggedFieldArray() + if err != nil { return err } } @@ -71,20 +95,39 @@ func (p *PartitionMetadata) encode(pe packetEncoder, version int16) (err error) pe.putInt32(p.LeaderEpoch) } - if err := pe.putInt32Array(p.Replicas); err != nil { + if p.Version < 9 { + err = pe.putInt32Array(p.Replicas) + } else { + err = pe.putCompactInt32Array(p.Replicas) + } + if err != nil { return err } - if err := pe.putInt32Array(p.Isr); err != nil { + if p.Version < 9 { + err = pe.putInt32Array(p.Isr) + } else { + err = pe.putCompactInt32Array(p.Isr) + } + if err != nil { return err } if p.Version >= 5 { - if err := pe.putInt32Array(p.OfflineReplicas); err != nil { + if p.Version < 9 { + err = pe.putInt32Array(p.OfflineReplicas) + } else { + err = pe.putCompactInt32Array(p.OfflineReplicas) + } + if err != nil { return err } } + if p.Version >= 9 { + pe.putEmptyTaggedFieldArray() + } + return nil } @@ -96,10 +139,12 @@ type TopicMetadata struct { Err KError // Name contains the topic name. Name string + Uuid Uuid // IsInternal contains a True if the topic is internal. IsInternal bool // Partitions contains each partition in the topic. - Partitions []*PartitionMetadata + Partitions []*PartitionMetadata + TopicAuthorizedOperations int32 // Only valid for Version >= 8 } func (t *TopicMetadata) decode(pd packetDecoder, version int16) (err error) { @@ -110,21 +155,44 @@ func (t *TopicMetadata) decode(pd packetDecoder, version int16) (err error) { } t.Err = KError(tmp) - if t.Name, err = pd.getString(); err != nil { + if t.Version < 9 { + t.Name, err = pd.getString() + } else { + t.Name, err = pd.getCompactString() + } + if err != nil { return err } + if t.Version >= 10 { + uuid, err := pd.getRawBytes(16) + if err != nil { + return err + } + t.Uuid = [16]byte{} + for i := 0; i < 16; i++ { + t.Uuid[i] = uuid[i] + } + } + if t.Version >= 1 { - if t.IsInternal, err = pd.getBool(); err != nil { + t.IsInternal, err = pd.getBool() + if err != nil { return err } } - if numPartitions, err := pd.getArrayLength(); err != nil { + var n int + if t.Version < 9 { + n, err = pd.getArrayLength() + } else { + n, err = pd.getCompactArrayLength() + } + if err != nil { return err } else { - t.Partitions = make([]*PartitionMetadata, numPartitions) - for i := 0; i < numPartitions; i++ { + t.Partitions = make([]*PartitionMetadata, n) + for i := 0; i < n; i++ { block := &PartitionMetadata{} if err := block.decode(pd, t.Version); err != nil { return err @@ -133,6 +201,20 @@ func (t *TopicMetadata) decode(pd packetDecoder, version int16) (err error) { } } + if t.Version >= 8 { + t.TopicAuthorizedOperations, err = pd.getInt32() + if err != nil { + return err + } + } + + if t.Version >= 9 { + _, err = pd.getEmptyTaggedFieldArray() + if err != nil { + return err + } + } + return nil } @@ -140,16 +222,33 @@ func (t *TopicMetadata) encode(pe packetEncoder, version int16) (err error) { t.Version = version pe.putInt16(int16(t.Err)) - if err := pe.putString(t.Name); err != nil { + if t.Version < 9 { + err = pe.putString(t.Name) + } else { + err = pe.putCompactString(t.Name) + } + if err != nil { return err } + if t.Version >= 10 { + err = pe.putRawBytes(t.Uuid[:]) + if err != nil { + return err + } + } + if t.Version >= 1 { pe.putBool(t.IsInternal) } - if err := pe.putArrayLength(len(t.Partitions)); err != nil { - return err + if t.Version < 9 { + err = pe.putArrayLength(len(t.Partitions)) + if err != nil { + return err + } + } else { + pe.putCompactArrayLength(len(t.Partitions)) } for _, block := range t.Partitions { if err := block.encode(pe, t.Version); err != nil { @@ -157,6 +256,14 @@ func (t *TopicMetadata) encode(pe packetEncoder, version int16) (err error) { } } + if t.Version >= 8 { + pe.putInt32(t.TopicAuthorizedOperations) + } + + if t.Version >= 9 { + pe.putEmptyTaggedFieldArray() + } + return nil } @@ -172,7 +279,8 @@ type MetadataResponse struct { // ControllerID contains the ID of the controller broker. ControllerID int32 // Topics contains each topic in the response. - Topics []*TopicMetadata + Topics []*TopicMetadata + ClusterAuthorizedOperations int32 // Only valid for Version >= 8 } func (r *MetadataResponse) decode(pd packetDecoder, version int16) (err error) { @@ -183,12 +291,18 @@ func (r *MetadataResponse) decode(pd packetDecoder, version int16) (err error) { } } - n, err := pd.getArrayLength() + var brokerArrayLen int + if r.Version < 9 { + brokerArrayLen, err = pd.getArrayLength() + } else { + brokerArrayLen, err = pd.getCompactArrayLength() + } if err != nil { return err } - r.Brokers = make([]*Broker, n) - for i := 0; i < n; i++ { + + r.Brokers = make([]*Broker, brokerArrayLen) + for i := 0; i < brokerArrayLen; i++ { r.Brokers[i] = new(Broker) err = r.Brokers[i].decode(pd, version) if err != nil { @@ -197,7 +311,12 @@ func (r *MetadataResponse) decode(pd packetDecoder, version int16) (err error) { } if r.Version >= 2 { - if r.ClusterID, err = pd.getNullableString(); err != nil { + if r.Version < 9 { + r.ClusterID, err = pd.getNullableString() + } else { + r.ClusterID, err = pd.getCompactNullableString() + } + if err != nil { return err } } @@ -208,16 +327,36 @@ func (r *MetadataResponse) decode(pd packetDecoder, version int16) (err error) { } } - if numTopics, err := pd.getArrayLength(); err != nil { - return err + var topicArrayLen int + if version < 9 { + topicArrayLen, err = pd.getArrayLength() } else { - r.Topics = make([]*TopicMetadata, numTopics) - for i := 0; i < numTopics; i++ { - block := &TopicMetadata{} - if err := block.decode(pd, r.Version); err != nil { - return err - } - r.Topics[i] = block + topicArrayLen, err = pd.getCompactArrayLength() + } + if err != nil { + return err + } + + r.Topics = make([]*TopicMetadata, topicArrayLen) + for i := 0; i < topicArrayLen; i++ { + r.Topics[i] = new(TopicMetadata) + err = r.Topics[i].decode(pd, version) + if err != nil { + return err + } + } + + if r.Version >= 8 { + r.ClusterAuthorizedOperations, err = pd.getInt32() + if err != nil { + return err + } + } + + if r.Version >= 9 { + _, err := pd.getEmptyTaggedFieldArray() + if err != nil { + return err } } @@ -229,9 +368,15 @@ func (r *MetadataResponse) encode(pe packetEncoder) (err error) { pe.putInt32(r.ThrottleTimeMs) } - if err := pe.putArrayLength(len(r.Brokers)); err != nil { - return err + if r.Version < 9 { + err = pe.putArrayLength(len(r.Brokers)) + if err != nil { + return err + } + } else { + pe.putCompactArrayLength(len(r.Brokers)) } + for _, broker := range r.Brokers { err = broker.encode(pe, r.Version) if err != nil { @@ -240,8 +385,16 @@ func (r *MetadataResponse) encode(pe packetEncoder) (err error) { } if r.Version >= 2 { - if err := pe.putNullableString(r.ClusterID); err != nil { - return err + if r.Version < 9 { + err = pe.putNullableString(r.ClusterID) + if err != nil { + return err + } + } else { + err = pe.putNullableCompactString(r.ClusterID) + if err != nil { + return err + } } } @@ -249,7 +402,12 @@ func (r *MetadataResponse) encode(pe packetEncoder) (err error) { pe.putInt32(r.ControllerID) } - if err := pe.putArrayLength(len(r.Topics)); err != nil { + if r.Version < 9 { + err = pe.putArrayLength(len(r.Topics)) + } else { + pe.putCompactArrayLength(len(r.Topics)) + } + if err != nil { return err } for _, block := range r.Topics { @@ -258,6 +416,14 @@ func (r *MetadataResponse) encode(pe packetEncoder) (err error) { } } + if r.Version >= 8 { + pe.putInt32(r.ClusterAuthorizedOperations) + } + + if r.Version >= 9 { + pe.putEmptyTaggedFieldArray() + } + return nil } @@ -270,28 +436,48 @@ func (r *MetadataResponse) version() int16 { } func (r *MetadataResponse) headerVersion() int16 { - return 0 + if r.Version < 9 { + return 0 + } else { + return 1 + } +} + +func (r *MetadataResponse) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 7 } func (r *MetadataResponse) requiredVersion() KafkaVersion { switch r.Version { - case 1: - return V0_10_0_0 - case 2: - return V0_10_1_0 - case 3, 4: - return V0_11_0_0 - case 5: - return V1_0_0_0 - case 6: - return V2_0_0_0 + case 10: + return V2_8_0_0 + case 9: + return V2_4_0_0 + case 8: + return V2_3_0_0 case 7: return V2_1_0_0 + case 6: + return V2_0_0_0 + case 5: + return V1_0_0_0 + case 3, 4: + return V0_11_0_0 + case 2: + return V0_10_1_0 + case 1: + return V0_10_0_0 + case 0: + return V0_8_2_0 default: - return MinVersion + return V2_8_0_0 } } +func (r *MetadataResponse) throttleTime() time.Duration { + return time.Duration(r.ThrottleTimeMs) * time.Millisecond +} + // testing API func (r *MetadataResponse) AddBroker(addr string, id int32) { @@ -336,7 +522,16 @@ func (r *MetadataResponse) AddTopicPartition(topic string, partition, brokerID i foundPartition: pmatch.Leader = brokerID pmatch.Replicas = replicas + if pmatch.Replicas == nil { + pmatch.Replicas = []int32{} + } pmatch.Isr = isr + if pmatch.Isr == nil { + pmatch.Isr = []int32{} + } pmatch.OfflineReplicas = offline + if pmatch.OfflineReplicas == nil { + pmatch.OfflineReplicas = []int32{} + } pmatch.Err = err } diff --git a/vendor/github.com/IBM/sarama/mockbroker.go b/vendor/github.com/IBM/sarama/mockbroker.go index 628c3cb90..8b73074fb 100644 --- a/vendor/github.com/IBM/sarama/mockbroker.go +++ b/vendor/github.com/IBM/sarama/mockbroker.go @@ -178,7 +178,9 @@ func (b *MockBroker) serverLoop() { i++ } wg.Wait() - Logger.Printf("*** mockbroker/%d: listener closed, err=%v", b.BrokerID(), err) + if !isConnectionClosedError(err) { + Logger.Printf("*** mockbroker/%d: listener closed, err=%v", b.BrokerID(), err) + } } func (b *MockBroker) SetGSSAPIHandler(handler GSSApiHandlerFunc) { @@ -243,8 +245,10 @@ func (b *MockBroker) handleRequests(conn io.ReadWriteCloser, idx int, wg *sync.W for { buffer, err := b.readToBytes(conn) if err != nil { - Logger.Printf("*** mockbroker/%d/%d: invalid request: err=%+v, %+v", b.brokerID, idx, err, spew.Sdump(buffer)) - b.serverError(err) + if !isConnectionClosedError(err) { + Logger.Printf("*** mockbroker/%d/%d: invalid request: err=%+v, %+v", b.brokerID, idx, err, spew.Sdump(buffer)) + b.serverError(err) + } break } @@ -253,8 +257,10 @@ func (b *MockBroker) handleRequests(conn io.ReadWriteCloser, idx int, wg *sync.W req, br, err := decodeRequest(bytes.NewReader(buffer)) bytesRead = br if err != nil { - Logger.Printf("*** mockbroker/%d/%d: invalid request: err=%+v, %+v", b.brokerID, idx, err, spew.Sdump(req)) - b.serverError(err) + if !isConnectionClosedError(err) { + Logger.Printf("*** mockbroker/%d/%d: invalid request: err=%+v, %+v", b.brokerID, idx, err, spew.Sdump(req)) + b.serverError(err) + } break } @@ -280,7 +286,7 @@ func (b *MockBroker) handleRequests(conn io.ReadWriteCloser, idx int, wg *sync.W encodedRes, err := encode(res, nil) if err != nil { - b.serverError(err) + b.serverError(fmt.Errorf("failed to encode %T - %w", res, err)) break } if len(encodedRes) == 0 { @@ -358,21 +364,25 @@ func (b *MockBroker) defaultRequestHandler(req *request) (res encoderWithHeader) } } -func (b *MockBroker) serverError(err error) { - isConnectionClosedError := false +func isConnectionClosedError(err error) bool { + var result bool opError := &net.OpError{} if errors.As(err, &opError) { - isConnectionClosedError = true + result = true } else if errors.Is(err, io.EOF) { - isConnectionClosedError = true + result = true } else if err.Error() == "use of closed network connection" { - isConnectionClosedError = true + result = true } - if isConnectionClosedError { + return result +} + +func (b *MockBroker) serverError(err error) { + b.t.Helper() + if isConnectionClosedError(err) { return } - b.t.Errorf(err.Error()) } diff --git a/vendor/github.com/IBM/sarama/mockresponses.go b/vendor/github.com/IBM/sarama/mockresponses.go index 15b4367f9..07a636740 100644 --- a/vendor/github.com/IBM/sarama/mockresponses.go +++ b/vendor/github.com/IBM/sarama/mockresponses.go @@ -13,6 +13,7 @@ type TestReporter interface { Errorf(string, ...interface{}) Fatal(...interface{}) Fatalf(string, ...interface{}) + Helper() } // MockResponse is a response builder interface it defines one method that @@ -82,9 +83,9 @@ func NewMockListGroupsResponse(t TestReporter) *MockListGroupsResponse { func (m *MockListGroupsResponse) For(reqBody versionedDecoder) encoderWithHeader { request := reqBody.(*ListGroupsRequest) - _ = request response := &ListGroupsResponse{ - Groups: m.groups, + Version: request.Version, + Groups: m.groups, } return response } @@ -114,7 +115,7 @@ func (m *MockDescribeGroupsResponse) AddGroupDescription(groupID string, descrip func (m *MockDescribeGroupsResponse) For(reqBody versionedDecoder) encoderWithHeader { request := reqBody.(*DescribeGroupsRequest) - response := &DescribeGroupsResponse{} + response := &DescribeGroupsResponse{Version: request.version()} for _, requestedGroup := range request.Groups { if group, ok := m.groups[requestedGroup]; ok { response.Groups = append(response.Groups, group) @@ -134,6 +135,7 @@ func (m *MockDescribeGroupsResponse) For(reqBody versionedDecoder) encoderWithHe // MockMetadataResponse is a `MetadataResponse` builder. type MockMetadataResponse struct { controllerID int32 + errors map[string]KError leaders map[string]map[int32]int32 brokers map[string]int32 t TestReporter @@ -141,12 +143,18 @@ type MockMetadataResponse struct { func NewMockMetadataResponse(t TestReporter) *MockMetadataResponse { return &MockMetadataResponse{ + errors: make(map[string]KError), leaders: make(map[string]map[int32]int32), brokers: make(map[string]int32), t: t, } } +func (mmr *MockMetadataResponse) SetError(topic string, kerror KError) *MockMetadataResponse { + mmr.errors[topic] = kerror + return mmr +} + func (mmr *MockMetadataResponse) SetLeader(topic string, partition, brokerID int32) *MockMetadataResponse { partitions := mmr.leaders[topic] if partitions == nil { @@ -190,10 +198,22 @@ func (mmr *MockMetadataResponse) For(reqBody versionedDecoder) encoderWithHeader metadataResponse.AddTopicPartition(topic, partition, brokerID, replicas, replicas, offlineReplicas, ErrNoError) } } + for topic, err := range mmr.errors { + metadataResponse.AddTopic(topic, err) + } return metadataResponse } for _, topic := range metadataRequest.Topics { - for partition, brokerID := range mmr.leaders[topic] { + leaders, ok := mmr.leaders[topic] + if !ok { + if err, ok := mmr.errors[topic]; ok { + metadataResponse.AddTopic(topic, err) + } else { + metadataResponse.AddTopic(topic, ErrUnknownTopicOrPartition) + } + continue + } + for partition, brokerID := range leaders { metadataResponse.AddTopicPartition(topic, partition, brokerID, replicas, replicas, offlineReplicas, ErrNoError) } } @@ -410,7 +430,7 @@ func (mr *MockConsumerMetadataResponse) SetError(group string, kerror KError) *M func (mr *MockConsumerMetadataResponse) For(reqBody versionedDecoder) encoderWithHeader { req := reqBody.(*ConsumerMetadataRequest) group := req.ConsumerGroup - res := &ConsumerMetadataResponse{} + res := &ConsumerMetadataResponse{Version: req.version()} v := mr.coordinators[group] switch v := v.(type) { case *MockBroker: @@ -458,8 +478,7 @@ func (mr *MockFindCoordinatorResponse) SetError(coordinatorType CoordinatorType, func (mr *MockFindCoordinatorResponse) For(reqBody versionedDecoder) encoderWithHeader { req := reqBody.(*FindCoordinatorRequest) - res := &FindCoordinatorResponse{} - res.Version = req.Version + res := &FindCoordinatorResponse{Version: req.version()} var v interface{} switch req.CoordinatorType { case CoordinatorGroup: @@ -507,7 +526,7 @@ func (mr *MockOffsetCommitResponse) SetError(group, topic string, partition int3 func (mr *MockOffsetCommitResponse) For(reqBody versionedDecoder) encoderWithHeader { req := reqBody.(*OffsetCommitRequest) group := req.ConsumerGroup - res := &OffsetCommitResponse{} + res := &OffsetCommitResponse{Version: req.version()} for topic, partitions := range req.blocks { for partition := range partitions { res.AddError(topic, partition, mr.getError(group, topic, partition)) @@ -564,7 +583,10 @@ func (mr *MockProduceResponse) SetError(topic string, partition int32, kerror KE func (mr *MockProduceResponse) For(reqBody versionedDecoder) encoderWithHeader { req := reqBody.(*ProduceRequest) res := &ProduceResponse{ - Version: mr.version, + Version: req.version(), + } + if mr.version > 0 { + res.Version = mr.version } for topic, partitions := range req.records { for partition := range partitions { @@ -667,7 +689,8 @@ func (mr *MockCreateTopicsResponse) For(reqBody versionedDecoder) encoderWithHea } type MockDeleteTopicsResponse struct { - t TestReporter + t TestReporter + error KError } func NewMockDeleteTopicsResponse(t TestReporter) *MockDeleteTopicsResponse { @@ -676,16 +699,21 @@ func NewMockDeleteTopicsResponse(t TestReporter) *MockDeleteTopicsResponse { func (mr *MockDeleteTopicsResponse) For(reqBody versionedDecoder) encoderWithHeader { req := reqBody.(*DeleteTopicsRequest) - res := &DeleteTopicsResponse{} + res := &DeleteTopicsResponse{Version: req.version()} res.TopicErrorCodes = make(map[string]KError) for _, topic := range req.Topics { - res.TopicErrorCodes[topic] = ErrNoError + res.TopicErrorCodes[topic] = mr.error } res.Version = req.Version return res } +func (mr *MockDeleteTopicsResponse) SetError(kerror KError) *MockDeleteTopicsResponse { + mr.error = kerror + return mr +} + type MockCreatePartitionsResponse struct { t TestReporter } @@ -696,7 +724,7 @@ func NewMockCreatePartitionsResponse(t TestReporter) *MockCreatePartitionsRespon func (mr *MockCreatePartitionsResponse) For(reqBody versionedDecoder) encoderWithHeader { req := reqBody.(*CreatePartitionsRequest) - res := &CreatePartitionsResponse{} + res := &CreatePartitionsResponse{Version: req.version()} res.TopicPartitionErrors = make(map[string]*TopicPartitionError) for topic := range req.TopicPartitions { @@ -724,7 +752,7 @@ func NewMockAlterPartitionReassignmentsResponse(t TestReporter) *MockAlterPartit func (mr *MockAlterPartitionReassignmentsResponse) For(reqBody versionedDecoder) encoderWithHeader { req := reqBody.(*AlterPartitionReassignmentsRequest) _ = req - res := &AlterPartitionReassignmentsResponse{} + res := &AlterPartitionReassignmentsResponse{Version: req.version()} return res } @@ -739,7 +767,7 @@ func NewMockListPartitionReassignmentsResponse(t TestReporter) *MockListPartitio func (mr *MockListPartitionReassignmentsResponse) For(reqBody versionedDecoder) encoderWithHeader { req := reqBody.(*ListPartitionReassignmentsRequest) _ = req - res := &ListPartitionReassignmentsResponse{} + res := &ListPartitionReassignmentsResponse{Version: req.version()} for topic, partitions := range req.blocks { for _, partition := range partitions { @@ -760,7 +788,7 @@ func NewMockDeleteRecordsResponse(t TestReporter) *MockDeleteRecordsResponse { func (mr *MockDeleteRecordsResponse) For(reqBody versionedDecoder) encoderWithHeader { req := reqBody.(*DeleteRecordsRequest) - res := &DeleteRecordsResponse{} + res := &DeleteRecordsResponse{Version: req.version()} res.Topics = make(map[string]*DeleteRecordsResponseTopic) for topic, deleteRecordRequestTopic := range req.Topics { @@ -906,7 +934,7 @@ func NewMockAlterConfigsResponse(t TestReporter) *MockAlterConfigsResponse { func (mr *MockAlterConfigsResponse) For(reqBody versionedDecoder) encoderWithHeader { req := reqBody.(*AlterConfigsRequest) - res := &AlterConfigsResponse{} + res := &AlterConfigsResponse{Version: req.version()} for _, r := range req.Resources { res.Resources = append(res.Resources, &AlterConfigsResourceResponse{ @@ -928,7 +956,7 @@ func NewMockAlterConfigsResponseWithErrorCode(t TestReporter) *MockAlterConfigsR func (mr *MockAlterConfigsResponseWithErrorCode) For(reqBody versionedDecoder) encoderWithHeader { req := reqBody.(*AlterConfigsRequest) - res := &AlterConfigsResponse{} + res := &AlterConfigsResponse{Version: req.version()} for _, r := range req.Resources { res.Resources = append(res.Resources, &AlterConfigsResourceResponse{ @@ -951,7 +979,7 @@ func NewMockIncrementalAlterConfigsResponse(t TestReporter) *MockIncrementalAlte func (mr *MockIncrementalAlterConfigsResponse) For(reqBody versionedDecoder) encoderWithHeader { req := reqBody.(*IncrementalAlterConfigsRequest) - res := &IncrementalAlterConfigsResponse{} + res := &IncrementalAlterConfigsResponse{Version: req.version()} for _, r := range req.Resources { res.Resources = append(res.Resources, &AlterConfigsResourceResponse{ @@ -973,7 +1001,7 @@ func NewMockIncrementalAlterConfigsResponseWithErrorCode(t TestReporter) *MockIn func (mr *MockIncrementalAlterConfigsResponseWithErrorCode) For(reqBody versionedDecoder) encoderWithHeader { req := reqBody.(*IncrementalAlterConfigsRequest) - res := &IncrementalAlterConfigsResponse{} + res := &IncrementalAlterConfigsResponse{Version: req.version()} for _, r := range req.Resources { res.Resources = append(res.Resources, &AlterConfigsResourceResponse{ @@ -996,7 +1024,7 @@ func NewMockCreateAclsResponse(t TestReporter) *MockCreateAclsResponse { func (mr *MockCreateAclsResponse) For(reqBody versionedDecoder) encoderWithHeader { req := reqBody.(*CreateAclsRequest) - res := &CreateAclsResponse{} + res := &CreateAclsResponse{Version: req.version()} for range req.AclCreations { res.AclCreationResponses = append(res.AclCreationResponses, &AclCreationResponse{Err: ErrNoError}) @@ -1014,7 +1042,7 @@ func NewMockCreateAclsResponseWithError(t TestReporter) *MockCreateAclsResponseE func (mr *MockCreateAclsResponseError) For(reqBody versionedDecoder) encoderWithHeader { req := reqBody.(*CreateAclsRequest) - res := &CreateAclsResponse{} + res := &CreateAclsResponse{Version: req.version()} for range req.AclCreations { res.AclCreationResponses = append(res.AclCreationResponses, &AclCreationResponse{Err: ErrInvalidRequest}) @@ -1032,7 +1060,7 @@ func NewMockListAclsResponse(t TestReporter) *MockListAclsResponse { func (mr *MockListAclsResponse) For(reqBody versionedDecoder) encoderWithHeader { req := reqBody.(*DescribeAclsRequest) - res := &DescribeAclsResponse{} + res := &DescribeAclsResponse{Version: req.version()} res.Err = ErrNoError acl := &ResourceAcls{} if req.ResourceName != nil { @@ -1075,11 +1103,12 @@ func NewMockSaslAuthenticateResponse(t TestReporter) *MockSaslAuthenticateRespon func (msar *MockSaslAuthenticateResponse) For(reqBody versionedDecoder) encoderWithHeader { req := reqBody.(*SaslAuthenticateRequest) - res := &SaslAuthenticateResponse{} - res.Version = req.Version - res.Err = msar.kerror - res.SaslAuthBytes = msar.saslAuthBytes - res.SessionLifetimeMs = msar.sessionLifetimeMs + res := &SaslAuthenticateResponse{ + Version: req.version(), + Err: msar.kerror, + SaslAuthBytes: msar.saslAuthBytes, + SessionLifetimeMs: msar.sessionLifetimeMs, + } return res } @@ -1113,7 +1142,8 @@ func NewMockSaslHandshakeResponse(t TestReporter) *MockSaslHandshakeResponse { } func (mshr *MockSaslHandshakeResponse) For(reqBody versionedDecoder) encoderWithHeader { - res := &SaslHandshakeResponse{} + req := reqBody.(*SaslHandshakeRequest) + res := &SaslHandshakeResponse{Version: req.version()} res.Err = mshr.kerror res.EnabledMechanisms = mshr.enabledMechanisms return res @@ -1135,7 +1165,7 @@ func NewMockDeleteAclsResponse(t TestReporter) *MockDeleteAclsResponse { func (mr *MockDeleteAclsResponse) For(reqBody versionedDecoder) encoderWithHeader { req := reqBody.(*DeleteAclsRequest) - res := &DeleteAclsResponse{} + res := &DeleteAclsResponse{Version: req.version()} for range req.Filters { response := &FilterResponse{Err: ErrNoError} @@ -1160,7 +1190,9 @@ func (m *MockDeleteGroupsResponse) SetDeletedGroups(groups []string) *MockDelete } func (m *MockDeleteGroupsResponse) For(reqBody versionedDecoder) encoderWithHeader { + req := reqBody.(*DeleteGroupsRequest) resp := &DeleteGroupsResponse{ + Version: req.version(), GroupErrorCodes: map[string]KError{}, } for _, group := range m.deletedGroups { @@ -1189,7 +1221,9 @@ func (m *MockDeleteOffsetResponse) SetDeletedOffset(errorCode KError, topic stri } func (m *MockDeleteOffsetResponse) For(reqBody versionedDecoder) encoderWithHeader { + req := reqBody.(*DeleteOffsetsRequest) resp := &DeleteOffsetsResponse{ + Version: req.version(), ErrorCode: m.errorCode, Errors: map[string]map[int32]KError{ m.topic: {m.partition: m.errorPartition}, @@ -1282,8 +1316,10 @@ func NewMockLeaveGroupResponse(t TestReporter) *MockLeaveGroupResponse { } func (m *MockLeaveGroupResponse) For(reqBody versionedDecoder) encoderWithHeader { + req := reqBody.(*LeaveGroupRequest) resp := &LeaveGroupResponse{ - Err: m.Err, + Version: req.version(), + Err: m.Err, } return resp } @@ -1305,7 +1341,9 @@ func NewMockSyncGroupResponse(t TestReporter) *MockSyncGroupResponse { } func (m *MockSyncGroupResponse) For(reqBody versionedDecoder) encoderWithHeader { + req := reqBody.(*SyncGroupRequest) resp := &SyncGroupResponse{ + Version: req.version(), Err: m.Err, MemberAssignment: m.MemberAssignment, } @@ -1337,7 +1375,10 @@ func NewMockHeartbeatResponse(t TestReporter) *MockHeartbeatResponse { } func (m *MockHeartbeatResponse) For(reqBody versionedDecoder) encoderWithHeader { - resp := &HeartbeatResponse{} + req := reqBody.(*HeartbeatRequest) + resp := &HeartbeatResponse{ + Version: req.version(), + } return resp } @@ -1382,7 +1423,9 @@ func (m *MockDescribeLogDirsResponse) SetLogDirs(logDirPath string, topicPartiti } func (m *MockDescribeLogDirsResponse) For(reqBody versionedDecoder) encoderWithHeader { + req := reqBody.(*DescribeLogDirsRequest) resp := &DescribeLogDirsResponse{ + Version: req.version(), LogDirs: m.logDirs, } return resp diff --git a/vendor/github.com/IBM/sarama/offset_commit_request.go b/vendor/github.com/IBM/sarama/offset_commit_request.go index ed0566fe6..45d1977d4 100644 --- a/vendor/github.com/IBM/sarama/offset_commit_request.go +++ b/vendor/github.com/IBM/sarama/offset_commit_request.go @@ -201,22 +201,26 @@ func (r *OffsetCommitRequest) headerVersion() int16 { return 1 } +func (r *OffsetCommitRequest) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 7 +} + func (r *OffsetCommitRequest) requiredVersion() KafkaVersion { switch r.Version { - case 1: - return V0_8_2_0 - case 2: - return V0_9_0_0 - case 3: - return V0_11_0_0 - case 4: - return V2_0_0_0 - case 5, 6: - return V2_1_0_0 case 7: return V2_3_0_0 + case 5, 6: + return V2_1_0_0 + case 4: + return V2_0_0_0 + case 3: + return V0_11_0_0 + case 2: + return V0_9_0_0 + case 0, 1: + return V0_8_2_0 default: - return MinVersion + return V2_4_0_0 } } diff --git a/vendor/github.com/IBM/sarama/offset_commit_response.go b/vendor/github.com/IBM/sarama/offset_commit_response.go index 4bed269aa..523508fa4 100644 --- a/vendor/github.com/IBM/sarama/offset_commit_response.go +++ b/vendor/github.com/IBM/sarama/offset_commit_response.go @@ -1,5 +1,7 @@ package sarama +import "time" + type OffsetCommitResponse struct { Version int16 ThrottleTimeMs int32 @@ -98,19 +100,29 @@ func (r *OffsetCommitResponse) headerVersion() int16 { return 0 } +func (r *OffsetCommitResponse) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 7 +} + func (r *OffsetCommitResponse) requiredVersion() KafkaVersion { switch r.Version { - case 1: - return V0_8_2_0 - case 2: - return V0_9_0_0 - case 3: - return V0_11_0_0 + case 7: + return V2_3_0_0 + case 5, 6: + return V2_1_0_0 case 4: return V2_0_0_0 - case 5, 6, 7: - return V2_3_0_0 + case 3: + return V0_11_0_0 + case 2: + return V0_9_0_0 + case 0, 1: + return V0_8_2_0 default: - return MinVersion + return V2_4_0_0 } } + +func (r *OffsetCommitResponse) throttleTime() time.Duration { + return time.Duration(r.ThrottleTimeMs) * time.Millisecond +} diff --git a/vendor/github.com/IBM/sarama/offset_fetch_request.go b/vendor/github.com/IBM/sarama/offset_fetch_request.go index 7e147eb60..c37ae73e3 100644 --- a/vendor/github.com/IBM/sarama/offset_fetch_request.go +++ b/vendor/github.com/IBM/sarama/offset_fetch_request.go @@ -171,24 +171,30 @@ func (r *OffsetFetchRequest) headerVersion() int16 { return 1 } +func (r *OffsetFetchRequest) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 7 +} + func (r *OffsetFetchRequest) requiredVersion() KafkaVersion { switch r.Version { - case 1: - return V0_8_2_0 - case 2: - return V0_10_2_0 - case 3: - return V0_11_0_0 - case 4: - return V2_0_0_0 - case 5: - return V2_1_0_0 - case 6: - return V2_4_0_0 case 7: return V2_5_0_0 + case 6: + return V2_4_0_0 + case 5: + return V2_1_0_0 + case 4: + return V2_0_0_0 + case 3: + return V0_11_0_0 + case 2: + return V0_10_2_0 + case 1: + return V0_8_2_0 + case 0: + return V0_8_2_0 default: - return MinVersion + return V2_5_0_0 } } diff --git a/vendor/github.com/IBM/sarama/offset_fetch_response.go b/vendor/github.com/IBM/sarama/offset_fetch_response.go index 19449220f..b412b25f1 100644 --- a/vendor/github.com/IBM/sarama/offset_fetch_response.go +++ b/vendor/github.com/IBM/sarama/offset_fetch_response.go @@ -1,5 +1,7 @@ package sarama +import "time" + type OffsetFetchResponseBlock struct { Offset int64 LeaderEpoch int32 @@ -234,27 +236,37 @@ func (r *OffsetFetchResponse) headerVersion() int16 { return 0 } +func (r *OffsetFetchResponse) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 7 +} + func (r *OffsetFetchResponse) requiredVersion() KafkaVersion { switch r.Version { - case 1: - return V0_8_2_0 - case 2: - return V0_10_2_0 - case 3: - return V0_11_0_0 - case 4: - return V2_0_0_0 - case 5: - return V2_1_0_0 - case 6: - return V2_4_0_0 case 7: return V2_5_0_0 + case 6: + return V2_4_0_0 + case 5: + return V2_1_0_0 + case 4: + return V2_0_0_0 + case 3: + return V0_11_0_0 + case 2: + return V0_10_2_0 + case 1: + return V0_8_2_0 + case 0: + return V0_8_2_0 default: - return MinVersion + return V2_5_0_0 } } +func (r *OffsetFetchResponse) throttleTime() time.Duration { + return time.Duration(r.ThrottleTimeMs) * time.Millisecond +} + func (r *OffsetFetchResponse) GetBlock(topic string, partition int32) *OffsetFetchResponseBlock { if r.Blocks == nil { return nil diff --git a/vendor/github.com/IBM/sarama/offset_manager.go b/vendor/github.com/IBM/sarama/offset_manager.go index 9b7960599..332679fd7 100644 --- a/vendor/github.com/IBM/sarama/offset_manager.go +++ b/vendor/github.com/IBM/sarama/offset_manager.go @@ -277,24 +277,50 @@ func (om *offsetManager) flushToBroker() { } func (om *offsetManager) constructRequest() *OffsetCommitRequest { - var r *OffsetCommitRequest - var perPartitionTimestamp int64 - if om.conf.Consumer.Offsets.Retention == 0 { - perPartitionTimestamp = ReceiveTime - r = &OffsetCommitRequest{ - Version: 1, - ConsumerGroup: om.group, - ConsumerID: om.memberID, - ConsumerGroupGeneration: om.generation, - } - } else { - r = &OffsetCommitRequest{ - Version: 2, - RetentionTime: int64(om.conf.Consumer.Offsets.Retention / time.Millisecond), - ConsumerGroup: om.group, - ConsumerID: om.memberID, - ConsumerGroupGeneration: om.generation, - } + r := &OffsetCommitRequest{ + Version: 1, + ConsumerGroup: om.group, + ConsumerID: om.memberID, + ConsumerGroupGeneration: om.generation, + } + // Version 1 adds timestamp and group membership information, as well as the commit timestamp. + // + // Version 2 adds retention time. It removes the commit timestamp added in version 1. + if om.conf.Version.IsAtLeast(V0_9_0_0) { + r.Version = 2 + } + // Version 3 and 4 are the same as version 2. + if om.conf.Version.IsAtLeast(V0_11_0_0) { + r.Version = 3 + } + if om.conf.Version.IsAtLeast(V2_0_0_0) { + r.Version = 4 + } + // Version 5 removes the retention time, which is now controlled only by a broker configuration. + // + // Version 6 adds the leader epoch for fencing. + if om.conf.Version.IsAtLeast(V2_1_0_0) { + r.Version = 6 + } + // version 7 adds a new field called groupInstanceId to indicate member identity across restarts. + if om.conf.Version.IsAtLeast(V2_3_0_0) { + r.Version = 7 + r.GroupInstanceId = om.groupInstanceId + } + + // commit timestamp was only briefly supported in V1 where we set it to + // ReceiveTime (-1) to tell the broker to set it to the time when the commit + // request was received + var commitTimestamp int64 + if r.Version == 1 { + commitTimestamp = ReceiveTime + } + + // request controlled retention was only supported from V2-V4 (it became + // broker-only after that) so if the user has set the config options then + // flow those through as retention time on the commit request + if r.Version >= 2 && r.Version < 5 && om.conf.Consumer.Offsets.Retention > 0 { + r.RetentionTime = int64(om.conf.Consumer.Offsets.Retention / time.Millisecond) } om.pomsLock.RLock() @@ -304,17 +330,12 @@ func (om *offsetManager) constructRequest() *OffsetCommitRequest { for _, pom := range topicManagers { pom.lock.Lock() if pom.dirty { - r.AddBlockWithLeaderEpoch(pom.topic, pom.partition, pom.offset, pom.leaderEpoch, perPartitionTimestamp, pom.metadata) + r.AddBlockWithLeaderEpoch(pom.topic, pom.partition, pom.offset, pom.leaderEpoch, commitTimestamp, pom.metadata) } pom.lock.Unlock() } } - if om.groupInstanceId != nil { - r.Version = 7 - r.GroupInstanceId = om.groupInstanceId - } - if len(r.blocks) > 0 { return r } diff --git a/vendor/github.com/IBM/sarama/offset_request.go b/vendor/github.com/IBM/sarama/offset_request.go index 4c9ce4df5..4e2934e0f 100644 --- a/vendor/github.com/IBM/sarama/offset_request.go +++ b/vendor/github.com/IBM/sarama/offset_request.go @@ -1,12 +1,18 @@ package sarama type offsetRequestBlock struct { - time int64 - maxOffsets int32 // Only used in version 0 + currentLeaderEpoch int32 // used in version 4+ + time int64 + maxOffsets int32 // Only used in version 0 } func (b *offsetRequestBlock) encode(pe packetEncoder, version int16) error { + if version >= 4 { + pe.putInt32(b.currentLeaderEpoch) + } + pe.putInt64(b.time) + if version == 0 { pe.putInt32(b.maxOffsets) } @@ -15,14 +21,23 @@ func (b *offsetRequestBlock) encode(pe packetEncoder, version int16) error { } func (b *offsetRequestBlock) decode(pd packetDecoder, version int16) (err error) { + b.currentLeaderEpoch = -1 + if version >= 4 { + if b.currentLeaderEpoch, err = pd.getInt32(); err != nil { + return err + } + } + if b.time, err = pd.getInt64(); err != nil { return err } + if version == 0 { if b.maxOffsets, err = pd.getInt32(); err != nil { return err } } + return nil } @@ -137,14 +152,24 @@ func (r *OffsetRequest) headerVersion() int16 { return 1 } +func (r *OffsetRequest) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 4 +} + func (r *OffsetRequest) requiredVersion() KafkaVersion { switch r.Version { - case 1: - return V0_10_1_0 + case 4: + return V2_1_0_0 + case 3: + return V2_0_0_0 case 2: return V0_11_0_0 + case 1: + return V0_10_1_0 + case 0: + return V0_8_2_0 default: - return MinVersion + return V2_0_0_0 } } @@ -170,6 +195,7 @@ func (r *OffsetRequest) AddBlock(topic string, partitionID int32, time int64, ma } tmp := new(offsetRequestBlock) + tmp.currentLeaderEpoch = -1 tmp.time = time if r.Version == 0 { tmp.maxOffsets = maxOffsets diff --git a/vendor/github.com/IBM/sarama/offset_response.go b/vendor/github.com/IBM/sarama/offset_response.go index ffe84664c..6c62e0791 100644 --- a/vendor/github.com/IBM/sarama/offset_response.go +++ b/vendor/github.com/IBM/sarama/offset_response.go @@ -1,10 +1,17 @@ package sarama +import "time" + type OffsetResponseBlock struct { - Err KError - Offsets []int64 // Version 0 - Offset int64 // Version 1 - Timestamp int64 // Version 1 + Err KError + // Offsets contains the result offsets (for V0/V1 compatibility) + Offsets []int64 // Version 0 + // Timestamp contains the timestamp associated with the returned offset. + Timestamp int64 // Version 1 + // Offset contains the returned offset. + Offset int64 // Version 1 + // LeaderEpoch contains the current leader epoch of the partition. + LeaderEpoch int32 } func (b *OffsetResponseBlock) decode(pd packetDecoder, version int16) (err error) { @@ -16,22 +23,29 @@ func (b *OffsetResponseBlock) decode(pd packetDecoder, version int16) (err error if version == 0 { b.Offsets, err = pd.getInt64Array() - return err } - b.Timestamp, err = pd.getInt64() - if err != nil { - return err - } + if version >= 1 { + b.Timestamp, err = pd.getInt64() + if err != nil { + return err + } - b.Offset, err = pd.getInt64() - if err != nil { - return err + b.Offset, err = pd.getInt64() + if err != nil { + return err + } + + // For backwards compatibility put the offset in the offsets array too + b.Offsets = []int64{b.Offset} } - // For backwards compatibility put the offset in the offsets array too - b.Offsets = []int64{b.Offset} + if version >= 4 { + if b.LeaderEpoch, err = pd.getInt32(); err != nil { + return err + } + } return nil } @@ -43,8 +57,14 @@ func (b *OffsetResponseBlock) encode(pe packetEncoder, version int16) (err error return pe.putInt64Array(b.Offsets) } - pe.putInt64(b.Timestamp) - pe.putInt64(b.Offset) + if version >= 1 { + pe.putInt64(b.Timestamp) + pe.putInt64(b.Offset) + } + + if version >= 4 { + pe.putInt32(b.LeaderEpoch) + } return nil } @@ -165,17 +185,31 @@ func (r *OffsetResponse) headerVersion() int16 { return 0 } +func (r *OffsetResponse) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 4 +} + func (r *OffsetResponse) requiredVersion() KafkaVersion { switch r.Version { - case 1: - return V0_10_1_0 + case 4: + return V2_1_0_0 + case 3: + return V2_0_0_0 case 2: return V0_11_0_0 + case 1: + return V0_10_1_0 + case 0: + return V0_8_2_0 default: - return MinVersion + return V2_0_0_0 } } +func (r *OffsetResponse) throttleTime() time.Duration { + return time.Duration(r.ThrottleTimeMs) * time.Millisecond +} + // testing API func (r *OffsetResponse) AddTopicPartition(topic string, partition int32, offset int64) { diff --git a/vendor/github.com/IBM/sarama/partitioner.go b/vendor/github.com/IBM/sarama/partitioner.go index 57377760a..50a345a3e 100644 --- a/vendor/github.com/IBM/sarama/partitioner.go +++ b/vendor/github.com/IBM/sarama/partitioner.go @@ -2,6 +2,7 @@ package sarama import ( "hash" + "hash/crc32" "hash/fnv" "math/rand" "time" @@ -53,6 +54,15 @@ func WithAbsFirst() HashPartitionerOption { } } +// WithHashUnsigned means the partitioner treats the hashed value as unsigned when +// partitioning. This is intended to be combined with the crc32 hash algorithm to +// be compatible with librdkafka's implementation +func WithHashUnsigned() HashPartitionerOption { + return func(hp *hashPartitioner) { + hp.hashUnsigned = true + } +} + // WithCustomHashFunction lets you specify what hash function to use for the partitioning func WithCustomHashFunction(hasher func() hash.Hash32) HashPartitionerOption { return func(hp *hashPartitioner) { @@ -126,6 +136,7 @@ type hashPartitioner struct { random Partitioner hasher hash.Hash32 referenceAbs bool + hashUnsigned bool } // NewCustomHashPartitioner is a wrapper around NewHashPartitioner, allowing the use of custom hasher. @@ -137,6 +148,7 @@ func NewCustomHashPartitioner(hasher func() hash.Hash32) PartitionerConstructor p.random = NewRandomPartitioner(topic) p.hasher = hasher() p.referenceAbs = false + p.hashUnsigned = false return p } } @@ -148,6 +160,7 @@ func NewCustomPartitioner(options ...HashPartitionerOption) PartitionerConstruct p.random = NewRandomPartitioner(topic) p.hasher = fnv.New32a() p.referenceAbs = false + p.hashUnsigned = false for _, option := range options { option(p) } @@ -164,6 +177,7 @@ func NewHashPartitioner(topic string) Partitioner { p.random = NewRandomPartitioner(topic) p.hasher = fnv.New32a() p.referenceAbs = false + p.hashUnsigned = false return p } @@ -176,6 +190,19 @@ func NewReferenceHashPartitioner(topic string) Partitioner { p.random = NewRandomPartitioner(topic) p.hasher = fnv.New32a() p.referenceAbs = true + p.hashUnsigned = false + return p +} + +// NewConsistentCRCHashPartitioner is like NewHashPartitioner execpt that it uses the *unsigned* crc32 hash +// of the encoded bytes of the message key modulus the number of partitions. This is compatible with +// librdkafka's `consistent_random` partitioner +func NewConsistentCRCHashPartitioner(topic string) Partitioner { + p := new(hashPartitioner) + p.random = NewRandomPartitioner(topic) + p.hasher = crc32.NewIEEE() + p.referenceAbs = false + p.hashUnsigned = true return p } @@ -199,6 +226,10 @@ func (p *hashPartitioner) Partition(message *ProducerMessage, numPartitions int3 // but not past Sarama versions if p.referenceAbs { partition = (int32(p.hasher.Sum32()) & 0x7fffffff) % numPartitions + } else if p.hashUnsigned { + // librdkafka treats the hashed value as unsigned. If `hashUnsigned` is set we are compatible + // with librdkafka's `consistent` partitioning but not past Sarama versions + partition = int32(p.hasher.Sum32() % uint32(numPartitions)) } else { partition = int32(p.hasher.Sum32()) % numPartitions if partition < 0 { diff --git a/vendor/github.com/IBM/sarama/produce_request.go b/vendor/github.com/IBM/sarama/produce_request.go index 0034651e2..cbe58dd82 100644 --- a/vendor/github.com/IBM/sarama/produce_request.go +++ b/vendor/github.com/IBM/sarama/produce_request.go @@ -29,7 +29,8 @@ type ProduceRequest struct { } func updateMsgSetMetrics(msgSet *MessageSet, compressionRatioMetric metrics.Histogram, - topicCompressionRatioMetric metrics.Histogram) int64 { + topicCompressionRatioMetric metrics.Histogram, +) int64 { var topicRecordCount int64 for _, messageBlock := range msgSet.Messages { // Is this a fake "message" wrapping real messages? @@ -53,7 +54,8 @@ func updateMsgSetMetrics(msgSet *MessageSet, compressionRatioMetric metrics.Hist } func updateBatchMetrics(recordBatch *RecordBatch, compressionRatioMetric metrics.Histogram, - topicCompressionRatioMetric metrics.Histogram) int64 { + topicCompressionRatioMetric metrics.Histogram, +) int64 { if recordBatch.compressedRecords != nil { compressionRatio := int64(float64(recordBatch.recordsLen) / float64(len(recordBatch.compressedRecords)) * 100) compressionRatioMetric.Update(compressionRatio) @@ -210,18 +212,28 @@ func (r *ProduceRequest) headerVersion() int16 { return 1 } +func (r *ProduceRequest) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 7 +} + func (r *ProduceRequest) requiredVersion() KafkaVersion { switch r.Version { - case 1: - return V0_9_0_0 - case 2: - return V0_10_0_0 - case 3: - return V0_11_0_0 case 7: return V2_1_0_0 + case 6: + return V2_0_0_0 + case 4, 5: + return V1_0_0_0 + case 3: + return V0_11_0_0 + case 2: + return V0_10_0_0 + case 1: + return V0_9_0_0 + case 0: + return V0_8_2_0 default: - return MinVersion + return V2_1_0_0 } } diff --git a/vendor/github.com/IBM/sarama/produce_response.go b/vendor/github.com/IBM/sarama/produce_response.go index edf978790..de53e06a0 100644 --- a/vendor/github.com/IBM/sarama/produce_response.go +++ b/vendor/github.com/IBM/sarama/produce_response.go @@ -175,8 +175,33 @@ func (r *ProduceResponse) headerVersion() int16 { return 0 } +func (r *ProduceResponse) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 7 +} + func (r *ProduceResponse) requiredVersion() KafkaVersion { - return MinVersion + switch r.Version { + case 7: + return V2_1_0_0 + case 6: + return V2_0_0_0 + case 4, 5: + return V1_0_0_0 + case 3: + return V0_11_0_0 + case 2: + return V0_10_0_0 + case 1: + return V0_9_0_0 + case 0: + return V0_8_2_0 + default: + return V2_1_0_0 + } +} + +func (r *ProduceResponse) throttleTime() time.Duration { + return r.ThrottleTime } func (r *ProduceResponse) GetBlock(topic string, partition int32) *ProduceResponseBlock { diff --git a/vendor/github.com/IBM/sarama/produce_set.go b/vendor/github.com/IBM/sarama/produce_set.go index 8d6980479..004fc6490 100644 --- a/vendor/github.com/IBM/sarama/produce_set.go +++ b/vendor/github.com/IBM/sarama/produce_set.go @@ -141,8 +141,13 @@ func (ps *produceSet) buildRequest() *ProduceRequest { req.TransactionalID = &ps.parent.conf.Producer.Transaction.ID } } - - if ps.parent.conf.Producer.Compression == CompressionZSTD && ps.parent.conf.Version.IsAtLeast(V2_1_0_0) { + if ps.parent.conf.Version.IsAtLeast(V1_0_0_0) { + req.Version = 5 + } + if ps.parent.conf.Version.IsAtLeast(V2_0_0_0) { + req.Version = 6 + } + if ps.parent.conf.Version.IsAtLeast(V2_1_0_0) { req.Version = 7 } diff --git a/vendor/github.com/IBM/sarama/request.go b/vendor/github.com/IBM/sarama/request.go index 1e3923de7..e8e74ca34 100644 --- a/vendor/github.com/IBM/sarama/request.go +++ b/vendor/github.com/IBM/sarama/request.go @@ -12,6 +12,7 @@ type protocolBody interface { key() int16 version() int16 headerVersion() int16 + isValidVersion() bool requiredVersion() KafkaVersion } @@ -119,85 +120,114 @@ func decodeRequest(r io.Reader) (*request, int, error) { func allocateBody(key, version int16) protocolBody { switch key { case 0: - return &ProduceRequest{} + return &ProduceRequest{Version: version} case 1: return &FetchRequest{Version: version} case 2: return &OffsetRequest{Version: version} case 3: return &MetadataRequest{Version: version} + // 4: LeaderAndIsrRequest + // 5: StopReplicaRequest + // 6: UpdateMetadataRequest + // 7: ControlledShutdownRequest case 8: return &OffsetCommitRequest{Version: version} case 9: return &OffsetFetchRequest{Version: version} case 10: - return &FindCoordinatorRequest{} + return &FindCoordinatorRequest{Version: version} case 11: - return &JoinGroupRequest{} + return &JoinGroupRequest{Version: version} case 12: - return &HeartbeatRequest{} + return &HeartbeatRequest{Version: version} case 13: - return &LeaveGroupRequest{} + return &LeaveGroupRequest{Version: version} case 14: - return &SyncGroupRequest{} + return &SyncGroupRequest{Version: version} case 15: - return &DescribeGroupsRequest{} + return &DescribeGroupsRequest{Version: version} case 16: - return &ListGroupsRequest{} + return &ListGroupsRequest{Version: version} case 17: - return &SaslHandshakeRequest{} + return &SaslHandshakeRequest{Version: version} case 18: return &ApiVersionsRequest{Version: version} case 19: - return &CreateTopicsRequest{} + return &CreateTopicsRequest{Version: version} case 20: - return &DeleteTopicsRequest{} + return &DeleteTopicsRequest{Version: version} case 21: - return &DeleteRecordsRequest{} + return &DeleteRecordsRequest{Version: version} case 22: return &InitProducerIDRequest{Version: version} + // 23: OffsetForLeaderEpochRequest case 24: - return &AddPartitionsToTxnRequest{} + return &AddPartitionsToTxnRequest{Version: version} case 25: - return &AddOffsetsToTxnRequest{} + return &AddOffsetsToTxnRequest{Version: version} case 26: - return &EndTxnRequest{} + return &EndTxnRequest{Version: version} + // 27: WriteTxnMarkersRequest case 28: - return &TxnOffsetCommitRequest{} + return &TxnOffsetCommitRequest{Version: version} case 29: - return &DescribeAclsRequest{} + return &DescribeAclsRequest{Version: int(version)} case 30: - return &CreateAclsRequest{} + return &CreateAclsRequest{Version: version} case 31: - return &DeleteAclsRequest{} + return &DeleteAclsRequest{Version: int(version)} case 32: - return &DescribeConfigsRequest{} + return &DescribeConfigsRequest{Version: version} case 33: - return &AlterConfigsRequest{} + return &AlterConfigsRequest{Version: version} + // 34: AlterReplicaLogDirsRequest case 35: - return &DescribeLogDirsRequest{} + return &DescribeLogDirsRequest{Version: version} case 36: - return &SaslAuthenticateRequest{} + return &SaslAuthenticateRequest{Version: version} case 37: - return &CreatePartitionsRequest{} + return &CreatePartitionsRequest{Version: version} + // 38: CreateDelegationTokenRequest + // 39: RenewDelegationTokenRequest + // 40: ExpireDelegationTokenRequest + // 41: DescribeDelegationTokenRequest case 42: - return &DeleteGroupsRequest{} + return &DeleteGroupsRequest{Version: version} + // 43: ElectLeadersRequest case 44: - return &IncrementalAlterConfigsRequest{} + return &IncrementalAlterConfigsRequest{Version: version} case 45: - return &AlterPartitionReassignmentsRequest{} + return &AlterPartitionReassignmentsRequest{Version: version} case 46: - return &ListPartitionReassignmentsRequest{} + return &ListPartitionReassignmentsRequest{Version: version} case 47: - return &DeleteOffsetsRequest{} + return &DeleteOffsetsRequest{Version: version} case 48: - return &DescribeClientQuotasRequest{} + return &DescribeClientQuotasRequest{Version: version} case 49: - return &AlterClientQuotasRequest{} + return &AlterClientQuotasRequest{Version: version} case 50: - return &DescribeUserScramCredentialsRequest{} + return &DescribeUserScramCredentialsRequest{Version: version} case 51: - return &AlterUserScramCredentialsRequest{} + return &AlterUserScramCredentialsRequest{Version: version} + // 52: VoteRequest + // 53: BeginQuorumEpochRequest + // 54: EndQuorumEpochRequest + // 55: DescribeQuorumRequest + // 56: AlterPartitionRequest + // 57: UpdateFeaturesRequest + // 58: EnvelopeRequest + // 59: FetchSnapshotRequest + // 60: DescribeClusterRequest + // 61: DescribeProducersRequest + // 62: BrokerRegistrationRequest + // 63: BrokerHeartbeatRequest + // 64: UnregisterBrokerRequest + // 65: DescribeTransactionsRequest + // 66: ListTransactionsRequest + // 67: AllocateProducerIdsRequest + // 68: ConsumerGroupHeartbeatRequest } return nil } diff --git a/vendor/github.com/IBM/sarama/sasl_authenticate_request.go b/vendor/github.com/IBM/sarama/sasl_authenticate_request.go index 5bb0988ea..3a562a53b 100644 --- a/vendor/github.com/IBM/sarama/sasl_authenticate_request.go +++ b/vendor/github.com/IBM/sarama/sasl_authenticate_request.go @@ -31,6 +31,10 @@ func (r *SaslAuthenticateRequest) headerVersion() int16 { return 1 } +func (r *SaslAuthenticateRequest) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 1 +} + func (r *SaslAuthenticateRequest) requiredVersion() KafkaVersion { switch r.Version { case 1: diff --git a/vendor/github.com/IBM/sarama/sasl_authenticate_response.go b/vendor/github.com/IBM/sarama/sasl_authenticate_response.go index 37c8e45da..ae52cde1c 100644 --- a/vendor/github.com/IBM/sarama/sasl_authenticate_response.go +++ b/vendor/github.com/IBM/sarama/sasl_authenticate_response.go @@ -59,6 +59,10 @@ func (r *SaslAuthenticateResponse) headerVersion() int16 { return 0 } +func (r *SaslAuthenticateResponse) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 1 +} + func (r *SaslAuthenticateResponse) requiredVersion() KafkaVersion { switch r.Version { case 1: diff --git a/vendor/github.com/IBM/sarama/sasl_handshake_request.go b/vendor/github.com/IBM/sarama/sasl_handshake_request.go index 74dc3072f..410a5b0ea 100644 --- a/vendor/github.com/IBM/sarama/sasl_handshake_request.go +++ b/vendor/github.com/IBM/sarama/sasl_handshake_request.go @@ -33,6 +33,15 @@ func (r *SaslHandshakeRequest) headerVersion() int16 { return 1 } +func (r *SaslHandshakeRequest) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 1 +} + func (r *SaslHandshakeRequest) requiredVersion() KafkaVersion { - return V0_10_0_0 + switch r.Version { + case 1: + return V1_0_0_0 + default: + return V0_10_0_0 + } } diff --git a/vendor/github.com/IBM/sarama/sasl_handshake_response.go b/vendor/github.com/IBM/sarama/sasl_handshake_response.go index 69dfc3178..502732cbd 100644 --- a/vendor/github.com/IBM/sarama/sasl_handshake_response.go +++ b/vendor/github.com/IBM/sarama/sasl_handshake_response.go @@ -1,6 +1,7 @@ package sarama type SaslHandshakeResponse struct { + Version int16 Err KError EnabledMechanisms []string } @@ -30,13 +31,22 @@ func (r *SaslHandshakeResponse) key() int16 { } func (r *SaslHandshakeResponse) version() int16 { - return 0 + return r.Version } func (r *SaslHandshakeResponse) headerVersion() int16 { return 0 } +func (r *SaslHandshakeResponse) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 1 +} + func (r *SaslHandshakeResponse) requiredVersion() KafkaVersion { - return V0_10_0_0 + switch r.Version { + case 1: + return V1_0_0_0 + default: + return V0_10_0_0 + } } diff --git a/vendor/github.com/IBM/sarama/sync_group_request.go b/vendor/github.com/IBM/sarama/sync_group_request.go index 33ed3bacc..95efc2858 100644 --- a/vendor/github.com/IBM/sarama/sync_group_request.go +++ b/vendor/github.com/IBM/sarama/sync_group_request.go @@ -123,12 +123,23 @@ func (r *SyncGroupRequest) headerVersion() int16 { return 1 } +func (r *SyncGroupRequest) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 3 +} + func (r *SyncGroupRequest) requiredVersion() KafkaVersion { - switch { - case r.Version >= 3: + switch r.Version { + case 3: + return V2_3_0_0 + case 2: + return V2_0_0_0 + case 1: + return V0_11_0_0 + case 0: + return V0_9_0_0 + default: return V2_3_0_0 } - return V0_9_0_0 } func (r *SyncGroupRequest) AddGroupAssignment(memberId string, memberAssignment []byte) { diff --git a/vendor/github.com/IBM/sarama/sync_group_response.go b/vendor/github.com/IBM/sarama/sync_group_response.go index 41b63b3d0..f7da15b4f 100644 --- a/vendor/github.com/IBM/sarama/sync_group_response.go +++ b/vendor/github.com/IBM/sarama/sync_group_response.go @@ -1,9 +1,11 @@ package sarama +import "time" + type SyncGroupResponse struct { // Version defines the protocol version to use for encode and decode Version int16 - // ThrottleTimeMs contains the duration in milliseconds for which the + // ThrottleTime contains the duration in milliseconds for which the // request was throttled due to a quota violation, or zero if the request // did not violate any quota. ThrottleTime int32 @@ -57,10 +59,25 @@ func (r *SyncGroupResponse) headerVersion() int16 { return 0 } +func (r *SyncGroupResponse) isValidVersion() bool { + return r.Version >= 0 && r.Version <= 3 +} + func (r *SyncGroupResponse) requiredVersion() KafkaVersion { switch r.Version { - case 1, 2, 3: + case 3: + return V2_3_0_0 + case 2: + return V2_0_0_0 + case 1: + return V0_11_0_0 + case 0: + return V0_9_0_0 + default: return V2_3_0_0 } - return V0_9_0_0 +} + +func (r *SyncGroupResponse) throttleTime() time.Duration { + return time.Duration(r.ThrottleTime) * time.Millisecond } diff --git a/vendor/github.com/IBM/sarama/transaction_manager.go b/vendor/github.com/IBM/sarama/transaction_manager.go index e1bcda3f9..546528f26 100644 --- a/vendor/github.com/IBM/sarama/transaction_manager.go +++ b/vendor/github.com/IBM/sarama/transaction_manager.go @@ -161,8 +161,10 @@ type topicPartition struct { } // to ensure that we don't do a full scan every time a partition or an offset is added. -type topicPartitionSet map[topicPartition]struct{} -type topicPartitionOffsets map[topicPartition]*PartitionOffsetMetadata +type ( + topicPartitionSet map[topicPartition]struct{} + topicPartitionOffsets map[topicPartition]*PartitionOffsetMetadata +) func (s topicPartitionSet) mapToRequest() map[string][]int32 { result := make(map[string][]int32, len(s)) @@ -315,12 +317,20 @@ func (t *transactionManager) publishOffsetsToTxn(offsets topicPartitionOffsets, if err != nil { return true, err } - response, err := coordinator.AddOffsetsToTxn(&AddOffsetsToTxnRequest{ + request := &AddOffsetsToTxnRequest{ TransactionalID: t.transactionalID, ProducerEpoch: t.producerEpoch, ProducerID: t.producerID, GroupID: groupId, - }) + } + if t.client.Config().Version.IsAtLeast(V2_7_0_0) { + // Version 2 adds the support for new error code PRODUCER_FENCED. + request.Version = 2 + } else if t.client.Config().Version.IsAtLeast(V2_0_0_0) { + // Version 1 is the same as version 0. + request.Version = 1 + } + response, err := coordinator.AddOffsetsToTxn(request) if err != nil { // If an error occurred try to refresh current transaction coordinator. _ = coordinator.Close() @@ -390,13 +400,21 @@ func (t *transactionManager) publishOffsetsToTxn(offsets topicPartitionOffsets, if err != nil { return resultOffsets, true, err } - responses, err := consumerGroupCoordinator.TxnOffsetCommit(&TxnOffsetCommitRequest{ + request := &TxnOffsetCommitRequest{ TransactionalID: t.transactionalID, ProducerEpoch: t.producerEpoch, ProducerID: t.producerID, GroupID: groupId, Topics: offsets.mapToRequest(), - }) + } + if t.client.Config().Version.IsAtLeast(V2_1_0_0) { + // Version 2 adds the committed leader epoch. + request.Version = 2 + } else if t.client.Config().Version.IsAtLeast(V2_0_0_0) { + // Version 1 is the same as version 0. + request.Version = 1 + } + responses, err := consumerGroupCoordinator.TxnOffsetCommit(request) if err != nil { _ = consumerGroupCoordinator.Close() _ = t.client.RefreshCoordinator(groupId) @@ -466,13 +484,24 @@ func (t *transactionManager) initProducerId() (int64, int16, error) { } if t.client.Config().Version.IsAtLeast(V2_5_0_0) { - req.Version = 3 + if t.client.Config().Version.IsAtLeast(V2_7_0_0) { + // Version 4 adds the support for new error code PRODUCER_FENCED. + req.Version = 4 + } else { + // Version 3 adds ProducerId and ProducerEpoch, allowing producers to try + // to resume after an INVALID_PRODUCER_EPOCH error + req.Version = 3 + } isEpochBump = t.producerID != noProducerID && t.producerEpoch != noProducerEpoch t.coordinatorSupportsBumpingEpoch = true req.ProducerID = t.producerID req.ProducerEpoch = t.producerEpoch } else if t.client.Config().Version.IsAtLeast(V2_4_0_0) { + // Version 2 is the first flexible version. req.Version = 2 + } else if t.client.Config().Version.IsAtLeast(V2_0_0_0) { + // Version 1 is the same as version 0. + req.Version = 1 } if isEpochBump { @@ -610,12 +639,20 @@ func (t *transactionManager) endTxn(commit bool) error { if err != nil { return true, err } - response, err := coordinator.EndTxn(&EndTxnRequest{ + request := &EndTxnRequest{ TransactionalID: t.transactionalID, ProducerEpoch: t.producerEpoch, ProducerID: t.producerID, TransactionResult: commit, - }) + } + if t.client.Config().Version.IsAtLeast(V2_7_0_0) { + // Version 2 adds the support for new error code PRODUCER_FENCED. + request.Version = 2 + } else if t.client.Config().Version.IsAtLeast(V2_0_0_0) { + // Version 1 is the same as version 0. + request.Version = 1 + } + response, err := coordinator.EndTxn(request) if err != nil { // Always retry on network error _ = coordinator.Close() @@ -779,13 +816,20 @@ func (t *transactionManager) publishTxnPartitions() error { if err != nil { return true, err } - addPartResponse, err := coordinator.AddPartitionsToTxn(&AddPartitionsToTxnRequest{ + request := &AddPartitionsToTxnRequest{ TransactionalID: t.transactionalID, ProducerID: t.producerID, ProducerEpoch: t.producerEpoch, TopicPartitions: t.pendingPartitionsInCurrentTxn.mapToRequest(), - }) - + } + if t.client.Config().Version.IsAtLeast(V2_7_0_0) { + // Version 2 adds the support for new error code PRODUCER_FENCED. + request.Version = 2 + } else if t.client.Config().Version.IsAtLeast(V2_0_0_0) { + // Version 1 is the same as version 0. + request.Version = 1 + } + addPartResponse, err := coordinator.AddPartitionsToTxn(request) if err != nil { _ = coordinator.Close() _ = t.client.RefreshTransactionCoordinator(t.transactionalID) diff --git a/vendor/github.com/IBM/sarama/txn_offset_commit_request.go b/vendor/github.com/IBM/sarama/txn_offset_commit_request.go index c4043a335..ca13afb3b 100644 --- a/vendor/github.com/IBM/sarama/txn_offset_commit_request.go +++ b/vendor/github.com/IBM/sarama/txn_offset_commit_request.go @@ -1,6 +1,7 @@ package sarama type TxnOffsetCommitRequest struct { + Version int16 TransactionalID string GroupID string ProducerID int64 @@ -29,7 +30,7 @@ func (t *TxnOffsetCommitRequest) encode(pe packetEncoder) error { return err } for _, partition := range partitions { - if err := partition.encode(pe); err != nil { + if err := partition.encode(pe, t.Version); err != nil { return err } } @@ -39,6 +40,7 @@ func (t *TxnOffsetCommitRequest) encode(pe packetEncoder) error { } func (t *TxnOffsetCommitRequest) decode(pd packetDecoder, version int16) (err error) { + t.Version = version if t.TransactionalID, err = pd.getString(); err != nil { return err } @@ -88,26 +90,49 @@ func (a *TxnOffsetCommitRequest) key() int16 { } func (a *TxnOffsetCommitRequest) version() int16 { - return 0 + return a.Version } func (a *TxnOffsetCommitRequest) headerVersion() int16 { return 1 } +func (a *TxnOffsetCommitRequest) isValidVersion() bool { + return a.Version >= 0 && a.Version <= 2 +} + func (a *TxnOffsetCommitRequest) requiredVersion() KafkaVersion { - return V0_11_0_0 + switch a.Version { + case 2: + return V2_1_0_0 + case 1: + return V2_0_0_0 + case 0: + return V0_11_0_0 + default: + return V2_1_0_0 + } } type PartitionOffsetMetadata struct { + // Partition contains the index of the partition within the topic. Partition int32 - Offset int64 - Metadata *string + // Offset contains the message offset to be committed. + Offset int64 + // LeaderEpoch contains the leader epoch of the last consumed record. + LeaderEpoch int32 + // Metadata contains any associated metadata the client wants to keep. + Metadata *string } -func (p *PartitionOffsetMetadata) encode(pe packetEncoder) error { +func (p *PartitionOffsetMetadata) encode(pe packetEncoder, version int16) error { pe.putInt32(p.Partition) pe.putInt64(p.Offset) + + if version >= 2 { + pe.putInt32(p.LeaderEpoch) + } + if err := pe.putNullableString(p.Metadata); err != nil { return err } @@ -122,6 +147,13 @@ func (p *PartitionOffsetMetadata) decode(pd packetDecoder, version int16) (err e if p.Offset, err = pd.getInt64(); err != nil { return err } + + if version >= 2 { + if p.LeaderEpoch, err = pd.getInt32(); err != nil { + return err + } + } + if p.Metadata, err = pd.getNullableString(); err != nil { return err } diff --git a/vendor/github.com/IBM/sarama/txn_offset_commit_response.go b/vendor/github.com/IBM/sarama/txn_offset_commit_response.go index 94d8029da..d5144faf7 100644 --- a/vendor/github.com/IBM/sarama/txn_offset_commit_response.go +++ b/vendor/github.com/IBM/sarama/txn_offset_commit_response.go @@ -5,6 +5,7 @@ import ( ) type TxnOffsetCommitResponse struct { + Version int16 ThrottleTime time.Duration Topics map[string][]*PartitionError } @@ -33,6 +34,7 @@ func (t *TxnOffsetCommitResponse) encode(pe packetEncoder) error { } func (t *TxnOffsetCommitResponse) decode(pd packetDecoder, version int16) (err error) { + t.Version = version throttleTime, err := pd.getInt32() if err != nil { return err @@ -75,13 +77,30 @@ func (a *TxnOffsetCommitResponse) key() int16 { } func (a *TxnOffsetCommitResponse) version() int16 { - return 0 + return a.Version } func (a *TxnOffsetCommitResponse) headerVersion() int16 { return 0 } +func (a *TxnOffsetCommitResponse) isValidVersion() bool { + return a.Version >= 0 && a.Version <= 2 +} + func (a *TxnOffsetCommitResponse) requiredVersion() KafkaVersion { - return V0_11_0_0 + switch a.Version { + case 2: + return V2_1_0_0 + case 1: + return V2_0_0_0 + case 0: + return V0_11_0_0 + default: + return V2_1_0_0 + } +} + +func (r *TxnOffsetCommitResponse) throttleTime() time.Duration { + return r.ThrottleTime } diff --git a/vendor/github.com/IBM/sarama/utils.go b/vendor/github.com/IBM/sarama/utils.go index 4526543d6..748d66412 100644 --- a/vendor/github.com/IBM/sarama/utils.go +++ b/vendor/github.com/IBM/sarama/utils.go @@ -194,6 +194,10 @@ var ( V3_3_0_0 = newKafkaVersion(3, 3, 0, 0) V3_3_1_0 = newKafkaVersion(3, 3, 1, 0) V3_3_2_0 = newKafkaVersion(3, 3, 2, 0) + V3_4_0_0 = newKafkaVersion(3, 4, 0, 0) + V3_4_1_0 = newKafkaVersion(3, 4, 1, 0) + V3_5_0_0 = newKafkaVersion(3, 5, 0, 0) + V3_5_1_0 = newKafkaVersion(3, 5, 1, 0) SupportedVersions = []KafkaVersion{ V0_8_2_0, @@ -250,12 +254,16 @@ var ( V3_3_0_0, V3_3_1_0, V3_3_2_0, + V3_4_0_0, + V3_4_1_0, + V3_5_0_0, + V3_5_1_0, } MinVersion = V0_8_2_0 - MaxVersion = V3_3_2_0 - DefaultVersion = V1_0_0_0 + MaxVersion = V3_5_1_0 + DefaultVersion = V2_1_0_0 - // reduced set of versions to matrix test + // reduced set of protocol versions to matrix test fvtRangeVersions = []KafkaVersion{ V0_8_2_2, V0_10_2_2, diff --git a/vendor/github.com/antonmedv/expr/README.md b/vendor/github.com/antonmedv/expr/README.md index 242431f2c..054409df2 100644 --- a/vendor/github.com/antonmedv/expr/README.md +++ b/vendor/github.com/antonmedv/expr/README.md @@ -3,44 +3,51 @@ [![Go Report Card](https://goreportcard.com/badge/github.com/antonmedv/expr)](https://goreportcard.com/report/github.com/antonmedv/expr) [![GoDoc](https://godoc.org/github.com/antonmedv/expr?status.svg)](https://godoc.org/github.com/antonmedv/expr) +**Expr** is a Go-centric expression language designed to deliver dynamic configurations with unparalleled accuracy, safety, and speed. + expr logo -**Expr** package provides an engine that can compile and evaluate expressions. -An expression is a one-liner that returns a value (mostly, but not limited to, booleans). -It is designed for simplicity, speed and safety. +```js +// Allow only admins and moderators to moderate comments. +user.Group in ["admin", "moderator"] || user.Id == comment.UserId +``` -The purpose of the package is to allow users to use expressions inside configuration for more complex logic. -It is a perfect candidate for the foundation of a _business rule engine_. -The idea is to let configure things in a dynamic way without recompile of a program: +```js +// Ensure all tweets are less than 240 characters. +all(Tweets, .Size <= 240) +``` -```coffeescript -# Get the special price if -user.Group in ["good_customers", "collaborator"] +## Features -# Promote article to the homepage when -len(article.Comments) > 100 and article.Category not in ["misc"] +**Expr** is a safe, fast, and intuitive expression evaluator optimized for the Go language. +Here are its standout features: -# Send an alert when -product.Stock < 15 -``` +### Safety and Isolation +* **Memory-Safe**: Expr is designed with a focus on safety, ensuring that programs do not access unrelated memory or introduce memory vulnerabilities. +* **Side-Effect-Free**: Expressions evaluated in Expr only compute outputs from their inputs, ensuring no side-effects that can change state or produce unintended results. +* **Always Terminating**: Expr is designed to prevent infinite loops, ensuring that every program will conclude in a reasonable amount of time. -## Features +### Go Integration +* **Seamless with Go**: Integrate Expr into your Go projects without the need to redefine types. -* Seamless integration with Go (no need to redefine types) -* Static typing ([example](https://godoc.org/github.com/antonmedv/expr#example-Env)). +### Static Typing +* Ensures type correctness and prevents runtime type errors. ```go out, err := expr.Compile(`name + age`) // err: invalid operation + (mismatched types string and int) // | name + age // | .....^ ``` -* User-friendly error messages. -* Reasonable set of basic operators. -* Builtins `all`, `none`, `any`, `one`, `filter`, `map`. - ```coffeescript - all(Tweets, {.Size <= 280}) - ``` -* Fast ([benchmarks](https://github.com/antonmedv/golang-expression-evaluation-comparison#readme)): uses bytecode virtual machine and optimizing compiler. + +### User-Friendly +* Provides user-friendly error messages to assist with debugging and development. + +### Flexibility and Utility +* **Rich Operators**: Offers a reasonable set of basic operators for a variety of applications. +* **Built-in Functions**: Functions like `all`, `none`, `any`, `one`, `filter`, and `map` are provided out-of-the-box. + +### Performance +* **Optimized for Speed**: Expr stands out in its performance, utilizing an optimizing compiler and a bytecode virtual machine. Check out these [benchmarks](https://github.com/antonmedv/golang-expression-evaluation-comparison#readme) for more details. ## Install @@ -138,20 +145,24 @@ func main() { ## Who uses Expr? -* [Aviasales](https://aviasales.ru) uses Expr as a business rule engine for our flight search engine. -* [Wish.com](https://www.wish.com) uses Expr for decision-making rule engine in the Wish Assistant. -* [Argo](https://argoproj.github.io) uses Expr in Argo Rollouts and Argo Workflows for Kubernetes. -* [Crowdsec](https://crowdsec.net) uses Expr in a security automation tool. -* [FACEIT](https://www.faceit.com) uses Expr to allow customization of its eSports matchmaking algorithm. -* [qiniu](https://www.qiniu.com) uses Expr in trade systems. -* [Junglee Games](https://www.jungleegames.com/) uses Expr for an in house marketing retention tool [Project Audience](https://www.linkedin.com/pulse/meet-project-audience-our-no-code-swiss-army-knife-product-bharti). -* [OpenTelemetry](https://opentelemetry.io) uses Expr in the OpenTelemetry Collector. -* [Philips Labs](https://github.com/philips-labs/tabia) uses Expr in Tabia, a tool for collecting insights on the characteristics of our code bases. -* [CoreDNS](https://coredns.io) uses Expr in CoreDNS, a DNS server. -* [Chaos Mesh](https://chaos-mesh.org) uses Expr in Chaos Mesh, a cloud-native Chaos Engineering platform. -* [Milvus](https://milvus.io) uses Expr in Milvus, an open-source vector database. -* [Visually.io](https://visually.io) uses Expr as a business rule engine for our personalization targeting algorithm. -* [Akvorado](https://github.com/akvorado/akvorado) uses Expr to classify exporters and interfaces in network flows. +* [Google](https://google.com) uses Expr as one of its expression languages on the [Google Cloud Platform](https://cloud.google.com). +* [Uber](https://uber.com) uses Expr to allow customization of its Uber Eats marketplace. +* [GoDaddy](https://godaddy.com) employs Expr for the customization of its GoDaddy Pro product. +* [ByteDance](https://bytedance.com) incorporates Expr into its internal business rule engine. +* [Aviasales](https://aviasales.ru) utilizes Expr as a business rule engine for its flight search engine. +* [Wish.com](https://www.wish.com) employs Expr in its decision-making rule engine for the Wish Assistant. +* [Argo](https://argoproj.github.io) integrates Expr into Argo Rollouts and Argo Workflows for Kubernetes. +* [Crowdsec](https://crowdsec.net) incorporates Expr into its security automation tool. +* [FACEIT](https://www.faceit.com) uses Expr to enhance customization of its eSports matchmaking algorithm. +* [qiniu](https://www.qiniu.com) implements Expr in its trade systems. +* [Junglee Games](https://www.jungleegames.com/) uses Expr for its in-house marketing retention tool, Project Audience. +* [OpenTelemetry](https://opentelemetry.io) integrates Expr into the OpenTelemetry Collector. +* [Philips Labs](https://github.com/philips-labs/tabia) employs Expr in Tabia, a tool designed to collect insights on their code bases. +* [CoreDNS](https://coredns.io) uses Expr in CoreDNS, which is a DNS server. +* [Chaos Mesh](https://chaos-mesh.org) incorporates Expr into Chaos Mesh, a cloud-native Chaos Engineering platform. +* [Milvus](https://milvus.io) integrates Expr into Milvus, an open-source vector database. +* [Visually.io](https://visually.io) employs Expr as a business rule engine for its personalization targeting algorithm. +* [Akvorado](https://github.com/akvorado/akvorado) utilizes Expr to classify exporters and interfaces in network flows. [Add your company too](https://github.com/antonmedv/expr/edit/master/README.md) diff --git a/vendor/github.com/antonmedv/expr/ast/dump.go b/vendor/github.com/antonmedv/expr/ast/dump.go new file mode 100644 index 000000000..56bc7dbe2 --- /dev/null +++ b/vendor/github.com/antonmedv/expr/ast/dump.go @@ -0,0 +1,59 @@ +package ast + +import ( + "fmt" + "reflect" + "regexp" +) + +func Dump(node Node) string { + return dump(reflect.ValueOf(node), "") +} + +func dump(v reflect.Value, ident string) string { + if !v.IsValid() { + return "nil" + } + t := v.Type() + switch t.Kind() { + case reflect.Struct: + out := t.Name() + "{\n" + for i := 0; i < t.NumField(); i++ { + f := t.Field(i) + if isPrivate(f.Name) { + continue + } + s := v.Field(i) + out += fmt.Sprintf("%v%v: %v,\n", ident+"\t", f.Name, dump(s, ident+"\t")) + } + return out + ident + "}" + case reflect.Slice: + if v.Len() == 0 { + return t.String() + "{}" + } + out := t.String() + "{\n" + for i := 0; i < v.Len(); i++ { + s := v.Index(i) + out += fmt.Sprintf("%v%v,", ident+"\t", dump(s, ident+"\t")) + if i+1 < v.Len() { + out += "\n" + } + } + return out + "\n" + ident + "}" + case reflect.Ptr: + return dump(v.Elem(), ident) + case reflect.Interface: + return dump(reflect.ValueOf(v.Interface()), ident) + + case reflect.String: + return fmt.Sprintf("%q", v) + default: + return fmt.Sprintf("%v", v) + } +} + +var isCapital = regexp.MustCompile("^[A-Z]") + +func isPrivate(s string) bool { + return !isCapital.Match([]byte(s)) +} diff --git a/vendor/github.com/antonmedv/expr/ast/node.go b/vendor/github.com/antonmedv/expr/ast/node.go index 5bdcb75ed..ba6545871 100644 --- a/vendor/github.com/antonmedv/expr/ast/node.go +++ b/vendor/github.com/antonmedv/expr/ast/node.go @@ -14,6 +14,7 @@ type Node interface { SetLocation(file.Location) Type() reflect.Type SetType(reflect.Type) + String() string } func Patch(node *Node, newNode Node) { diff --git a/vendor/github.com/antonmedv/expr/ast/print.go b/vendor/github.com/antonmedv/expr/ast/print.go index 56bc7dbe2..2e8744730 100644 --- a/vendor/github.com/antonmedv/expr/ast/print.go +++ b/vendor/github.com/antonmedv/expr/ast/print.go @@ -1,59 +1,171 @@ package ast import ( + "encoding/json" "fmt" - "reflect" - "regexp" + "strings" + + "github.com/antonmedv/expr/parser/operator" + "github.com/antonmedv/expr/parser/utils" ) -func Dump(node Node) string { - return dump(reflect.ValueOf(node), "") +func (n *NilNode) String() string { + return "nil" +} + +func (n *IdentifierNode) String() string { + return n.Value +} + +func (n *IntegerNode) String() string { + return fmt.Sprintf("%d", n.Value) +} + +func (n *FloatNode) String() string { + return fmt.Sprintf("%v", n.Value) } -func dump(v reflect.Value, ident string) string { - if !v.IsValid() { +func (n *BoolNode) String() string { + return fmt.Sprintf("%t", n.Value) +} + +func (n *StringNode) String() string { + return fmt.Sprintf("%q", n.Value) +} + +func (n *ConstantNode) String() string { + if n.Value == nil { return "nil" } - t := v.Type() - switch t.Kind() { - case reflect.Struct: - out := t.Name() + "{\n" - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - if isPrivate(f.Name) { - continue - } - s := v.Field(i) - out += fmt.Sprintf("%v%v: %v,\n", ident+"\t", f.Name, dump(s, ident+"\t")) - } - return out + ident + "}" - case reflect.Slice: - if v.Len() == 0 { - return t.String() + "{}" + b, err := json.Marshal(n.Value) + if err != nil { + panic(err) + } + return string(b) +} + +func (n *UnaryNode) String() string { + op := "" + if n.Operator == "not" { + op = fmt.Sprintf("%s ", n.Operator) + } else { + op = fmt.Sprintf("%s", n.Operator) + } + if _, ok := n.Node.(*BinaryNode); ok { + return fmt.Sprintf("%s(%s)", op, n.Node.String()) + } + return fmt.Sprintf("%s%s", op, n.Node.String()) +} + +func (n *BinaryNode) String() string { + var left, right string + if b, ok := n.Left.(*BinaryNode); ok && operator.Less(b.Operator, n.Operator) { + left = fmt.Sprintf("(%s)", n.Left.String()) + } else { + left = n.Left.String() + } + if b, ok := n.Right.(*BinaryNode); ok && operator.Less(b.Operator, n.Operator) { + right = fmt.Sprintf("(%s)", n.Right.String()) + } else { + right = n.Right.String() + } + return fmt.Sprintf("%s %s %s", left, n.Operator, right) +} + +func (n *ChainNode) String() string { + return n.Node.String() +} + +func (n *MemberNode) String() string { + if n.Optional { + if str, ok := n.Property.(*StringNode); ok && utils.IsValidIdentifier(str.Value) { + return fmt.Sprintf("%s?.%s", n.Node.String(), str.Value) + } else { + return fmt.Sprintf("get(%s, %s)", n.Node.String(), n.Property.String()) } - out := t.String() + "{\n" - for i := 0; i < v.Len(); i++ { - s := v.Index(i) - out += fmt.Sprintf("%v%v,", ident+"\t", dump(s, ident+"\t")) - if i+1 < v.Len() { - out += "\n" - } + } + if str, ok := n.Property.(*StringNode); ok && utils.IsValidIdentifier(str.Value) { + if _, ok := n.Node.(*PointerNode); ok { + return fmt.Sprintf(".%s", str.Value) } - return out + "\n" + ident + "}" - case reflect.Ptr: - return dump(v.Elem(), ident) - case reflect.Interface: - return dump(reflect.ValueOf(v.Interface()), ident) + return fmt.Sprintf("%s.%s", n.Node.String(), str.Value) + } + return fmt.Sprintf("%s[%s]", n.Node.String(), n.Property.String()) +} - case reflect.String: - return fmt.Sprintf("%q", v) - default: - return fmt.Sprintf("%v", v) +func (n *SliceNode) String() string { + if n.From == nil && n.To == nil { + return fmt.Sprintf("%s[:]", n.Node.String()) + } + if n.From == nil { + return fmt.Sprintf("%s[:%s]", n.Node.String(), n.To.String()) } + if n.To == nil { + return fmt.Sprintf("%s[%s:]", n.Node.String(), n.From.String()) + } + return fmt.Sprintf("%s[%s:%s]", n.Node.String(), n.From.String(), n.To.String()) +} + +func (n *CallNode) String() string { + arguments := make([]string, len(n.Arguments)) + for i, arg := range n.Arguments { + arguments[i] = arg.String() + } + return fmt.Sprintf("%s(%s)", n.Callee.String(), strings.Join(arguments, ", ")) +} + +func (n *BuiltinNode) String() string { + arguments := make([]string, len(n.Arguments)) + for i, arg := range n.Arguments { + arguments[i] = arg.String() + } + return fmt.Sprintf("%s(%s)", n.Name, strings.Join(arguments, ", ")) +} + +func (n *ClosureNode) String() string { + return n.Node.String() } -var isCapital = regexp.MustCompile("^[A-Z]") +func (n *PointerNode) String() string { + return "#" +} + +func (n *ConditionalNode) String() string { + var cond, exp1, exp2 string + if _, ok := n.Cond.(*ConditionalNode); ok { + cond = fmt.Sprintf("(%s)", n.Cond.String()) + } else { + cond = n.Cond.String() + } + if _, ok := n.Exp1.(*ConditionalNode); ok { + exp1 = fmt.Sprintf("(%s)", n.Exp1.String()) + } else { + exp1 = n.Exp1.String() + } + if _, ok := n.Exp2.(*ConditionalNode); ok { + exp2 = fmt.Sprintf("(%s)", n.Exp2.String()) + } else { + exp2 = n.Exp2.String() + } + return fmt.Sprintf("%s ? %s : %s", cond, exp1, exp2) +} + +func (n *ArrayNode) String() string { + nodes := make([]string, len(n.Nodes)) + for i, node := range n.Nodes { + nodes[i] = node.String() + } + return fmt.Sprintf("[%s]", strings.Join(nodes, ", ")) +} + +func (n *MapNode) String() string { + pairs := make([]string, len(n.Pairs)) + for i, pair := range n.Pairs { + pairs[i] = pair.String() + } + return fmt.Sprintf("{%s}", strings.Join(pairs, ", ")) +} -func isPrivate(s string) bool { - return !isCapital.Match([]byte(s)) +func (n *PairNode) String() string { + return fmt.Sprintf("%s: %s", n.Key.String(), n.Value.String()) } diff --git a/vendor/github.com/antonmedv/expr/builtin/builtin.go b/vendor/github.com/antonmedv/expr/builtin/builtin.go index ad9376962..f03162b2f 100644 --- a/vendor/github.com/antonmedv/expr/builtin/builtin.go +++ b/vendor/github.com/antonmedv/expr/builtin/builtin.go @@ -1,38 +1,45 @@ package builtin import ( + "encoding/base64" + "encoding/json" "fmt" "reflect" -) + "strings" + "time" -var ( - anyType = reflect.TypeOf(new(interface{})).Elem() - integerType = reflect.TypeOf(0) - floatType = reflect.TypeOf(float64(0)) + "github.com/antonmedv/expr/vm/runtime" ) type Function struct { Name string Func func(args ...interface{}) (interface{}, error) - Opcode int Types []reflect.Type + Builtin1 func(arg interface{}) interface{} Validate func(args []reflect.Type) (reflect.Type, error) } -const ( - Len = iota + 1 - Abs - Int - Float +var ( + Index map[string]int + Names []string ) -var Builtins = map[int]*Function{ - Len: { - Name: "len", - Opcode: Len, +func init() { + Index = make(map[string]int) + Names = make([]string, len(Builtins)) + for i, fn := range Builtins { + Index[fn.Name] = i + Names[i] = fn.Name + } +} + +var Builtins = []*Function{ + { + Name: "len", + Builtin1: Len, Validate: func(args []reflect.Type) (reflect.Type, error) { if len(args) != 1 { - return anyType, fmt.Errorf("invalid number of arguments for len (expected 1, got %d)", len(args)) + return anyType, fmt.Errorf("invalid number of arguments (expected 1, got %d)", len(args)) } switch kind(args[0]) { case reflect.Array, reflect.Map, reflect.Slice, reflect.String, reflect.Interface: @@ -41,12 +48,17 @@ var Builtins = map[int]*Function{ return anyType, fmt.Errorf("invalid argument for len (type %s)", args[0]) }, }, - Abs: { - Name: "abs", - Opcode: Abs, + { + Name: "type", + Builtin1: Type, + Types: types(new(func(interface{}) string)), + }, + { + Name: "abs", + Builtin1: Abs, Validate: func(args []reflect.Type) (reflect.Type, error) { if len(args) != 1 { - return anyType, fmt.Errorf("invalid number of arguments for abs (expected 1, got %d)", len(args)) + return anyType, fmt.Errorf("invalid number of arguments (expected 1, got %d)", len(args)) } switch kind(args[0]) { case reflect.Float32, reflect.Float64, reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Interface: @@ -55,12 +67,12 @@ var Builtins = map[int]*Function{ return anyType, fmt.Errorf("invalid argument for abs (type %s)", args[0]) }, }, - Int: { - Name: "int", - Opcode: Int, + { + Name: "int", + Builtin1: Int, Validate: func(args []reflect.Type) (reflect.Type, error) { if len(args) != 1 { - return anyType, fmt.Errorf("invalid number of arguments for int (expected 1, got %d)", len(args)) + return anyType, fmt.Errorf("invalid number of arguments (expected 1, got %d)", len(args)) } switch kind(args[0]) { case reflect.Interface: @@ -73,12 +85,12 @@ var Builtins = map[int]*Function{ return anyType, fmt.Errorf("invalid argument for int (type %s)", args[0]) }, }, - Float: { - Name: "float", - Opcode: Float, + { + Name: "float", + Builtin1: Float, Validate: func(args []reflect.Type) (reflect.Type, error) { if len(args) != 1 { - return anyType, fmt.Errorf("invalid number of arguments for float (expected 1, got %d)", len(args)) + return anyType, fmt.Errorf("invalid number of arguments (expected 1, got %d)", len(args)) } switch kind(args[0]) { case reflect.Interface: @@ -91,11 +103,436 @@ var Builtins = map[int]*Function{ return anyType, fmt.Errorf("invalid argument for float (type %s)", args[0]) }, }, -} + { + Name: "string", + Builtin1: String, + Types: types(new(func(any interface{}) string)), + }, + { + Name: "trim", + Func: func(args ...interface{}) (interface{}, error) { + if len(args) == 1 { + return strings.TrimSpace(args[0].(string)), nil + } else if len(args) == 2 { + return strings.Trim(args[0].(string), args[1].(string)), nil + } else { + return nil, fmt.Errorf("invalid number of arguments for trim (expected 1 or 2, got %d)", len(args)) + } + }, + Types: types( + strings.TrimSpace, + strings.Trim, + ), + }, + { + Name: "trimPrefix", + Func: func(args ...interface{}) (interface{}, error) { + s := " " + if len(args) == 2 { + s = args[1].(string) + } + return strings.TrimPrefix(args[0].(string), s), nil + }, + Types: types( + strings.TrimPrefix, + new(func(string) string), + ), + }, + { + Name: "trimSuffix", + Func: func(args ...interface{}) (interface{}, error) { + s := " " + if len(args) == 2 { + s = args[1].(string) + } + return strings.TrimSuffix(args[0].(string), s), nil + }, + Types: types( + strings.TrimSuffix, + new(func(string) string), + ), + }, + { + Name: "upper", + Builtin1: func(arg interface{}) interface{} { + return strings.ToUpper(arg.(string)) + }, + Types: types(strings.ToUpper), + }, + { + Name: "lower", + Builtin1: func(arg interface{}) interface{} { + return strings.ToLower(arg.(string)) + }, + Types: types(strings.ToLower), + }, + { + Name: "split", + Func: func(args ...interface{}) (interface{}, error) { + if len(args) == 2 { + return strings.Split(args[0].(string), args[1].(string)), nil + } else if len(args) == 3 { + return strings.SplitN(args[0].(string), args[1].(string), runtime.ToInt(args[2])), nil + } else { + return nil, fmt.Errorf("invalid number of arguments for split (expected 2 or 3, got %d)", len(args)) + } + }, + Types: types( + strings.Split, + strings.SplitN, + ), + }, + { + Name: "splitAfter", + Func: func(args ...interface{}) (interface{}, error) { + if len(args) == 2 { + return strings.SplitAfter(args[0].(string), args[1].(string)), nil + } else if len(args) == 3 { + return strings.SplitAfterN(args[0].(string), args[1].(string), runtime.ToInt(args[2])), nil + } else { + return nil, fmt.Errorf("invalid number of arguments for splitAfter (expected 2 or 3, got %d)", len(args)) + } + }, + Types: types( + strings.SplitAfter, + strings.SplitAfterN, + ), + }, + { + Name: "replace", + Func: func(args ...interface{}) (interface{}, error) { + if len(args) == 4 { + return strings.Replace(args[0].(string), args[1].(string), args[2].(string), runtime.ToInt(args[3])), nil + } else if len(args) == 3 { + return strings.ReplaceAll(args[0].(string), args[1].(string), args[2].(string)), nil + } else { + return nil, fmt.Errorf("invalid number of arguments for replace (expected 3 or 4, got %d)", len(args)) + } + }, + Types: types( + strings.Replace, + strings.ReplaceAll, + ), + }, + { + Name: "repeat", + Func: func(args ...interface{}) (interface{}, error) { + n := runtime.ToInt(args[1]) + if n > 1e6 { + panic("memory budget exceeded") + } + return strings.Repeat(args[0].(string), n), nil + }, + Types: types(strings.Repeat), + }, + { + Name: "join", + Func: func(args ...interface{}) (interface{}, error) { + glue := "" + if len(args) == 2 { + glue = args[1].(string) + } + switch args[0].(type) { + case []string: + return strings.Join(args[0].([]string), glue), nil + case []interface{}: + var s []string + for _, arg := range args[0].([]interface{}) { + s = append(s, arg.(string)) + } + return strings.Join(s, glue), nil + } + return nil, fmt.Errorf("invalid argument for join (type %s)", reflect.TypeOf(args[0])) + }, + Types: types( + strings.Join, + new(func([]interface{}, string) string), + new(func([]interface{}) string), + new(func([]string, string) string), + new(func([]string) string), + ), + }, + { + Name: "indexOf", + Func: func(args ...interface{}) (interface{}, error) { + return strings.Index(args[0].(string), args[1].(string)), nil + }, + Types: types(strings.Index), + }, + { + Name: "lastIndexOf", + Func: func(args ...interface{}) (interface{}, error) { + return strings.LastIndex(args[0].(string), args[1].(string)), nil + }, + Types: types(strings.LastIndex), + }, + { + Name: "hasPrefix", + Func: func(args ...interface{}) (interface{}, error) { + return strings.HasPrefix(args[0].(string), args[1].(string)), nil + }, + Types: types(strings.HasPrefix), + }, + { + Name: "hasSuffix", + Func: func(args ...interface{}) (interface{}, error) { + return strings.HasSuffix(args[0].(string), args[1].(string)), nil + }, + Types: types(strings.HasSuffix), + }, + { + Name: "max", + Func: Max, + Validate: func(args []reflect.Type) (reflect.Type, error) { + if len(args) == 0 { + return anyType, fmt.Errorf("not enough arguments to call max") + } + for _, arg := range args { + switch kind(arg) { + case reflect.Interface: + return anyType, nil + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64: + default: + return anyType, fmt.Errorf("invalid argument for max (type %s)", arg) + } + } + return args[0], nil + }, + }, + { + Name: "min", + Func: Min, + Validate: func(args []reflect.Type) (reflect.Type, error) { + if len(args) == 0 { + return anyType, fmt.Errorf("not enough arguments to call min") + } + for _, arg := range args { + switch kind(arg) { + case reflect.Interface: + return anyType, nil + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64: + default: + return anyType, fmt.Errorf("invalid argument for min (type %s)", arg) + } + } + return args[0], nil + }, + }, + { + Name: "toJSON", + Func: func(args ...interface{}) (interface{}, error) { + b, err := json.MarshalIndent(args[0], "", " ") + if err != nil { + return nil, err + } + return string(b), nil + }, + Types: types(new(func(interface{}) string)), + }, + { + Name: "fromJSON", + Func: func(args ...interface{}) (interface{}, error) { + var v interface{} + err := json.Unmarshal([]byte(args[0].(string)), &v) + if err != nil { + return nil, err + } + return v, nil + }, + Types: types(new(func(string) interface{})), + }, + { + Name: "toBase64", + Func: func(args ...interface{}) (interface{}, error) { + return base64.StdEncoding.EncodeToString([]byte(args[0].(string))), nil + }, + Types: types(new(func(string) string)), + }, + { + Name: "fromBase64", + Func: func(args ...interface{}) (interface{}, error) { + b, err := base64.StdEncoding.DecodeString(args[0].(string)) + if err != nil { + return nil, err + } + return string(b), nil + }, + Types: types(new(func(string) string)), + }, + { + Name: "now", + Func: func(args ...interface{}) (interface{}, error) { + return time.Now(), nil + }, + Types: types(new(func() time.Time)), + }, + { + Name: "duration", + Func: func(args ...interface{}) (interface{}, error) { + return time.ParseDuration(args[0].(string)) + }, + Types: types(time.ParseDuration), + }, + { + Name: "date", + Func: func(args ...interface{}) (interface{}, error) { + date := args[0].(string) + if len(args) == 2 { + layout := args[1].(string) + return time.Parse(layout, date) + } + if len(args) == 3 { + layout := args[1].(string) + timeZone := args[2].(string) + tz, err := time.LoadLocation(timeZone) + if err != nil { + return nil, err + } + t, err := time.ParseInLocation(layout, date, tz) + if err != nil { + return nil, err + } + return t, nil + } -func kind(t reflect.Type) reflect.Kind { - if t == nil { - return reflect.Invalid - } - return t.Kind() + layouts := []string{ + "2006-01-02", + "15:04:05", + "2006-01-02 15:04:05", + time.RFC3339, + time.RFC822, + time.RFC850, + time.RFC1123, + } + for _, layout := range layouts { + t, err := time.Parse(layout, date) + if err == nil { + return t, nil + } + } + return nil, fmt.Errorf("invalid date %s", date) + }, + Types: types( + new(func(string) time.Time), + new(func(string, string) time.Time), + new(func(string, string, string) time.Time), + ), + }, + { + Name: "first", + Func: func(args ...interface{}) (interface{}, error) { + defer func() { + if r := recover(); r != nil { + return + } + }() + return runtime.Fetch(args[0], 0), nil + }, + Validate: func(args []reflect.Type) (reflect.Type, error) { + if len(args) != 1 { + return anyType, fmt.Errorf("invalid number of arguments (expected 1, got %d)", len(args)) + } + switch kind(args[0]) { + case reflect.Interface: + return anyType, nil + case reflect.Slice, reflect.Array: + return args[0].Elem(), nil + } + return anyType, fmt.Errorf("cannot get first element from %s", args[0]) + }, + }, + { + Name: "last", + Func: func(args ...interface{}) (interface{}, error) { + defer func() { + if r := recover(); r != nil { + return + } + }() + return runtime.Fetch(args[0], -1), nil + }, + Validate: func(args []reflect.Type) (reflect.Type, error) { + if len(args) != 1 { + return anyType, fmt.Errorf("invalid number of arguments (expected 1, got %d)", len(args)) + } + switch kind(args[0]) { + case reflect.Interface: + return anyType, nil + case reflect.Slice, reflect.Array: + return args[0].Elem(), nil + } + return anyType, fmt.Errorf("cannot get last element from %s", args[0]) + }, + }, + { + Name: "get", + Func: func(args ...interface{}) (out interface{}, err error) { + defer func() { + if r := recover(); r != nil { + return + } + }() + return runtime.Fetch(args[0], args[1]), nil + }, + }, + { + Name: "keys", + Func: func(args ...interface{}) (interface{}, error) { + if len(args) != 1 { + return nil, fmt.Errorf("invalid number of arguments (expected 1, got %d)", len(args)) + } + v := reflect.ValueOf(args[0]) + if v.Kind() != reflect.Map { + return nil, fmt.Errorf("cannot get keys from %s", v.Kind()) + } + keys := v.MapKeys() + out := make([]interface{}, len(keys)) + for i, key := range keys { + out[i] = key.Interface() + } + return out, nil + }, + Validate: func(args []reflect.Type) (reflect.Type, error) { + if len(args) != 1 { + return anyType, fmt.Errorf("invalid number of arguments (expected 1, got %d)", len(args)) + } + switch kind(args[0]) { + case reflect.Interface: + return arrayType, nil + case reflect.Map: + return arrayType, nil + } + return anyType, fmt.Errorf("cannot get keys from %s", args[0]) + }, + }, + { + Name: "values", + Func: func(args ...interface{}) (interface{}, error) { + if len(args) != 1 { + return nil, fmt.Errorf("invalid number of arguments (expected 1, got %d)", len(args)) + } + v := reflect.ValueOf(args[0]) + if v.Kind() != reflect.Map { + return nil, fmt.Errorf("cannot get values from %s", v.Kind()) + } + keys := v.MapKeys() + out := make([]interface{}, len(keys)) + for i, key := range keys { + out[i] = v.MapIndex(key).Interface() + } + return out, nil + }, + Validate: func(args []reflect.Type) (reflect.Type, error) { + if len(args) != 1 { + return anyType, fmt.Errorf("invalid number of arguments (expected 1, got %d)", len(args)) + } + switch kind(args[0]) { + case reflect.Interface: + return arrayType, nil + case reflect.Map: + return arrayType, nil + } + return anyType, fmt.Errorf("cannot get values from %s", args[0]) + }, + }, } diff --git a/vendor/github.com/antonmedv/expr/builtin/func.go b/vendor/github.com/antonmedv/expr/builtin/func.go new file mode 100644 index 000000000..a14f6553d --- /dev/null +++ b/vendor/github.com/antonmedv/expr/builtin/func.go @@ -0,0 +1,237 @@ +package builtin + +import ( + "fmt" + "reflect" + "strconv" + + "github.com/antonmedv/expr/vm/runtime" +) + +func Len(x interface{}) interface{} { + v := reflect.ValueOf(x) + switch v.Kind() { + case reflect.Array, reflect.Slice, reflect.Map, reflect.String: + return v.Len() + default: + panic(fmt.Sprintf("invalid argument for len (type %T)", x)) + } +} + +func Type(arg interface{}) interface{} { + if arg == nil { + return "nil" + } + v := reflect.ValueOf(arg) + for { + if v.Kind() == reflect.Ptr { + v = v.Elem() + } else if v.Kind() == reflect.Interface { + v = v.Elem() + } else { + break + } + } + if v.Type().Name() != "" && v.Type().PkgPath() != "" { + return fmt.Sprintf("%s.%s", v.Type().PkgPath(), v.Type().Name()) + } + switch v.Type().Kind() { + case reflect.Invalid: + return "invalid" + case reflect.Bool: + return "bool" + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return "int" + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + return "uint" + case reflect.Float32, reflect.Float64: + return "float" + case reflect.String: + return "string" + case reflect.Array, reflect.Slice: + return "array" + case reflect.Map: + return "map" + case reflect.Func: + return "func" + case reflect.Struct: + return "struct" + } + return "unknown" +} + +func Abs(x interface{}) interface{} { + switch x.(type) { + case float32: + if x.(float32) < 0 { + return -x.(float32) + } else { + return x + } + case float64: + if x.(float64) < 0 { + return -x.(float64) + } else { + return x + } + case int: + if x.(int) < 0 { + return -x.(int) + } else { + return x + } + case int8: + if x.(int8) < 0 { + return -x.(int8) + } else { + return x + } + case int16: + if x.(int16) < 0 { + return -x.(int16) + } else { + return x + } + case int32: + if x.(int32) < 0 { + return -x.(int32) + } else { + return x + } + case int64: + if x.(int64) < 0 { + return -x.(int64) + } else { + return x + } + case uint: + if x.(uint) < 0 { + return -x.(uint) + } else { + return x + } + case uint8: + if x.(uint8) < 0 { + return -x.(uint8) + } else { + return x + } + case uint16: + if x.(uint16) < 0 { + return -x.(uint16) + } else { + return x + } + case uint32: + if x.(uint32) < 0 { + return -x.(uint32) + } else { + return x + } + case uint64: + if x.(uint64) < 0 { + return -x.(uint64) + } else { + return x + } + } + panic(fmt.Sprintf("invalid argument for abs (type %T)", x)) +} + +func Int(x interface{}) interface{} { + switch x := x.(type) { + case float32: + return int(x) + case float64: + return int(x) + case int: + return x + case int8: + return int(x) + case int16: + return int(x) + case int32: + return int(x) + case int64: + return int(x) + case uint: + return int(x) + case uint8: + return int(x) + case uint16: + return int(x) + case uint32: + return int(x) + case uint64: + return int(x) + case string: + i, err := strconv.Atoi(x) + if err != nil { + panic(fmt.Sprintf("invalid operation: int(%s)", x)) + } + return i + default: + panic(fmt.Sprintf("invalid operation: int(%T)", x)) + } +} + +func Float(x interface{}) interface{} { + switch x := x.(type) { + case float32: + return float64(x) + case float64: + return x + case int: + return float64(x) + case int8: + return float64(x) + case int16: + return float64(x) + case int32: + return float64(x) + case int64: + return float64(x) + case uint: + return float64(x) + case uint8: + return float64(x) + case uint16: + return float64(x) + case uint32: + return float64(x) + case uint64: + return float64(x) + case string: + f, err := strconv.ParseFloat(x, 64) + if err != nil { + panic(fmt.Sprintf("invalid operation: float(%s)", x)) + } + return f + default: + panic(fmt.Sprintf("invalid operation: float(%T)", x)) + } +} + +func String(arg interface{}) interface{} { + return fmt.Sprintf("%v", arg) +} + +func Max(args ...interface{}) (interface{}, error) { + var max interface{} + for _, arg := range args { + if max == nil || runtime.Less(max, arg) { + max = arg + } + } + return max, nil +} + +func Min(args ...interface{}) (interface{}, error) { + var min interface{} + for _, arg := range args { + if min == nil || runtime.More(min, arg) { + min = arg + } + } + return min, nil +} diff --git a/vendor/github.com/antonmedv/expr/builtin/utils.go b/vendor/github.com/antonmedv/expr/builtin/utils.go new file mode 100644 index 000000000..afe169f76 --- /dev/null +++ b/vendor/github.com/antonmedv/expr/builtin/utils.go @@ -0,0 +1,35 @@ +package builtin + +import ( + "reflect" +) + +var ( + anyType = reflect.TypeOf(new(interface{})).Elem() + integerType = reflect.TypeOf(0) + floatType = reflect.TypeOf(float64(0)) + stringType = reflect.TypeOf("") + arrayType = reflect.TypeOf([]interface{}{}) +) + +func kind(t reflect.Type) reflect.Kind { + if t == nil { + return reflect.Invalid + } + return t.Kind() +} + +func types(types ...interface{}) []reflect.Type { + ts := make([]reflect.Type, len(types)) + for i, t := range types { + t := reflect.TypeOf(t) + if t.Kind() == reflect.Ptr { + t = t.Elem() + } + if t.Kind() != reflect.Func { + panic("not a function") + } + ts[i] = t + } + return ts +} diff --git a/vendor/github.com/antonmedv/expr/checker/checker.go b/vendor/github.com/antonmedv/expr/checker/checker.go index 86d6d6c6a..fe31f8c92 100644 --- a/vendor/github.com/antonmedv/expr/checker/checker.go +++ b/vendor/github.com/antonmedv/expr/checker/checker.go @@ -31,9 +31,15 @@ func Check(tree *parser.Tree, config *conf.Config) (t reflect.Type, err error) { } if v.config.Expect != reflect.Invalid { + if v.config.ExpectAny { + if isAny(t) { + return t, nil + } + } + switch v.config.Expect { case reflect.Int, reflect.Int64, reflect.Float64: - if !isNumber(t) && !isAny(t) { + if !isNumber(t) { return nil, fmt.Errorf("expected %v, but got %v", v.config.Expect, t) } default: @@ -129,11 +135,14 @@ func (v *visitor) NilNode(*ast.NilNode) (reflect.Type, info) { } func (v *visitor) IdentifierNode(node *ast.IdentifierNode) (reflect.Type, info) { + if node.Value == "$env" { + return mapType, info{} + } + if fn, ok := v.config.Builtins[node.Value]; ok { + return functionType, info{fn: fn} + } if fn, ok := v.config.Functions[node.Value]; ok { - // Return anyType instead of func type as we don't know the arguments yet. - // The func type can be one of the fn.Types. The type will be resolved - // when the arguments are known in CallNode. - return anyType, info{fn: fn} + return functionType, info{fn: fn} } if t, ok := v.config.Types[node.Value]; ok { if t.Ambiguous { @@ -262,11 +271,14 @@ func (v *visitor) BinaryNode(node *ast.BinaryNode) (reflect.Type, info) { if isTime(l) && isTime(r) { return durationType, info{} } + if isTime(l) && isDuration(r) { + return timeType, info{} + } if or(l, r, isNumber, isTime) { return anyType, info{} } - case "/", "*": + case "*": if isNumber(l) && isNumber(r) { return combined(l, r), info{} } @@ -274,6 +286,14 @@ func (v *visitor) BinaryNode(node *ast.BinaryNode) (reflect.Type, info) { return anyType, info{} } + case "/": + if isNumber(l) && isNumber(r) { + return floatType, info{} + } + if or(l, r, isNumber) { + return floatType, info{} + } + case "**", "^": if isNumber(l) && isNumber(r) { return floatType, info{} @@ -312,9 +332,21 @@ func (v *visitor) BinaryNode(node *ast.BinaryNode) (reflect.Type, info) { return boolType, info{} } if isMap(r) { + if l == nil { // It is possible to compare with nil. + return boolType, info{} + } + if !isAny(l) && !l.AssignableTo(r.Key()) { + return v.error(node, "cannot use %v as type %v in map key", l, r.Key()) + } return boolType, info{} } if isArray(r) { + if l == nil { // It is possible to compare with nil. + return boolType, info{} + } + if !isAny(l) && !l.AssignableTo(r.Elem()) && !(isInteger(l) && isInteger(r.Elem())) { + return v.error(node, "cannot use %v as type %v in array", l, r.Elem()) + } return boolType, info{} } if isAny(l) && anyOf(r, isString, isArray, isMap) { @@ -384,8 +416,10 @@ func (v *visitor) ChainNode(node *ast.ChainNode) (reflect.Type, info) { } func (v *visitor) MemberNode(node *ast.MemberNode) (reflect.Type, info) { + base, _ := v.visit(node.Node) prop, _ := v.visit(node.Property) - if an, ok := node.Node.(*ast.IdentifierNode); ok && an.Value == "env" { + + if an, ok := node.Node.(*ast.IdentifierNode); ok && an.Value == "$env" { // If the index is a constant string, can save some // cycles later by finding the type of its referent if name, ok := node.Property.(*ast.StringNode); ok { @@ -395,7 +429,6 @@ func (v *visitor) MemberNode(node *ast.MemberNode) (reflect.Type, info) { } return anyType, info{} } - base, _ := v.visit(node.Node) if name, ok := node.Property.(*ast.StringNode); ok { if base == nil { @@ -404,7 +437,7 @@ func (v *visitor) MemberNode(node *ast.MemberNode) (reflect.Type, info) { // First, check methods defined on base type itself, // independent of which type it is. Without dereferencing. if m, ok := base.MethodByName(name.Value); ok { - if base.Kind() == reflect.Interface { + if kind(base) == reflect.Interface { // In case of interface type method will not have a receiver, // and to prevent checker decreasing numbers of in arguments // return method type as not method (second argument is false). @@ -422,11 +455,11 @@ func (v *visitor) MemberNode(node *ast.MemberNode) (reflect.Type, info) { } } - if base.Kind() == reflect.Ptr { + if kind(base) == reflect.Ptr { base = base.Elem() } - switch base.Kind() { + switch kind(base) { case reflect.Interface: return anyType, info{} @@ -465,7 +498,7 @@ func (v *visitor) MemberNode(node *ast.MemberNode) (reflect.Type, info) { func (v *visitor) SliceNode(node *ast.SliceNode) (reflect.Type, info) { t, _ := v.visit(node.Node) - switch t.Kind() { + switch kind(t) { case reflect.Interface: // ok case reflect.String, reflect.Array, reflect.Slice: @@ -493,45 +526,8 @@ func (v *visitor) CallNode(node *ast.CallNode) (reflect.Type, info) { fn, fnInfo := v.visit(node.Callee) if fnInfo.fn != nil { - f := fnInfo.fn - node.Func = f - if f.Validate != nil { - args := make([]reflect.Type, len(node.Arguments)) - for i, arg := range node.Arguments { - args[i], _ = v.visit(arg) - } - t, err := f.Validate(args) - if err != nil { - return v.error(node, "%v", err) - } - return t, info{} - } - if len(f.Types) == 0 { - t, err := v.checkFunc(f.Name, functionType, false, node) - if err != nil { - if v.err == nil { - v.err = err - } - return anyType, info{} - } - // No type was specified, so we assume the function returns any. - return t, info{} - } - var lastErr *file.Error - for _, t := range f.Types { - outType, err := v.checkFunc(f.Name, t, false, node) - if err != nil { - lastErr = err - continue - } - return outType, info{} - } - if lastErr != nil { - if v.err == nil { - v.err = lastErr - } - return anyType, info{} - } + node.Func = fnInfo.fn + return v.checkFunction(fnInfo.fn, node, node.Arguments) } fnName := "function" @@ -559,12 +555,12 @@ func (v *visitor) CallNode(node *ast.CallNode) (reflect.Type, info) { fn.NumOut() == 1 && fn.Out(0).Kind() == reflect.Interface { rest := fn.In(fn.NumIn() - 1) // function has only one param for functions and two for methods - if rest.Kind() == reflect.Slice && rest.Elem().Kind() == reflect.Interface { + if kind(rest) == reflect.Slice && rest.Elem().Kind() == reflect.Interface { node.Fast = true } } - outType, err := v.checkFunc(fnName, fn, fnInfo.method, node) + outType, err := v.checkArguments(fnName, fn, fnInfo.method, node.Arguments, node) if err != nil { if v.err == nil { v.err = err @@ -579,90 +575,6 @@ func (v *visitor) CallNode(node *ast.CallNode) (reflect.Type, info) { return v.error(node, "%v is not callable", fn) } -func (v *visitor) checkFunc(name string, fn reflect.Type, method bool, node *ast.CallNode) (reflect.Type, *file.Error) { - if isAny(fn) { - return anyType, nil - } - - if fn.NumOut() == 0 { - return anyType, &file.Error{ - Location: node.Location(), - Message: fmt.Sprintf("func %v doesn't return value", name), - } - } - if numOut := fn.NumOut(); numOut > 2 { - return anyType, &file.Error{ - Location: node.Location(), - Message: fmt.Sprintf("func %v returns more then two values", name), - } - } - - // If func is method on an env, first argument should be a receiver, - // and actual arguments less than fnNumIn by one. - fnNumIn := fn.NumIn() - if method { - fnNumIn-- - } - // Skip first argument in case of the receiver. - fnInOffset := 0 - if method { - fnInOffset = 1 - } - - if fn.IsVariadic() { - if len(node.Arguments) < fnNumIn-1 { - return anyType, &file.Error{ - Location: node.Location(), - Message: fmt.Sprintf("not enough arguments to call %v", name), - } - } - } else { - if len(node.Arguments) > fnNumIn { - return anyType, &file.Error{ - Location: node.Location(), - Message: fmt.Sprintf("too many arguments to call %v", name), - } - } - if len(node.Arguments) < fnNumIn { - return anyType, &file.Error{ - Location: node.Location(), - Message: fmt.Sprintf("not enough arguments to call %v", name), - } - } - } - - for i, arg := range node.Arguments { - t, _ := v.visit(arg) - - var in reflect.Type - if fn.IsVariadic() && i >= fnNumIn-1 { - // For variadic arguments fn(xs ...int), go replaces type of xs (int) with ([]int). - // As we compare arguments one by one, we need underling type. - in = fn.In(fn.NumIn() - 1).Elem() - } else { - in = fn.In(i + fnInOffset) - } - - if isIntegerOrArithmeticOperation(arg) && (isInteger(in) || isFloat(in)) { - t = in - setTypeForIntegers(arg, t) - } - - if t == nil { - continue - } - - if !t.AssignableTo(in) && t.Kind() != reflect.Interface { - return anyType, &file.Error{ - Location: arg.Location(), - Message: fmt.Sprintf("cannot use %v as argument (type %v) to call %v ", t, in, name), - } - } - } - - return fn.Out(0), nil -} - func (v *visitor) BuiltinNode(node *ast.BuiltinNode) (reflect.Type, info) { switch node.Name { case "all", "none", "any", "one": @@ -748,14 +660,190 @@ func (v *visitor) BuiltinNode(node *ast.BuiltinNode) (reflect.Type, info) { return integerType, info{} } return v.error(node.Arguments[1], "closure should has one input and one output param") + } - default: - return v.error(node, "unknown builtin %v", node.Name) + if id, ok := builtin.Index[node.Name]; ok { + switch node.Name { + case "get": + return v.checkBuiltinGet(node) + } + return v.checkFunction(builtin.Builtins[id], node, node.Arguments) + } + + return v.error(node, "unknown builtin %v", node.Name) +} + +func (v *visitor) checkBuiltinGet(node *ast.BuiltinNode) (reflect.Type, info) { + if len(node.Arguments) != 2 { + return v.error(node, "invalid number of arguments (expected 2, got %d)", len(node.Arguments)) + } + + val := node.Arguments[0] + prop := node.Arguments[1] + if id, ok := val.(*ast.IdentifierNode); ok && id.Value == "$env" { + if s, ok := prop.(*ast.StringNode); ok { + return v.config.Types[s.Value].Type, info{} + } + return anyType, info{} + } + + t, _ := v.visit(val) + + switch kind(t) { + case reflect.Interface: + return anyType, info{} + case reflect.Slice, reflect.Array: + p, _ := v.visit(prop) + if p == nil { + return v.error(prop, "cannot use nil as slice index") + } + if !isInteger(p) && !isAny(p) { + return v.error(prop, "non-integer slice index %v", p) + } + return t.Elem(), info{} + case reflect.Map: + p, _ := v.visit(prop) + if p == nil { + return v.error(prop, "cannot use nil as map index") + } + if !p.AssignableTo(t.Key()) && !isAny(p) { + return v.error(prop, "cannot use %v to get an element from %v", p, t) + } + return t.Elem(), info{} + } + return v.error(val, "type %v does not support indexing", t) +} + +func (v *visitor) checkFunction(f *builtin.Function, node ast.Node, arguments []ast.Node) (reflect.Type, info) { + if f.Validate != nil { + args := make([]reflect.Type, len(arguments)) + for i, arg := range arguments { + args[i], _ = v.visit(arg) + } + t, err := f.Validate(args) + if err != nil { + return v.error(node, "%v", err) + } + return t, info{} + } else if len(f.Types) == 0 { + t, err := v.checkArguments(f.Name, functionType, false, arguments, node) + if err != nil { + if v.err == nil { + v.err = err + } + return anyType, info{} + } + // No type was specified, so we assume the function returns any. + return t, info{} + } + var lastErr *file.Error + for _, t := range f.Types { + outType, err := v.checkArguments(f.Name, t, false, arguments, node) + if err != nil { + lastErr = err + continue + } + return outType, info{} } + if lastErr != nil { + if v.err == nil { + v.err = lastErr + } + return anyType, info{} + } + + return v.error(node, "no matching overload for %v", f.Name) +} + +func (v *visitor) checkArguments(name string, fn reflect.Type, method bool, arguments []ast.Node, node ast.Node) (reflect.Type, *file.Error) { + if isAny(fn) { + return anyType, nil + } + + if fn.NumOut() == 0 { + return anyType, &file.Error{ + Location: node.Location(), + Message: fmt.Sprintf("func %v doesn't return value", name), + } + } + if numOut := fn.NumOut(); numOut > 2 { + return anyType, &file.Error{ + Location: node.Location(), + Message: fmt.Sprintf("func %v returns more then two values", name), + } + } + + // If func is method on an env, first argument should be a receiver, + // and actual arguments less than fnNumIn by one. + fnNumIn := fn.NumIn() + if method { + fnNumIn-- + } + // Skip first argument in case of the receiver. + fnInOffset := 0 + if method { + fnInOffset = 1 + } + + if fn.IsVariadic() { + if len(arguments) < fnNumIn-1 { + return anyType, &file.Error{ + Location: node.Location(), + Message: fmt.Sprintf("not enough arguments to call %v", name), + } + } + } else { + if len(arguments) > fnNumIn { + return anyType, &file.Error{ + Location: node.Location(), + Message: fmt.Sprintf("too many arguments to call %v", name), + } + } + if len(arguments) < fnNumIn { + return anyType, &file.Error{ + Location: node.Location(), + Message: fmt.Sprintf("not enough arguments to call %v", name), + } + } + } + + for i, arg := range arguments { + t, _ := v.visit(arg) + + var in reflect.Type + if fn.IsVariadic() && i >= fnNumIn-1 { + // For variadic arguments fn(xs ...int), go replaces type of xs (int) with ([]int). + // As we compare arguments one by one, we need underling type. + in = fn.In(fn.NumIn() - 1).Elem() + } else { + in = fn.In(i + fnInOffset) + } + + if isIntegerOrArithmeticOperation(arg) && (isInteger(in) || isFloat(in)) { + t = in + setTypeForIntegers(arg, t) + } + + if t == nil { + continue + } + + if !t.AssignableTo(in) && kind(t) != reflect.Interface { + return anyType, &file.Error{ + Location: arg.Location(), + Message: fmt.Sprintf("cannot use %v as argument (type %v) to call %v ", t, in, name), + } + } + } + + return fn.Out(0), nil } func (v *visitor) ClosureNode(node *ast.ClosureNode) (reflect.Type, info) { t, _ := v.visit(node.Node) + if t == nil { + return v.error(node.Node, "closure cannot be nil") + } return reflect.FuncOf([]reflect.Type{anyType}, []reflect.Type{t}, false), info{} } diff --git a/vendor/github.com/antonmedv/expr/checker/types.go b/vendor/github.com/antonmedv/expr/checker/types.go index e8f53372c..d1a5e85e6 100644 --- a/vendor/github.com/antonmedv/expr/checker/types.go +++ b/vendor/github.com/antonmedv/expr/checker/types.go @@ -20,7 +20,6 @@ var ( timeType = reflect.TypeOf(time.Time{}) durationType = reflect.TypeOf(time.Duration(0)) functionType = reflect.TypeOf(new(func(...interface{}) (interface{}, error))).Elem() - errorType = reflect.TypeOf((*error)(nil)).Elem() ) func combined(a, b reflect.Type) reflect.Type { @@ -98,7 +97,7 @@ func isTime(t reflect.Type) bool { return true } } - return isAny(t) + return false } func isDuration(t reflect.Type) bool { @@ -223,6 +222,13 @@ func deref(t reflect.Type) reflect.Type { return t } +func kind(t reflect.Type) reflect.Kind { + if t == nil { + return reflect.Invalid + } + return t.Kind() +} + func isIntegerOrArithmeticOperation(node ast.Node) bool { switch n := node.(type) { case *ast.IntegerNode: @@ -234,7 +240,7 @@ func isIntegerOrArithmeticOperation(node ast.Node) bool { } case *ast.BinaryNode: switch n.Operator { - case "+", "/", "-", "*": + case "+", "-", "*": return true } } diff --git a/vendor/github.com/antonmedv/expr/compiler/compiler.go b/vendor/github.com/antonmedv/expr/compiler/compiler.go index 4b2f94603..89a44039e 100644 --- a/vendor/github.com/antonmedv/expr/compiler/compiler.go +++ b/vendor/github.com/antonmedv/expr/compiler/compiler.go @@ -5,6 +5,7 @@ import ( "reflect" "github.com/antonmedv/expr/ast" + "github.com/antonmedv/expr/builtin" "github.com/antonmedv/expr/conf" "github.com/antonmedv/expr/file" "github.com/antonmedv/expr/parser" @@ -53,6 +54,7 @@ func Compile(tree *parser.Tree, config *conf.Config) (program *Program, err erro Bytecode: c.bytecode, Arguments: c.arguments, Functions: c.functions, + FuncNames: c.functionNames, } return } @@ -63,6 +65,7 @@ type compiler struct { constants []interface{} constantsIndex map[interface{}]int functions []Function + functionNames []string functionsIndex map[string]int mapEnv bool cast reflect.Kind @@ -126,16 +129,35 @@ func (c *compiler) addConstant(constant interface{}) int { return p } -func (c *compiler) addFunction(node *ast.CallNode) int { - if node.Func == nil { +// emitFunction adds builtin.Function.Func to the program.Functions and emits call opcode. +func (c *compiler) emitFunction(fn *builtin.Function, argsLen int) { + switch argsLen { + case 0: + c.emit(OpCall0, c.addFunction(fn)) + case 1: + c.emit(OpCall1, c.addFunction(fn)) + case 2: + c.emit(OpCall2, c.addFunction(fn)) + case 3: + c.emit(OpCall3, c.addFunction(fn)) + default: + c.emit(OpLoadFunc, c.addFunction(fn)) + c.emit(OpCallN, argsLen) + } +} + +// addFunction adds builtin.Function.Func to the program.Functions and returns its index. +func (c *compiler) addFunction(fn *builtin.Function) int { + if fn == nil { panic("function is nil") } - if p, ok := c.functionsIndex[node.Func.Name]; ok { + if p, ok := c.functionsIndex[fn.Name]; ok { return p } p := len(c.functions) - c.functions = append(c.functions, node.Func.Func) - c.functionsIndex[node.Func.Name] = p + c.functions = append(c.functions, fn.Func) + c.functionNames = append(c.functionNames, fn.Name) + c.functionsIndex[fn.Name] = p return p } @@ -205,7 +227,7 @@ func (c *compiler) NilNode(_ *ast.NilNode) { } func (c *compiler) IdentifierNode(node *ast.IdentifierNode) { - if node.Value == "env" { + if node.Value == "$env" { c.emit(OpLoadEnv) return } @@ -563,23 +585,7 @@ func (c *compiler) CallNode(node *ast.CallNode) { c.compile(arg) } if node.Func != nil { - if node.Func.Opcode > 0 { - c.emit(OpBuiltin, node.Func.Opcode) - return - } - switch len(node.Arguments) { - case 0: - c.emit(OpCall0, c.addFunction(node)) - case 1: - c.emit(OpCall1, c.addFunction(node)) - case 2: - c.emit(OpCall2, c.addFunction(node)) - case 3: - c.emit(OpCall3, c.addFunction(node)) - default: - c.emit(OpLoadFunc, c.addFunction(node)) - c.emit(OpCallN, len(node.Arguments)) - } + c.emitFunction(node.Func, len(node.Arguments)) return } c.compile(node.Callee) @@ -607,6 +613,7 @@ func (c *compiler) BuiltinNode(node *ast.BuiltinNode) { c.emit(OpTrue) c.patchJump(loopBreak) c.emit(OpEnd) + return case "none": c.compile(node.Arguments[0]) @@ -621,6 +628,7 @@ func (c *compiler) BuiltinNode(node *ast.BuiltinNode) { c.emit(OpTrue) c.patchJump(loopBreak) c.emit(OpEnd) + return case "any": c.compile(node.Arguments[0]) @@ -634,6 +642,7 @@ func (c *compiler) BuiltinNode(node *ast.BuiltinNode) { c.emit(OpFalse) c.patchJump(loopBreak) c.emit(OpEnd) + return case "one": c.compile(node.Arguments[0]) @@ -648,6 +657,7 @@ func (c *compiler) BuiltinNode(node *ast.BuiltinNode) { c.emitPush(1) c.emit(OpEqual) c.emit(OpEnd) + return case "filter": c.compile(node.Arguments[0]) @@ -662,6 +672,7 @@ func (c *compiler) BuiltinNode(node *ast.BuiltinNode) { c.emit(OpGetCount) c.emit(OpEnd) c.emit(OpArray) + return case "map": c.compile(node.Arguments[0]) @@ -672,6 +683,7 @@ func (c *compiler) BuiltinNode(node *ast.BuiltinNode) { c.emit(OpGetLen) c.emit(OpEnd) c.emit(OpArray) + return case "count": c.compile(node.Arguments[0]) @@ -684,10 +696,23 @@ func (c *compiler) BuiltinNode(node *ast.BuiltinNode) { }) c.emit(OpGetCount) c.emit(OpEnd) + return + } - default: - panic(fmt.Sprintf("unknown builtin %v", node.Name)) + if id, ok := builtin.Index[node.Name]; ok { + f := builtin.Builtins[id] + for _, arg := range node.Arguments { + c.compile(arg) + } + if f.Builtin1 != nil { + c.emit(OpCallBuiltin1, id) + } else if f.Func != nil { + c.emitFunction(f, len(node.Arguments)) + } + return } + + panic(fmt.Sprintf("unknown builtin %v", node.Name)) } func (c *compiler) emitCond(body func()) { diff --git a/vendor/github.com/antonmedv/expr/conf/config.go b/vendor/github.com/antonmedv/expr/conf/config.go index 1ac0fa7d2..f89e6cca0 100644 --- a/vendor/github.com/antonmedv/expr/conf/config.go +++ b/vendor/github.com/antonmedv/expr/conf/config.go @@ -16,23 +16,29 @@ type Config struct { DefaultType reflect.Type Operators OperatorsTable Expect reflect.Kind + ExpectAny bool Optimize bool Strict bool + Pipes bool ConstFns map[string]reflect.Value Visitors []ast.Visitor Functions map[string]*builtin.Function + Builtins map[string]*builtin.Function + Disabled map[string]bool // disabled builtins } // CreateNew creates new config with default values. func CreateNew() *Config { c := &Config{ + Optimize: true, Operators: make(map[string][]string), ConstFns: make(map[string]reflect.Value), Functions: make(map[string]*builtin.Function), - Optimize: true, + Builtins: make(map[string]*builtin.Function), + Disabled: make(map[string]bool), } for _, f := range builtin.Builtins { - c.Functions[f.Name] = f + c.Builtins[f.Name] = f } return c } @@ -93,4 +99,20 @@ func (c *Config) Check() { } } } + for fnName, t := range c.Types { + if kind(t.Type) == reflect.Func { + for _, b := range c.Builtins { + if b.Name == fnName { + panic(fmt.Errorf(`cannot override builtin %s(): use expr.DisableBuiltin("%s") to override`, b.Name, b.Name)) + } + } + } + } + for _, f := range c.Functions { + for _, b := range c.Builtins { + if b.Name == f.Name { + panic(fmt.Errorf(`cannot override builtin %s(); use expr.DisableBuiltin("%s") to override`, f.Name, f.Name)) + } + } + } } diff --git a/vendor/github.com/antonmedv/expr/conf/types_table.go b/vendor/github.com/antonmedv/expr/conf/types_table.go index f4d401c9c..592340069 100644 --- a/vendor/github.com/antonmedv/expr/conf/types_table.go +++ b/vendor/github.com/antonmedv/expr/conf/types_table.go @@ -54,7 +54,7 @@ func CreateTypesTable(i interface{}) TypesTable { for _, key := range v.MapKeys() { value := v.MapIndex(key) if key.Kind() == reflect.String && value.IsValid() && value.CanInterface() { - if key.String() == "env" { // Could check for all keywords here + if key.String() == "$env" { // Could check for all keywords here panic("attempt to misuse env keyword as env map key") } types[key.String()] = Tag{Type: reflect.TypeOf(value.Interface())} @@ -97,7 +97,7 @@ func FieldsFromStruct(t reflect.Type) TypesTable { } } } - if fn := FieldName(f); fn == "env" { // Could check for all keywords here + if fn := FieldName(f); fn == "$env" { // Could check for all keywords here panic("attempt to misuse env keyword as env struct field tag") } else { types[FieldName(f)] = Tag{ @@ -121,6 +121,13 @@ func dereference(t reflect.Type) reflect.Type { return t } +func kind(t reflect.Type) reflect.Kind { + if t == nil { + return reflect.Invalid + } + return t.Kind() +} + func FieldName(field reflect.StructField) string { if taggedName := field.Tag.Get("expr"); taggedName != "" { return taggedName diff --git a/vendor/github.com/antonmedv/expr/expr.go b/vendor/github.com/antonmedv/expr/expr.go index 6aa674fb5..973bdc108 100644 --- a/vendor/github.com/antonmedv/expr/expr.go +++ b/vendor/github.com/antonmedv/expr/expr.go @@ -52,6 +52,13 @@ func ConstExpr(fn string) Option { } } +// AsAny tells the compiler to expect any result. +func AsAny() Option { + return func(c *conf.Config) { + c.ExpectAny = true + } +} + // AsKind tells the compiler to expect kind of the result. func AsKind(kind reflect.Kind) Option { return func(c *conf.Config) { @@ -123,13 +130,45 @@ func Function(name string, fn func(params ...interface{}) (interface{}, error), } } +// ExperimentalPipes enables pipes syntax. +func ExperimentalPipes() Option { + return func(c *conf.Config) { + c.Pipes = true + } +} + +// DisableAllBuiltins disables all builtins. +func DisableAllBuiltins() Option { + return func(c *conf.Config) { + for name := range c.Builtins { + c.Disabled[name] = true + } + } +} + +// DisableBuiltin disables builtin function. +func DisableBuiltin(name string) Option { + return func(c *conf.Config) { + c.Disabled[name] = true + } +} + +// EnableBuiltin enables builtin function. +func EnableBuiltin(name string) Option { + return func(c *conf.Config) { + delete(c.Disabled, name) + } +} + // Compile parses and compiles given input expression to bytecode program. func Compile(input string, ops ...Option) (*vm.Program, error) { config := conf.CreateNew() - for _, op := range ops { op(config) } + for name := range config.Disabled { + delete(config.Builtins, name) + } config.Check() if len(config.Operators) > 0 { @@ -139,7 +178,7 @@ func Compile(input string, ops ...Option) (*vm.Program, error) { }) } - tree, err := parser.Parse(input) + tree, err := parser.ParseWithConfig(input, config) if err != nil { return nil, err } diff --git a/vendor/github.com/antonmedv/expr/parser/lexer/state.go b/vendor/github.com/antonmedv/expr/parser/lexer/state.go index 1212aa321..c8f0d1725 100644 --- a/vendor/github.com/antonmedv/expr/parser/lexer/state.go +++ b/vendor/github.com/antonmedv/expr/parser/lexer/state.go @@ -2,6 +2,8 @@ package lexer import ( "strings" + + "github.com/antonmedv/expr/parser/utils" ) type stateFn func(*lexer) stateFn @@ -11,7 +13,7 @@ func root(l *lexer) stateFn { case r == eof: l.emitEOF() return nil - case IsSpace(r): + case utils.IsSpace(r): l.ignore() return root case r == '\'' || r == '"': @@ -28,19 +30,22 @@ func root(l *lexer) stateFn { return questionMark case r == '/': return slash + case r == '|': + l.accept("|") + l.emit(Operator) case strings.ContainsRune("([{", r): l.emit(Bracket) case strings.ContainsRune(")]}", r): l.emit(Bracket) case strings.ContainsRune("#,:%+-^", r): // single rune operator l.emit(Operator) - case strings.ContainsRune("&|!=*<>", r): // possible double rune operator - l.accept("&|=*") + case strings.ContainsRune("&!=*<>", r): // possible double rune operator + l.accept("&=*") l.emit(Operator) case r == '.': l.backup() return dot - case IsAlphaNumeric(r): + case utils.IsAlphaNumeric(r): l.backup() return identifier default: @@ -88,7 +93,7 @@ func (l *lexer) scanNumber() bool { l.acceptRun(digits) } // Next thing mustn't be alphanumeric. - if IsAlphaNumeric(l.peek()) { + if utils.IsAlphaNumeric(l.peek()) { l.next() return false } @@ -110,7 +115,7 @@ func identifier(l *lexer) stateFn { loop: for { switch r := l.next(); { - case IsAlphaNumeric(r): + case utils.IsAlphaNumeric(r): // absorb default: l.backup() @@ -138,7 +143,7 @@ func not(l *lexer) stateFn { // Get the next word. for { r := l.next() - if IsAlphaNumeric(r) { + if utils.IsAlphaNumeric(r) { // absorb } else { l.backup() diff --git a/vendor/github.com/antonmedv/expr/parser/lexer/utils.go b/vendor/github.com/antonmedv/expr/parser/lexer/utils.go index 72e3cf20c..83d96f49c 100644 --- a/vendor/github.com/antonmedv/expr/parser/lexer/utils.go +++ b/vendor/github.com/antonmedv/expr/parser/lexer/utils.go @@ -3,22 +3,9 @@ package lexer import ( "fmt" "strings" - "unicode" "unicode/utf8" ) -func IsSpace(r rune) bool { - return unicode.IsSpace(r) -} - -func IsAlphaNumeric(r rune) bool { - return IsAlphabetic(r) || unicode.IsDigit(r) -} - -func IsAlphabetic(r rune) bool { - return r == '_' || r == '$' || unicode.IsLetter(r) -} - var ( newlineNormalizer = strings.NewReplacer("\r\n", "\n", "\r", "\n") ) @@ -63,10 +50,10 @@ func unescape(value string) (string, error) { // unescapeChar takes a string input and returns the following info: // -// value - the escaped unicode rune at the front of the string. -// multibyte - whether the rune value might require multiple bytes to represent. -// tail - the remainder of the input string. -// err - error value, if the character could not be unescaped. +// value - the escaped unicode rune at the front of the string. +// multibyte - whether the rune value might require multiple bytes to represent. +// tail - the remainder of the input string. +// err - error value, if the character could not be unescaped. // // When multibyte is true the return value may still fit within a single byte, // but a multibyte conversion is attempted which is more expensive than when the diff --git a/vendor/github.com/antonmedv/expr/parser/operator/operator.go b/vendor/github.com/antonmedv/expr/parser/operator/operator.go new file mode 100644 index 000000000..455c06f17 --- /dev/null +++ b/vendor/github.com/antonmedv/expr/parser/operator/operator.go @@ -0,0 +1,52 @@ +package operator + +type Associativity int + +const ( + Left Associativity = iota + 1 + Right +) + +type Operator struct { + Precedence int + Associativity Associativity +} + +func Less(a, b string) bool { + return Binary[a].Precedence < Binary[b].Precedence +} + +var Unary = map[string]Operator{ + "not": {50, Left}, + "!": {50, Left}, + "-": {90, Left}, + "+": {90, Left}, +} + +var Binary = map[string]Operator{ + "|": {0, Left}, + "or": {10, Left}, + "||": {10, Left}, + "and": {15, Left}, + "&&": {15, Left}, + "==": {20, Left}, + "!=": {20, Left}, + "<": {20, Left}, + ">": {20, Left}, + ">=": {20, Left}, + "<=": {20, Left}, + "in": {20, Left}, + "matches": {20, Left}, + "contains": {20, Left}, + "startsWith": {20, Left}, + "endsWith": {20, Left}, + "..": {25, Left}, + "+": {30, Left}, + "-": {30, Left}, + "*": {60, Left}, + "/": {60, Left}, + "%": {60, Left}, + "**": {100, Right}, + "^": {100, Right}, + "??": {500, Left}, +} diff --git a/vendor/github.com/antonmedv/expr/parser/parser.go b/vendor/github.com/antonmedv/expr/parser/parser.go index fd26fe18b..102091748 100644 --- a/vendor/github.com/antonmedv/expr/parser/parser.go +++ b/vendor/github.com/antonmedv/expr/parser/parser.go @@ -4,64 +4,19 @@ import ( "fmt" "strconv" "strings" - "unicode/utf8" . "github.com/antonmedv/expr/ast" + "github.com/antonmedv/expr/builtin" + "github.com/antonmedv/expr/conf" "github.com/antonmedv/expr/file" . "github.com/antonmedv/expr/parser/lexer" + "github.com/antonmedv/expr/parser/operator" + "github.com/antonmedv/expr/parser/utils" ) -type associativity int - -const ( - left associativity = iota + 1 - right -) - -type operator struct { - precedence int - associativity associativity -} - -type builtin struct { +var predicates = map[string]struct { arity int -} - -var unaryOperators = map[string]operator{ - "not": {50, left}, - "!": {50, left}, - "-": {90, left}, - "+": {90, left}, -} - -var binaryOperators = map[string]operator{ - "or": {10, left}, - "||": {10, left}, - "and": {15, left}, - "&&": {15, left}, - "==": {20, left}, - "!=": {20, left}, - "<": {20, left}, - ">": {20, left}, - ">=": {20, left}, - "<=": {20, left}, - "in": {20, left}, - "matches": {20, left}, - "contains": {20, left}, - "startsWith": {20, left}, - "endsWith": {20, left}, - "..": {25, left}, - "+": {30, left}, - "-": {30, left}, - "*": {60, left}, - "/": {60, left}, - "%": {60, left}, - "**": {100, right}, - "^": {100, right}, - "??": {500, left}, -} - -var builtins = map[string]builtin{ +}{ "all": {2}, "none": {2}, "any": {2}, @@ -77,6 +32,7 @@ type parser struct { pos int err *file.Error depth int // closure call depth + config *conf.Config } type Tree struct { @@ -85,6 +41,13 @@ type Tree struct { } func Parse(input string) (*Tree, error) { + return ParseWithConfig(input, &conf.Config{ + Pipes: false, + Disabled: map[string]bool{}, + }) +} + +func ParseWithConfig(input string, config *conf.Config) (*Tree, error) { source := file.NewSource(input) tokens, err := Lex(source) @@ -95,6 +58,7 @@ func Parse(input string) (*Tree, error) { p := &parser{ tokens: tokens, current: tokens[0], + config: config, } node := p.parseExpression(0) @@ -148,12 +112,13 @@ func (p *parser) expect(kind Kind, values ...string) { func (p *parser) parseExpression(precedence int) Node { nodeLeft := p.parsePrimary() - lastOperator := "" + prevOperator := "" opToken := p.current for opToken.Is(Operator) && p.err == nil { negate := false var notToken Token + // Handle "not *" operator, like "not in" or "not contains". if opToken.Is(Operator, "not") { p.next() notToken = p.current @@ -161,20 +126,25 @@ func (p *parser) parseExpression(precedence int) Node { opToken = p.current } - if op, ok := binaryOperators[opToken.Value]; ok { - if op.precedence >= precedence { + if op, ok := operator.Binary[opToken.Value]; ok { + if op.Precedence >= precedence { p.next() - if lastOperator == "??" && opToken.Value != "??" && !opToken.Is(Bracket, "(") { + if opToken.Value == "|" { + nodeLeft = p.parsePipe(nodeLeft) + goto next + } + + if prevOperator == "??" && opToken.Value != "??" && !opToken.Is(Bracket, "(") { p.errorAt(opToken, "Operator (%v) and coalesce expressions (??) cannot be mixed. Wrap either by parentheses.", opToken.Value) break } var nodeRight Node - if op.associativity == left { - nodeRight = p.parseExpression(op.precedence + 1) + if op.Associativity == operator.Left { + nodeRight = p.parseExpression(op.Precedence + 1) } else { - nodeRight = p.parseExpression(op.precedence) + nodeRight = p.parseExpression(op.Precedence) } nodeLeft = &BinaryNode{ @@ -192,28 +162,54 @@ func (p *parser) parseExpression(precedence int) Node { nodeLeft.SetLocation(notToken.Location) } - lastOperator = opToken.Value - opToken = p.current - continue + goto next } } break + + next: + prevOperator = opToken.Value + opToken = p.current } if precedence == 0 { - nodeLeft = p.parseConditionalExpression(nodeLeft) + nodeLeft = p.parseConditional(nodeLeft) } return nodeLeft } +func (p *parser) parseConditional(node Node) Node { + var expr1, expr2 Node + for p.current.Is(Operator, "?") && p.err == nil { + p.next() + + if !p.current.Is(Operator, ":") { + expr1 = p.parseExpression(0) + p.expect(Operator, ":") + expr2 = p.parseExpression(0) + } else { + p.next() + expr1 = node + expr2 = p.parseExpression(0) + } + + node = &ConditionalNode{ + Cond: node, + Exp1: expr1, + Exp2: expr2, + } + } + return node +} + func (p *parser) parsePrimary() Node { token := p.current if token.Is(Operator) { - if op, ok := unaryOperators[token.Value]; ok { + if op, ok := operator.Unary[token.Value]; ok { p.next() - expr := p.parseExpression(op.precedence) + expr := p.parseExpression(op.Precedence) node := &UnaryNode{ Operator: token.Value, Node: expr, @@ -245,34 +241,10 @@ func (p *parser) parsePrimary() Node { } } - return p.parsePrimaryExpression() + return p.parseSecondary() } -func (p *parser) parseConditionalExpression(node Node) Node { - var expr1, expr2 Node - for p.current.Is(Operator, "?") && p.err == nil { - p.next() - - if !p.current.Is(Operator, ":") { - expr1 = p.parseExpression(0) - p.expect(Operator, ":") - expr2 = p.parseExpression(0) - } else { - p.next() - expr1 = node - expr2 = p.parseExpression(0) - } - - node = &ConditionalNode{ - Cond: node, - Exp1: expr1, - Exp2: expr2, - } - } - return node -} - -func (p *parser) parsePrimaryExpression() Node { +func (p *parser) parseSecondary() Node { var node Node token := p.current @@ -294,7 +266,7 @@ func (p *parser) parsePrimaryExpression() Node { node.SetLocation(token.Location) return node default: - node = p.parseIdentifierExpression(token) + node = p.parseCall(token) } case Number: @@ -345,14 +317,13 @@ func (p *parser) parsePrimaryExpression() Node { return p.parsePostfixExpression(node) } -func (p *parser) parseIdentifierExpression(token Token) Node { +func (p *parser) parseCall(token Token) Node { var node Node if p.current.Is(Bracket, "(") { var arguments []Node - if b, ok := builtins[token.Value]; ok { + if b, ok := predicates[token.Value]; ok { p.expect(Bracket, "(") - // TODO: Add builtins signatures. if b.arity == 1 { arguments = make([]Node, 1) arguments[0] = p.parseExpression(0) @@ -369,6 +340,12 @@ func (p *parser) parseIdentifierExpression(token Token) Node { Arguments: arguments, } node.SetLocation(token.Location) + } else if _, ok := builtin.Index[token.Value]; ok && !p.config.Disabled[token.Value] { + node = &BuiltinNode{ + Name: token.Value, + Arguments: p.parseArguments(), + } + node.SetLocation(token.Location) } else { callee := &IdentifierNode{Value: token.Value} callee.SetLocation(token.Location) @@ -487,7 +464,7 @@ func (p *parser) parsePostfixExpression(node Node) Node { if propertyToken.Kind != Identifier && // Operators like "not" and "matches" are valid methods or property names. - (propertyToken.Kind != Operator || !isValidIdentifier(propertyToken.Value)) { + (propertyToken.Kind != Operator || !utils.IsValidIdentifier(propertyToken.Value)) { p.error("expected name") } @@ -578,20 +555,51 @@ func (p *parser) parsePostfixExpression(node Node) Node { return node } -func isValidIdentifier(str string) bool { - if len(str) == 0 { - return false - } - h, w := utf8.DecodeRuneInString(str) - if !IsAlphabetic(h) { - return false +func (p *parser) parsePipe(node Node) Node { + if !p.config.Pipes { + p.error("enable Pipes via expr.ExperimentalPipes()") + return &NilNode{} } - for _, r := range str[w:] { - if !IsAlphaNumeric(r) { - return false + + identifier := p.current + p.expect(Identifier) + + arguments := []Node{node} + + if b, ok := predicates[identifier.Value]; ok { + p.expect(Bracket, "(") + if b.arity == 2 { + arguments = append(arguments, p.parseClosure()) } + p.expect(Bracket, ")") + + node = &BuiltinNode{ + Name: identifier.Value, + Arguments: arguments, + } + node.SetLocation(identifier.Location) + } else if _, ok := builtin.Index[identifier.Value]; ok { + arguments = append(arguments, p.parseArguments()...) + + node = &BuiltinNode{ + Name: identifier.Value, + Arguments: arguments, + } + node.SetLocation(identifier.Location) + } else { + callee := &IdentifierNode{Value: identifier.Value} + callee.SetLocation(identifier.Location) + + arguments = append(arguments, p.parseArguments()...) + + node = &CallNode{ + Callee: callee, + Arguments: arguments, + } + node.SetLocation(identifier.Location) } - return true + + return node } func (p *parser) parseArguments() []Node { diff --git a/vendor/github.com/antonmedv/expr/parser/utils/utils.go b/vendor/github.com/antonmedv/expr/parser/utils/utils.go new file mode 100644 index 000000000..947f9a400 --- /dev/null +++ b/vendor/github.com/antonmedv/expr/parser/utils/utils.go @@ -0,0 +1,34 @@ +package utils + +import ( + "unicode" + "unicode/utf8" +) + +func IsValidIdentifier(str string) bool { + if len(str) == 0 { + return false + } + h, w := utf8.DecodeRuneInString(str) + if !IsAlphabetic(h) { + return false + } + for _, r := range str[w:] { + if !IsAlphaNumeric(r) { + return false + } + } + return true +} + +func IsSpace(r rune) bool { + return unicode.IsSpace(r) +} + +func IsAlphaNumeric(r rune) bool { + return IsAlphabetic(r) || unicode.IsDigit(r) +} + +func IsAlphabetic(r rune) bool { + return r == '_' || r == '$' || unicode.IsLetter(r) +} diff --git a/vendor/github.com/antonmedv/expr/vm/opcodes.go b/vendor/github.com/antonmedv/expr/vm/opcodes.go index 4bc9abf4d..1720fd4c2 100644 --- a/vendor/github.com/antonmedv/expr/vm/opcodes.go +++ b/vendor/github.com/antonmedv/expr/vm/opcodes.go @@ -57,7 +57,7 @@ const ( OpCallN OpCallFast OpCallTyped - OpBuiltin + OpCallBuiltin1 OpArray OpMap OpLen diff --git a/vendor/github.com/antonmedv/expr/vm/program.go b/vendor/github.com/antonmedv/expr/vm/program.go index 936eca9a2..ccc7cfb41 100644 --- a/vendor/github.com/antonmedv/expr/vm/program.go +++ b/vendor/github.com/antonmedv/expr/vm/program.go @@ -3,6 +3,7 @@ package vm import ( "bytes" "fmt" + "io" "reflect" "regexp" "strings" @@ -22,11 +23,18 @@ type Program struct { Bytecode []Opcode Arguments []int Functions []Function + FuncNames []string } func (program *Program) Disassemble() string { var buf bytes.Buffer w := tabwriter.NewWriter(&buf, 0, 0, 2, ' ', 0) + program.Opcodes(w) + _ = w.Flush() + return buf.String() +} + +func (program *Program) Opcodes(w io.Writer) { ip := 0 for ip < len(program.Bytecode) { pp := ip @@ -64,12 +72,11 @@ func (program *Program) Disassemble() string { } _, _ = fmt.Fprintf(w, "%v\t%v\t<%v>\t%v\n", pp, label, arg, c) } - builtIn := func(label string) { - f, ok := builtin.Builtins[arg] - if !ok { - panic(fmt.Sprintf("unknown builtin %v", arg)) - } - _, _ = fmt.Fprintf(w, "%v\t%v\t%v\n", pp, "OpBuiltin", f.Name) + builtin := func(label string) { + _, _ = fmt.Fprintf(w, "%v\t%v\t<%v>\t%v\n", pp, label, arg, builtin.Builtins[arg].Name) + } + funcName := func(label string) { + _, _ = fmt.Fprintf(w, "%v\t%v\t<%v>\t%v()\n", pp, label, arg, program.FuncNames[arg]) } switch op { @@ -215,16 +222,16 @@ func (program *Program) Disassemble() string { argument("OpCall") case OpCall0: - argument("OpCall0") + funcName("OpCall0") case OpCall1: - argument("OpCall1") + funcName("OpCall1") case OpCall2: - argument("OpCall2") + funcName("OpCall2") case OpCall3: - argument("OpCall3") + funcName("OpCall3") case OpCallN: argument("OpCallN") @@ -236,8 +243,8 @@ func (program *Program) Disassemble() string { signature := reflect.TypeOf(FuncTypes[arg]).Elem().String() _, _ = fmt.Fprintf(w, "%v\t%v\t<%v>\t%v\n", pp, "OpCallTyped", arg, signature) - case OpBuiltin: - builtIn("OpBuiltin") + case OpCallBuiltin1: + builtin("OpCallBuiltin1") case OpArray: code("OpArray") @@ -279,6 +286,4 @@ func (program *Program) Disassemble() string { _, _ = fmt.Fprintf(w, "%v\t%#x (unknown)\n", ip, op) } } - _ = w.Flush() - return buf.String() } diff --git a/vendor/github.com/antonmedv/expr/vm/runtime/generated.go b/vendor/github.com/antonmedv/expr/vm/runtime/generated.go index 09a4a200e..011a03325 100644 --- a/vendor/github.com/antonmedv/expr/vm/runtime/generated.go +++ b/vendor/github.com/antonmedv/expr/vm/runtime/generated.go @@ -2386,6 +2386,8 @@ func Subtract(a, b interface{}) interface{} { switch y := b.(type) { case time.Time: return x.Sub(y) + case time.Duration: + return x.Add(-y) } } panic(fmt.Sprintf("invalid operation: %T - %T", a, b)) diff --git a/vendor/github.com/antonmedv/expr/vm/runtime/runtime.go b/vendor/github.com/antonmedv/expr/vm/runtime/runtime.go index 75ac94bf8..7075c7014 100644 --- a/vendor/github.com/antonmedv/expr/vm/runtime/runtime.go +++ b/vendor/github.com/antonmedv/expr/vm/runtime/runtime.go @@ -6,7 +6,6 @@ import ( "fmt" "math" "reflect" - "strconv" ) func Fetch(from, i interface{}) interface{} { @@ -184,9 +183,15 @@ func Slice(array, from, to interface{}) interface{} { if a < 0 { a = length + a } + if a < 0 { + a = 0 + } if b < 0 { b = length + b } + if b < 0 { + b = 0 + } if b > length { b = length } @@ -262,10 +267,10 @@ func In(needle interface{}, array interface{}) bool { return false } - panic(fmt.Sprintf(`operator "in"" not defined on %T`, array)) + panic(fmt.Sprintf(`operator "in" not defined on %T`, array)) } -func Len(a interface{}) interface{} { +func Len(a interface{}) int { v := reflect.ValueOf(a) switch v.Kind() { case reflect.Array, reflect.Slice, reflect.Map, reflect.String: @@ -348,12 +353,6 @@ func ToInt(a interface{}) int { return int(x) case uint64: return int(x) - case string: - i, err := strconv.Atoi(x) - if err != nil { - panic(fmt.Sprintf("invalid operation: int(%s)", x)) - } - return i default: panic(fmt.Sprintf("invalid operation: int(%T)", x)) } @@ -416,12 +415,6 @@ func ToFloat64(a interface{}) float64 { return float64(x) case uint64: return float64(x) - case string: - f, err := strconv.ParseFloat(x, 64) - if err != nil { - panic(fmt.Sprintf("invalid operation: float(%s)", x)) - } - return f default: panic(fmt.Sprintf("invalid operation: float(%T)", x)) } @@ -439,81 +432,3 @@ func IsNil(v interface{}) bool { return false } } - -func Abs(x interface{}) interface{} { - switch x.(type) { - case float32: - if x.(float32) < 0 { - return -x.(float32) - } else { - return x - } - case float64: - if x.(float64) < 0 { - return -x.(float64) - } else { - return x - } - case int: - if x.(int) < 0 { - return -x.(int) - } else { - return x - } - case int8: - if x.(int8) < 0 { - return -x.(int8) - } else { - return x - } - case int16: - if x.(int16) < 0 { - return -x.(int16) - } else { - return x - } - case int32: - if x.(int32) < 0 { - return -x.(int32) - } else { - return x - } - case int64: - if x.(int64) < 0 { - return -x.(int64) - } else { - return x - } - case uint: - if x.(uint) < 0 { - return -x.(uint) - } else { - return x - } - case uint8: - if x.(uint8) < 0 { - return -x.(uint8) - } else { - return x - } - case uint16: - if x.(uint16) < 0 { - return -x.(uint16) - } else { - return x - } - case uint32: - if x.(uint32) < 0 { - return -x.(uint32) - } else { - return x - } - case uint64: - if x.(uint64) < 0 { - return -x.(uint64) - } else { - return x - } - } - panic(fmt.Sprintf("invalid argument for abs (type %T)", x)) -} diff --git a/vendor/github.com/antonmedv/expr/vm/vm.go b/vendor/github.com/antonmedv/expr/vm/vm.go index ec22c251d..343a02064 100644 --- a/vendor/github.com/antonmedv/expr/vm/vm.go +++ b/vendor/github.com/antonmedv/expr/vm/vm.go @@ -377,9 +377,10 @@ func (vm *VM) Run(program *Program, env interface{}) (_ interface{}, err error) vm.push(fn(in...)) case OpCallTyped: - fn := vm.pop() - out := vm.call(fn, arg) - vm.push(out) + vm.push(vm.call(vm.pop(), arg)) + + case OpCallBuiltin1: + vm.push(builtin.Builtins[arg].Builtin1(vm.pop())) case OpArray: size := vm.pop().(int) @@ -411,8 +412,7 @@ func (vm *VM) Run(program *Program, env interface{}) (_ interface{}, err error) vm.push(runtime.Len(vm.current())) case OpCast: - t := arg - switch t { + switch arg { case 0: vm.push(runtime.ToInt(vm.pop())) case 1: @@ -456,24 +456,6 @@ func (vm *VM) Run(program *Program, env interface{}) (_ interface{}, err error) case OpEnd: vm.scopes = vm.scopes[:len(vm.scopes)-1] - case OpBuiltin: - switch arg { - case builtin.Len: - vm.push(runtime.Len(vm.pop())) - - case builtin.Abs: - vm.push(runtime.Abs(vm.pop())) - - case builtin.Int: - vm.push(runtime.ToInt(vm.pop())) - - case builtin.Float: - vm.push(runtime.ToFloat64(vm.pop())) - - default: - panic(fmt.Sprintf("unknown builtin %v", arg)) - } - default: panic(fmt.Sprintf("unknown bytecode %#x", op)) } diff --git a/vendor/github.com/aws/aws-sdk-go-v2/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/CHANGELOG.md index 804f5f15c..47da5cbbf 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/CHANGELOG.md @@ -1,3 +1,139 @@ +# Release (2023-08-21) + +## General Highlights +* **Dependency Update**: Updated to the latest SDK module versions + +## Module Highlights +* `github.com/aws/aws-sdk-go-v2`: v1.21.0 + * **Feature**: Add support for polly SynthesizeSpeech GET request presigner +* `github.com/aws/aws-sdk-go-v2/service/cloud9`: [v1.18.6](service/cloud9/CHANGELOG.md#v1186-2023-08-21) + * **Documentation**: Doc only update to add Ubuntu 22.04 as an Image ID option for Cloud9 +* `github.com/aws/aws-sdk-go-v2/service/ec2`: [v1.114.0](service/ec2/CHANGELOG.md#v11140-2023-08-21) + * **Feature**: The DeleteKeyPair API has been updated to return the keyPairId when an existing key pair is deleted. +* `github.com/aws/aws-sdk-go-v2/service/finspace`: [v1.12.0](service/finspace/CHANGELOG.md#v1120-2023-08-21) + * **Feature**: Allow customers to manage outbound traffic from their Kx Environment when attaching a transit gateway by providing network acl entries. Allow the customer to choose how they want to update the databases on a cluster allowing updates to possibly be faster than usual. +* `github.com/aws/aws-sdk-go-v2/service/polly`: [v1.30.0](service/polly/CHANGELOG.md#v1300-2023-08-21) + * **Feature**: Add support for polly SynthesizeSpeech GET request presigner +* `github.com/aws/aws-sdk-go-v2/service/rds`: [v1.51.0](service/rds/CHANGELOG.md#v1510-2023-08-21) + * **Feature**: Adding support for RDS Aurora Global Database Unplanned Failover +* `github.com/aws/aws-sdk-go-v2/service/route53domains`: [v1.17.3](service/route53domains/CHANGELOG.md#v1173-2023-08-21) + * **Documentation**: Fixed typos in description fields + +# Release (2023-08-18) + +## General Highlights +* **Dependency Update**: Updated to the latest SDK module versions + +## Module Highlights +* `github.com/aws/aws-sdk-go-v2/service/codecommit`: [v1.16.0](service/codecommit/CHANGELOG.md#v1160-2023-08-18) + * **Feature**: Add new ListFileCommitHistory operation to retrieve commits which introduced changes to a specific file. +* `github.com/aws/aws-sdk-go-v2/service/securityhub`: [v1.36.0](service/securityhub/CHANGELOG.md#v1360-2023-08-18) + * **Feature**: Added Inspector Lambda code Vulnerability section to ASFF, including GeneratorDetails, EpssScore, ExploitAvailable, and CodeVulnerabilities. + +# Release (2023-08-17) + +## General Highlights +* **Dependency Update**: Updated to the latest SDK module versions + +## Module Highlights +* `github.com/aws/aws-sdk-go-v2`: v1.20.2 + * **Bug Fix**: Sign `X-Amz-Server-Side-Encryption-Context` header to fix signing for PutObject requests that set `SSEKMSEncryptionContext`. +* `github.com/aws/aws-sdk-go-v2/service/ec2`: [v1.113.0](service/ec2/CHANGELOG.md#v11130-2023-08-17) + * **Feature**: Adds support for SubnetConfigurations to allow users to select their own IPv4 and IPv6 addresses for Interface VPC endpoints +* `github.com/aws/aws-sdk-go-v2/service/gamelift`: [v1.22.0](service/gamelift/CHANGELOG.md#v1220-2023-08-17) + * **Feature**: Amazon GameLift updates its instance types support. +* `github.com/aws/aws-sdk-go-v2/service/s3control`: [v1.32.3](service/s3control/CHANGELOG.md#v1323-2023-08-17) + * **Announcement**: BREAKFIX: corrected function spelling in environment config from GetS3DisableMultRegionAccessPoints to GetS3DisableMultiRegionAccessPoints + * **Bug Fix**: Adds DisableMRAP option to config loader, and DisableMRAP client resolver to achieve parity with other S3 options in the config loader. Additionally, added breakfix to correct spelling. + +# Release (2023-08-16) + +## Module Highlights +* `github.com/aws/aws-sdk-go-v2/service/cloudwatch`: [v1.27.3](service/cloudwatch/CHANGELOG.md#v1273-2023-08-16) + * **Documentation**: Doc-only update to incorporate several doc bug fixes + +# Release (2023-08-15) + +## Module Highlights +* `github.com/aws/aws-sdk-go-v2/service/chimesdkmeetings`: [v1.17.0](service/chimesdkmeetings/CHANGELOG.md#v1170-2023-08-15) + * **Feature**: Updated API documentation to include additional exceptions. +* `github.com/aws/aws-sdk-go-v2/service/ec2`: [v1.112.0](service/ec2/CHANGELOG.md#v11120-2023-08-15) + * **Feature**: Documentation updates for Elastic Compute Cloud (EC2). +* `github.com/aws/aws-sdk-go-v2/service/glue`: [v1.61.0](service/glue/CHANGELOG.md#v1610-2023-08-15) + * **Feature**: AWS Glue Crawlers can now accept SerDe overrides from a custom csv classifier. The two SerDe options are LazySimpleSerDe and OpenCSVSerDe. In case, the user wants crawler to do the selection, "None" can be selected for this purpose. +* `github.com/aws/aws-sdk-go-v2/service/pi`: [v1.19.0](service/pi/CHANGELOG.md#v1190-2023-08-15) + * **Feature**: AWS Performance Insights for Amazon RDS is launching Performance Analysis On Demand, a new feature that allows you to analyze database performance metrics and find out the performance issues. You can now use SDK to create, list, get, delete, and manage tags of performance analysis reports. +* `github.com/aws/aws-sdk-go-v2/service/route53domains`: [v1.17.0](service/route53domains/CHANGELOG.md#v1170-2023-08-15) + * **Feature**: Provide explanation if CheckDomainTransferability return false. Provide requestId if a request is already submitted. Add sensitive protection for customer information +* `github.com/aws/aws-sdk-go-v2/service/sagemaker`: [v1.102.0](service/sagemaker/CHANGELOG.md#v11020-2023-08-15) + * **Feature**: SageMaker Inference Recommender now provides SupportedResponseMIMETypes from DescribeInferenceRecommendationsJob response + +# Release (2023-08-14) + +## Module Highlights +* `github.com/aws/aws-sdk-go-v2/service/mediapackage`: [v1.23.0](service/mediapackage/CHANGELOG.md#v1230-2023-08-14) + * **Feature**: Fix SDK logging of certain fields. +* `github.com/aws/aws-sdk-go-v2/service/omics`: [v1.8.0](service/omics/CHANGELOG.md#v180-2023-08-14) + * **Feature**: This release provides support for annotation store versioning and cross account sharing for Omics Analytics +* `github.com/aws/aws-sdk-go-v2/service/transfer`: [v1.33.4](service/transfer/CHANGELOG.md#v1334-2023-08-14) + * **Documentation**: Documentation updates for AWS Transfer Family + +# Release (2023-08-11) + +## Module Highlights +* `github.com/aws/aws-sdk-go-v2/service/amplifybackend`: [v1.16.0](service/amplifybackend/CHANGELOG.md#v1160-2023-08-11) + * **Feature**: Adds sensitive trait to required input shapes. +* `github.com/aws/aws-sdk-go-v2/service/configservice`: [v1.36.0](service/configservice/CHANGELOG.md#v1360-2023-08-11) + * **Feature**: Updated ResourceType enum with new resource types onboarded by AWS Config in July 2023. +* `github.com/aws/aws-sdk-go-v2/service/ec2`: [v1.111.0](service/ec2/CHANGELOG.md#v11110-2023-08-11) + * **Feature**: Amazon EC2 P5 instances, powered by the latest NVIDIA H100 Tensor Core GPUs, deliver the highest performance in EC2 for deep learning (DL) and HPC applications. M7i-flex and M7i instances are next-generation general purpose instances powered by custom 4th Generation Intel Xeon Scalable processors. +* `github.com/aws/aws-sdk-go-v2/service/quicksight`: [v1.41.0](service/quicksight/CHANGELOG.md#v1410-2023-08-11) + * **Feature**: New Authentication method for Account subscription - IAM Identity Center. Hierarchy layout support, default column width support and related style properties for pivot table visuals. Non-additive topic field aggregations for Topic API +* `github.com/aws/aws-sdk-go-v2/service/ses`: [v1.16.3](service/ses/CHANGELOG.md#v1163-2023-08-11) + * **Documentation**: Doc only updates to include: 1) Clarified which part of an email address where it's okay to have Punycode when it contains non-ASCII characters for the SendRawEmail action and other actions where this is applicable. 2) Updated S3Action description with new MB max bucket size from 30 to 40. +* `github.com/aws/aws-sdk-go-v2/service/swf`: [v1.17.0](service/swf/CHANGELOG.md#v1170-2023-08-11) + * **Feature**: This release adds new API parameters to override workflow task list for workflow executions. + +# Release (2023-08-10) + +## Module Highlights +* `github.com/aws/aws-sdk-go-v2/service/cloudtrail`: [v1.28.3](service/cloudtrail/CHANGELOG.md#v1283-2023-08-10) + * **Documentation**: Documentation updates for CloudTrail. +* `github.com/aws/aws-sdk-go-v2/service/connect`: [v1.65.0](service/connect/CHANGELOG.md#v1650-2023-08-10) + * **Feature**: This release adds APIs to provision agents that are global / available in multiple AWS regions and distribute them across these regions by percentage. +* `github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2`: [v1.21.0](service/elasticloadbalancingv2/CHANGELOG.md#v1210-2023-08-10) + * **Feature**: This release enables configuring security groups for Network Load Balancers +* `github.com/aws/aws-sdk-go-v2/service/omics`: [v1.7.0](service/omics/CHANGELOG.md#v170-2023-08-10) + * **Feature**: This release adds instanceType to GetRunTask & ListRunTasks responses. +* `github.com/aws/aws-sdk-go-v2/service/secretsmanager`: [v1.21.0](service/secretsmanager/CHANGELOG.md#v1210-2023-08-10) + * **Feature**: Add additional InvalidRequestException to list of possible exceptions for ListSecret. +* `github.com/aws/aws-sdk-go-v2/service/transfer`: [v1.33.3](service/transfer/CHANGELOG.md#v1333-2023-08-10) + * **Documentation**: Documentation updates for AW Transfer Family + +# Release (2023-08-09) + +## Module Highlights +* `github.com/aws/aws-sdk-go-v2/service/chimesdkvoice`: [v1.8.0](service/chimesdkvoice/CHANGELOG.md#v180-2023-08-09) + * **Feature**: Updating CreatePhoneNumberOrder, UpdatePhoneNumber and BatchUpdatePhoneNumbers APIs, adding phone number name +* `github.com/aws/aws-sdk-go-v2/service/fsx`: [v1.32.0](service/fsx/CHANGELOG.md#v1320-2023-08-09) + * **Feature**: For FSx for Lustre, add new data repository task type, RELEASE_DATA_FROM_FILESYSTEM, to release files that have been archived to S3. For FSx for Windows, enable support for configuring and updating SSD IOPS, and for updating storage type. For FSx for OpenZFS, add new deployment type, MULTI_AZ_1. +* `github.com/aws/aws-sdk-go-v2/service/globalaccelerator`: [v1.17.3](service/globalaccelerator/CHANGELOG.md#v1173-2023-08-09) + * **Documentation**: Documentation update for dualstack EC2 endpoint support +* `github.com/aws/aws-sdk-go-v2/service/guardduty`: [v1.26.0](service/guardduty/CHANGELOG.md#v1260-2023-08-09) + * **Feature**: Added autoEnable ALL to UpdateOrganizationConfiguration and DescribeOrganizationConfiguration APIs. +* `github.com/aws/aws-sdk-go-v2/service/sagemaker`: [v1.101.0](service/sagemaker/CHANGELOG.md#v11010-2023-08-09) + * **Feature**: This release adds support for cross account access for SageMaker Model Cards through AWS RAM. + +# Release (2023-08-08) + +## Module Highlights +* `github.com/aws/aws-sdk-go-v2/service/backup`: [v1.24.0](service/backup/CHANGELOG.md#v1240-2023-08-08) + * **Feature**: This release introduces a new logically air-gapped vault (Preview) in AWS Backup that stores immutable backup copies, which are locked by default and isolated with encryption using AWS owned keys. Logically air-gapped vault (Preview) allows secure recovery of application data across accounts. +* `github.com/aws/aws-sdk-go-v2/service/elasticache`: [v1.29.0](service/elasticache/CHANGELOG.md#v1290-2023-08-08) + * **Feature**: Added support for cluster mode in online migration and test migration API +* `github.com/aws/aws-sdk-go-v2/service/servicecatalog`: [v1.21.0](service/servicecatalog/CHANGELOG.md#v1210-2023-08-08) + * **Feature**: Introduce support for HashiCorp Terraform Cloud in Service Catalog by addying TERRAFORM_CLOUD product type in CreateProduct and CreateProvisioningArtifact API. + # Release (2023-08-07) ## General Highlights diff --git a/vendor/github.com/aws/aws-sdk-go-v2/Makefile b/vendor/github.com/aws/aws-sdk-go-v2/Makefile index 996c13e1a..9dc36fe4e 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/Makefile +++ b/vendor/github.com/aws/aws-sdk-go-v2/Makefile @@ -86,7 +86,10 @@ tidy-modules-. add-module-license-files gen-aws-ptrs format generate-tmpreplace-smithy: smithy-generate update-requires gen-repo-mod-replace update-module-metadata smithy-annotate-stable \ gen-config-asserts gen-internal-codegen copy-attributevalue-feature gen-mod-replace-smithy-. min-go-version-. \ -tidy-modules-. add-module-license-files gen-aws-ptrs format gen-mod-dropreplace-smithy-. +tidy-modules-. add-module-license-files gen-aws-ptrs format gen-mod-dropreplace-smithy-. reset-sum + +reset-sum: + find . -name go.sum -exec git checkout -- {} \; smithy-generate: cd codegen && ./gradlew clean build -Plog-tests && ./gradlew clean diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/go_module_metadata.go index c0af5602a..8cd672b6f 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/aws/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/go_module_metadata.go @@ -3,4 +3,4 @@ package aws // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.20.1" +const goModuleVersion = "1.21.0" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/protocol/query/object.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/protocol/query/object.go index 6a99d4ea8..455b92515 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/aws/protocol/query/object.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/protocol/query/object.go @@ -41,6 +41,12 @@ func (o *Object) Key(name string) Value { return o.key(name, false) } +// KeyWithValues adds the given named key to the Query object. +// Returns a Value encoder that should be used to encode a Query list of values. +func (o *Object) KeyWithValues(name string) Value { + return o.keyWithValues(name, false) +} + // FlatKey adds the given named key to the Query object. // Returns a Value encoder that should be used to encode a Query value type. The // value will be flattened if it is a map or array. @@ -54,3 +60,10 @@ func (o *Object) key(name string, flatValue bool) Value { } return newValue(o.values, name, flatValue) } + +func (o *Object) keyWithValues(name string, flatValue bool) Value { + if o.prefix != "" { + return newAppendValue(o.values, fmt.Sprintf("%s.%s", o.prefix, name), flatValue) + } + return newAppendValue(o.values, name, flatValue) +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/protocol/query/value.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/protocol/query/value.go index 302525ab1..a9251521f 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/aws/protocol/query/value.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/protocol/query/value.go @@ -27,6 +27,15 @@ func newValue(values url.Values, key string, flat bool) Value { } } +func newAppendValue(values url.Values, key string, flat bool) Value { + return Value{ + values: values, + key: key, + flat: flat, + queryValue: httpbinding.NewQueryValue(values, key, true), + } +} + func newBaseValue(values url.Values) Value { return Value{ values: values, diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/signer/internal/v4/headers.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/signer/internal/v4/headers.go index 64c4c4845..71b1a3521 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/aws/signer/internal/v4/headers.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/signer/internal/v4/headers.go @@ -48,6 +48,7 @@ var RequiredSignedHeaders = Rules{ "X-Amz-Request-Payer": struct{}{}, "X-Amz-Server-Side-Encryption": struct{}{}, "X-Amz-Server-Side-Encryption-Aws-Kms-Key-Id": struct{}{}, + "X-Amz-Server-Side-Encryption-Context": struct{}{}, "X-Amz-Server-Side-Encryption-Customer-Algorithm": struct{}{}, "X-Amz-Server-Side-Encryption-Customer-Key": struct{}{}, "X-Amz-Server-Side-Encryption-Customer-Key-Md5": struct{}{}, diff --git a/vendor/github.com/aws/aws-sdk-go-v2/ci-find-smithy-go.sh b/vendor/github.com/aws/aws-sdk-go-v2/ci-find-smithy-go.sh index a3eb9b31f..9b8f3a3d2 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/ci-find-smithy-go.sh +++ b/vendor/github.com/aws/aws-sdk-go-v2/ci-find-smithy-go.sh @@ -10,8 +10,7 @@ # - feat-foo if [ -z "$SMITHY_GO_REPOSITORY" ]; then - echo env SMITHY_GO_REPOSITORY is required - exit 1 + SMITHY_GO_REPOSITORY=aws/smithy-go fi if [ -z "$RUNNER_TMPDIR" ]; then @@ -25,12 +24,19 @@ if [ "$branch" == main ]; then exit 0 fi +# For PR workflows, only the triggering ref is checked out, which in isolation +# is not recognized as a branch by git. Use the specific workflow env instead. +if [ -z "$branch" ]; then + branch=$GITHUB_HEAD_REF +fi + if [ -n "$GIT_PAT" ]; then repository=https://$GIT_PAT@github.com/$SMITHY_GO_REPOSITORY else repository=https://github.com/$SMITHY_GO_REPOSITORY fi +echo on branch \"$branch\" while [ -n "$branch" ] && [[ "$branch" == *-* ]]; do echo looking for $branch... git ls-remote --exit-code --heads $repository refs/heads/$branch diff --git a/vendor/github.com/aws/aws-sdk-go-v2/config/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/config/CHANGELOG.md index 5309131d2..774040216 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/config/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/config/CHANGELOG.md @@ -1,3 +1,19 @@ +# v1.18.37 (2023-08-23) + +* No change notes available for this release. + +# v1.18.36 (2023-08-21) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.18.35 (2023-08-18) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.18.34 (2023-08-17) + +* **Dependency Update**: Updated to the latest SDK module versions + # v1.18.33 (2023-08-07) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/config/env_config.go b/vendor/github.com/aws/aws-sdk-go-v2/config/env_config.go index 18c8e0121..63ecd02b3 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/config/env_config.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/config/env_config.go @@ -482,9 +482,9 @@ func (c EnvConfig) GetS3UseARNRegion(ctx context.Context) (value, ok bool, err e return *c.S3UseARNRegion, true, nil } -// GetS3DisableMultRegionAccessPoints returns whether to disable multi-region access point +// GetS3DisableMultiRegionAccessPoints returns whether to disable multi-region access point // support for the S3 client. -func (c EnvConfig) GetS3DisableMultRegionAccessPoints(ctx context.Context) (value, ok bool, err error) { +func (c EnvConfig) GetS3DisableMultiRegionAccessPoints(ctx context.Context) (value, ok bool, err error) { if c.S3DisableMultiRegionAccessPoints == nil { return false, false, nil } diff --git a/vendor/github.com/aws/aws-sdk-go-v2/config/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/config/go_module_metadata.go index 34137c882..c973bb552 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/config/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/config/go_module_metadata.go @@ -3,4 +3,4 @@ package config // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.18.33" +const goModuleVersion = "1.18.37" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/config/load_options.go b/vendor/github.com/aws/aws-sdk-go-v2/config/load_options.go index d2280dae6..7480bb45e 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/config/load_options.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/config/load_options.go @@ -172,6 +172,10 @@ type LoadOptions struct { // the region, the client's requests are sent to. S3UseARNRegion *bool + // S3DisableMultiRegionAccessPoints specifies if the S3 service should disable + // the S3 Multi-Region access points feature. + S3DisableMultiRegionAccessPoints *bool + // EnableEndpointDiscovery specifies if endpoint discovery is enable for // the client. EnableEndpointDiscovery aws.EndpointDiscoveryEnableState @@ -876,6 +880,26 @@ func WithS3UseARNRegion(v bool) LoadOptionsFunc { } } +// GetS3DisableMultiRegionAccessPoints returns whether to disable +// the S3 multi-region access points feature. +func (o LoadOptions) GetS3DisableMultiRegionAccessPoints(ctx context.Context) (v bool, found bool, err error) { + if o.S3DisableMultiRegionAccessPoints == nil { + return false, false, nil + } + return *o.S3DisableMultiRegionAccessPoints, true, nil +} + +// WithS3DisableMultiRegionAccessPoints is a helper function to construct functional options +// that can be used to set S3DisableMultiRegionAccessPoints on LoadOptions. +// If multiple WithS3DisableMultiRegionAccessPoints calls are made, the last call overrides +// the previous call values. +func WithS3DisableMultiRegionAccessPoints(v bool) LoadOptionsFunc { + return func(o *LoadOptions) error { + o.S3DisableMultiRegionAccessPoints = &v + return nil + } +} + // GetEnableEndpointDiscovery returns if the EnableEndpointDiscovery flag is set. func (o LoadOptions) GetEnableEndpointDiscovery(ctx context.Context) (value aws.EndpointDiscoveryEnableState, ok bool, err error) { if o.EnableEndpointDiscovery == aws.EndpointDiscoveryUnset { diff --git a/vendor/github.com/aws/aws-sdk-go-v2/credentials/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/credentials/CHANGELOG.md index 5c09f58b5..ef2dd4b2d 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/credentials/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/credentials/CHANGELOG.md @@ -1,3 +1,15 @@ +# v1.13.35 (2023-08-21) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.13.34 (2023-08-18) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.13.33 (2023-08-17) + +* **Dependency Update**: Updated to the latest SDK module versions + # v1.13.32 (2023-08-07) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/credentials/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/credentials/go_module_metadata.go index 38bd167ac..eb75bb481 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/credentials/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/credentials/go_module_metadata.go @@ -3,4 +3,4 @@ package credentials // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.13.32" +const goModuleVersion = "1.13.35" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/CHANGELOG.md index 0c3ea6eff..66b3e83c3 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/CHANGELOG.md @@ -1,3 +1,15 @@ +# v1.13.11 (2023-08-21) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.13.10 (2023-08-18) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.13.9 (2023-08-17) + +* **Dependency Update**: Updated to the latest SDK module versions + # v1.13.8 (2023-08-07) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/go_module_metadata.go index fb22bca68..deb28a237 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/go_module_metadata.go @@ -3,4 +3,4 @@ package imds // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.13.8" +const goModuleVersion = "1.13.11" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/CHANGELOG.md index 3c7fb90a4..9826a85e6 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/CHANGELOG.md @@ -1,3 +1,15 @@ +# v1.1.41 (2023-08-21) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.1.40 (2023-08-18) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.1.39 (2023-08-17) + +* **Dependency Update**: Updated to the latest SDK module versions + # v1.1.38 (2023-08-07) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/go_module_metadata.go index acf968aa7..c7eec1c13 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/go_module_metadata.go @@ -3,4 +3,4 @@ package configsources // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.1.38" +const goModuleVersion = "1.1.41" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/CHANGELOG.md index 0c49cf68b..a470e22de 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/CHANGELOG.md @@ -1,3 +1,15 @@ +# v2.4.35 (2023-08-21) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v2.4.34 (2023-08-18) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v2.4.33 (2023-08-17) + +* **Dependency Update**: Updated to the latest SDK module versions + # v2.4.32 (2023-08-07) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/go_module_metadata.go index 06c328c97..ac28b313b 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/go_module_metadata.go @@ -3,4 +3,4 @@ package endpoints // goModuleVersion is the tagged release for this module -const goModuleVersion = "2.4.32" +const goModuleVersion = "2.4.35" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/CHANGELOG.md index 16ff6332d..74eff6a52 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/CHANGELOG.md @@ -1,3 +1,15 @@ +# v1.3.42 (2023-08-21) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.3.41 (2023-08-18) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.3.40 (2023-08-17) + +* **Dependency Update**: Updated to the latest SDK module versions + # v1.3.39 (2023-08-07) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/go_module_metadata.go index b653c0513..709294b9e 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/go_module_metadata.go @@ -3,4 +3,4 @@ package ini // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.3.39" +const goModuleVersion = "1.3.42" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/modman.toml b/vendor/github.com/aws/aws-sdk-go-v2/modman.toml index a4a343671..dad0dfc63 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/modman.toml +++ b/vendor/github.com/aws/aws-sdk-go-v2/modman.toml @@ -1,7 +1,7 @@ [dependencies] "github.com/aws/aws-sdk-go" = "v1.44.28" - "github.com/aws/smithy-go" = "v1.14.1" + "github.com/aws/smithy-go" = "v1.14.2" "github.com/google/go-cmp" = "v0.5.8" "github.com/jmespath/go-jmespath" = "v0.4.0" "golang.org/x/net" = "v0.1.0" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/CHANGELOG.md index ad4244324..e410f3e48 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/CHANGELOG.md @@ -1,3 +1,15 @@ +# v1.9.35 (2023-08-21) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.9.34 (2023-08-18) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.9.33 (2023-08-17) + +* **Dependency Update**: Updated to the latest SDK module versions + # v1.9.32 (2023-08-07) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/go_module_metadata.go index 7cd0b2d81..9c076b11f 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/go_module_metadata.go @@ -3,4 +3,4 @@ package presignedurl // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.9.32" +const goModuleVersion = "1.9.35" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/CHANGELOG.md index 58aa3ecc4..c7ba9b268 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/CHANGELOG.md @@ -1,3 +1,15 @@ +# v1.13.5 (2023-08-21) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.13.4 (2023-08-18) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.13.3 (2023-08-17) + +* **Dependency Update**: Updated to the latest SDK module versions + # v1.13.2 (2023-08-07) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/go_module_metadata.go index ac980ae3f..98050334e 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/go_module_metadata.go @@ -3,4 +3,4 @@ package sso // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.13.2" +const goModuleVersion = "1.13.5" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/CHANGELOG.md index d38e94554..608ac60ce 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/CHANGELOG.md @@ -1,3 +1,15 @@ +# v1.15.5 (2023-08-21) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.15.4 (2023-08-18) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.15.3 (2023-08-17) + +* **Dependency Update**: Updated to the latest SDK module versions + # v1.15.2 (2023-08-07) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/go_module_metadata.go index f6d156607..435045414 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/go_module_metadata.go @@ -3,4 +3,4 @@ package ssooidc // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.15.2" +const goModuleVersion = "1.15.5" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/CHANGELOG.md index 2804b794c..a3f535af8 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/CHANGELOG.md @@ -1,3 +1,15 @@ +# v1.21.5 (2023-08-21) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.21.4 (2023-08-18) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.21.3 (2023-08-17) + +* **Dependency Update**: Updated to the latest SDK module versions + # v1.21.2 (2023-08-07) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/go_module_metadata.go index 5312046b7..f0a57a675 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/go_module_metadata.go @@ -3,4 +3,4 @@ package sts // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.21.2" +const goModuleVersion = "1.21.5" diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/ssocreds/token_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/ssocreds/token_provider.go index 7562cd013..3388b78b4 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/ssocreds/token_provider.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/ssocreds/token_provider.go @@ -111,6 +111,15 @@ func (p *SSOTokenProvider) refreshToken(token cachedToken) (cachedToken, error) if err != nil { return cachedToken{}, fmt.Errorf("unable to refresh SSO token, %v", err) } + if createResult.ExpiresIn == nil { + return cachedToken{}, fmt.Errorf("missing required field ExpiresIn") + } + if createResult.AccessToken == nil { + return cachedToken{}, fmt.Errorf("missing required field AccessToken") + } + if createResult.RefreshToken == nil { + return cachedToken{}, fmt.Errorf("missing required field RefreshToken") + } expiresAt := nowTime().Add(time.Duration(*createResult.ExpiresIn) * time.Second) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go index d7ca9fbf5..59582df71 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go @@ -1058,6 +1058,9 @@ var awsPartition = partition{ endpointKey{ Region: "eu-west-3", }: endpoint{}, + endpointKey{ + Region: "il-central-1", + }: endpoint{}, endpointKey{ Region: "me-south-1", }: endpoint{}, @@ -1853,6 +1856,9 @@ var awsPartition = partition{ endpointKey{ Region: "ap-south-1", }: endpoint{}, + endpointKey{ + Region: "eu-central-1", + }: endpoint{}, endpointKey{ Region: "us-east-1", }: endpoint{}, @@ -2925,6 +2931,15 @@ var awsPartition = partition{ }: endpoint{ Hostname: "appmesh.eu-west-3.api.aws", }, + endpointKey{ + Region: "il-central-1", + }: endpoint{}, + endpointKey{ + Region: "il-central-1", + Variant: dualStackVariant, + }: endpoint{ + Hostname: "appmesh.il-central-1.api.aws", + }, endpointKey{ Region: "me-south-1", }: endpoint{}, @@ -3667,6 +3682,15 @@ var awsPartition = partition{ }, Deprecated: boxedTrue, }, + endpointKey{ + Region: "il-central-1", + }: endpoint{}, + endpointKey{ + Region: "il-central-1", + Variant: dualStackVariant, + }: endpoint{ + Hostname: "athena.il-central-1.api.aws", + }, endpointKey{ Region: "me-central-1", }: endpoint{}, @@ -4050,6 +4074,9 @@ var awsPartition = partition{ endpointKey{ Region: "eu-west-3", }: endpoint{}, + endpointKey{ + Region: "il-central-1", + }: endpoint{}, endpointKey{ Region: "me-central-1", }: endpoint{}, @@ -4331,6 +4358,9 @@ var awsPartition = partition{ }, Deprecated: boxedTrue, }, + endpointKey{ + Region: "il-central-1", + }: endpoint{}, endpointKey{ Region: "me-central-1", }: endpoint{}, @@ -7894,6 +7924,9 @@ var awsPartition = partition{ }, Deprecated: boxedTrue, }, + endpointKey{ + Region: "il-central-1", + }: endpoint{}, endpointKey{ Region: "me-central-1", }: endpoint{}, @@ -11011,6 +11044,9 @@ var awsPartition = partition{ }, Deprecated: boxedTrue, }, + endpointKey{ + Region: "il-central-1", + }: endpoint{}, endpointKey{ Region: "me-south-1", }: endpoint{}, @@ -12185,6 +12221,9 @@ var awsPartition = partition{ }, Deprecated: boxedTrue, }, + endpointKey{ + Region: "il-central-1", + }: endpoint{}, endpointKey{ Region: "me-central-1", }: endpoint{}, @@ -12582,6 +12621,9 @@ var awsPartition = partition{ }, Deprecated: boxedTrue, }, + endpointKey{ + Region: "il-central-1", + }: endpoint{}, endpointKey{ Region: "me-central-1", }: endpoint{}, @@ -13480,6 +13522,9 @@ var awsPartition = partition{ endpointKey{ Region: "eu-west-3", }: endpoint{}, + endpointKey{ + Region: "il-central-1", + }: endpoint{}, endpointKey{ Region: "me-central-1", }: endpoint{}, @@ -14055,6 +14100,42 @@ var awsPartition = partition{ endpointKey{ Region: "eu-west-3", }: endpoint{}, + endpointKey{ + Region: "fips-us-east-1", + }: endpoint{ + Hostname: "inspector2-fips.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + Deprecated: boxedTrue, + }, + endpointKey{ + Region: "fips-us-east-2", + }: endpoint{ + Hostname: "inspector2-fips.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + Deprecated: boxedTrue, + }, + endpointKey{ + Region: "fips-us-west-1", + }: endpoint{ + Hostname: "inspector2-fips.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + Deprecated: boxedTrue, + }, + endpointKey{ + Region: "fips-us-west-2", + }: endpoint{ + Hostname: "inspector2-fips.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + Deprecated: boxedTrue, + }, endpointKey{ Region: "me-south-1", }: endpoint{}, @@ -14064,15 +14145,39 @@ var awsPartition = partition{ endpointKey{ Region: "us-east-1", }: endpoint{}, + endpointKey{ + Region: "us-east-1", + Variant: fipsVariant, + }: endpoint{ + Hostname: "inspector2-fips.us-east-1.amazonaws.com", + }, endpointKey{ Region: "us-east-2", }: endpoint{}, + endpointKey{ + Region: "us-east-2", + Variant: fipsVariant, + }: endpoint{ + Hostname: "inspector2-fips.us-east-2.amazonaws.com", + }, endpointKey{ Region: "us-west-1", }: endpoint{}, + endpointKey{ + Region: "us-west-1", + Variant: fipsVariant, + }: endpoint{ + Hostname: "inspector2-fips.us-west-1.amazonaws.com", + }, endpointKey{ Region: "us-west-2", }: endpoint{}, + endpointKey{ + Region: "us-west-2", + Variant: fipsVariant, + }: endpoint{ + Hostname: "inspector2-fips.us-west-2.amazonaws.com", + }, }, }, "internetmonitor": service{ @@ -17087,6 +17192,9 @@ var awsPartition = partition{ }, Deprecated: boxedTrue, }, + endpointKey{ + Region: "il-central-1", + }: endpoint{}, endpointKey{ Region: "me-south-1", }: endpoint{}, @@ -18092,6 +18200,9 @@ var awsPartition = partition{ endpointKey{ Region: "ap-northeast-2", }: endpoint{}, + endpointKey{ + Region: "ap-northeast-3", + }: endpoint{}, endpointKey{ Region: "ap-south-1", }: endpoint{}, @@ -18101,6 +18212,9 @@ var awsPartition = partition{ endpointKey{ Region: "ap-southeast-2", }: endpoint{}, + endpointKey{ + Region: "ap-southeast-4", + }: endpoint{}, endpointKey{ Region: "ca-central-1", }: endpoint{}, @@ -18932,6 +19046,9 @@ var awsPartition = partition{ }, Deprecated: boxedTrue, }, + endpointKey{ + Region: "il-central-1", + }: endpoint{}, endpointKey{ Region: "me-central-1", }: endpoint{}, @@ -20437,6 +20554,12 @@ var awsPartition = partition{ }, Deprecated: boxedTrue, }, + endpointKey{ + Region: "il-central-1", + }: endpoint{}, + endpointKey{ + Region: "me-central-1", + }: endpoint{}, endpointKey{ Region: "me-south-1", }: endpoint{}, @@ -22462,6 +22585,9 @@ var awsPartition = partition{ endpointKey{ Region: "eu-west-2", }: endpoint{}, + endpointKey{ + Region: "il-central-1", + }: endpoint{}, endpointKey{ Region: "rekognition-fips.ca-central-1", }: endpoint{ @@ -24566,6 +24692,9 @@ var awsPartition = partition{ Deprecated: boxedTrue, }, + endpointKey{ + Region: "il-central-1", + }: endpoint{}, endpointKey{ Region: "me-south-1", }: endpoint{}, @@ -26012,6 +26141,9 @@ var awsPartition = partition{ endpointKey{ Region: "eu-west-3", }: endpoint{}, + endpointKey{ + Region: "il-central-1", + }: endpoint{}, endpointKey{ Region: "me-central-1", }: endpoint{}, @@ -27870,6 +28002,9 @@ var awsPartition = partition{ endpointKey{ Region: "eu-west-3", }: endpoint{}, + endpointKey{ + Region: "il-central-1", + }: endpoint{}, endpointKey{ Region: "me-central-1", }: endpoint{}, @@ -36454,12 +36589,42 @@ var awsusgovPartition = partition{ }, "inspector2": service{ Endpoints: serviceEndpoints{ + endpointKey{ + Region: "fips-us-gov-east-1", + }: endpoint{ + Hostname: "inspector2-fips.us-gov-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-east-1", + }, + Deprecated: boxedTrue, + }, + endpointKey{ + Region: "fips-us-gov-west-1", + }: endpoint{ + Hostname: "inspector2-fips.us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + Deprecated: boxedTrue, + }, endpointKey{ Region: "us-gov-east-1", }: endpoint{}, + endpointKey{ + Region: "us-gov-east-1", + Variant: fipsVariant, + }: endpoint{ + Hostname: "inspector2-fips.us-gov-east-1.amazonaws.com", + }, endpointKey{ Region: "us-gov-west-1", }: endpoint{}, + endpointKey{ + Region: "us-gov-west-1", + Variant: fipsVariant, + }: endpoint{ + Hostname: "inspector2-fips.us-gov-west-1.amazonaws.com", + }, }, }, "internetmonitor": service{ @@ -38574,7 +38739,7 @@ var awsusgovPartition = partition{ Region: "us-gov-east-1", Variant: dualStackVariant, }: endpoint{ - Hostname: "servicediscovery.us-gov-east-1.amazonaws.com", + Hostname: "servicediscovery.us-gov-east-1.api.aws", }, endpointKey{ Region: "us-gov-east-1", @@ -38586,7 +38751,7 @@ var awsusgovPartition = partition{ Region: "us-gov-east-1", Variant: fipsVariant | dualStackVariant, }: endpoint{ - Hostname: "servicediscovery-fips.us-gov-east-1.amazonaws.com", + Hostname: "servicediscovery-fips.us-gov-east-1.api.aws", }, endpointKey{ Region: "us-gov-east-1-fips", @@ -38604,7 +38769,7 @@ var awsusgovPartition = partition{ Region: "us-gov-west-1", Variant: dualStackVariant, }: endpoint{ - Hostname: "servicediscovery.us-gov-west-1.amazonaws.com", + Hostname: "servicediscovery.us-gov-west-1.api.aws", }, endpointKey{ Region: "us-gov-west-1", @@ -38616,7 +38781,7 @@ var awsusgovPartition = partition{ Region: "us-gov-west-1", Variant: fipsVariant | dualStackVariant, }: endpoint{ - Hostname: "servicediscovery-fips.us-gov-west-1.amazonaws.com", + Hostname: "servicediscovery-fips.us-gov-west-1.api.aws", }, endpointKey{ Region: "us-gov-west-1-fips", @@ -39976,6 +40141,9 @@ var awsisoPartition = partition{ endpointKey{ Region: "us-iso-east-1", }: endpoint{}, + endpointKey{ + Region: "us-iso-west-1", + }: endpoint{}, }, }, "elasticache": service{ @@ -40319,6 +40487,16 @@ var awsisoPartition = partition{ }: endpoint{}, }, }, + "resource-groups": service{ + Endpoints: serviceEndpoints{ + endpointKey{ + Region: "us-iso-east-1", + }: endpoint{}, + endpointKey{ + Region: "us-iso-west-1", + }: endpoint{}, + }, + }, "route53": service{ PartitionEndpoint: "aws-iso-global", IsRegionalized: boxedFalse, @@ -40959,6 +41137,13 @@ var awsisobPartition = partition{ }: endpoint{}, }, }, + "outposts": service{ + Endpoints: serviceEndpoints{ + endpointKey{ + Region: "us-isob-east-1", + }: endpoint{}, + }, + }, "ram": service{ Endpoints: serviceEndpoints{ endpointKey{ diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go index 41386bab1..b20979374 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go @@ -135,6 +135,7 @@ var requiredSignedHeaders = rules{ "X-Amz-Request-Payer": struct{}{}, "X-Amz-Server-Side-Encryption": struct{}{}, "X-Amz-Server-Side-Encryption-Aws-Kms-Key-Id": struct{}{}, + "X-Amz-Server-Side-Encryption-Context": struct{}{}, "X-Amz-Server-Side-Encryption-Customer-Algorithm": struct{}{}, "X-Amz-Server-Side-Encryption-Customer-Key": struct{}{}, "X-Amz-Server-Side-Encryption-Customer-Key-Md5": struct{}{}, diff --git a/vendor/github.com/aws/aws-sdk-go/aws/version.go b/vendor/github.com/aws/aws-sdk-go/aws/version.go index a0203e758..96b11c71c 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/version.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/version.go @@ -5,4 +5,4 @@ package aws const SDKName = "aws-sdk-go" // SDKVersion is the version of this SDK -const SDKVersion = "1.44.323" +const SDKVersion = "1.44.333" diff --git a/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go b/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go index c1ddd39b4..7e55ef172 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go @@ -8685,9 +8685,11 @@ func (c *EC2) CreateSubnetCidrReservationRequest(input *CreateSubnetCidrReservat // CreateSubnetCidrReservation API operation for Amazon Elastic Compute Cloud. // -// Creates a subnet CIDR reservation. For information about subnet CIDR reservations, -// see Subnet CIDR reservations (https://docs.aws.amazon.com/vpc/latest/userguide/subnet-cidr-reservation.html) -// in the Amazon Virtual Private Cloud User Guide. +// Creates a subnet CIDR reservation. For more information, see Subnet CIDR +// reservations (https://docs.aws.amazon.com/vpc/latest/userguide/subnet-cidr-reservation.html) +// in the Amazon Virtual Private Cloud User Guide and Assign prefixes to network +// interfaces (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-prefix-eni.html) +// in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -12456,7 +12458,6 @@ func (c *EC2) DeleteKeyPairRequest(input *DeleteKeyPairInput) (req *request.Requ output = &DeleteKeyPairOutput{} req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(ec2query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return } @@ -12609,10 +12610,19 @@ func (c *EC2) DeleteLaunchTemplateVersionsRequest(input *DeleteLaunchTemplateVer // DeleteLaunchTemplateVersions API operation for Amazon Elastic Compute Cloud. // -// Deletes one or more versions of a launch template. You cannot delete the -// default version of a launch template; you must first assign a different version -// as the default. If the default version is the only version for the launch -// template, you must delete the entire launch template using DeleteLaunchTemplate. +// Deletes one or more versions of a launch template. +// +// You can't delete the default version of a launch template; you must first +// assign a different version as the default. If the default version is the +// only version for the launch template, you must delete the entire launch template +// using DeleteLaunchTemplate. +// +// You can delete up to 200 launch template versions in a single request. To +// delete more than 200 versions in a single request, use DeleteLaunchTemplate, +// which deletes the launch template and all of its versions. +// +// For more information, see Delete a launch template version (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/manage-launch-template-versions.html#delete-launch-template-version) +// in the EC2 User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -69416,9 +69426,7 @@ type CreateFlowLogsInput struct { // in the Amazon VPC User Guide or Transit Gateway Flow Log records (https://docs.aws.amazon.com/vpc/latest/tgw/tgw-flow-logs.html#flow-log-records) // in the Amazon Web Services Transit Gateway Guide. // - // Specify the fields using the ${field-id} format, separated by spaces. For - // the CLI, surround this parameter value with single quotes on Linux or double - // quotes on Windows. + // Specify the fields using the ${field-id} format, separated by spaces. LogFormat *string `type:"string"` // The name of a new or existing CloudWatch Logs log group where Amazon EC2 @@ -74866,18 +74874,13 @@ type CreateSubnetCidrReservationInput struct { // it is UnauthorizedOperation. DryRun *bool `type:"boolean"` - // The type of reservation. + // The type of reservation. The reservation type determines how the reserved + // IP addresses are assigned to resources. // - // The following are valid values: + // * prefix - Amazon Web Services assigns the reserved IP addresses to network + // interfaces. // - // * prefix: The Amazon EC2 Prefix Delegation feature assigns the IP addresses - // to network interfaces that are associated with an instance. For information - // about Prefix Delegation, see Prefix Delegation for Amazon EC2 network - // interfaces (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-prefix-delegation.html) - // in the Amazon Elastic Compute Cloud User Guide. - // - // * explicit: You manually assign the IP addresses to resources that reside - // in your subnet. + // * explicit - You assign the reserved IP addresses to network interfaces. // // ReservationType is a required field ReservationType *string `type:"string" required:"true" enum:"SubnetCidrReservationType"` @@ -75617,6 +75620,10 @@ type CreateTrafficMirrorSessionInput struct { // // If you do not want to mirror the entire packet, use the PacketLength parameter // to specify the number of bytes in each packet to mirror. + // + // For sessions with Network Load Balancer (NLB) Traffic Mirror targets the + // default PacketLength will be set to 8500. Valid values are 1-8500. Setting + // a PacketLength greater than 8500 will result in an error response. PacketLength *int64 `type:"integer"` // The session number determines the order in which sessions are evaluated when @@ -78819,7 +78826,7 @@ type CreateVpcEndpointInput struct { RouteTableIds []*string `locationName:"RouteTableId" locationNameList:"item" type:"list"` // (Interface endpoint) The IDs of the security groups to associate with the - // endpoint network interface. If this parameter is not specified, we use the + // endpoint network interfaces. If this parameter is not specified, we use the // default security group for the VPC. SecurityGroupIds []*string `locationName:"SecurityGroupId" locationNameList:"item" type:"list"` @@ -78828,8 +78835,11 @@ type CreateVpcEndpointInput struct { // ServiceName is a required field ServiceName *string `type:"string" required:"true"` + // The subnet configurations for the endpoint. + SubnetConfigurations []*SubnetConfiguration `locationName:"SubnetConfiguration" locationNameList:"item" type:"list"` + // (Interface and Gateway Load Balancer endpoints) The IDs of the subnets in - // which to create an endpoint network interface. For a Gateway Load Balancer + // which to create endpoint network interfaces. For a Gateway Load Balancer // endpoint, you can specify only one subnet. SubnetIds []*string `locationName:"SubnetId" locationNameList:"item" type:"list"` @@ -78935,6 +78945,12 @@ func (s *CreateVpcEndpointInput) SetServiceName(v string) *CreateVpcEndpointInpu return s } +// SetSubnetConfigurations sets the SubnetConfigurations field's value. +func (s *CreateVpcEndpointInput) SetSubnetConfigurations(v []*SubnetConfiguration) *CreateVpcEndpointInput { + s.SubnetConfigurations = v + return s +} + // SetSubnetIds sets the SubnetIds field's value. func (s *CreateVpcEndpointInput) SetSubnetIds(v []*string) *CreateVpcEndpointInput { s.SubnetIds = v @@ -82037,6 +82053,12 @@ func (s *DeleteKeyPairInput) SetKeyPairId(v string) *DeleteKeyPairInput { type DeleteKeyPairOutput struct { _ struct{} `type:"structure"` + + // The ID of the key pair. + KeyPairId *string `locationName:"keyPairId" type:"string"` + + // Is true if the request succeeds, and an error otherwise. + Return *bool `locationName:"return" type:"boolean"` } // String returns the string representation. @@ -82057,6 +82079,18 @@ func (s DeleteKeyPairOutput) GoString() string { return s.String() } +// SetKeyPairId sets the KeyPairId field's value. +func (s *DeleteKeyPairOutput) SetKeyPairId(v string) *DeleteKeyPairOutput { + s.KeyPairId = &v + return s +} + +// SetReturn sets the Return field's value. +func (s *DeleteKeyPairOutput) SetReturn(v bool) *DeleteKeyPairOutput { + s.Return = &v + return s +} + type DeleteLaunchTemplateInput struct { _ struct{} `type:"structure"` @@ -82180,7 +82214,8 @@ type DeleteLaunchTemplateVersionsInput struct { // not both. LaunchTemplateName *string `min:"3" type:"string"` - // The version numbers of one or more launch template versions to delete. + // The version numbers of one or more launch template versions to delete. You + // can specify up to 200 launch template version numbers. // // Versions is a required field Versions []*string `locationName:"LaunchTemplateVersion" locationNameList:"item" type:"list" required:"true"` @@ -95325,7 +95360,7 @@ type DescribeInstancesInput struct { // * availability-zone - The Availability Zone of the instance. // // * block-device-mapping.attach-time - The attach time for an EBS volume - // mapped to the instance, for example, 2010-09-15T17:15:20.000Z. + // mapped to the instance, for example, 2022-09-15T17:15:20.000Z. // // * block-device-mapping.delete-on-termination - A Boolean that indicates // whether the EBS volume is deleted on instance termination. @@ -95338,14 +95373,38 @@ type DescribeInstancesInput struct { // // * block-device-mapping.volume-id - The volume ID of the EBS volume. // + // * boot-mode - The boot mode that was specified by the AMI (legacy-bios + // | uefi | uefi-preferred). + // // * capacity-reservation-id - The ID of the Capacity Reservation into which // the instance was launched. // + // * capacity-reservation-specification.capacity-reservation-preference - + // The instance's Capacity Reservation preference (open | none). + // + // * capacity-reservation-specification.capacity-reservation-target.capacity-reservation-id + // - The ID of the targeted Capacity Reservation. + // + // * capacity-reservation-specification.capacity-reservation-target.capacity-reservation-resource-group-arn + // - The ARN of the targeted Capacity Reservation group. + // // * client-token - The idempotency token you provided when you launched // the instance. // + // * current-instance-boot-mode - The boot mode that is used to launch the + // instance at launch or start (legacy-bios | uefi). + // // * dns-name - The public DNS name of the instance. // + // * ebs-optimized - A Boolean that indicates whether the instance is optimized + // for Amazon EBS I/O. + // + // * ena-support - A Boolean that indicates whether the instance is enabled + // for enhanced networking with ENA. + // + // * enclave-options.enabled - A Boolean that indicates whether the instance + // is enabled for Amazon Web Services Nitro Enclaves. + // // * hibernation-options.configured - A Boolean that indicates whether the // instance is enabled for hibernation. A value of true means that the instance // is enabled for hibernation. @@ -95359,6 +95418,12 @@ type DescribeInstancesInput struct { // * iam-instance-profile.arn - The instance profile associated with the // instance. Specified as an ARN. // + // * iam-instance-profile.id - The instance profile associated with the instance. + // Specified as an ID. + // + // * iam-instance-profile.name - The instance profile associated with the + // instance. Specified as an name. + // // * image-id - The ID of the image used to launch the instance. // // * instance-id - The ID of the instance. @@ -95383,6 +95448,8 @@ type DescribeInstancesInput struct { // // * ip-address - The public IPv4 address of the instance. // + // * ipv6-address - The IPv6 address of the instance. + // // * kernel-id - The kernel ID. // // * key-name - The name of the key pair used when the instance was launched. @@ -95395,27 +95462,41 @@ type DescribeInstancesInput struct { // You can use a wildcard (*), for example, 2021-09-29T*, which matches an // entire day. // - // * metadata-options.http-tokens - The metadata request authorization state - // (optional | required) + // * license-pool - // - // * metadata-options.http-put-response-hop-limit - The HTTP metadata request - // put response hop limit (integer, possible values 1 to 64) + // * maintenance-options.auto-recovery - The current automatic recovery behavior + // of the instance (disabled | default). // // * metadata-options.http-endpoint - The status of access to the HTTP metadata // endpoint on your instance (enabled | disabled) // + // * metadata-options.http-protocol-ipv4 - Indicates whether the IPv4 endpoint + // is enabled (disabled | enabled). + // + // * metadata-options.http-protocol-ipv6 - Indicates whether the IPv6 endpoint + // is enabled (disabled | enabled). + // + // * metadata-options.http-put-response-hop-limit - The HTTP metadata request + // put response hop limit (integer, possible values 1 to 64) + // + // * metadata-options.http-tokens - The metadata request authorization state + // (optional | required) + // // * metadata-options.instance-metadata-tags - The status of access to instance // tags from the instance metadata (enabled | disabled) // + // * metadata-options.state - The state of the metadata option changes (pending + // | applied). + // // * monitoring-state - Indicates whether detailed monitoring is enabled // (disabled | enabled). // - // * network-interface.addresses.private-ip-address - The private IPv4 address - // associated with the network interface. - // // * network-interface.addresses.primary - Specifies whether the IPv4 address // of the network interface is the primary private IPv4 address. // + // * network-interface.addresses.private-ip-address - The private IPv4 address + // associated with the network interface. + // // * network-interface.addresses.association.public-ip - The ID of the association // of an Elastic IP address (IPv4) with a network interface. // @@ -95507,8 +95588,29 @@ type DescribeInstancesInput struct { // // * platform - The platform. To list only Windows instances, use windows. // + // * platform-details - The platform (Linux/UNIX | Red Hat BYOL Linux | Red + // Hat Enterprise Linux | Red Hat Enterprise Linux with HA | Red Hat Enterprise + // Linux with SQL Server Standard and HA | Red Hat Enterprise Linux with + // SQL Server Enterprise and HA | Red Hat Enterprise Linux with SQL Server + // Standard | Red Hat Enterprise Linux with SQL Server Web | Red Hat Enterprise + // Linux with SQL Server Enterprise | SQL Server Enterprise | SQL Server + // Standard | SQL Server Web | SUSE Linux | Ubuntu Pro | Windows | Windows + // BYOL | Windows with SQL Server Enterprise | Windows with SQL Server Standard + // | Windows with SQL Server Web). + // // * private-dns-name - The private IPv4 DNS name of the instance. // + // * private-dns-name-options.enable-resource-name-dns-a-record - A Boolean + // that indicates whether to respond to DNS queries for instance hostnames + // with DNS A records. + // + // * private-dns-name-options.enable-resource-name-dns-aaaa-record - A Boolean + // that indicates whether to respond to DNS queries for instance hostnames + // with DNS AAAA records. + // + // * private-dns-name-options.hostname-type - The type of hostname (ip-name + // | resource-name). + // // * private-ip-address - The private IPv4 address of the instance. // // * product-code - The product code associated with the AMI used to launch @@ -95564,6 +95666,19 @@ type DescribeInstancesInput struct { // // * tenancy - The tenancy of an instance (dedicated | default | host). // + // * tpm-support - Indicates if the instance is configured for NitroTPM support + // (v2.0). + // + // * usage-operation - The usage operation value for the instance (RunInstances + // | RunInstances:00g0 | RunInstances:0010 | RunInstances:1010 | RunInstances:1014 + // | RunInstances:1110 | RunInstances:0014 | RunInstances:0210 | RunInstances:0110 + // | RunInstances:0100 | RunInstances:0004 | RunInstances:0200 | RunInstances:000g + // | RunInstances:0g00 | RunInstances:0002 | RunInstances:0800 | RunInstances:0102 + // | RunInstances:0006 | RunInstances:0202). + // + // * usage-operation-update-time - The time that the usage operation was + // last updated, for example, 2022-09-15T17:15:20.000Z. + // // * virtualization-type - The virtualization type of the instance (paravirtual // | hvm). // @@ -122924,7 +123039,11 @@ type GetPasswordDataOutput struct { // The password of the instance. Returns an empty string if the password is // not available. - PasswordData *string `locationName:"passwordData" type:"string"` + // + // PasswordData is a sensitive parameter and its value will be + // replaced with "sensitive" in string returned by GetPasswordDataOutput's + // String and GoString methods. + PasswordData *string `locationName:"passwordData" type:"string" sensitive:"true"` // The time the data was last updated. Timestamp *time.Time `locationName:"timestamp" type:"timestamp"` @@ -145835,6 +145954,10 @@ type ModifyTrafficMirrorSessionInput struct { // For example, if you set this value to 100, then the first 100 bytes that // meet the filter criteria are copied to the target. Do not specify this parameter // when you want to mirror the entire packet. + // + // For sessions with Network Load Balancer (NLB) traffic mirror targets, the + // default PacketLength will be set to 8500. Valid values are 1-8500. Setting + // a PacketLength greater than 8500 will result in an error response. PacketLength *int64 `type:"integer"` // The properties that you want to remove from the Traffic Mirror session. @@ -148070,7 +148193,7 @@ type ModifyVpcEndpointInput struct { AddRouteTableIds []*string `locationName:"AddRouteTableId" locationNameList:"item" type:"list"` // (Interface endpoint) The IDs of the security groups to associate with the - // network interface. + // endpoint network interfaces. AddSecurityGroupIds []*string `locationName:"AddSecurityGroupId" locationNameList:"item" type:"list"` // (Interface and Gateway Load Balancer endpoints) The IDs of the subnets in @@ -148102,7 +148225,7 @@ type ModifyVpcEndpointInput struct { RemoveRouteTableIds []*string `locationName:"RemoveRouteTableId" locationNameList:"item" type:"list"` // (Interface endpoint) The IDs of the security groups to disassociate from - // the network interface. + // the endpoint network interfaces. RemoveSecurityGroupIds []*string `locationName:"RemoveSecurityGroupId" locationNameList:"item" type:"list"` // (Interface endpoint) The IDs of the subnets from which to remove the endpoint. @@ -148112,6 +148235,9 @@ type ModifyVpcEndpointInput struct { // policy. The default policy allows full access to the service. ResetPolicy *bool `type:"boolean"` + // The subnet configurations for the endpoint. + SubnetConfigurations []*SubnetConfiguration `locationName:"SubnetConfiguration" locationNameList:"item" type:"list"` + // The ID of the endpoint. // // VpcEndpointId is a required field @@ -148221,6 +148347,12 @@ func (s *ModifyVpcEndpointInput) SetResetPolicy(v bool) *ModifyVpcEndpointInput return s } +// SetSubnetConfigurations sets the SubnetConfigurations field's value. +func (s *ModifyVpcEndpointInput) SetSubnetConfigurations(v []*SubnetConfiguration) *ModifyVpcEndpointInput { + s.SubnetConfigurations = v + return s +} + // SetVpcEndpointId sets the VpcEndpointId field's value. func (s *ModifyVpcEndpointInput) SetVpcEndpointId(v string) *ModifyVpcEndpointInput { s.VpcEndpointId = &v @@ -164919,7 +165051,11 @@ type S3Storage struct { UploadPolicy []byte `locationName:"uploadPolicy" type:"blob"` // The signature of the JSON document. - UploadPolicySignature *string `locationName:"uploadPolicySignature" type:"string"` + // + // UploadPolicySignature is a sensitive parameter and its value will be + // replaced with "sensitive" in string returned by S3Storage's + // String and GoString methods. + UploadPolicySignature *string `locationName:"uploadPolicySignature" type:"string" sensitive:"true"` } // String returns the string representation. @@ -171720,6 +171856,68 @@ func (s *SubnetCidrReservation) SetTags(v []*Tag) *SubnetCidrReservation { return s } +// Describes the configuration of a subnet for a VPC endpoint. +type SubnetConfiguration struct { + _ struct{} `type:"structure"` + + // The IPv4 address to assign to the endpoint network interface in the subnet. + // You must provide an IPv4 address if the VPC endpoint supports IPv4. + // + // If you specify an IPv4 address when modifying a VPC endpoint, we replace + // the existing endpoint network interface with a new endpoint network interface + // with this IP address. This process temporarily disconnects the subnet and + // the VPC endpoint. + Ipv4 *string `type:"string"` + + // The IPv6 address to assign to the endpoint network interface in the subnet. + // You must provide an IPv6 address if the VPC endpoint supports IPv6. + // + // If you specify an IPv6 address when modifying a VPC endpoint, we replace + // the existing endpoint network interface with a new endpoint network interface + // with this IP address. This process temporarily disconnects the subnet and + // the VPC endpoint. + Ipv6 *string `type:"string"` + + // The ID of the subnet. + SubnetId *string `type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s SubnetConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s SubnetConfiguration) GoString() string { + return s.String() +} + +// SetIpv4 sets the Ipv4 field's value. +func (s *SubnetConfiguration) SetIpv4(v string) *SubnetConfiguration { + s.Ipv4 = &v + return s +} + +// SetIpv6 sets the Ipv6 field's value. +func (s *SubnetConfiguration) SetIpv6(v string) *SubnetConfiguration { + s.Ipv6 = &v + return s +} + +// SetSubnetId sets the SubnetId field's value. +func (s *SubnetConfiguration) SetSubnetId(v string) *SubnetConfiguration { + s.SubnetId = &v + return s +} + // Describes an association between a subnet and an IPv6 CIDR block. type SubnetIpv6CidrBlockAssociation struct { _ struct{} `type:"structure"` @@ -187049,6 +187247,54 @@ const ( // InstanceTypeM7iFlex8xlarge is a InstanceType enum value InstanceTypeM7iFlex8xlarge = "m7i-flex.8xlarge" + + // InstanceTypeM7aMedium is a InstanceType enum value + InstanceTypeM7aMedium = "m7a.medium" + + // InstanceTypeM7aLarge is a InstanceType enum value + InstanceTypeM7aLarge = "m7a.large" + + // InstanceTypeM7aXlarge is a InstanceType enum value + InstanceTypeM7aXlarge = "m7a.xlarge" + + // InstanceTypeM7a2xlarge is a InstanceType enum value + InstanceTypeM7a2xlarge = "m7a.2xlarge" + + // InstanceTypeM7a4xlarge is a InstanceType enum value + InstanceTypeM7a4xlarge = "m7a.4xlarge" + + // InstanceTypeM7a8xlarge is a InstanceType enum value + InstanceTypeM7a8xlarge = "m7a.8xlarge" + + // InstanceTypeM7a12xlarge is a InstanceType enum value + InstanceTypeM7a12xlarge = "m7a.12xlarge" + + // InstanceTypeM7a16xlarge is a InstanceType enum value + InstanceTypeM7a16xlarge = "m7a.16xlarge" + + // InstanceTypeM7a24xlarge is a InstanceType enum value + InstanceTypeM7a24xlarge = "m7a.24xlarge" + + // InstanceTypeM7a32xlarge is a InstanceType enum value + InstanceTypeM7a32xlarge = "m7a.32xlarge" + + // InstanceTypeM7a48xlarge is a InstanceType enum value + InstanceTypeM7a48xlarge = "m7a.48xlarge" + + // InstanceTypeM7aMetal48xl is a InstanceType enum value + InstanceTypeM7aMetal48xl = "m7a.metal-48xl" + + // InstanceTypeHpc7a12xlarge is a InstanceType enum value + InstanceTypeHpc7a12xlarge = "hpc7a.12xlarge" + + // InstanceTypeHpc7a24xlarge is a InstanceType enum value + InstanceTypeHpc7a24xlarge = "hpc7a.24xlarge" + + // InstanceTypeHpc7a48xlarge is a InstanceType enum value + InstanceTypeHpc7a48xlarge = "hpc7a.48xlarge" + + // InstanceTypeHpc7a96xlarge is a InstanceType enum value + InstanceTypeHpc7a96xlarge = "hpc7a.96xlarge" ) // InstanceType_Values returns all elements of the InstanceType enum @@ -187734,6 +187980,22 @@ func InstanceType_Values() []string { InstanceTypeM7iFlex2xlarge, InstanceTypeM7iFlex4xlarge, InstanceTypeM7iFlex8xlarge, + InstanceTypeM7aMedium, + InstanceTypeM7aLarge, + InstanceTypeM7aXlarge, + InstanceTypeM7a2xlarge, + InstanceTypeM7a4xlarge, + InstanceTypeM7a8xlarge, + InstanceTypeM7a12xlarge, + InstanceTypeM7a16xlarge, + InstanceTypeM7a24xlarge, + InstanceTypeM7a32xlarge, + InstanceTypeM7a48xlarge, + InstanceTypeM7aMetal48xl, + InstanceTypeHpc7a12xlarge, + InstanceTypeHpc7a24xlarge, + InstanceTypeHpc7a48xlarge, + InstanceTypeHpc7a96xlarge, } } diff --git a/vendor/github.com/aws/smithy-go/CHANGELOG.md b/vendor/github.com/aws/smithy-go/CHANGELOG.md index a1754c221..b9171b88b 100644 --- a/vendor/github.com/aws/smithy-go/CHANGELOG.md +++ b/vendor/github.com/aws/smithy-go/CHANGELOG.md @@ -1,3 +1,7 @@ +# Release (2023-08-18) + +* No change notes available for this release. + # Release (2023-08-07) ## Module Highlights diff --git a/vendor/github.com/aws/smithy-go/go_module_metadata.go b/vendor/github.com/aws/smithy-go/go_module_metadata.go index 5dffb6360..997c30924 100644 --- a/vendor/github.com/aws/smithy-go/go_module_metadata.go +++ b/vendor/github.com/aws/smithy-go/go_module_metadata.go @@ -3,4 +3,4 @@ package smithy // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.14.1" +const goModuleVersion = "1.14.2" diff --git a/vendor/github.com/eapache/go-resiliency/breaker/README.md b/vendor/github.com/eapache/go-resiliency/breaker/README.md index 2d1b3d932..76f500739 100644 --- a/vendor/github.com/eapache/go-resiliency/breaker/README.md +++ b/vendor/github.com/eapache/go-resiliency/breaker/README.md @@ -1,7 +1,7 @@ circuit-breaker =============== -[![Build Status](https://travis-ci.org/eapache/go-resiliency.svg?branch=master)](https://travis-ci.org/eapache/go-resiliency) +[![Golang CI](https://github.com/eapache/go-resiliency/actions/workflows/golang-ci.yml/badge.svg)](https://github.com/eapache/go-resiliency/actions/workflows/golang-ci.yml) [![GoDoc](https://godoc.org/github.com/eapache/go-resiliency/breaker?status.svg)](https://godoc.org/github.com/eapache/go-resiliency/breaker) [![Code of Conduct](https://img.shields.io/badge/code%20of%20conduct-active-blue.svg)](https://eapache.github.io/conduct.html) diff --git a/vendor/github.com/eapache/go-xerial-snappy/snappy.go b/vendor/github.com/eapache/go-xerial-snappy/snappy.go index e2c1714ff..c2eb20507 100644 --- a/vendor/github.com/eapache/go-xerial-snappy/snappy.go +++ b/vendor/github.com/eapache/go-xerial-snappy/snappy.go @@ -83,13 +83,23 @@ func Decode(src []byte) ([]byte, error) { // for use by this function. If `dst` is nil *or* insufficiently large to hold // the decoded `src`, new space will be allocated. func DecodeInto(dst, src []byte) ([]byte, error) { + if len(src) < 8 || !bytes.Equal(src[:8], xerialHeader) { + dst, err := master.Decode(dst[:cap(dst)], src) + if err != nil && len(src) < len(xerialHeader) { + // Keep compatibility and return ErrMalformed when there is a + // short or truncated header. + return nil, ErrMalformed + } + return dst, err + } + var max = len(src) if max < len(xerialHeader) { return nil, ErrMalformed } - if !bytes.Equal(src[:8], xerialHeader) { - return master.Decode(dst[:cap(dst)], src) + if max == sizeOffset { + return []byte{}, nil } if max < sizeOffset+sizeBytes { diff --git a/vendor/github.com/goccy/go-json/.codecov.yml b/vendor/github.com/goccy/go-json/.codecov.yml new file mode 100644 index 000000000..e98134570 --- /dev/null +++ b/vendor/github.com/goccy/go-json/.codecov.yml @@ -0,0 +1,32 @@ +codecov: + require_ci_to_pass: yes + +coverage: + precision: 2 + round: down + range: "70...100" + + status: + project: + default: + target: 70% + threshold: 2% + patch: off + changes: no + +parsers: + gcov: + branch_detection: + conditional: yes + loop: yes + method: no + macro: no + +comment: + layout: "header,diff" + behavior: default + require_changes: no + +ignore: + - internal/encoder/vm_color + - internal/encoder/vm_color_indent diff --git a/vendor/github.com/goccy/go-json/.gitignore b/vendor/github.com/goccy/go-json/.gitignore new file mode 100644 index 000000000..378283829 --- /dev/null +++ b/vendor/github.com/goccy/go-json/.gitignore @@ -0,0 +1,2 @@ +cover.html +cover.out diff --git a/vendor/github.com/goccy/go-json/.golangci.yml b/vendor/github.com/goccy/go-json/.golangci.yml new file mode 100644 index 000000000..57ae5a528 --- /dev/null +++ b/vendor/github.com/goccy/go-json/.golangci.yml @@ -0,0 +1,83 @@ +run: + skip-files: + - encode_optype.go + - ".*_test\\.go$" + +linters-settings: + govet: + enable-all: true + disable: + - shadow + +linters: + enable-all: true + disable: + - dogsled + - dupl + - exhaustive + - exhaustivestruct + - errorlint + - forbidigo + - funlen + - gci + - gochecknoglobals + - gochecknoinits + - gocognit + - gocritic + - gocyclo + - godot + - godox + - goerr113 + - gofumpt + - gomnd + - gosec + - ifshort + - lll + - makezero + - nakedret + - nestif + - nlreturn + - paralleltest + - testpackage + - thelper + - wrapcheck + - interfacer + - lll + - nakedret + - nestif + - nlreturn + - testpackage + - wsl + - varnamelen + - nilnil + - ireturn + - govet + - forcetypeassert + - cyclop + - containedctx + - revive + +issues: + exclude-rules: + # not needed + - path: /*.go + text: "ST1003: should not use underscores in package names" + linters: + - stylecheck + - path: /*.go + text: "don't use an underscore in package name" + linters: + - golint + - path: rtype.go + linters: + - golint + - stylecheck + - path: error.go + linters: + - staticcheck + + # Maximum issues count per one linter. Set to 0 to disable. Default is 50. + max-issues-per-linter: 0 + + # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. + max-same-issues: 0 diff --git a/vendor/github.com/goccy/go-json/CHANGELOG.md b/vendor/github.com/goccy/go-json/CHANGELOG.md new file mode 100644 index 000000000..d09bb89c3 --- /dev/null +++ b/vendor/github.com/goccy/go-json/CHANGELOG.md @@ -0,0 +1,425 @@ +# v0.10.2 - 2023/03/20 + +### New features + +* Support DebugDOT option for debugging encoder ( #440 ) + +### Fix bugs + +* Fix combination of embedding structure and omitempty option ( #442 ) + +# v0.10.1 - 2023/03/13 + +### Fix bugs + +* Fix checkptr error for array decoder ( #415 ) +* Fix added buffer size check when decoding key ( #430 ) +* Fix handling of anonymous fields other than struct ( #431 ) +* Fix to not optimize when lower conversion can't handle byte-by-byte ( #432 ) +* Fix a problem that MarshalIndent does not work when UnorderedMap is specified ( #435 ) +* Fix mapDecoder.DecodeStream() for empty objects containing whitespace ( #425 ) +* Fix an issue that could not set the correct NextField for fields in the embedded structure ( #438 ) + +# v0.10.0 - 2022/11/29 + +### New features + +* Support JSON Path ( #250 ) + +### Fix bugs + +* Fix marshaler for map's key ( #409 ) + +# v0.9.11 - 2022/08/18 + +### Fix bugs + +* Fix unexpected behavior when buffer ends with backslash ( #383 ) +* Fix stream decoding of escaped character ( #387 ) + +# v0.9.10 - 2022/07/15 + +### Fix bugs + +* Fix boundary exception of type caching ( #382 ) + +# v0.9.9 - 2022/07/15 + +### Fix bugs + +* Fix encoding of directed interface with typed nil ( #377 ) +* Fix embedded primitive type encoding using alias ( #378 ) +* Fix slice/array type encoding with types implementing MarshalJSON ( #379 ) +* Fix unicode decoding when the expected buffer state is not met after reading ( #380 ) + +# v0.9.8 - 2022/06/30 + +### Fix bugs + +* Fix decoding of surrogate-pair ( #365 ) +* Fix handling of embedded primitive type ( #366 ) +* Add validation of escape sequence for decoder ( #367 ) +* Fix stream tokenizing respecting UseNumber ( #369 ) +* Fix encoding when struct pointer type that implements Marshal JSON is embedded ( #375 ) + +### Improve performance + +* Improve performance of linkRecursiveCode ( #368 ) + +# v0.9.7 - 2022/04/22 + +### Fix bugs + +#### Encoder + +* Add filtering process for encoding on slow path ( #355 ) +* Fix encoding of interface{} with pointer type ( #363 ) + +#### Decoder + +* Fix map key decoder that implements UnmarshalJSON ( #353 ) +* Fix decoding of []uint8 type ( #361 ) + +### New features + +* Add DebugWith option for encoder ( #356 ) + +# v0.9.6 - 2022/03/22 + +### Fix bugs + +* Correct the handling of the minimum value of int type for decoder ( #344 ) +* Fix bugs of stream decoder's bufferSize ( #349 ) +* Add a guard to use typeptr more safely ( #351 ) + +### Improve decoder performance + +* Improve escapeString's performance ( #345 ) + +### Others + +* Update go version for CI ( #347 ) + +# v0.9.5 - 2022/03/04 + +### Fix bugs + +* Fix panic when decoding time.Time with context ( #328 ) +* Fix reading the next character in buffer to nul consideration ( #338 ) +* Fix incorrect handling on skipValue ( #341 ) + +### Improve decoder performance + +* Improve performance when a payload contains escape sequence ( #334 ) + +# v0.9.4 - 2022/01/21 + +* Fix IsNilForMarshaler for string type with omitempty ( #323 ) +* Fix the case where the embedded field is at the end ( #326 ) + +# v0.9.3 - 2022/01/14 + +* Fix logic of removing struct field for decoder ( #322 ) + +# v0.9.2 - 2022/01/14 + +* Add invalid decoder to delay type error judgment at decode ( #321 ) + +# v0.9.1 - 2022/01/11 + +* Fix encoding of MarshalText/MarshalJSON operation with head offset ( #319 ) + +# v0.9.0 - 2022/01/05 + +### New feature + +* Supports dynamic filtering of struct fields ( #314 ) + +### Improve encoding performance + +* Improve map encoding performance ( #310 ) +* Optimize encoding path for escaped string ( #311 ) +* Add encoding option for performance ( #312 ) + +### Fix bugs + +* Fix panic at encoding map value on 1.18 ( #310 ) +* Fix MarshalIndent for interface type ( #317 ) + +# v0.8.1 - 2021/12/05 + +* Fix operation conversion from PtrHead to Head in Recursive type ( #305 ) + +# v0.8.0 - 2021/12/02 + +* Fix embedded field conflict behavior ( #300 ) +* Refactor compiler for encoder ( #301 #302 ) + +# v0.7.10 - 2021/10/16 + +* Fix conversion from pointer to uint64 ( #294 ) + +# v0.7.9 - 2021/09/28 + +* Fix encoding of nil value about interface type that has method ( #291 ) + +# v0.7.8 - 2021/09/01 + +* Fix mapassign_faststr for indirect struct type ( #283 ) +* Fix encoding of not empty interface type ( #284 ) +* Fix encoding of empty struct interface type ( #286 ) + +# v0.7.7 - 2021/08/25 + +* Fix invalid utf8 on stream decoder ( #279 ) +* Fix buffer length bug on string stream decoder ( #280 ) + +Thank you @orisano !! + +# v0.7.6 - 2021/08/13 + +* Fix nil slice assignment ( #276 ) +* Improve error message ( #277 ) + +# v0.7.5 - 2021/08/12 + +* Fix encoding of embedded struct with tags ( #265 ) +* Fix encoding of embedded struct that isn't first field ( #272 ) +* Fix decoding of binary type with escaped char ( #273 ) + +# v0.7.4 - 2021/07/06 + +* Fix encoding of indirect layout structure ( #264 ) + +# v0.7.3 - 2021/06/29 + +* Fix encoding of pointer type in empty interface ( #262 ) + +# v0.7.2 - 2021/06/26 + +### Fix decoder + +* Add decoder for func type to fix decoding of nil function value ( #257 ) +* Fix stream decoding of []byte type ( #258 ) + +### Performance + +* Improve decoding performance of map[string]interface{} type ( use `mapassign_faststr` ) ( #256 ) +* Improve encoding performance of empty interface type ( remove recursive calling of `vm.Run` ) ( #259 ) + +### Benchmark + +* Add bytedance/sonic as benchmark target ( #254 ) + +# v0.7.1 - 2021/06/18 + +### Fix decoder + +* Fix error when unmarshal empty array ( #253 ) + +# v0.7.0 - 2021/06/12 + +### Support context for MarshalJSON and UnmarshalJSON ( #248 ) + +* json.MarshalContext(context.Context, interface{}, ...json.EncodeOption) ([]byte, error) +* json.NewEncoder(io.Writer).EncodeContext(context.Context, interface{}, ...json.EncodeOption) error +* json.UnmarshalContext(context.Context, []byte, interface{}, ...json.DecodeOption) error +* json.NewDecoder(io.Reader).DecodeContext(context.Context, interface{}) error + +```go +type MarshalerContext interface { + MarshalJSON(context.Context) ([]byte, error) +} + +type UnmarshalerContext interface { + UnmarshalJSON(context.Context, []byte) error +} +``` + +### Add DecodeFieldPriorityFirstWin option ( #242 ) + +In the default behavior, go-json, like encoding/json, will reflect the result of the last evaluation when a field with the same name exists. I've added new options to allow you to change this behavior. `json.DecodeFieldPriorityFirstWin` option reflects the result of the first evaluation if a field with the same name exists. This behavior has a performance advantage as it allows the subsequent strings to be skipped if all fields have been evaluated. + +### Fix encoder + +* Fix indent number contains recursive type ( #249 ) +* Fix encoding of using empty interface as map key ( #244 ) + +### Fix decoder + +* Fix decoding fields containing escaped characters ( #237 ) + +### Refactor + +* Move some tests to subdirectory ( #243 ) +* Refactor package layout for decoder ( #238 ) + +# v0.6.1 - 2021/06/02 + +### Fix encoder + +* Fix value of totalLength for encoding ( #236 ) + +# v0.6.0 - 2021/06/01 + +### Support Colorize option for encoding (#233) + +```go +b, err := json.MarshalWithOption(v, json.Colorize(json.DefaultColorScheme)) +if err != nil { + ... +} +fmt.Println(string(b)) // print colored json +``` + +### Refactor + +* Fix opcode layout - Adjust memory layout of the opcode to 128 bytes in a 64-bit environment ( #230 ) +* Refactor encode option ( #231 ) +* Refactor escape string ( #232 ) + +# v0.5.1 - 2021/5/20 + +### Optimization + +* Add type addrShift to enable bigger encoder/decoder cache ( #213 ) + +### Fix decoder + +* Keep original reference of slice element ( #229 ) + +### Refactor + +* Refactor Debug mode for encoding ( #226 ) +* Generate VM sources for encoding ( #227 ) +* Refactor validator for null/true/false for decoding ( #221 ) + +# v0.5.0 - 2021/5/9 + +### Supports using omitempty and string tags at the same time ( #216 ) + +### Fix decoder + +* Fix stream decoder for unicode char ( #215 ) +* Fix decoding of slice element ( #219 ) +* Fix calculating of buffer length for stream decoder ( #220 ) + +### Refactor + +* replace skipWhiteSpace goto by loop ( #212 ) + +# v0.4.14 - 2021/5/4 + +### Benchmark + +* Add valyala/fastjson to benchmark ( #193 ) +* Add benchmark task for CI ( #211 ) + +### Fix decoder + +* Fix decoding of slice with unmarshal json type ( #198 ) +* Fix decoding of null value for interface type that does not implement Unmarshaler ( #205 ) +* Fix decoding of null value to []byte by json.Unmarshal ( #206 ) +* Fix decoding of backslash char at the end of string ( #207 ) +* Fix stream decoder for null/true/false value ( #208 ) +* Fix stream decoder for slow reader ( #211 ) + +### Performance + +* If cap of slice is enough, reuse slice data for compatibility with encoding/json ( #200 ) + +# v0.4.13 - 2021/4/20 + +### Fix json.Compact and json.Indent + +* Support validation the input buffer for json.Compact and json.Indent ( #189 ) +* Optimize json.Compact and json.Indent ( improve memory footprint ) ( #190 ) + +# v0.4.12 - 2021/4/15 + +### Fix encoder + +* Fix unnecessary indent for empty slice type ( #181 ) +* Fix encoding of omitempty feature for the slice or interface type ( #183 ) +* Fix encoding custom types zero values with omitempty when marshaller exists ( #187 ) + +### Fix decoder + +* Fix decoder for invalid top level value ( #184 ) +* Fix decoder for invalid number value ( #185 ) + +# v0.4.11 - 2021/4/3 + +* Improve decoder performance for interface type + +# v0.4.10 - 2021/4/2 + +### Fix encoder + +* Fixed a bug when encoding slice and map containing recursive structures +* Fixed a logic to determine if indirect reference + +# v0.4.9 - 2021/3/29 + +### Add debug mode + +If you use `json.MarshalWithOption(v, json.Debug())` and `panic` occurred in `go-json`, produces debug information to console. + +### Support a new feature to compatible with encoding/json + +- invalid UTF-8 is coerced to valid UTF-8 ( without performance down ) + +### Fix encoder + +- Fixed handling of MarshalJSON of function type + +### Fix decoding of slice of pointer type + +If there is a pointer value, go-json will use it. (This behavior is necessary to achieve the ability to prioritize pre-filled values). However, since slices are reused internally, there was a bug that referred to the previous pointer value. Therefore, it is not necessary to refer to the pointer value in advance for the slice element, so we explicitly initialize slice element by `nil`. + +# v0.4.8 - 2021/3/21 + +### Reduce memory usage at compile time + +* go-json have used about 2GB of memory at compile time, but now it can compile with about less than 550MB. + +### Fix any encoder's bug + +* Add many test cases for encoder +* Fix composite type ( slice/array/map ) +* Fix pointer types +* Fix encoding of MarshalJSON or MarshalText or json.Number type + +### Refactor encoder + +* Change package layout for reducing memory usage at compile +* Remove anonymous and only operation +* Remove root property from encodeCompileContext and opcode + +### Fix CI + +* Add Go 1.16 +* Remove Go 1.13 +* Fix `make cover` task + +### Number/Delim/Token/RawMessage use the types defined in encoding/json by type alias + +# v0.4.7 - 2021/02/22 + +### Fix decoder + +* Fix decoding of deep recursive structure +* Fix decoding of embedded unexported pointer field +* Fix invalid test case +* Fix decoding of invalid value +* Fix decoding of prefilled value +* Fix not being able to return UnmarshalTypeError when it should be returned +* Fix decoding of null value +* Fix decoding of type of null string +* Use pre allocated pointer if exists it at decoding + +### Reduce memory usage at compile + +* Integrate int/int8/int16/int32/int64 and uint/uint8/uint16/uint32/uint64 operation to reduce memory usage at compile + +### Remove unnecessary optype diff --git a/vendor/github.com/goccy/go-json/LICENSE b/vendor/github.com/goccy/go-json/LICENSE new file mode 100644 index 000000000..6449c8bff --- /dev/null +++ b/vendor/github.com/goccy/go-json/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Masaaki Goshima + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/goccy/go-json/Makefile b/vendor/github.com/goccy/go-json/Makefile new file mode 100644 index 000000000..5bbfc4c9a --- /dev/null +++ b/vendor/github.com/goccy/go-json/Makefile @@ -0,0 +1,39 @@ +PKG := github.com/goccy/go-json + +BIN_DIR := $(CURDIR)/bin +PKGS := $(shell go list ./... | grep -v internal/cmd|grep -v test) +COVER_PKGS := $(foreach pkg,$(PKGS),$(subst $(PKG),.,$(pkg))) + +COMMA := , +EMPTY := +SPACE := $(EMPTY) $(EMPTY) +COVERPKG_OPT := $(subst $(SPACE),$(COMMA),$(COVER_PKGS)) + +$(BIN_DIR): + @mkdir -p $(BIN_DIR) + +.PHONY: cover +cover: + go test -coverpkg=$(COVERPKG_OPT) -coverprofile=cover.out ./... + +.PHONY: cover-html +cover-html: cover + go tool cover -html=cover.out + +.PHONY: lint +lint: golangci-lint + $(BIN_DIR)/golangci-lint run + +golangci-lint: | $(BIN_DIR) + @{ \ + set -e; \ + GOLANGCI_LINT_TMP_DIR=$$(mktemp -d); \ + cd $$GOLANGCI_LINT_TMP_DIR; \ + go mod init tmp; \ + GOBIN=$(BIN_DIR) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.48.0; \ + rm -rf $$GOLANGCI_LINT_TMP_DIR; \ + } + +.PHONY: generate +generate: + go generate ./internal/... diff --git a/vendor/github.com/goccy/go-json/README.md b/vendor/github.com/goccy/go-json/README.md new file mode 100644 index 000000000..7bacc54f9 --- /dev/null +++ b/vendor/github.com/goccy/go-json/README.md @@ -0,0 +1,529 @@ +# go-json + +![Go](https://github.com/goccy/go-json/workflows/Go/badge.svg) +[![GoDoc](https://godoc.org/github.com/goccy/go-json?status.svg)](https://pkg.go.dev/github.com/goccy/go-json?tab=doc) +[![codecov](https://codecov.io/gh/goccy/go-json/branch/master/graph/badge.svg)](https://codecov.io/gh/goccy/go-json) + +Fast JSON encoder/decoder compatible with encoding/json for Go + + + +# Roadmap + +``` +* version ( expected release date ) + +* v0.9.0 + | + | while maintaining compatibility with encoding/json, we will add convenient APIs + | + v +* v1.0.0 +``` + +We are accepting requests for features that will be implemented between v0.9.0 and v.1.0.0. +If you have the API you need, please submit your issue [here](https://github.com/goccy/go-json/issues). + +# Features + +- Drop-in replacement of `encoding/json` +- Fast ( See [Benchmark section](https://github.com/goccy/go-json#benchmarks) ) +- Flexible customization with options +- Coloring the encoded string +- Can propagate context.Context to `MarshalJSON` or `UnmarshalJSON` +- Can dynamically filter the fields of the structure type-safely + +# Installation + +``` +go get github.com/goccy/go-json +``` + +# How to use + +Replace import statement from `encoding/json` to `github.com/goccy/go-json` + +``` +-import "encoding/json" ++import "github.com/goccy/go-json" +``` + +# JSON library comparison + +| name | encoder | decoder | compatible with `encoding/json` | +| :----: | :------: | :-----: | :-----------------------------: | +| encoding/json | yes | yes | N/A | +| [json-iterator/go](https://github.com/json-iterator/go) | yes | yes | partial | +| [easyjson](https://github.com/mailru/easyjson) | yes | yes | no | +| [gojay](https://github.com/francoispqt/gojay) | yes | yes | no | +| [segmentio/encoding/json](https://github.com/segmentio/encoding/tree/master/json) | yes | yes | partial | +| [jettison](https://github.com/wI2L/jettison) | yes | no | no | +| [simdjson-go](https://github.com/minio/simdjson-go) | no | yes | no | +| goccy/go-json | yes | yes | yes | + +- `json-iterator/go` isn't compatible with `encoding/json` in many ways (e.g. https://github.com/json-iterator/go/issues/229 ), but it hasn't been supported for a long time. +- `segmentio/encoding/json` is well supported for encoders, but some are not supported for decoder APIs such as `Token` ( streaming decode ) + +## Other libraries + +- [jingo](https://github.com/bet365/jingo) + +I tried the benchmark but it didn't work. +Also, it seems to panic when it receives an unexpected value because there is no error handling... + +- [ffjson](https://github.com/pquerna/ffjson) + +Benchmarking gave very slow results. +It seems that it is assumed that the user will use the buffer pool properly. +Also, development seems to have already stopped + +# Benchmarks + +``` +$ cd benchmarks +$ go test -bench . +``` + +## Encode + + + + +## Decode + + + + + + +# Fuzzing + +[go-json-fuzz](https://github.com/goccy/go-json-fuzz) is the repository for fuzzing tests. +If you run the test in this repository and find a bug, please commit to corpus to go-json-fuzz and report the issue to [go-json](https://github.com/goccy/go-json/issues). + +# How it works + +`go-json` is very fast in both encoding and decoding compared to other libraries. +It's easier to implement by using automatic code generation for performance or by using a dedicated interface, but `go-json` dares to stick to compatibility with `encoding/json` and is the simple interface. Despite this, we are developing with the aim of being the fastest library. + +Here, we explain the various speed-up techniques implemented by `go-json`. + +## Basic technique + +The techniques listed here are the ones used by most of the libraries listed above. + +### Buffer reuse + +Since the only value required for the result of `json.Marshal(interface{}) ([]byte, error)` is `[]byte`, the only value that must be allocated during encoding is the return value `[]byte` . + +Also, as the number of allocations increases, the performance will be affected, so the number of allocations should be kept as low as possible when creating `[]byte`. + +Therefore, there is a technique to reduce the number of times a new buffer must be allocated by reusing the buffer used for the previous encoding by using `sync.Pool`. + +Finally, you allocate a buffer that is as long as the resulting buffer and copy the contents into it, you only need to allocate the buffer once in theory. + +```go +type buffer struct { + data []byte +} + +var bufPool = sync.Pool{ + New: func() interface{} { + return &buffer{data: make([]byte, 0, 1024)} + }, +} + +buf := bufPool.Get().(*buffer) +data := encode(buf.data) // reuse buf.data + +newBuf := make([]byte, len(data)) +copy(newBuf, buf) + +buf.data = data +bufPool.Put(buf) +``` + +### Elimination of reflection + +As you know, the reflection operation is very slow. + +Therefore, using the fact that the address position where the type information is stored is fixed for each binary ( we call this `typeptr` ), +we can use the address in the type information to call a pre-built optimized process. + +For example, you can get the address to the type information from `interface{}` as follows and you can use that information to call a process that does not have reflection. + +To process without reflection, pass a pointer (`unsafe.Pointer`) to the value is stored. + +```go + +type emptyInterface struct { + typ unsafe.Pointer + ptr unsafe.Pointer +} + +var typeToEncoder = map[uintptr]func(unsafe.Pointer)([]byte, error){} + +func Marshal(v interface{}) ([]byte, error) { + iface := (*emptyInterface)(unsafe.Pointer(&v) + typeptr := uintptr(iface.typ) + if enc, exists := typeToEncoder[typeptr]; exists { + return enc(iface.ptr) + } + ... +} +``` + +※ In reality, `typeToEncoder` can be referenced by multiple goroutines, so exclusive control is required. + +## Unique speed-up technique + +## Encoder + +### Do not escape arguments of `Marshal` + +`json.Marshal` and `json.Unmarshal` receive `interface{}` value and they perform type determination dynamically to process. +In normal case, you need to use the `reflect` library to determine the type dynamically, but since `reflect.Type` is defined as `interface`, when you call the method of `reflect.Type`, The reflect's argument is escaped. + +Therefore, the arguments for `Marshal` and `Unmarshal` are always escaped to the heap. +However, `go-json` can use the feature of `reflect.Type` while avoiding escaping. + +`reflect.Type` is defined as `interface`, but in reality `reflect.Type` is implemented only by the structure `rtype` defined in the `reflect` package. +For this reason, to date `reflect.Type` is the same as `*reflect.rtype`. + +Therefore, by directly handling `*reflect.rtype`, which is an implementation of `reflect.Type`, it is possible to avoid escaping because it changes from `interface` to using `struct`. + +The technique for working with `*reflect.rtype` directly from `go-json` is implemented at [rtype.go](https://github.com/goccy/go-json/blob/master/internal/runtime/rtype.go) + +Also, the same technique is cut out as a library ( https://github.com/goccy/go-reflect ) + +Initially this feature was the default behavior of `go-json`. +But after careful testing, I found that I passed a large value to `json.Marshal()` and if the argument could not be assigned to the stack, it could not be properly escaped to the heap (a bug in the Go compiler). + +Therefore, this feature will be provided as an **optional** until this issue is resolved. + +To use it, add `NoEscape` like `MarshalNoEscape()` + +### Encoding using opcode sequence + +I explained that you can use `typeptr` to call a pre-built process from type information. + +In other libraries, this dedicated process is processed by making it an function calling like anonymous function, but function calls are inherently slow processes and should be avoided as much as possible. + +Therefore, `go-json` adopted the Instruction-based execution processing system, which is also used to implement virtual machines for programming language. + +If it is the first type to encode, create the opcode ( instruction ) sequence required for encoding. +From the second time onward, use `typeptr` to get the cached pre-built opcode sequence and encode it based on it. An example of the opcode sequence is shown below. + +```go +json.Marshal(struct{ + X int `json:"x"` + Y string `json:"y"` +}{X: 1, Y: "hello"}) +``` + +When encoding a structure like the one above, create a sequence of opcodes like this: + +``` +- opStructFieldHead ( `{` ) +- opStructFieldInt ( `"x": 1,` ) +- opStructFieldString ( `"y": "hello"` ) +- opStructEnd ( `}` ) +- opEnd +``` + +※ When processing each operation, write the letters on the right. + +In addition, each opcode is managed by the following structure ( +Pseudo code ). + +```go +type opType int +const ( + opStructFieldHead opType = iota + opStructFieldInt + opStructFieldStirng + opStructEnd + opEnd +) +type opcode struct { + op opType + key []byte + next *opcode +} +``` + +The process of encoding using the opcode sequence is roughly implemented as follows. + +```go +func encode(code *opcode, b []byte, p unsafe.Pointer) ([]byte, error) { + for { + switch code.op { + case opStructFieldHead: + b = append(b, '{') + code = code.next + case opStructFieldInt: + b = append(b, code.key...) + b = appendInt((*int)(unsafe.Pointer(uintptr(p)+code.offset))) + code = code.next + case opStructFieldString: + b = append(b, code.key...) + b = appendString((*string)(unsafe.Pointer(uintptr(p)+code.offset))) + code = code.next + case opStructEnd: + b = append(b, '}') + code = code.next + case opEnd: + goto END + } + } +END: + return b, nil +} +``` + +In this way, the huge `switch-case` is used to encode by manipulating the linked list opcodes to avoid unnecessary function calls. + +### Opcode sequence optimization + +One of the advantages of encoding using the opcode sequence is the ease of optimization. +The opcode sequence mentioned above is actually converted into the following optimized operations and used. + +``` +- opStructFieldHeadInt ( `{"x": 1,` ) +- opStructEndString ( `"y": "hello"}` ) +- opEnd +``` + +It has been reduced from 5 opcodes to 3 opcodes ! +Reducing the number of opcodees means reducing the number of branches with `switch-case`. +In other words, the closer the number of operations is to 1, the faster the processing can be performed. + +In `go-json`, optimization to reduce the number of opcodes itself like the above and it speeds up by preparing opcodes with optimized paths. + +### Change recursive call from CALL to JMP + +Recursive processing is required during encoding if the type is defined recursively as follows: + +```go +type T struct { + X int + U *U +} + +type U struct { + T *T +} + +b, err := json.Marshal(&T{ + X: 1, + U: &U{ + T: &T{ + X: 2, + }, + }, +}) +fmt.Println(string(b)) // {"X":1,"U":{"T":{"X":2,"U":null}}} +``` + +In `go-json`, recursive processing is processed by the operation type of ` opStructFieldRecursive`. + +In this operation, after acquiring the opcode sequence used for recursive processing, the function is **not** called recursively as it is, but the necessary values ​​are saved by itself and implemented by moving to the next operation. + +The technique of implementing recursive processing with the `JMP` operation while avoiding the `CALL` operation is a famous technique for implementing a high-speed virtual machine. + +For more details, please refer to [the article](https://engineering.mercari.com/blog/entry/1599563768-081104c850) ( but Japanese only ). + +### Dispatch by typeptr from map to slice + +When retrieving the data cached from the type information by `typeptr`, we usually use map. +Map requires exclusive control, so use `sync.Map` for a naive implementation. + +However, this is slow, so it's a good idea to use the `atomic` package for exclusive control as implemented by `segmentio/encoding/json` ( https://github.com/segmentio/encoding/blob/master/json/codec.go#L41-L55 ). + +This implementation slows down the set instead of speeding up the get, but it works well because of the nature of the library, it encodes much more for the same type. + +However, as a result of profiling, I noticed that `runtime.mapaccess2` accounts for a significant percentage of the execution time. So I thought if I could change the lookup from map to slice. + +There is an API named `typelinks` defined in the `runtime` package that the `reflect` package uses internally. +This allows you to get all the type information defined in the binary at runtime. + +The fact that all type information can be acquired means that by constructing slices in advance with the acquired total number of type information, it is possible to look up with the value of `typeptr` without worrying about out-of-range access. + +However, if there is too much type information, it will use a lot of memory, so by default we will only use this optimization if the slice size fits within **2Mib** . + +If this approach is not available, it will fall back to the `atomic` based process described above. + +If you want to know more, please refer to the implementation [here](https://github.com/goccy/go-json/blob/master/internal/runtime/type.go#L36-L100) + +## Decoder + +### Dispatch by typeptr from map to slice + +Like the encoder, the decoder also uses typeptr to call the dedicated process. + +### Faster termination character inspection using NUL character + +In order to decode, you have to traverse the input buffer character by position. +At that time, if you check whether the buffer has reached the end, it will be very slow. + +`buf` : `[]byte` type variable. holds the string passed to the decoder +`cursor` : `int64` type variable. holds the current read position + +```go +buflen := len(buf) +for ; cursor < buflen; cursor++ { // compare cursor and buflen at all times, it is so slow. + switch buf[cursor] { + case ' ', '\n', '\r', '\t': + } +} +``` + +Therefore, by adding the `NUL` (`\000`) character to the end of the read buffer as shown below, it is possible to check the termination character at the same time as other characters. + +```go +for { + switch buf[cursor] { + case ' ', '\n', '\r', '\t': + case '\000': + return nil + } + cursor++ +} +``` + +### Use Boundary Check Elimination + +Due to the `NUL` character optimization, the Go compiler does a boundary check every time, even though `buf[cursor]` does not cause out-of-range access. + +Therefore, `go-json` eliminates boundary check by fetching characters for hotspot by pointer operation. For example, the following code. + +```go +func char(ptr unsafe.Pointer, offset int64) byte { + return *(*byte)(unsafe.Pointer(uintptr(ptr) + uintptr(offset))) +} + +p := (*sliceHeader)(&unsafe.Pointer(buf)).data +for { + switch char(p, cursor) { + case ' ', '\n', '\r', '\t': + case '\000': + return nil + } + cursor++ +} +``` + +### Checking the existence of fields of struct using Bitmaps + +I found by the profiling result, in the struct decode, lookup process for field was taking a long time. + +For example, consider decoding a string like `{"a":1,"b":2,"c":3}` into the following structure: + +```go +type T struct { + A int `json:"a"` + B int `json:"b"` + C int `json:"c"` +} +``` + +At this time, it was found that it takes a lot of time to acquire the decoding process corresponding to the field from the field name as shown below during the decoding process. + +```go +fieldName := decodeKey(buf, cursor) // "a" or "b" or "c" +decoder, exists := fieldToDecoderMap[fieldName] // so slow +if exists { + decoder(buf, cursor) +} else { + skipValue(buf, cursor) +} +``` + +To improve this process, `json-iterator/go` is optimized so that it can be branched by switch-case when the number of fields in the structure is 10 or less (switch-case is faster than map). However, there is a risk of hash collision because the value hashed by the FNV algorithm is used for conditional branching. Also, `gojay` processes this part at high speed by letting the library user yourself write `switch-case`. + + +`go-json` considers and implements a new approach that is different from these. I call this **bitmap field optimization**. + +The range of values ​​per character can be represented by `[256]byte`. Also, if the number of fields in the structure is 8 or less, `int8` type can represent the state of each field. +In other words, it has the following structure. + +- Base ( 8bit ): `00000000` +- Key "a": `00000001` ( assign key "a" to the first bit ) +- Key "b": `00000010` ( assign key "b" to the second bit ) +- Key "c": `00000100` ( assign key "c" to the third bit ) + +Bitmap structure is the following + +``` + | key index(0) | +------------------------ + 0 | 00000000 | + 1 | 00000000 | +~~ | | +97 (a) | 00000001 | +98 (b) | 00000010 | +99 (c) | 00000100 | +~~ | | +255 | 00000000 | +``` + +You can think of this as a Bitmap with a height of `256` and a width of the maximum string length in the field name. +In other words, it can be represented by the following type . + +```go +[maxFieldKeyLength][256]int8 +``` + +When decoding a field character, check whether the corresponding character exists by referring to the pre-built bitmap like the following. + +```go +var curBit int8 = math.MaxInt8 // 11111111 + +c := char(buf, cursor) +bit := bitmap[keyIdx][c] +curBit &= bit +if curBit == 0 { + // not found field +} +``` + +If `curBit` is not `0` until the end of the field string, then the string is +You may have hit one of the fields. +But the possibility is that if the decoded string is shorter than the field string, you will get a false hit. + +- input: `{"a":1}` +```go +type T struct { + X int `json:"abc"` +} +``` +※ Since `a` is shorter than `abc`, it can decode to the end of the field character without `curBit` being 0. + +Rest assured. In this case, it doesn't matter because you can tell if you hit by comparing the string length of `a` with the string length of `abc`. + +Finally, calculate the position of the bit where `1` is set and get the corresponding value, and you're done. + +Using this technique, field lookups are possible with only bitwise operations and access to slices. + +`go-json` uses a similar technique for fields with 9 or more and 16 or less fields. At this time, Bitmap is constructed as `[maxKeyLen][256]int16` type. + +Currently, this optimization is not performed when the maximum length of the field name is long (specifically, 64 bytes or more) in addition to the limitation of the number of fields from the viewpoint of saving memory usage. + +### Others + +I have done a lot of other optimizations. I will find time to write about them. If you have any questions about what's written here or other optimizations, please visit the `#go-json` channel on `gophers.slack.com` . + +## Reference + +Regarding the story of go-json, there are the following articles in Japanese only. + +- https://speakerdeck.com/goccy/zui-su-falsejsonraiburariwoqiu-mete +- https://engineering.mercari.com/blog/entry/1599563768-081104c850/ + +# Looking for Sponsors + +I'm looking for sponsors this library. This library is being developed as a personal project in my spare time. If you want a quick response or problem resolution when using this library in your project, please register as a [sponsor](https://github.com/sponsors/goccy). I will cooperate as much as possible. Of course, this library is developed as an MIT license, so you can use it freely for free. + +# License + +MIT diff --git a/vendor/github.com/goccy/go-json/color.go b/vendor/github.com/goccy/go-json/color.go new file mode 100644 index 000000000..e80b22b48 --- /dev/null +++ b/vendor/github.com/goccy/go-json/color.go @@ -0,0 +1,68 @@ +package json + +import ( + "fmt" + + "github.com/goccy/go-json/internal/encoder" +) + +type ( + ColorFormat = encoder.ColorFormat + ColorScheme = encoder.ColorScheme +) + +const escape = "\x1b" + +type colorAttr int + +//nolint:deadcode,varcheck +const ( + fgBlackColor colorAttr = iota + 30 + fgRedColor + fgGreenColor + fgYellowColor + fgBlueColor + fgMagentaColor + fgCyanColor + fgWhiteColor +) + +//nolint:deadcode,varcheck +const ( + fgHiBlackColor colorAttr = iota + 90 + fgHiRedColor + fgHiGreenColor + fgHiYellowColor + fgHiBlueColor + fgHiMagentaColor + fgHiCyanColor + fgHiWhiteColor +) + +func createColorFormat(attr colorAttr) ColorFormat { + return ColorFormat{ + Header: wrapColor(attr), + Footer: resetColor(), + } +} + +func wrapColor(attr colorAttr) string { + return fmt.Sprintf("%s[%dm", escape, attr) +} + +func resetColor() string { + return wrapColor(colorAttr(0)) +} + +var ( + DefaultColorScheme = &ColorScheme{ + Int: createColorFormat(fgHiMagentaColor), + Uint: createColorFormat(fgHiMagentaColor), + Float: createColorFormat(fgHiMagentaColor), + Bool: createColorFormat(fgHiYellowColor), + String: createColorFormat(fgHiGreenColor), + Binary: createColorFormat(fgHiRedColor), + ObjectKey: createColorFormat(fgHiCyanColor), + Null: createColorFormat(fgBlueColor), + } +) diff --git a/vendor/github.com/goccy/go-json/decode.go b/vendor/github.com/goccy/go-json/decode.go new file mode 100644 index 000000000..74c6ac3bc --- /dev/null +++ b/vendor/github.com/goccy/go-json/decode.go @@ -0,0 +1,263 @@ +package json + +import ( + "context" + "fmt" + "io" + "reflect" + "unsafe" + + "github.com/goccy/go-json/internal/decoder" + "github.com/goccy/go-json/internal/errors" + "github.com/goccy/go-json/internal/runtime" +) + +type Decoder struct { + s *decoder.Stream +} + +const ( + nul = '\000' +) + +type emptyInterface struct { + typ *runtime.Type + ptr unsafe.Pointer +} + +func unmarshal(data []byte, v interface{}, optFuncs ...DecodeOptionFunc) error { + src := make([]byte, len(data)+1) // append nul byte to the end + copy(src, data) + + header := (*emptyInterface)(unsafe.Pointer(&v)) + + if err := validateType(header.typ, uintptr(header.ptr)); err != nil { + return err + } + dec, err := decoder.CompileToGetDecoder(header.typ) + if err != nil { + return err + } + ctx := decoder.TakeRuntimeContext() + ctx.Buf = src + ctx.Option.Flags = 0 + for _, optFunc := range optFuncs { + optFunc(ctx.Option) + } + cursor, err := dec.Decode(ctx, 0, 0, header.ptr) + if err != nil { + decoder.ReleaseRuntimeContext(ctx) + return err + } + decoder.ReleaseRuntimeContext(ctx) + return validateEndBuf(src, cursor) +} + +func unmarshalContext(ctx context.Context, data []byte, v interface{}, optFuncs ...DecodeOptionFunc) error { + src := make([]byte, len(data)+1) // append nul byte to the end + copy(src, data) + + header := (*emptyInterface)(unsafe.Pointer(&v)) + + if err := validateType(header.typ, uintptr(header.ptr)); err != nil { + return err + } + dec, err := decoder.CompileToGetDecoder(header.typ) + if err != nil { + return err + } + rctx := decoder.TakeRuntimeContext() + rctx.Buf = src + rctx.Option.Flags = 0 + rctx.Option.Flags |= decoder.ContextOption + rctx.Option.Context = ctx + for _, optFunc := range optFuncs { + optFunc(rctx.Option) + } + cursor, err := dec.Decode(rctx, 0, 0, header.ptr) + if err != nil { + decoder.ReleaseRuntimeContext(rctx) + return err + } + decoder.ReleaseRuntimeContext(rctx) + return validateEndBuf(src, cursor) +} + +var ( + pathDecoder = decoder.NewPathDecoder() +) + +func extractFromPath(path *Path, data []byte, optFuncs ...DecodeOptionFunc) ([][]byte, error) { + if path.path.RootSelectorOnly { + return [][]byte{data}, nil + } + src := make([]byte, len(data)+1) // append nul byte to the end + copy(src, data) + + ctx := decoder.TakeRuntimeContext() + ctx.Buf = src + ctx.Option.Flags = 0 + ctx.Option.Flags |= decoder.PathOption + ctx.Option.Path = path.path + for _, optFunc := range optFuncs { + optFunc(ctx.Option) + } + paths, cursor, err := pathDecoder.DecodePath(ctx, 0, 0) + if err != nil { + decoder.ReleaseRuntimeContext(ctx) + return nil, err + } + decoder.ReleaseRuntimeContext(ctx) + if err := validateEndBuf(src, cursor); err != nil { + return nil, err + } + return paths, nil +} + +func unmarshalNoEscape(data []byte, v interface{}, optFuncs ...DecodeOptionFunc) error { + src := make([]byte, len(data)+1) // append nul byte to the end + copy(src, data) + + header := (*emptyInterface)(unsafe.Pointer(&v)) + + if err := validateType(header.typ, uintptr(header.ptr)); err != nil { + return err + } + dec, err := decoder.CompileToGetDecoder(header.typ) + if err != nil { + return err + } + + ctx := decoder.TakeRuntimeContext() + ctx.Buf = src + ctx.Option.Flags = 0 + for _, optFunc := range optFuncs { + optFunc(ctx.Option) + } + cursor, err := dec.Decode(ctx, 0, 0, noescape(header.ptr)) + if err != nil { + decoder.ReleaseRuntimeContext(ctx) + return err + } + decoder.ReleaseRuntimeContext(ctx) + return validateEndBuf(src, cursor) +} + +func validateEndBuf(src []byte, cursor int64) error { + for { + switch src[cursor] { + case ' ', '\t', '\n', '\r': + cursor++ + continue + case nul: + return nil + } + return errors.ErrSyntax( + fmt.Sprintf("invalid character '%c' after top-level value", src[cursor]), + cursor+1, + ) + } +} + +//nolint:staticcheck +//go:nosplit +func noescape(p unsafe.Pointer) unsafe.Pointer { + x := uintptr(p) + return unsafe.Pointer(x ^ 0) +} + +func validateType(typ *runtime.Type, p uintptr) error { + if typ == nil || typ.Kind() != reflect.Ptr || p == 0 { + return &InvalidUnmarshalError{Type: runtime.RType2Type(typ)} + } + return nil +} + +// NewDecoder returns a new decoder that reads from r. +// +// The decoder introduces its own buffering and may +// read data from r beyond the JSON values requested. +func NewDecoder(r io.Reader) *Decoder { + s := decoder.NewStream(r) + return &Decoder{ + s: s, + } +} + +// Buffered returns a reader of the data remaining in the Decoder's +// buffer. The reader is valid until the next call to Decode. +func (d *Decoder) Buffered() io.Reader { + return d.s.Buffered() +} + +// Decode reads the next JSON-encoded value from its +// input and stores it in the value pointed to by v. +// +// See the documentation for Unmarshal for details about +// the conversion of JSON into a Go value. +func (d *Decoder) Decode(v interface{}) error { + return d.DecodeWithOption(v) +} + +// DecodeContext reads the next JSON-encoded value from its +// input and stores it in the value pointed to by v with context.Context. +func (d *Decoder) DecodeContext(ctx context.Context, v interface{}) error { + d.s.Option.Flags |= decoder.ContextOption + d.s.Option.Context = ctx + return d.DecodeWithOption(v) +} + +func (d *Decoder) DecodeWithOption(v interface{}, optFuncs ...DecodeOptionFunc) error { + header := (*emptyInterface)(unsafe.Pointer(&v)) + typ := header.typ + ptr := uintptr(header.ptr) + typeptr := uintptr(unsafe.Pointer(typ)) + // noescape trick for header.typ ( reflect.*rtype ) + copiedType := *(**runtime.Type)(unsafe.Pointer(&typeptr)) + + if err := validateType(copiedType, ptr); err != nil { + return err + } + + dec, err := decoder.CompileToGetDecoder(typ) + if err != nil { + return err + } + if err := d.s.PrepareForDecode(); err != nil { + return err + } + s := d.s + for _, optFunc := range optFuncs { + optFunc(s.Option) + } + if err := dec.DecodeStream(s, 0, header.ptr); err != nil { + return err + } + s.Reset() + return nil +} + +func (d *Decoder) More() bool { + return d.s.More() +} + +func (d *Decoder) Token() (Token, error) { + return d.s.Token() +} + +// DisallowUnknownFields causes the Decoder to return an error when the destination +// is a struct and the input contains object keys which do not match any +// non-ignored, exported fields in the destination. +func (d *Decoder) DisallowUnknownFields() { + d.s.DisallowUnknownFields = true +} + +func (d *Decoder) InputOffset() int64 { + return d.s.TotalOffset() +} + +// UseNumber causes the Decoder to unmarshal a number into an interface{} as a +// Number instead of as a float64. +func (d *Decoder) UseNumber() { + d.s.UseNumber = true +} diff --git a/vendor/github.com/goccy/go-json/docker-compose.yml b/vendor/github.com/goccy/go-json/docker-compose.yml new file mode 100644 index 000000000..db40c79ad --- /dev/null +++ b/vendor/github.com/goccy/go-json/docker-compose.yml @@ -0,0 +1,13 @@ +version: '2' +services: + go-json: + image: golang:1.18 + volumes: + - '.:/go/src/go-json' + deploy: + resources: + limits: + memory: 620M + working_dir: /go/src/go-json + command: | + sh -c "go test -c . && ls go-json.test" diff --git a/vendor/github.com/goccy/go-json/encode.go b/vendor/github.com/goccy/go-json/encode.go new file mode 100644 index 000000000..4bd899f38 --- /dev/null +++ b/vendor/github.com/goccy/go-json/encode.go @@ -0,0 +1,326 @@ +package json + +import ( + "context" + "io" + "os" + "unsafe" + + "github.com/goccy/go-json/internal/encoder" + "github.com/goccy/go-json/internal/encoder/vm" + "github.com/goccy/go-json/internal/encoder/vm_color" + "github.com/goccy/go-json/internal/encoder/vm_color_indent" + "github.com/goccy/go-json/internal/encoder/vm_indent" +) + +// An Encoder writes JSON values to an output stream. +type Encoder struct { + w io.Writer + enabledIndent bool + enabledHTMLEscape bool + prefix string + indentStr string +} + +// NewEncoder returns a new encoder that writes to w. +func NewEncoder(w io.Writer) *Encoder { + return &Encoder{w: w, enabledHTMLEscape: true} +} + +// Encode writes the JSON encoding of v to the stream, followed by a newline character. +// +// See the documentation for Marshal for details about the conversion of Go values to JSON. +func (e *Encoder) Encode(v interface{}) error { + return e.EncodeWithOption(v) +} + +// EncodeWithOption call Encode with EncodeOption. +func (e *Encoder) EncodeWithOption(v interface{}, optFuncs ...EncodeOptionFunc) error { + ctx := encoder.TakeRuntimeContext() + ctx.Option.Flag = 0 + + err := e.encodeWithOption(ctx, v, optFuncs...) + + encoder.ReleaseRuntimeContext(ctx) + return err +} + +// EncodeContext call Encode with context.Context and EncodeOption. +func (e *Encoder) EncodeContext(ctx context.Context, v interface{}, optFuncs ...EncodeOptionFunc) error { + rctx := encoder.TakeRuntimeContext() + rctx.Option.Flag = 0 + rctx.Option.Flag |= encoder.ContextOption + rctx.Option.Context = ctx + + err := e.encodeWithOption(rctx, v, optFuncs...) + + encoder.ReleaseRuntimeContext(rctx) + return err +} + +func (e *Encoder) encodeWithOption(ctx *encoder.RuntimeContext, v interface{}, optFuncs ...EncodeOptionFunc) error { + if e.enabledHTMLEscape { + ctx.Option.Flag |= encoder.HTMLEscapeOption + } + ctx.Option.Flag |= encoder.NormalizeUTF8Option + ctx.Option.DebugOut = os.Stdout + for _, optFunc := range optFuncs { + optFunc(ctx.Option) + } + var ( + buf []byte + err error + ) + if e.enabledIndent { + buf, err = encodeIndent(ctx, v, e.prefix, e.indentStr) + } else { + buf, err = encode(ctx, v) + } + if err != nil { + return err + } + if e.enabledIndent { + buf = buf[:len(buf)-2] + } else { + buf = buf[:len(buf)-1] + } + buf = append(buf, '\n') + if _, err := e.w.Write(buf); err != nil { + return err + } + return nil +} + +// SetEscapeHTML specifies whether problematic HTML characters should be escaped inside JSON quoted strings. +// The default behavior is to escape &, <, and > to \u0026, \u003c, and \u003e to avoid certain safety problems that can arise when embedding JSON in HTML. +// +// In non-HTML settings where the escaping interferes with the readability of the output, SetEscapeHTML(false) disables this behavior. +func (e *Encoder) SetEscapeHTML(on bool) { + e.enabledHTMLEscape = on +} + +// SetIndent instructs the encoder to format each subsequent encoded value as if indented by the package-level function Indent(dst, src, prefix, indent). +// Calling SetIndent("", "") disables indentation. +func (e *Encoder) SetIndent(prefix, indent string) { + if prefix == "" && indent == "" { + e.enabledIndent = false + return + } + e.prefix = prefix + e.indentStr = indent + e.enabledIndent = true +} + +func marshalContext(ctx context.Context, v interface{}, optFuncs ...EncodeOptionFunc) ([]byte, error) { + rctx := encoder.TakeRuntimeContext() + rctx.Option.Flag = 0 + rctx.Option.Flag = encoder.HTMLEscapeOption | encoder.NormalizeUTF8Option | encoder.ContextOption + rctx.Option.Context = ctx + for _, optFunc := range optFuncs { + optFunc(rctx.Option) + } + + buf, err := encode(rctx, v) + if err != nil { + encoder.ReleaseRuntimeContext(rctx) + return nil, err + } + + // this line exists to escape call of `runtime.makeslicecopy` . + // if use `make([]byte, len(buf)-1)` and `copy(copied, buf)`, + // dst buffer size and src buffer size are differrent. + // in this case, compiler uses `runtime.makeslicecopy`, but it is slow. + buf = buf[:len(buf)-1] + copied := make([]byte, len(buf)) + copy(copied, buf) + + encoder.ReleaseRuntimeContext(rctx) + return copied, nil +} + +func marshal(v interface{}, optFuncs ...EncodeOptionFunc) ([]byte, error) { + ctx := encoder.TakeRuntimeContext() + + ctx.Option.Flag = 0 + ctx.Option.Flag |= (encoder.HTMLEscapeOption | encoder.NormalizeUTF8Option) + for _, optFunc := range optFuncs { + optFunc(ctx.Option) + } + + buf, err := encode(ctx, v) + if err != nil { + encoder.ReleaseRuntimeContext(ctx) + return nil, err + } + + // this line exists to escape call of `runtime.makeslicecopy` . + // if use `make([]byte, len(buf)-1)` and `copy(copied, buf)`, + // dst buffer size and src buffer size are differrent. + // in this case, compiler uses `runtime.makeslicecopy`, but it is slow. + buf = buf[:len(buf)-1] + copied := make([]byte, len(buf)) + copy(copied, buf) + + encoder.ReleaseRuntimeContext(ctx) + return copied, nil +} + +func marshalNoEscape(v interface{}) ([]byte, error) { + ctx := encoder.TakeRuntimeContext() + + ctx.Option.Flag = 0 + ctx.Option.Flag |= (encoder.HTMLEscapeOption | encoder.NormalizeUTF8Option) + + buf, err := encodeNoEscape(ctx, v) + if err != nil { + encoder.ReleaseRuntimeContext(ctx) + return nil, err + } + + // this line exists to escape call of `runtime.makeslicecopy` . + // if use `make([]byte, len(buf)-1)` and `copy(copied, buf)`, + // dst buffer size and src buffer size are differrent. + // in this case, compiler uses `runtime.makeslicecopy`, but it is slow. + buf = buf[:len(buf)-1] + copied := make([]byte, len(buf)) + copy(copied, buf) + + encoder.ReleaseRuntimeContext(ctx) + return copied, nil +} + +func marshalIndent(v interface{}, prefix, indent string, optFuncs ...EncodeOptionFunc) ([]byte, error) { + ctx := encoder.TakeRuntimeContext() + + ctx.Option.Flag = 0 + ctx.Option.Flag |= (encoder.HTMLEscapeOption | encoder.NormalizeUTF8Option | encoder.IndentOption) + for _, optFunc := range optFuncs { + optFunc(ctx.Option) + } + + buf, err := encodeIndent(ctx, v, prefix, indent) + if err != nil { + encoder.ReleaseRuntimeContext(ctx) + return nil, err + } + + buf = buf[:len(buf)-2] + copied := make([]byte, len(buf)) + copy(copied, buf) + + encoder.ReleaseRuntimeContext(ctx) + return copied, nil +} + +func encode(ctx *encoder.RuntimeContext, v interface{}) ([]byte, error) { + b := ctx.Buf[:0] + if v == nil { + b = encoder.AppendNull(ctx, b) + b = encoder.AppendComma(ctx, b) + return b, nil + } + header := (*emptyInterface)(unsafe.Pointer(&v)) + typ := header.typ + + typeptr := uintptr(unsafe.Pointer(typ)) + codeSet, err := encoder.CompileToGetCodeSet(ctx, typeptr) + if err != nil { + return nil, err + } + + p := uintptr(header.ptr) + ctx.Init(p, codeSet.CodeLength) + ctx.KeepRefs = append(ctx.KeepRefs, header.ptr) + + buf, err := encodeRunCode(ctx, b, codeSet) + if err != nil { + return nil, err + } + ctx.Buf = buf + return buf, nil +} + +func encodeNoEscape(ctx *encoder.RuntimeContext, v interface{}) ([]byte, error) { + b := ctx.Buf[:0] + if v == nil { + b = encoder.AppendNull(ctx, b) + b = encoder.AppendComma(ctx, b) + return b, nil + } + header := (*emptyInterface)(unsafe.Pointer(&v)) + typ := header.typ + + typeptr := uintptr(unsafe.Pointer(typ)) + codeSet, err := encoder.CompileToGetCodeSet(ctx, typeptr) + if err != nil { + return nil, err + } + + p := uintptr(header.ptr) + ctx.Init(p, codeSet.CodeLength) + buf, err := encodeRunCode(ctx, b, codeSet) + if err != nil { + return nil, err + } + + ctx.Buf = buf + return buf, nil +} + +func encodeIndent(ctx *encoder.RuntimeContext, v interface{}, prefix, indent string) ([]byte, error) { + b := ctx.Buf[:0] + if v == nil { + b = encoder.AppendNull(ctx, b) + b = encoder.AppendCommaIndent(ctx, b) + return b, nil + } + header := (*emptyInterface)(unsafe.Pointer(&v)) + typ := header.typ + + typeptr := uintptr(unsafe.Pointer(typ)) + codeSet, err := encoder.CompileToGetCodeSet(ctx, typeptr) + if err != nil { + return nil, err + } + + p := uintptr(header.ptr) + ctx.Init(p, codeSet.CodeLength) + buf, err := encodeRunIndentCode(ctx, b, codeSet, prefix, indent) + + ctx.KeepRefs = append(ctx.KeepRefs, header.ptr) + + if err != nil { + return nil, err + } + + ctx.Buf = buf + return buf, nil +} + +func encodeRunCode(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) { + if (ctx.Option.Flag & encoder.DebugOption) != 0 { + if (ctx.Option.Flag & encoder.ColorizeOption) != 0 { + return vm_color.DebugRun(ctx, b, codeSet) + } + return vm.DebugRun(ctx, b, codeSet) + } + if (ctx.Option.Flag & encoder.ColorizeOption) != 0 { + return vm_color.Run(ctx, b, codeSet) + } + return vm.Run(ctx, b, codeSet) +} + +func encodeRunIndentCode(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, prefix, indent string) ([]byte, error) { + ctx.Prefix = []byte(prefix) + ctx.IndentStr = []byte(indent) + if (ctx.Option.Flag & encoder.DebugOption) != 0 { + if (ctx.Option.Flag & encoder.ColorizeOption) != 0 { + return vm_color_indent.DebugRun(ctx, b, codeSet) + } + return vm_indent.DebugRun(ctx, b, codeSet) + } + if (ctx.Option.Flag & encoder.ColorizeOption) != 0 { + return vm_color_indent.Run(ctx, b, codeSet) + } + return vm_indent.Run(ctx, b, codeSet) +} diff --git a/vendor/github.com/goccy/go-json/error.go b/vendor/github.com/goccy/go-json/error.go new file mode 100644 index 000000000..5b2dcee50 --- /dev/null +++ b/vendor/github.com/goccy/go-json/error.go @@ -0,0 +1,41 @@ +package json + +import ( + "github.com/goccy/go-json/internal/errors" +) + +// Before Go 1.2, an InvalidUTF8Error was returned by Marshal when +// attempting to encode a string value with invalid UTF-8 sequences. +// As of Go 1.2, Marshal instead coerces the string to valid UTF-8 by +// replacing invalid bytes with the Unicode replacement rune U+FFFD. +// +// Deprecated: No longer used; kept for compatibility. +type InvalidUTF8Error = errors.InvalidUTF8Error + +// An InvalidUnmarshalError describes an invalid argument passed to Unmarshal. +// (The argument to Unmarshal must be a non-nil pointer.) +type InvalidUnmarshalError = errors.InvalidUnmarshalError + +// A MarshalerError represents an error from calling a MarshalJSON or MarshalText method. +type MarshalerError = errors.MarshalerError + +// A SyntaxError is a description of a JSON syntax error. +type SyntaxError = errors.SyntaxError + +// An UnmarshalFieldError describes a JSON object key that +// led to an unexported (and therefore unwritable) struct field. +// +// Deprecated: No longer used; kept for compatibility. +type UnmarshalFieldError = errors.UnmarshalFieldError + +// An UnmarshalTypeError describes a JSON value that was +// not appropriate for a value of a specific Go type. +type UnmarshalTypeError = errors.UnmarshalTypeError + +// An UnsupportedTypeError is returned by Marshal when attempting +// to encode an unsupported value type. +type UnsupportedTypeError = errors.UnsupportedTypeError + +type UnsupportedValueError = errors.UnsupportedValueError + +type PathError = errors.PathError diff --git a/vendor/github.com/goccy/go-json/internal/decoder/anonymous_field.go b/vendor/github.com/goccy/go-json/internal/decoder/anonymous_field.go new file mode 100644 index 000000000..b6876cf0d --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/anonymous_field.go @@ -0,0 +1,41 @@ +package decoder + +import ( + "unsafe" + + "github.com/goccy/go-json/internal/runtime" +) + +type anonymousFieldDecoder struct { + structType *runtime.Type + offset uintptr + dec Decoder +} + +func newAnonymousFieldDecoder(structType *runtime.Type, offset uintptr, dec Decoder) *anonymousFieldDecoder { + return &anonymousFieldDecoder{ + structType: structType, + offset: offset, + dec: dec, + } +} + +func (d *anonymousFieldDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error { + if *(*unsafe.Pointer)(p) == nil { + *(*unsafe.Pointer)(p) = unsafe_New(d.structType) + } + p = *(*unsafe.Pointer)(p) + return d.dec.DecodeStream(s, depth, unsafe.Pointer(uintptr(p)+d.offset)) +} + +func (d *anonymousFieldDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) { + if *(*unsafe.Pointer)(p) == nil { + *(*unsafe.Pointer)(p) = unsafe_New(d.structType) + } + p = *(*unsafe.Pointer)(p) + return d.dec.Decode(ctx, cursor, depth, unsafe.Pointer(uintptr(p)+d.offset)) +} + +func (d *anonymousFieldDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) { + return d.dec.DecodePath(ctx, cursor, depth) +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/array.go b/vendor/github.com/goccy/go-json/internal/decoder/array.go new file mode 100644 index 000000000..4b23ed43f --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/array.go @@ -0,0 +1,176 @@ +package decoder + +import ( + "fmt" + "unsafe" + + "github.com/goccy/go-json/internal/errors" + "github.com/goccy/go-json/internal/runtime" +) + +type arrayDecoder struct { + elemType *runtime.Type + size uintptr + valueDecoder Decoder + alen int + structName string + fieldName string + zeroValue unsafe.Pointer +} + +func newArrayDecoder(dec Decoder, elemType *runtime.Type, alen int, structName, fieldName string) *arrayDecoder { + // workaround to avoid checkptr errors. cannot use `*(*unsafe.Pointer)(unsafe_New(elemType))` directly. + zeroValuePtr := unsafe_New(elemType) + zeroValue := **(**unsafe.Pointer)(unsafe.Pointer(&zeroValuePtr)) + return &arrayDecoder{ + valueDecoder: dec, + elemType: elemType, + size: elemType.Size(), + alen: alen, + structName: structName, + fieldName: fieldName, + zeroValue: zeroValue, + } +} + +func (d *arrayDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error { + depth++ + if depth > maxDecodeNestingDepth { + return errors.ErrExceededMaxDepth(s.char(), s.cursor) + } + + for { + switch s.char() { + case ' ', '\n', '\t', '\r': + case 'n': + if err := nullBytes(s); err != nil { + return err + } + return nil + case '[': + idx := 0 + s.cursor++ + if s.skipWhiteSpace() == ']' { + for idx < d.alen { + *(*unsafe.Pointer)(unsafe.Pointer(uintptr(p) + uintptr(idx)*d.size)) = d.zeroValue + idx++ + } + s.cursor++ + return nil + } + for { + if idx < d.alen { + if err := d.valueDecoder.DecodeStream(s, depth, unsafe.Pointer(uintptr(p)+uintptr(idx)*d.size)); err != nil { + return err + } + } else { + if err := s.skipValue(depth); err != nil { + return err + } + } + idx++ + switch s.skipWhiteSpace() { + case ']': + for idx < d.alen { + *(*unsafe.Pointer)(unsafe.Pointer(uintptr(p) + uintptr(idx)*d.size)) = d.zeroValue + idx++ + } + s.cursor++ + return nil + case ',': + s.cursor++ + continue + case nul: + if s.read() { + s.cursor++ + continue + } + goto ERROR + default: + goto ERROR + } + } + case nul: + if s.read() { + continue + } + goto ERROR + default: + goto ERROR + } + s.cursor++ + } +ERROR: + return errors.ErrUnexpectedEndOfJSON("array", s.totalOffset()) +} + +func (d *arrayDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) { + buf := ctx.Buf + depth++ + if depth > maxDecodeNestingDepth { + return 0, errors.ErrExceededMaxDepth(buf[cursor], cursor) + } + + for { + switch buf[cursor] { + case ' ', '\n', '\t', '\r': + cursor++ + continue + case 'n': + if err := validateNull(buf, cursor); err != nil { + return 0, err + } + cursor += 4 + return cursor, nil + case '[': + idx := 0 + cursor++ + cursor = skipWhiteSpace(buf, cursor) + if buf[cursor] == ']' { + for idx < d.alen { + *(*unsafe.Pointer)(unsafe.Pointer(uintptr(p) + uintptr(idx)*d.size)) = d.zeroValue + idx++ + } + cursor++ + return cursor, nil + } + for { + if idx < d.alen { + c, err := d.valueDecoder.Decode(ctx, cursor, depth, unsafe.Pointer(uintptr(p)+uintptr(idx)*d.size)) + if err != nil { + return 0, err + } + cursor = c + } else { + c, err := skipValue(buf, cursor, depth) + if err != nil { + return 0, err + } + cursor = c + } + idx++ + cursor = skipWhiteSpace(buf, cursor) + switch buf[cursor] { + case ']': + for idx < d.alen { + *(*unsafe.Pointer)(unsafe.Pointer(uintptr(p) + uintptr(idx)*d.size)) = d.zeroValue + idx++ + } + cursor++ + return cursor, nil + case ',': + cursor++ + continue + default: + return 0, errors.ErrInvalidCharacter(buf[cursor], "array", cursor) + } + } + default: + return 0, errors.ErrUnexpectedEndOfJSON("array", cursor) + } + } +} + +func (d *arrayDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) { + return nil, 0, fmt.Errorf("json: array decoder does not support decode path") +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/assign.go b/vendor/github.com/goccy/go-json/internal/decoder/assign.go new file mode 100644 index 000000000..c53e6ad9f --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/assign.go @@ -0,0 +1,438 @@ +package decoder + +import ( + "fmt" + "reflect" + "strconv" +) + +var ( + nilValue = reflect.ValueOf(nil) +) + +func AssignValue(src, dst reflect.Value) error { + if dst.Type().Kind() != reflect.Ptr { + return fmt.Errorf("invalid dst type. required pointer type: %T", dst.Type()) + } + casted, err := castValue(dst.Elem().Type(), src) + if err != nil { + return err + } + dst.Elem().Set(casted) + return nil +} + +func castValue(t reflect.Type, v reflect.Value) (reflect.Value, error) { + switch t.Kind() { + case reflect.Int: + vv, err := castInt(v) + if err != nil { + return nilValue, err + } + return reflect.ValueOf(int(vv.Int())), nil + case reflect.Int8: + vv, err := castInt(v) + if err != nil { + return nilValue, err + } + return reflect.ValueOf(int8(vv.Int())), nil + case reflect.Int16: + vv, err := castInt(v) + if err != nil { + return nilValue, err + } + return reflect.ValueOf(int16(vv.Int())), nil + case reflect.Int32: + vv, err := castInt(v) + if err != nil { + return nilValue, err + } + return reflect.ValueOf(int32(vv.Int())), nil + case reflect.Int64: + return castInt(v) + case reflect.Uint: + vv, err := castUint(v) + if err != nil { + return nilValue, err + } + return reflect.ValueOf(uint(vv.Uint())), nil + case reflect.Uint8: + vv, err := castUint(v) + if err != nil { + return nilValue, err + } + return reflect.ValueOf(uint8(vv.Uint())), nil + case reflect.Uint16: + vv, err := castUint(v) + if err != nil { + return nilValue, err + } + return reflect.ValueOf(uint16(vv.Uint())), nil + case reflect.Uint32: + vv, err := castUint(v) + if err != nil { + return nilValue, err + } + return reflect.ValueOf(uint32(vv.Uint())), nil + case reflect.Uint64: + return castUint(v) + case reflect.Uintptr: + vv, err := castUint(v) + if err != nil { + return nilValue, err + } + return reflect.ValueOf(uintptr(vv.Uint())), nil + case reflect.String: + return castString(v) + case reflect.Bool: + return castBool(v) + case reflect.Float32: + vv, err := castFloat(v) + if err != nil { + return nilValue, err + } + return reflect.ValueOf(float32(vv.Float())), nil + case reflect.Float64: + return castFloat(v) + case reflect.Array: + return castArray(t, v) + case reflect.Slice: + return castSlice(t, v) + case reflect.Map: + return castMap(t, v) + case reflect.Struct: + return castStruct(t, v) + } + return v, nil +} + +func castInt(v reflect.Value) (reflect.Value, error) { + switch v.Type().Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v, nil + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return reflect.ValueOf(int64(v.Uint())), nil + case reflect.String: + i64, err := strconv.ParseInt(v.String(), 10, 64) + if err != nil { + return nilValue, err + } + return reflect.ValueOf(i64), nil + case reflect.Bool: + if v.Bool() { + return reflect.ValueOf(int64(1)), nil + } + return reflect.ValueOf(int64(0)), nil + case reflect.Float32, reflect.Float64: + return reflect.ValueOf(int64(v.Float())), nil + case reflect.Array: + if v.Len() > 0 { + return castInt(v.Index(0)) + } + return nilValue, fmt.Errorf("failed to cast to int64 from empty array") + case reflect.Slice: + if v.Len() > 0 { + return castInt(v.Index(0)) + } + return nilValue, fmt.Errorf("failed to cast to int64 from empty slice") + case reflect.Interface: + return castInt(reflect.ValueOf(v.Interface())) + case reflect.Map: + return nilValue, fmt.Errorf("failed to cast to int64 from map") + case reflect.Struct: + return nilValue, fmt.Errorf("failed to cast to int64 from struct") + case reflect.Ptr: + return castInt(v.Elem()) + } + return nilValue, fmt.Errorf("failed to cast to int64 from %s", v.Type().Kind()) +} + +func castUint(v reflect.Value) (reflect.Value, error) { + switch v.Type().Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return reflect.ValueOf(uint64(v.Int())), nil + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return v, nil + case reflect.String: + u64, err := strconv.ParseUint(v.String(), 10, 64) + if err != nil { + return nilValue, err + } + return reflect.ValueOf(u64), nil + case reflect.Bool: + if v.Bool() { + return reflect.ValueOf(uint64(1)), nil + } + return reflect.ValueOf(uint64(0)), nil + case reflect.Float32, reflect.Float64: + return reflect.ValueOf(uint64(v.Float())), nil + case reflect.Array: + if v.Len() > 0 { + return castUint(v.Index(0)) + } + return nilValue, fmt.Errorf("failed to cast to uint64 from empty array") + case reflect.Slice: + if v.Len() > 0 { + return castUint(v.Index(0)) + } + return nilValue, fmt.Errorf("failed to cast to uint64 from empty slice") + case reflect.Interface: + return castUint(reflect.ValueOf(v.Interface())) + case reflect.Map: + return nilValue, fmt.Errorf("failed to cast to uint64 from map") + case reflect.Struct: + return nilValue, fmt.Errorf("failed to cast to uint64 from struct") + case reflect.Ptr: + return castUint(v.Elem()) + } + return nilValue, fmt.Errorf("failed to cast to uint64 from %s", v.Type().Kind()) +} + +func castString(v reflect.Value) (reflect.Value, error) { + switch v.Type().Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return reflect.ValueOf(fmt.Sprint(v.Int())), nil + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return reflect.ValueOf(fmt.Sprint(v.Uint())), nil + case reflect.String: + return v, nil + case reflect.Bool: + if v.Bool() { + return reflect.ValueOf("true"), nil + } + return reflect.ValueOf("false"), nil + case reflect.Float32, reflect.Float64: + return reflect.ValueOf(fmt.Sprint(v.Float())), nil + case reflect.Array: + if v.Len() > 0 { + return castString(v.Index(0)) + } + return nilValue, fmt.Errorf("failed to cast to string from empty array") + case reflect.Slice: + if v.Len() > 0 { + return castString(v.Index(0)) + } + return nilValue, fmt.Errorf("failed to cast to string from empty slice") + case reflect.Interface: + return castString(reflect.ValueOf(v.Interface())) + case reflect.Map: + return nilValue, fmt.Errorf("failed to cast to string from map") + case reflect.Struct: + return nilValue, fmt.Errorf("failed to cast to string from struct") + case reflect.Ptr: + return castString(v.Elem()) + } + return nilValue, fmt.Errorf("failed to cast to string from %s", v.Type().Kind()) +} + +func castBool(v reflect.Value) (reflect.Value, error) { + switch v.Type().Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + switch v.Int() { + case 0: + return reflect.ValueOf(false), nil + case 1: + return reflect.ValueOf(true), nil + } + return nilValue, fmt.Errorf("failed to cast to bool from %d", v.Int()) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + switch v.Uint() { + case 0: + return reflect.ValueOf(false), nil + case 1: + return reflect.ValueOf(true), nil + } + return nilValue, fmt.Errorf("failed to cast to bool from %d", v.Uint()) + case reflect.String: + b, err := strconv.ParseBool(v.String()) + if err != nil { + return nilValue, err + } + return reflect.ValueOf(b), nil + case reflect.Bool: + return v, nil + case reflect.Float32, reflect.Float64: + switch v.Float() { + case 0: + return reflect.ValueOf(false), nil + case 1: + return reflect.ValueOf(true), nil + } + return nilValue, fmt.Errorf("failed to cast to bool from %f", v.Float()) + case reflect.Array: + if v.Len() > 0 { + return castBool(v.Index(0)) + } + return nilValue, fmt.Errorf("failed to cast to string from empty array") + case reflect.Slice: + if v.Len() > 0 { + return castBool(v.Index(0)) + } + return nilValue, fmt.Errorf("failed to cast to string from empty slice") + case reflect.Interface: + return castBool(reflect.ValueOf(v.Interface())) + case reflect.Map: + return nilValue, fmt.Errorf("failed to cast to string from map") + case reflect.Struct: + return nilValue, fmt.Errorf("failed to cast to string from struct") + case reflect.Ptr: + return castBool(v.Elem()) + } + return nilValue, fmt.Errorf("failed to cast to bool from %s", v.Type().Kind()) +} + +func castFloat(v reflect.Value) (reflect.Value, error) { + switch v.Type().Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return reflect.ValueOf(float64(v.Int())), nil + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return reflect.ValueOf(float64(v.Uint())), nil + case reflect.String: + f64, err := strconv.ParseFloat(v.String(), 64) + if err != nil { + return nilValue, err + } + return reflect.ValueOf(f64), nil + case reflect.Bool: + if v.Bool() { + return reflect.ValueOf(float64(1)), nil + } + return reflect.ValueOf(float64(0)), nil + case reflect.Float32, reflect.Float64: + return v, nil + case reflect.Array: + if v.Len() > 0 { + return castFloat(v.Index(0)) + } + return nilValue, fmt.Errorf("failed to cast to float64 from empty array") + case reflect.Slice: + if v.Len() > 0 { + return castFloat(v.Index(0)) + } + return nilValue, fmt.Errorf("failed to cast to float64 from empty slice") + case reflect.Interface: + return castFloat(reflect.ValueOf(v.Interface())) + case reflect.Map: + return nilValue, fmt.Errorf("failed to cast to float64 from map") + case reflect.Struct: + return nilValue, fmt.Errorf("failed to cast to float64 from struct") + case reflect.Ptr: + return castFloat(v.Elem()) + } + return nilValue, fmt.Errorf("failed to cast to float64 from %s", v.Type().Kind()) +} + +func castArray(t reflect.Type, v reflect.Value) (reflect.Value, error) { + kind := v.Type().Kind() + if kind == reflect.Interface { + return castArray(t, reflect.ValueOf(v.Interface())) + } + if kind != reflect.Slice && kind != reflect.Array { + return nilValue, fmt.Errorf("failed to cast to array from %s", kind) + } + if t.Elem() == v.Type().Elem() { + return v, nil + } + if t.Len() != v.Len() { + return nilValue, fmt.Errorf("failed to cast [%d]array from slice of %d length", t.Len(), v.Len()) + } + ret := reflect.New(t).Elem() + for i := 0; i < v.Len(); i++ { + vv, err := castValue(t.Elem(), v.Index(i)) + if err != nil { + return nilValue, err + } + ret.Index(i).Set(vv) + } + return ret, nil +} + +func castSlice(t reflect.Type, v reflect.Value) (reflect.Value, error) { + kind := v.Type().Kind() + if kind == reflect.Interface { + return castSlice(t, reflect.ValueOf(v.Interface())) + } + if kind != reflect.Slice && kind != reflect.Array { + return nilValue, fmt.Errorf("failed to cast to slice from %s", kind) + } + if t.Elem() == v.Type().Elem() { + return v, nil + } + ret := reflect.MakeSlice(t, v.Len(), v.Len()) + for i := 0; i < v.Len(); i++ { + vv, err := castValue(t.Elem(), v.Index(i)) + if err != nil { + return nilValue, err + } + ret.Index(i).Set(vv) + } + return ret, nil +} + +func castMap(t reflect.Type, v reflect.Value) (reflect.Value, error) { + ret := reflect.MakeMap(t) + switch v.Type().Kind() { + case reflect.Map: + iter := v.MapRange() + for iter.Next() { + key, err := castValue(t.Key(), iter.Key()) + if err != nil { + return nilValue, err + } + value, err := castValue(t.Elem(), iter.Value()) + if err != nil { + return nilValue, err + } + ret.SetMapIndex(key, value) + } + return ret, nil + case reflect.Interface: + return castMap(t, reflect.ValueOf(v.Interface())) + case reflect.Slice: + if v.Len() > 0 { + return castMap(t, v.Index(0)) + } + return nilValue, fmt.Errorf("failed to cast to map from empty slice") + } + return nilValue, fmt.Errorf("failed to cast to map from %s", v.Type().Kind()) +} + +func castStruct(t reflect.Type, v reflect.Value) (reflect.Value, error) { + ret := reflect.New(t).Elem() + switch v.Type().Kind() { + case reflect.Map: + iter := v.MapRange() + for iter.Next() { + key := iter.Key() + k, err := castString(key) + if err != nil { + return nilValue, err + } + fieldName := k.String() + field, ok := t.FieldByName(fieldName) + if ok { + value, err := castValue(field.Type, iter.Value()) + if err != nil { + return nilValue, err + } + ret.FieldByName(fieldName).Set(value) + } + } + return ret, nil + case reflect.Struct: + for i := 0; i < v.Type().NumField(); i++ { + name := v.Type().Field(i).Name + ret.FieldByName(name).Set(v.FieldByName(name)) + } + return ret, nil + case reflect.Interface: + return castStruct(t, reflect.ValueOf(v.Interface())) + case reflect.Slice: + if v.Len() > 0 { + return castStruct(t, v.Index(0)) + } + return nilValue, fmt.Errorf("failed to cast to struct from empty slice") + default: + return nilValue, fmt.Errorf("failed to cast to struct from %s", v.Type().Kind()) + } +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/bool.go b/vendor/github.com/goccy/go-json/internal/decoder/bool.go new file mode 100644 index 000000000..ba6cf5bc4 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/bool.go @@ -0,0 +1,83 @@ +package decoder + +import ( + "fmt" + "unsafe" + + "github.com/goccy/go-json/internal/errors" +) + +type boolDecoder struct { + structName string + fieldName string +} + +func newBoolDecoder(structName, fieldName string) *boolDecoder { + return &boolDecoder{structName: structName, fieldName: fieldName} +} + +func (d *boolDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error { + c := s.skipWhiteSpace() + for { + switch c { + case 't': + if err := trueBytes(s); err != nil { + return err + } + **(**bool)(unsafe.Pointer(&p)) = true + return nil + case 'f': + if err := falseBytes(s); err != nil { + return err + } + **(**bool)(unsafe.Pointer(&p)) = false + return nil + case 'n': + if err := nullBytes(s); err != nil { + return err + } + return nil + case nul: + if s.read() { + c = s.char() + continue + } + goto ERROR + } + break + } +ERROR: + return errors.ErrUnexpectedEndOfJSON("bool", s.totalOffset()) +} + +func (d *boolDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) { + buf := ctx.Buf + cursor = skipWhiteSpace(buf, cursor) + switch buf[cursor] { + case 't': + if err := validateTrue(buf, cursor); err != nil { + return 0, err + } + cursor += 4 + **(**bool)(unsafe.Pointer(&p)) = true + return cursor, nil + case 'f': + if err := validateFalse(buf, cursor); err != nil { + return 0, err + } + cursor += 5 + **(**bool)(unsafe.Pointer(&p)) = false + return cursor, nil + case 'n': + if err := validateNull(buf, cursor); err != nil { + return 0, err + } + cursor += 4 + return cursor, nil + } + return 0, errors.ErrUnexpectedEndOfJSON("bool", cursor) +} + +func (d *boolDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) { + return nil, 0, fmt.Errorf("json: bool decoder does not support decode path") +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/bytes.go b/vendor/github.com/goccy/go-json/internal/decoder/bytes.go new file mode 100644 index 000000000..939bf4327 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/bytes.go @@ -0,0 +1,118 @@ +package decoder + +import ( + "encoding/base64" + "fmt" + "unsafe" + + "github.com/goccy/go-json/internal/errors" + "github.com/goccy/go-json/internal/runtime" +) + +type bytesDecoder struct { + typ *runtime.Type + sliceDecoder Decoder + stringDecoder *stringDecoder + structName string + fieldName string +} + +func byteUnmarshalerSliceDecoder(typ *runtime.Type, structName string, fieldName string) Decoder { + var unmarshalDecoder Decoder + switch { + case runtime.PtrTo(typ).Implements(unmarshalJSONType): + unmarshalDecoder = newUnmarshalJSONDecoder(runtime.PtrTo(typ), structName, fieldName) + case runtime.PtrTo(typ).Implements(unmarshalTextType): + unmarshalDecoder = newUnmarshalTextDecoder(runtime.PtrTo(typ), structName, fieldName) + default: + unmarshalDecoder, _ = compileUint8(typ, structName, fieldName) + } + return newSliceDecoder(unmarshalDecoder, typ, 1, structName, fieldName) +} + +func newBytesDecoder(typ *runtime.Type, structName string, fieldName string) *bytesDecoder { + return &bytesDecoder{ + typ: typ, + sliceDecoder: byteUnmarshalerSliceDecoder(typ, structName, fieldName), + stringDecoder: newStringDecoder(structName, fieldName), + structName: structName, + fieldName: fieldName, + } +} + +func (d *bytesDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error { + bytes, err := d.decodeStreamBinary(s, depth, p) + if err != nil { + return err + } + if bytes == nil { + s.reset() + return nil + } + decodedLen := base64.StdEncoding.DecodedLen(len(bytes)) + buf := make([]byte, decodedLen) + n, err := base64.StdEncoding.Decode(buf, bytes) + if err != nil { + return err + } + *(*[]byte)(p) = buf[:n] + s.reset() + return nil +} + +func (d *bytesDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) { + bytes, c, err := d.decodeBinary(ctx, cursor, depth, p) + if err != nil { + return 0, err + } + if bytes == nil { + return c, nil + } + cursor = c + decodedLen := base64.StdEncoding.DecodedLen(len(bytes)) + b := make([]byte, decodedLen) + n, err := base64.StdEncoding.Decode(b, bytes) + if err != nil { + return 0, err + } + *(*[]byte)(p) = b[:n] + return cursor, nil +} + +func (d *bytesDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) { + return nil, 0, fmt.Errorf("json: []byte decoder does not support decode path") +} + +func (d *bytesDecoder) decodeStreamBinary(s *Stream, depth int64, p unsafe.Pointer) ([]byte, error) { + c := s.skipWhiteSpace() + if c == '[' { + if d.sliceDecoder == nil { + return nil, &errors.UnmarshalTypeError{ + Type: runtime.RType2Type(d.typ), + Offset: s.totalOffset(), + } + } + err := d.sliceDecoder.DecodeStream(s, depth, p) + return nil, err + } + return d.stringDecoder.decodeStreamByte(s) +} + +func (d *bytesDecoder) decodeBinary(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) ([]byte, int64, error) { + buf := ctx.Buf + cursor = skipWhiteSpace(buf, cursor) + if buf[cursor] == '[' { + if d.sliceDecoder == nil { + return nil, 0, &errors.UnmarshalTypeError{ + Type: runtime.RType2Type(d.typ), + Offset: cursor, + } + } + c, err := d.sliceDecoder.Decode(ctx, cursor, depth, p) + if err != nil { + return nil, 0, err + } + return nil, c, nil + } + return d.stringDecoder.decodeByte(buf, cursor) +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/compile.go b/vendor/github.com/goccy/go-json/internal/decoder/compile.go new file mode 100644 index 000000000..fab643764 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/compile.go @@ -0,0 +1,487 @@ +package decoder + +import ( + "encoding/json" + "fmt" + "reflect" + "strings" + "sync/atomic" + "unicode" + "unsafe" + + "github.com/goccy/go-json/internal/runtime" +) + +var ( + jsonNumberType = reflect.TypeOf(json.Number("")) + typeAddr *runtime.TypeAddr + cachedDecoderMap unsafe.Pointer // map[uintptr]decoder + cachedDecoder []Decoder +) + +func init() { + typeAddr = runtime.AnalyzeTypeAddr() + if typeAddr == nil { + typeAddr = &runtime.TypeAddr{} + } + cachedDecoder = make([]Decoder, typeAddr.AddrRange>>typeAddr.AddrShift+1) +} + +func loadDecoderMap() map[uintptr]Decoder { + p := atomic.LoadPointer(&cachedDecoderMap) + return *(*map[uintptr]Decoder)(unsafe.Pointer(&p)) +} + +func storeDecoder(typ uintptr, dec Decoder, m map[uintptr]Decoder) { + newDecoderMap := make(map[uintptr]Decoder, len(m)+1) + newDecoderMap[typ] = dec + + for k, v := range m { + newDecoderMap[k] = v + } + + atomic.StorePointer(&cachedDecoderMap, *(*unsafe.Pointer)(unsafe.Pointer(&newDecoderMap))) +} + +func compileToGetDecoderSlowPath(typeptr uintptr, typ *runtime.Type) (Decoder, error) { + decoderMap := loadDecoderMap() + if dec, exists := decoderMap[typeptr]; exists { + return dec, nil + } + + dec, err := compileHead(typ, map[uintptr]Decoder{}) + if err != nil { + return nil, err + } + storeDecoder(typeptr, dec, decoderMap) + return dec, nil +} + +func compileHead(typ *runtime.Type, structTypeToDecoder map[uintptr]Decoder) (Decoder, error) { + switch { + case implementsUnmarshalJSONType(runtime.PtrTo(typ)): + return newUnmarshalJSONDecoder(runtime.PtrTo(typ), "", ""), nil + case runtime.PtrTo(typ).Implements(unmarshalTextType): + return newUnmarshalTextDecoder(runtime.PtrTo(typ), "", ""), nil + } + return compile(typ.Elem(), "", "", structTypeToDecoder) +} + +func compile(typ *runtime.Type, structName, fieldName string, structTypeToDecoder map[uintptr]Decoder) (Decoder, error) { + switch { + case implementsUnmarshalJSONType(runtime.PtrTo(typ)): + return newUnmarshalJSONDecoder(runtime.PtrTo(typ), structName, fieldName), nil + case runtime.PtrTo(typ).Implements(unmarshalTextType): + return newUnmarshalTextDecoder(runtime.PtrTo(typ), structName, fieldName), nil + } + + switch typ.Kind() { + case reflect.Ptr: + return compilePtr(typ, structName, fieldName, structTypeToDecoder) + case reflect.Struct: + return compileStruct(typ, structName, fieldName, structTypeToDecoder) + case reflect.Slice: + elem := typ.Elem() + if elem.Kind() == reflect.Uint8 { + return compileBytes(elem, structName, fieldName) + } + return compileSlice(typ, structName, fieldName, structTypeToDecoder) + case reflect.Array: + return compileArray(typ, structName, fieldName, structTypeToDecoder) + case reflect.Map: + return compileMap(typ, structName, fieldName, structTypeToDecoder) + case reflect.Interface: + return compileInterface(typ, structName, fieldName) + case reflect.Uintptr: + return compileUint(typ, structName, fieldName) + case reflect.Int: + return compileInt(typ, structName, fieldName) + case reflect.Int8: + return compileInt8(typ, structName, fieldName) + case reflect.Int16: + return compileInt16(typ, structName, fieldName) + case reflect.Int32: + return compileInt32(typ, structName, fieldName) + case reflect.Int64: + return compileInt64(typ, structName, fieldName) + case reflect.Uint: + return compileUint(typ, structName, fieldName) + case reflect.Uint8: + return compileUint8(typ, structName, fieldName) + case reflect.Uint16: + return compileUint16(typ, structName, fieldName) + case reflect.Uint32: + return compileUint32(typ, structName, fieldName) + case reflect.Uint64: + return compileUint64(typ, structName, fieldName) + case reflect.String: + return compileString(typ, structName, fieldName) + case reflect.Bool: + return compileBool(structName, fieldName) + case reflect.Float32: + return compileFloat32(structName, fieldName) + case reflect.Float64: + return compileFloat64(structName, fieldName) + case reflect.Func: + return compileFunc(typ, structName, fieldName) + } + return newInvalidDecoder(typ, structName, fieldName), nil +} + +func isStringTagSupportedType(typ *runtime.Type) bool { + switch { + case implementsUnmarshalJSONType(runtime.PtrTo(typ)): + return false + case runtime.PtrTo(typ).Implements(unmarshalTextType): + return false + } + switch typ.Kind() { + case reflect.Map: + return false + case reflect.Slice: + return false + case reflect.Array: + return false + case reflect.Struct: + return false + case reflect.Interface: + return false + } + return true +} + +func compileMapKey(typ *runtime.Type, structName, fieldName string, structTypeToDecoder map[uintptr]Decoder) (Decoder, error) { + if runtime.PtrTo(typ).Implements(unmarshalTextType) { + return newUnmarshalTextDecoder(runtime.PtrTo(typ), structName, fieldName), nil + } + if typ.Kind() == reflect.String { + return newStringDecoder(structName, fieldName), nil + } + dec, err := compile(typ, structName, fieldName, structTypeToDecoder) + if err != nil { + return nil, err + } + for { + switch t := dec.(type) { + case *stringDecoder, *interfaceDecoder: + return dec, nil + case *boolDecoder, *intDecoder, *uintDecoder, *numberDecoder: + return newWrappedStringDecoder(typ, dec, structName, fieldName), nil + case *ptrDecoder: + dec = t.dec + default: + return newInvalidDecoder(typ, structName, fieldName), nil + } + } +} + +func compilePtr(typ *runtime.Type, structName, fieldName string, structTypeToDecoder map[uintptr]Decoder) (Decoder, error) { + dec, err := compile(typ.Elem(), structName, fieldName, structTypeToDecoder) + if err != nil { + return nil, err + } + return newPtrDecoder(dec, typ.Elem(), structName, fieldName), nil +} + +func compileInt(typ *runtime.Type, structName, fieldName string) (Decoder, error) { + return newIntDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v int64) { + *(*int)(p) = int(v) + }), nil +} + +func compileInt8(typ *runtime.Type, structName, fieldName string) (Decoder, error) { + return newIntDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v int64) { + *(*int8)(p) = int8(v) + }), nil +} + +func compileInt16(typ *runtime.Type, structName, fieldName string) (Decoder, error) { + return newIntDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v int64) { + *(*int16)(p) = int16(v) + }), nil +} + +func compileInt32(typ *runtime.Type, structName, fieldName string) (Decoder, error) { + return newIntDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v int64) { + *(*int32)(p) = int32(v) + }), nil +} + +func compileInt64(typ *runtime.Type, structName, fieldName string) (Decoder, error) { + return newIntDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v int64) { + *(*int64)(p) = v + }), nil +} + +func compileUint(typ *runtime.Type, structName, fieldName string) (Decoder, error) { + return newUintDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v uint64) { + *(*uint)(p) = uint(v) + }), nil +} + +func compileUint8(typ *runtime.Type, structName, fieldName string) (Decoder, error) { + return newUintDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v uint64) { + *(*uint8)(p) = uint8(v) + }), nil +} + +func compileUint16(typ *runtime.Type, structName, fieldName string) (Decoder, error) { + return newUintDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v uint64) { + *(*uint16)(p) = uint16(v) + }), nil +} + +func compileUint32(typ *runtime.Type, structName, fieldName string) (Decoder, error) { + return newUintDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v uint64) { + *(*uint32)(p) = uint32(v) + }), nil +} + +func compileUint64(typ *runtime.Type, structName, fieldName string) (Decoder, error) { + return newUintDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v uint64) { + *(*uint64)(p) = v + }), nil +} + +func compileFloat32(structName, fieldName string) (Decoder, error) { + return newFloatDecoder(structName, fieldName, func(p unsafe.Pointer, v float64) { + *(*float32)(p) = float32(v) + }), nil +} + +func compileFloat64(structName, fieldName string) (Decoder, error) { + return newFloatDecoder(structName, fieldName, func(p unsafe.Pointer, v float64) { + *(*float64)(p) = v + }), nil +} + +func compileString(typ *runtime.Type, structName, fieldName string) (Decoder, error) { + if typ == runtime.Type2RType(jsonNumberType) { + return newNumberDecoder(structName, fieldName, func(p unsafe.Pointer, v json.Number) { + *(*json.Number)(p) = v + }), nil + } + return newStringDecoder(structName, fieldName), nil +} + +func compileBool(structName, fieldName string) (Decoder, error) { + return newBoolDecoder(structName, fieldName), nil +} + +func compileBytes(typ *runtime.Type, structName, fieldName string) (Decoder, error) { + return newBytesDecoder(typ, structName, fieldName), nil +} + +func compileSlice(typ *runtime.Type, structName, fieldName string, structTypeToDecoder map[uintptr]Decoder) (Decoder, error) { + elem := typ.Elem() + decoder, err := compile(elem, structName, fieldName, structTypeToDecoder) + if err != nil { + return nil, err + } + return newSliceDecoder(decoder, elem, elem.Size(), structName, fieldName), nil +} + +func compileArray(typ *runtime.Type, structName, fieldName string, structTypeToDecoder map[uintptr]Decoder) (Decoder, error) { + elem := typ.Elem() + decoder, err := compile(elem, structName, fieldName, structTypeToDecoder) + if err != nil { + return nil, err + } + return newArrayDecoder(decoder, elem, typ.Len(), structName, fieldName), nil +} + +func compileMap(typ *runtime.Type, structName, fieldName string, structTypeToDecoder map[uintptr]Decoder) (Decoder, error) { + keyDec, err := compileMapKey(typ.Key(), structName, fieldName, structTypeToDecoder) + if err != nil { + return nil, err + } + valueDec, err := compile(typ.Elem(), structName, fieldName, structTypeToDecoder) + if err != nil { + return nil, err + } + return newMapDecoder(typ, typ.Key(), keyDec, typ.Elem(), valueDec, structName, fieldName), nil +} + +func compileInterface(typ *runtime.Type, structName, fieldName string) (Decoder, error) { + return newInterfaceDecoder(typ, structName, fieldName), nil +} + +func compileFunc(typ *runtime.Type, strutName, fieldName string) (Decoder, error) { + return newFuncDecoder(typ, strutName, fieldName), nil +} + +func typeToStructTags(typ *runtime.Type) runtime.StructTags { + tags := runtime.StructTags{} + fieldNum := typ.NumField() + for i := 0; i < fieldNum; i++ { + field := typ.Field(i) + if runtime.IsIgnoredStructField(field) { + continue + } + tags = append(tags, runtime.StructTagFromField(field)) + } + return tags +} + +func compileStruct(typ *runtime.Type, structName, fieldName string, structTypeToDecoder map[uintptr]Decoder) (Decoder, error) { + fieldNum := typ.NumField() + fieldMap := map[string]*structFieldSet{} + typeptr := uintptr(unsafe.Pointer(typ)) + if dec, exists := structTypeToDecoder[typeptr]; exists { + return dec, nil + } + structDec := newStructDecoder(structName, fieldName, fieldMap) + structTypeToDecoder[typeptr] = structDec + structName = typ.Name() + tags := typeToStructTags(typ) + allFields := []*structFieldSet{} + for i := 0; i < fieldNum; i++ { + field := typ.Field(i) + if runtime.IsIgnoredStructField(field) { + continue + } + isUnexportedField := unicode.IsLower([]rune(field.Name)[0]) + tag := runtime.StructTagFromField(field) + dec, err := compile(runtime.Type2RType(field.Type), structName, field.Name, structTypeToDecoder) + if err != nil { + return nil, err + } + if field.Anonymous && !tag.IsTaggedKey { + if stDec, ok := dec.(*structDecoder); ok { + if runtime.Type2RType(field.Type) == typ { + // recursive definition + continue + } + for k, v := range stDec.fieldMap { + if tags.ExistsKey(k) { + continue + } + fieldSet := &structFieldSet{ + dec: v.dec, + offset: field.Offset + v.offset, + isTaggedKey: v.isTaggedKey, + key: k, + keyLen: int64(len(k)), + } + allFields = append(allFields, fieldSet) + } + } else if pdec, ok := dec.(*ptrDecoder); ok { + contentDec := pdec.contentDecoder() + if pdec.typ == typ { + // recursive definition + continue + } + var fieldSetErr error + if isUnexportedField { + fieldSetErr = fmt.Errorf( + "json: cannot set embedded pointer to unexported struct: %v", + field.Type.Elem(), + ) + } + if dec, ok := contentDec.(*structDecoder); ok { + for k, v := range dec.fieldMap { + if tags.ExistsKey(k) { + continue + } + fieldSet := &structFieldSet{ + dec: newAnonymousFieldDecoder(pdec.typ, v.offset, v.dec), + offset: field.Offset, + isTaggedKey: v.isTaggedKey, + key: k, + keyLen: int64(len(k)), + err: fieldSetErr, + } + allFields = append(allFields, fieldSet) + } + } else { + fieldSet := &structFieldSet{ + dec: pdec, + offset: field.Offset, + isTaggedKey: tag.IsTaggedKey, + key: field.Name, + keyLen: int64(len(field.Name)), + } + allFields = append(allFields, fieldSet) + } + } else { + fieldSet := &structFieldSet{ + dec: dec, + offset: field.Offset, + isTaggedKey: tag.IsTaggedKey, + key: field.Name, + keyLen: int64(len(field.Name)), + } + allFields = append(allFields, fieldSet) + } + } else { + if tag.IsString && isStringTagSupportedType(runtime.Type2RType(field.Type)) { + dec = newWrappedStringDecoder(runtime.Type2RType(field.Type), dec, structName, field.Name) + } + var key string + if tag.Key != "" { + key = tag.Key + } else { + key = field.Name + } + fieldSet := &structFieldSet{ + dec: dec, + offset: field.Offset, + isTaggedKey: tag.IsTaggedKey, + key: key, + keyLen: int64(len(key)), + } + allFields = append(allFields, fieldSet) + } + } + for _, set := range filterDuplicatedFields(allFields) { + fieldMap[set.key] = set + lower := strings.ToLower(set.key) + if _, exists := fieldMap[lower]; !exists { + // first win + fieldMap[lower] = set + } + } + delete(structTypeToDecoder, typeptr) + structDec.tryOptimize() + return structDec, nil +} + +func filterDuplicatedFields(allFields []*structFieldSet) []*structFieldSet { + fieldMap := map[string][]*structFieldSet{} + for _, field := range allFields { + fieldMap[field.key] = append(fieldMap[field.key], field) + } + duplicatedFieldMap := map[string]struct{}{} + for k, sets := range fieldMap { + sets = filterFieldSets(sets) + if len(sets) != 1 { + duplicatedFieldMap[k] = struct{}{} + } + } + + filtered := make([]*structFieldSet, 0, len(allFields)) + for _, field := range allFields { + if _, exists := duplicatedFieldMap[field.key]; exists { + continue + } + filtered = append(filtered, field) + } + return filtered +} + +func filterFieldSets(sets []*structFieldSet) []*structFieldSet { + if len(sets) == 1 { + return sets + } + filtered := make([]*structFieldSet, 0, len(sets)) + for _, set := range sets { + if set.isTaggedKey { + filtered = append(filtered, set) + } + } + return filtered +} + +func implementsUnmarshalJSONType(typ *runtime.Type) bool { + return typ.Implements(unmarshalJSONType) || typ.Implements(unmarshalJSONContextType) +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/compile_norace.go b/vendor/github.com/goccy/go-json/internal/decoder/compile_norace.go new file mode 100644 index 000000000..eb7e2b134 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/compile_norace.go @@ -0,0 +1,29 @@ +//go:build !race +// +build !race + +package decoder + +import ( + "unsafe" + + "github.com/goccy/go-json/internal/runtime" +) + +func CompileToGetDecoder(typ *runtime.Type) (Decoder, error) { + typeptr := uintptr(unsafe.Pointer(typ)) + if typeptr > typeAddr.MaxTypeAddr { + return compileToGetDecoderSlowPath(typeptr, typ) + } + + index := (typeptr - typeAddr.BaseTypeAddr) >> typeAddr.AddrShift + if dec := cachedDecoder[index]; dec != nil { + return dec, nil + } + + dec, err := compileHead(typ, map[uintptr]Decoder{}) + if err != nil { + return nil, err + } + cachedDecoder[index] = dec + return dec, nil +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/compile_race.go b/vendor/github.com/goccy/go-json/internal/decoder/compile_race.go new file mode 100644 index 000000000..49cdda4a1 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/compile_race.go @@ -0,0 +1,37 @@ +//go:build race +// +build race + +package decoder + +import ( + "sync" + "unsafe" + + "github.com/goccy/go-json/internal/runtime" +) + +var decMu sync.RWMutex + +func CompileToGetDecoder(typ *runtime.Type) (Decoder, error) { + typeptr := uintptr(unsafe.Pointer(typ)) + if typeptr > typeAddr.MaxTypeAddr { + return compileToGetDecoderSlowPath(typeptr, typ) + } + + index := (typeptr - typeAddr.BaseTypeAddr) >> typeAddr.AddrShift + decMu.RLock() + if dec := cachedDecoder[index]; dec != nil { + decMu.RUnlock() + return dec, nil + } + decMu.RUnlock() + + dec, err := compileHead(typ, map[uintptr]Decoder{}) + if err != nil { + return nil, err + } + decMu.Lock() + cachedDecoder[index] = dec + decMu.Unlock() + return dec, nil +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/context.go b/vendor/github.com/goccy/go-json/internal/decoder/context.go new file mode 100644 index 000000000..cb2ffdafd --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/context.go @@ -0,0 +1,254 @@ +package decoder + +import ( + "sync" + "unsafe" + + "github.com/goccy/go-json/internal/errors" +) + +type RuntimeContext struct { + Buf []byte + Option *Option +} + +var ( + runtimeContextPool = sync.Pool{ + New: func() interface{} { + return &RuntimeContext{ + Option: &Option{}, + } + }, + } +) + +func TakeRuntimeContext() *RuntimeContext { + return runtimeContextPool.Get().(*RuntimeContext) +} + +func ReleaseRuntimeContext(ctx *RuntimeContext) { + runtimeContextPool.Put(ctx) +} + +var ( + isWhiteSpace = [256]bool{} +) + +func init() { + isWhiteSpace[' '] = true + isWhiteSpace['\n'] = true + isWhiteSpace['\t'] = true + isWhiteSpace['\r'] = true +} + +func char(ptr unsafe.Pointer, offset int64) byte { + return *(*byte)(unsafe.Pointer(uintptr(ptr) + uintptr(offset))) +} + +func skipWhiteSpace(buf []byte, cursor int64) int64 { + for isWhiteSpace[buf[cursor]] { + cursor++ + } + return cursor +} + +func skipObject(buf []byte, cursor, depth int64) (int64, error) { + braceCount := 1 + for { + switch buf[cursor] { + case '{': + braceCount++ + depth++ + if depth > maxDecodeNestingDepth { + return 0, errors.ErrExceededMaxDepth(buf[cursor], cursor) + } + case '}': + depth-- + braceCount-- + if braceCount == 0 { + return cursor + 1, nil + } + case '[': + depth++ + if depth > maxDecodeNestingDepth { + return 0, errors.ErrExceededMaxDepth(buf[cursor], cursor) + } + case ']': + depth-- + case '"': + for { + cursor++ + switch buf[cursor] { + case '\\': + cursor++ + if buf[cursor] == nul { + return 0, errors.ErrUnexpectedEndOfJSON("string of object", cursor) + } + case '"': + goto SWITCH_OUT + case nul: + return 0, errors.ErrUnexpectedEndOfJSON("string of object", cursor) + } + } + case nul: + return 0, errors.ErrUnexpectedEndOfJSON("object of object", cursor) + } + SWITCH_OUT: + cursor++ + } +} + +func skipArray(buf []byte, cursor, depth int64) (int64, error) { + bracketCount := 1 + for { + switch buf[cursor] { + case '[': + bracketCount++ + depth++ + if depth > maxDecodeNestingDepth { + return 0, errors.ErrExceededMaxDepth(buf[cursor], cursor) + } + case ']': + bracketCount-- + depth-- + if bracketCount == 0 { + return cursor + 1, nil + } + case '{': + depth++ + if depth > maxDecodeNestingDepth { + return 0, errors.ErrExceededMaxDepth(buf[cursor], cursor) + } + case '}': + depth-- + case '"': + for { + cursor++ + switch buf[cursor] { + case '\\': + cursor++ + if buf[cursor] == nul { + return 0, errors.ErrUnexpectedEndOfJSON("string of object", cursor) + } + case '"': + goto SWITCH_OUT + case nul: + return 0, errors.ErrUnexpectedEndOfJSON("string of object", cursor) + } + } + case nul: + return 0, errors.ErrUnexpectedEndOfJSON("array of object", cursor) + } + SWITCH_OUT: + cursor++ + } +} + +func skipValue(buf []byte, cursor, depth int64) (int64, error) { + for { + switch buf[cursor] { + case ' ', '\t', '\n', '\r': + cursor++ + continue + case '{': + return skipObject(buf, cursor+1, depth+1) + case '[': + return skipArray(buf, cursor+1, depth+1) + case '"': + for { + cursor++ + switch buf[cursor] { + case '\\': + cursor++ + if buf[cursor] == nul { + return 0, errors.ErrUnexpectedEndOfJSON("string of object", cursor) + } + case '"': + return cursor + 1, nil + case nul: + return 0, errors.ErrUnexpectedEndOfJSON("string of object", cursor) + } + } + case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + for { + cursor++ + if floatTable[buf[cursor]] { + continue + } + break + } + return cursor, nil + case 't': + if err := validateTrue(buf, cursor); err != nil { + return 0, err + } + cursor += 4 + return cursor, nil + case 'f': + if err := validateFalse(buf, cursor); err != nil { + return 0, err + } + cursor += 5 + return cursor, nil + case 'n': + if err := validateNull(buf, cursor); err != nil { + return 0, err + } + cursor += 4 + return cursor, nil + default: + return cursor, errors.ErrUnexpectedEndOfJSON("null", cursor) + } + } +} + +func validateTrue(buf []byte, cursor int64) error { + if cursor+3 >= int64(len(buf)) { + return errors.ErrUnexpectedEndOfJSON("true", cursor) + } + if buf[cursor+1] != 'r' { + return errors.ErrInvalidCharacter(buf[cursor+1], "true", cursor) + } + if buf[cursor+2] != 'u' { + return errors.ErrInvalidCharacter(buf[cursor+2], "true", cursor) + } + if buf[cursor+3] != 'e' { + return errors.ErrInvalidCharacter(buf[cursor+3], "true", cursor) + } + return nil +} + +func validateFalse(buf []byte, cursor int64) error { + if cursor+4 >= int64(len(buf)) { + return errors.ErrUnexpectedEndOfJSON("false", cursor) + } + if buf[cursor+1] != 'a' { + return errors.ErrInvalidCharacter(buf[cursor+1], "false", cursor) + } + if buf[cursor+2] != 'l' { + return errors.ErrInvalidCharacter(buf[cursor+2], "false", cursor) + } + if buf[cursor+3] != 's' { + return errors.ErrInvalidCharacter(buf[cursor+3], "false", cursor) + } + if buf[cursor+4] != 'e' { + return errors.ErrInvalidCharacter(buf[cursor+4], "false", cursor) + } + return nil +} + +func validateNull(buf []byte, cursor int64) error { + if cursor+3 >= int64(len(buf)) { + return errors.ErrUnexpectedEndOfJSON("null", cursor) + } + if buf[cursor+1] != 'u' { + return errors.ErrInvalidCharacter(buf[cursor+1], "null", cursor) + } + if buf[cursor+2] != 'l' { + return errors.ErrInvalidCharacter(buf[cursor+2], "null", cursor) + } + if buf[cursor+3] != 'l' { + return errors.ErrInvalidCharacter(buf[cursor+3], "null", cursor) + } + return nil +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/float.go b/vendor/github.com/goccy/go-json/internal/decoder/float.go new file mode 100644 index 000000000..9b2eb8b35 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/float.go @@ -0,0 +1,170 @@ +package decoder + +import ( + "strconv" + "unsafe" + + "github.com/goccy/go-json/internal/errors" +) + +type floatDecoder struct { + op func(unsafe.Pointer, float64) + structName string + fieldName string +} + +func newFloatDecoder(structName, fieldName string, op func(unsafe.Pointer, float64)) *floatDecoder { + return &floatDecoder{op: op, structName: structName, fieldName: fieldName} +} + +var ( + floatTable = [256]bool{ + '0': true, + '1': true, + '2': true, + '3': true, + '4': true, + '5': true, + '6': true, + '7': true, + '8': true, + '9': true, + '.': true, + 'e': true, + 'E': true, + '+': true, + '-': true, + } + + validEndNumberChar = [256]bool{ + nul: true, + ' ': true, + '\t': true, + '\r': true, + '\n': true, + ',': true, + ':': true, + '}': true, + ']': true, + } +) + +func floatBytes(s *Stream) []byte { + start := s.cursor + for { + s.cursor++ + if floatTable[s.char()] { + continue + } else if s.char() == nul { + if s.read() { + s.cursor-- // for retry current character + continue + } + } + break + } + return s.buf[start:s.cursor] +} + +func (d *floatDecoder) decodeStreamByte(s *Stream) ([]byte, error) { + for { + switch s.char() { + case ' ', '\n', '\t', '\r': + s.cursor++ + continue + case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + return floatBytes(s), nil + case 'n': + if err := nullBytes(s); err != nil { + return nil, err + } + return nil, nil + case nul: + if s.read() { + continue + } + goto ERROR + default: + goto ERROR + } + } +ERROR: + return nil, errors.ErrUnexpectedEndOfJSON("float", s.totalOffset()) +} + +func (d *floatDecoder) decodeByte(buf []byte, cursor int64) ([]byte, int64, error) { + for { + switch buf[cursor] { + case ' ', '\n', '\t', '\r': + cursor++ + continue + case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + start := cursor + cursor++ + for floatTable[buf[cursor]] { + cursor++ + } + num := buf[start:cursor] + return num, cursor, nil + case 'n': + if err := validateNull(buf, cursor); err != nil { + return nil, 0, err + } + cursor += 4 + return nil, cursor, nil + default: + return nil, 0, errors.ErrUnexpectedEndOfJSON("float", cursor) + } + } +} + +func (d *floatDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error { + bytes, err := d.decodeStreamByte(s) + if err != nil { + return err + } + if bytes == nil { + return nil + } + str := *(*string)(unsafe.Pointer(&bytes)) + f64, err := strconv.ParseFloat(str, 64) + if err != nil { + return errors.ErrSyntax(err.Error(), s.totalOffset()) + } + d.op(p, f64) + return nil +} + +func (d *floatDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) { + buf := ctx.Buf + bytes, c, err := d.decodeByte(buf, cursor) + if err != nil { + return 0, err + } + if bytes == nil { + return c, nil + } + cursor = c + if !validEndNumberChar[buf[cursor]] { + return 0, errors.ErrUnexpectedEndOfJSON("float", cursor) + } + s := *(*string)(unsafe.Pointer(&bytes)) + f64, err := strconv.ParseFloat(s, 64) + if err != nil { + return 0, errors.ErrSyntax(err.Error(), cursor) + } + d.op(p, f64) + return cursor, nil +} + +func (d *floatDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) { + buf := ctx.Buf + bytes, c, err := d.decodeByte(buf, cursor) + if err != nil { + return nil, 0, err + } + if bytes == nil { + return [][]byte{nullbytes}, c, nil + } + return [][]byte{bytes}, c, nil +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/func.go b/vendor/github.com/goccy/go-json/internal/decoder/func.go new file mode 100644 index 000000000..4cc12ca81 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/func.go @@ -0,0 +1,146 @@ +package decoder + +import ( + "bytes" + "fmt" + "unsafe" + + "github.com/goccy/go-json/internal/errors" + "github.com/goccy/go-json/internal/runtime" +) + +type funcDecoder struct { + typ *runtime.Type + structName string + fieldName string +} + +func newFuncDecoder(typ *runtime.Type, structName, fieldName string) *funcDecoder { + fnDecoder := &funcDecoder{typ, structName, fieldName} + return fnDecoder +} + +func (d *funcDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error { + s.skipWhiteSpace() + start := s.cursor + if err := s.skipValue(depth); err != nil { + return err + } + src := s.buf[start:s.cursor] + if len(src) > 0 { + switch src[0] { + case '"': + return &errors.UnmarshalTypeError{ + Value: "string", + Type: runtime.RType2Type(d.typ), + Offset: s.totalOffset(), + } + case '[': + return &errors.UnmarshalTypeError{ + Value: "array", + Type: runtime.RType2Type(d.typ), + Offset: s.totalOffset(), + } + case '{': + return &errors.UnmarshalTypeError{ + Value: "object", + Type: runtime.RType2Type(d.typ), + Offset: s.totalOffset(), + } + case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + return &errors.UnmarshalTypeError{ + Value: "number", + Type: runtime.RType2Type(d.typ), + Offset: s.totalOffset(), + } + case 'n': + if err := nullBytes(s); err != nil { + return err + } + *(*unsafe.Pointer)(p) = nil + return nil + case 't': + if err := trueBytes(s); err == nil { + return &errors.UnmarshalTypeError{ + Value: "boolean", + Type: runtime.RType2Type(d.typ), + Offset: s.totalOffset(), + } + } + case 'f': + if err := falseBytes(s); err == nil { + return &errors.UnmarshalTypeError{ + Value: "boolean", + Type: runtime.RType2Type(d.typ), + Offset: s.totalOffset(), + } + } + } + } + return errors.ErrInvalidBeginningOfValue(s.buf[s.cursor], s.totalOffset()) +} + +func (d *funcDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) { + buf := ctx.Buf + cursor = skipWhiteSpace(buf, cursor) + start := cursor + end, err := skipValue(buf, cursor, depth) + if err != nil { + return 0, err + } + src := buf[start:end] + if len(src) > 0 { + switch src[0] { + case '"': + return 0, &errors.UnmarshalTypeError{ + Value: "string", + Type: runtime.RType2Type(d.typ), + Offset: start, + } + case '[': + return 0, &errors.UnmarshalTypeError{ + Value: "array", + Type: runtime.RType2Type(d.typ), + Offset: start, + } + case '{': + return 0, &errors.UnmarshalTypeError{ + Value: "object", + Type: runtime.RType2Type(d.typ), + Offset: start, + } + case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + return 0, &errors.UnmarshalTypeError{ + Value: "number", + Type: runtime.RType2Type(d.typ), + Offset: start, + } + case 'n': + if bytes.Equal(src, nullbytes) { + *(*unsafe.Pointer)(p) = nil + return end, nil + } + case 't': + if err := validateTrue(buf, start); err == nil { + return 0, &errors.UnmarshalTypeError{ + Value: "boolean", + Type: runtime.RType2Type(d.typ), + Offset: start, + } + } + case 'f': + if err := validateFalse(buf, start); err == nil { + return 0, &errors.UnmarshalTypeError{ + Value: "boolean", + Type: runtime.RType2Type(d.typ), + Offset: start, + } + } + } + } + return cursor, errors.ErrInvalidBeginningOfValue(buf[cursor], cursor) +} + +func (d *funcDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) { + return nil, 0, fmt.Errorf("json: func decoder does not support decode path") +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/int.go b/vendor/github.com/goccy/go-json/internal/decoder/int.go new file mode 100644 index 000000000..1a7f08199 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/int.go @@ -0,0 +1,246 @@ +package decoder + +import ( + "fmt" + "reflect" + "unsafe" + + "github.com/goccy/go-json/internal/errors" + "github.com/goccy/go-json/internal/runtime" +) + +type intDecoder struct { + typ *runtime.Type + kind reflect.Kind + op func(unsafe.Pointer, int64) + structName string + fieldName string +} + +func newIntDecoder(typ *runtime.Type, structName, fieldName string, op func(unsafe.Pointer, int64)) *intDecoder { + return &intDecoder{ + typ: typ, + kind: typ.Kind(), + op: op, + structName: structName, + fieldName: fieldName, + } +} + +func (d *intDecoder) typeError(buf []byte, offset int64) *errors.UnmarshalTypeError { + return &errors.UnmarshalTypeError{ + Value: fmt.Sprintf("number %s", string(buf)), + Type: runtime.RType2Type(d.typ), + Struct: d.structName, + Field: d.fieldName, + Offset: offset, + } +} + +var ( + pow10i64 = [...]int64{ + 1e00, 1e01, 1e02, 1e03, 1e04, 1e05, 1e06, 1e07, 1e08, 1e09, + 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, + } + pow10i64Len = len(pow10i64) +) + +func (d *intDecoder) parseInt(b []byte) (int64, error) { + isNegative := false + if b[0] == '-' { + b = b[1:] + isNegative = true + } + maxDigit := len(b) + if maxDigit > pow10i64Len { + return 0, fmt.Errorf("invalid length of number") + } + sum := int64(0) + for i := 0; i < maxDigit; i++ { + c := int64(b[i]) - 48 + digitValue := pow10i64[maxDigit-i-1] + sum += c * digitValue + } + if isNegative { + return -1 * sum, nil + } + return sum, nil +} + +var ( + numTable = [256]bool{ + '0': true, + '1': true, + '2': true, + '3': true, + '4': true, + '5': true, + '6': true, + '7': true, + '8': true, + '9': true, + } +) + +var ( + numZeroBuf = []byte{'0'} +) + +func (d *intDecoder) decodeStreamByte(s *Stream) ([]byte, error) { + for { + switch s.char() { + case ' ', '\n', '\t', '\r': + s.cursor++ + continue + case '-': + start := s.cursor + for { + s.cursor++ + if numTable[s.char()] { + continue + } else if s.char() == nul { + if s.read() { + s.cursor-- // for retry current character + continue + } + } + break + } + num := s.buf[start:s.cursor] + if len(num) < 2 { + goto ERROR + } + return num, nil + case '0': + s.cursor++ + return numZeroBuf, nil + case '1', '2', '3', '4', '5', '6', '7', '8', '9': + start := s.cursor + for { + s.cursor++ + if numTable[s.char()] { + continue + } else if s.char() == nul { + if s.read() { + s.cursor-- // for retry current character + continue + } + } + break + } + num := s.buf[start:s.cursor] + return num, nil + case 'n': + if err := nullBytes(s); err != nil { + return nil, err + } + return nil, nil + case nul: + if s.read() { + continue + } + goto ERROR + default: + return nil, d.typeError([]byte{s.char()}, s.totalOffset()) + } + } +ERROR: + return nil, errors.ErrUnexpectedEndOfJSON("number(integer)", s.totalOffset()) +} + +func (d *intDecoder) decodeByte(buf []byte, cursor int64) ([]byte, int64, error) { + b := (*sliceHeader)(unsafe.Pointer(&buf)).data + for { + switch char(b, cursor) { + case ' ', '\n', '\t', '\r': + cursor++ + continue + case '0': + cursor++ + return numZeroBuf, cursor, nil + case '-', '1', '2', '3', '4', '5', '6', '7', '8', '9': + start := cursor + cursor++ + for numTable[char(b, cursor)] { + cursor++ + } + num := buf[start:cursor] + return num, cursor, nil + case 'n': + if err := validateNull(buf, cursor); err != nil { + return nil, 0, err + } + cursor += 4 + return nil, cursor, nil + default: + return nil, 0, d.typeError([]byte{char(b, cursor)}, cursor) + } + } +} + +func (d *intDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error { + bytes, err := d.decodeStreamByte(s) + if err != nil { + return err + } + if bytes == nil { + return nil + } + i64, err := d.parseInt(bytes) + if err != nil { + return d.typeError(bytes, s.totalOffset()) + } + switch d.kind { + case reflect.Int8: + if i64 < -1*(1<<7) || (1<<7) <= i64 { + return d.typeError(bytes, s.totalOffset()) + } + case reflect.Int16: + if i64 < -1*(1<<15) || (1<<15) <= i64 { + return d.typeError(bytes, s.totalOffset()) + } + case reflect.Int32: + if i64 < -1*(1<<31) || (1<<31) <= i64 { + return d.typeError(bytes, s.totalOffset()) + } + } + d.op(p, i64) + s.reset() + return nil +} + +func (d *intDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) { + bytes, c, err := d.decodeByte(ctx.Buf, cursor) + if err != nil { + return 0, err + } + if bytes == nil { + return c, nil + } + cursor = c + + i64, err := d.parseInt(bytes) + if err != nil { + return 0, d.typeError(bytes, cursor) + } + switch d.kind { + case reflect.Int8: + if i64 < -1*(1<<7) || (1<<7) <= i64 { + return 0, d.typeError(bytes, cursor) + } + case reflect.Int16: + if i64 < -1*(1<<15) || (1<<15) <= i64 { + return 0, d.typeError(bytes, cursor) + } + case reflect.Int32: + if i64 < -1*(1<<31) || (1<<31) <= i64 { + return 0, d.typeError(bytes, cursor) + } + } + d.op(p, i64) + return cursor, nil +} + +func (d *intDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) { + return nil, 0, fmt.Errorf("json: int decoder does not support decode path") +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/interface.go b/vendor/github.com/goccy/go-json/internal/decoder/interface.go new file mode 100644 index 000000000..45c69ab8c --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/interface.go @@ -0,0 +1,528 @@ +package decoder + +import ( + "bytes" + "encoding" + "encoding/json" + "reflect" + "unsafe" + + "github.com/goccy/go-json/internal/errors" + "github.com/goccy/go-json/internal/runtime" +) + +type interfaceDecoder struct { + typ *runtime.Type + structName string + fieldName string + sliceDecoder *sliceDecoder + mapDecoder *mapDecoder + floatDecoder *floatDecoder + numberDecoder *numberDecoder + stringDecoder *stringDecoder +} + +func newEmptyInterfaceDecoder(structName, fieldName string) *interfaceDecoder { + ifaceDecoder := &interfaceDecoder{ + typ: emptyInterfaceType, + structName: structName, + fieldName: fieldName, + floatDecoder: newFloatDecoder(structName, fieldName, func(p unsafe.Pointer, v float64) { + *(*interface{})(p) = v + }), + numberDecoder: newNumberDecoder(structName, fieldName, func(p unsafe.Pointer, v json.Number) { + *(*interface{})(p) = v + }), + stringDecoder: newStringDecoder(structName, fieldName), + } + ifaceDecoder.sliceDecoder = newSliceDecoder( + ifaceDecoder, + emptyInterfaceType, + emptyInterfaceType.Size(), + structName, fieldName, + ) + ifaceDecoder.mapDecoder = newMapDecoder( + interfaceMapType, + stringType, + ifaceDecoder.stringDecoder, + interfaceMapType.Elem(), + ifaceDecoder, + structName, + fieldName, + ) + return ifaceDecoder +} + +func newInterfaceDecoder(typ *runtime.Type, structName, fieldName string) *interfaceDecoder { + emptyIfaceDecoder := newEmptyInterfaceDecoder(structName, fieldName) + stringDecoder := newStringDecoder(structName, fieldName) + return &interfaceDecoder{ + typ: typ, + structName: structName, + fieldName: fieldName, + sliceDecoder: newSliceDecoder( + emptyIfaceDecoder, + emptyInterfaceType, + emptyInterfaceType.Size(), + structName, fieldName, + ), + mapDecoder: newMapDecoder( + interfaceMapType, + stringType, + stringDecoder, + interfaceMapType.Elem(), + emptyIfaceDecoder, + structName, + fieldName, + ), + floatDecoder: newFloatDecoder(structName, fieldName, func(p unsafe.Pointer, v float64) { + *(*interface{})(p) = v + }), + numberDecoder: newNumberDecoder(structName, fieldName, func(p unsafe.Pointer, v json.Number) { + *(*interface{})(p) = v + }), + stringDecoder: stringDecoder, + } +} + +func (d *interfaceDecoder) numDecoder(s *Stream) Decoder { + if s.UseNumber { + return d.numberDecoder + } + return d.floatDecoder +} + +var ( + emptyInterfaceType = runtime.Type2RType(reflect.TypeOf((*interface{})(nil)).Elem()) + EmptyInterfaceType = emptyInterfaceType + interfaceMapType = runtime.Type2RType( + reflect.TypeOf((*map[string]interface{})(nil)).Elem(), + ) + stringType = runtime.Type2RType( + reflect.TypeOf(""), + ) +) + +func decodeStreamUnmarshaler(s *Stream, depth int64, unmarshaler json.Unmarshaler) error { + start := s.cursor + if err := s.skipValue(depth); err != nil { + return err + } + src := s.buf[start:s.cursor] + dst := make([]byte, len(src)) + copy(dst, src) + + if err := unmarshaler.UnmarshalJSON(dst); err != nil { + return err + } + return nil +} + +func decodeStreamUnmarshalerContext(s *Stream, depth int64, unmarshaler unmarshalerContext) error { + start := s.cursor + if err := s.skipValue(depth); err != nil { + return err + } + src := s.buf[start:s.cursor] + dst := make([]byte, len(src)) + copy(dst, src) + + if err := unmarshaler.UnmarshalJSON(s.Option.Context, dst); err != nil { + return err + } + return nil +} + +func decodeUnmarshaler(buf []byte, cursor, depth int64, unmarshaler json.Unmarshaler) (int64, error) { + cursor = skipWhiteSpace(buf, cursor) + start := cursor + end, err := skipValue(buf, cursor, depth) + if err != nil { + return 0, err + } + src := buf[start:end] + dst := make([]byte, len(src)) + copy(dst, src) + + if err := unmarshaler.UnmarshalJSON(dst); err != nil { + return 0, err + } + return end, nil +} + +func decodeUnmarshalerContext(ctx *RuntimeContext, buf []byte, cursor, depth int64, unmarshaler unmarshalerContext) (int64, error) { + cursor = skipWhiteSpace(buf, cursor) + start := cursor + end, err := skipValue(buf, cursor, depth) + if err != nil { + return 0, err + } + src := buf[start:end] + dst := make([]byte, len(src)) + copy(dst, src) + + if err := unmarshaler.UnmarshalJSON(ctx.Option.Context, dst); err != nil { + return 0, err + } + return end, nil +} + +func decodeStreamTextUnmarshaler(s *Stream, depth int64, unmarshaler encoding.TextUnmarshaler, p unsafe.Pointer) error { + start := s.cursor + if err := s.skipValue(depth); err != nil { + return err + } + src := s.buf[start:s.cursor] + if bytes.Equal(src, nullbytes) { + *(*unsafe.Pointer)(p) = nil + return nil + } + + dst := make([]byte, len(src)) + copy(dst, src) + + if err := unmarshaler.UnmarshalText(dst); err != nil { + return err + } + return nil +} + +func decodeTextUnmarshaler(buf []byte, cursor, depth int64, unmarshaler encoding.TextUnmarshaler, p unsafe.Pointer) (int64, error) { + cursor = skipWhiteSpace(buf, cursor) + start := cursor + end, err := skipValue(buf, cursor, depth) + if err != nil { + return 0, err + } + src := buf[start:end] + if bytes.Equal(src, nullbytes) { + *(*unsafe.Pointer)(p) = nil + return end, nil + } + if s, ok := unquoteBytes(src); ok { + src = s + } + if err := unmarshaler.UnmarshalText(src); err != nil { + return 0, err + } + return end, nil +} + +func (d *interfaceDecoder) decodeStreamEmptyInterface(s *Stream, depth int64, p unsafe.Pointer) error { + c := s.skipWhiteSpace() + for { + switch c { + case '{': + var v map[string]interface{} + ptr := unsafe.Pointer(&v) + if err := d.mapDecoder.DecodeStream(s, depth, ptr); err != nil { + return err + } + *(*interface{})(p) = v + return nil + case '[': + var v []interface{} + ptr := unsafe.Pointer(&v) + if err := d.sliceDecoder.DecodeStream(s, depth, ptr); err != nil { + return err + } + *(*interface{})(p) = v + return nil + case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + return d.numDecoder(s).DecodeStream(s, depth, p) + case '"': + s.cursor++ + start := s.cursor + for { + switch s.char() { + case '\\': + if _, err := decodeEscapeString(s, nil); err != nil { + return err + } + case '"': + literal := s.buf[start:s.cursor] + s.cursor++ + *(*interface{})(p) = string(literal) + return nil + case nul: + if s.read() { + continue + } + return errors.ErrUnexpectedEndOfJSON("string", s.totalOffset()) + } + s.cursor++ + } + case 't': + if err := trueBytes(s); err != nil { + return err + } + **(**interface{})(unsafe.Pointer(&p)) = true + return nil + case 'f': + if err := falseBytes(s); err != nil { + return err + } + **(**interface{})(unsafe.Pointer(&p)) = false + return nil + case 'n': + if err := nullBytes(s); err != nil { + return err + } + *(*interface{})(p) = nil + return nil + case nul: + if s.read() { + c = s.char() + continue + } + } + break + } + return errors.ErrInvalidBeginningOfValue(c, s.totalOffset()) +} + +type emptyInterface struct { + typ *runtime.Type + ptr unsafe.Pointer +} + +func (d *interfaceDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error { + runtimeInterfaceValue := *(*interface{})(unsafe.Pointer(&emptyInterface{ + typ: d.typ, + ptr: p, + })) + rv := reflect.ValueOf(runtimeInterfaceValue) + if rv.NumMethod() > 0 && rv.CanInterface() { + if u, ok := rv.Interface().(unmarshalerContext); ok { + return decodeStreamUnmarshalerContext(s, depth, u) + } + if u, ok := rv.Interface().(json.Unmarshaler); ok { + return decodeStreamUnmarshaler(s, depth, u) + } + if u, ok := rv.Interface().(encoding.TextUnmarshaler); ok { + return decodeStreamTextUnmarshaler(s, depth, u, p) + } + if s.skipWhiteSpace() == 'n' { + if err := nullBytes(s); err != nil { + return err + } + *(*interface{})(p) = nil + return nil + } + return d.errUnmarshalType(rv.Type(), s.totalOffset()) + } + iface := rv.Interface() + ifaceHeader := (*emptyInterface)(unsafe.Pointer(&iface)) + typ := ifaceHeader.typ + if ifaceHeader.ptr == nil || d.typ == typ || typ == nil { + // concrete type is empty interface + return d.decodeStreamEmptyInterface(s, depth, p) + } + if typ.Kind() == reflect.Ptr && typ.Elem() == d.typ || typ.Kind() != reflect.Ptr { + return d.decodeStreamEmptyInterface(s, depth, p) + } + if s.skipWhiteSpace() == 'n' { + if err := nullBytes(s); err != nil { + return err + } + *(*interface{})(p) = nil + return nil + } + decoder, err := CompileToGetDecoder(typ) + if err != nil { + return err + } + return decoder.DecodeStream(s, depth, ifaceHeader.ptr) +} + +func (d *interfaceDecoder) errUnmarshalType(typ reflect.Type, offset int64) *errors.UnmarshalTypeError { + return &errors.UnmarshalTypeError{ + Value: typ.String(), + Type: typ, + Offset: offset, + Struct: d.structName, + Field: d.fieldName, + } +} + +func (d *interfaceDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) { + buf := ctx.Buf + runtimeInterfaceValue := *(*interface{})(unsafe.Pointer(&emptyInterface{ + typ: d.typ, + ptr: p, + })) + rv := reflect.ValueOf(runtimeInterfaceValue) + if rv.NumMethod() > 0 && rv.CanInterface() { + if u, ok := rv.Interface().(unmarshalerContext); ok { + return decodeUnmarshalerContext(ctx, buf, cursor, depth, u) + } + if u, ok := rv.Interface().(json.Unmarshaler); ok { + return decodeUnmarshaler(buf, cursor, depth, u) + } + if u, ok := rv.Interface().(encoding.TextUnmarshaler); ok { + return decodeTextUnmarshaler(buf, cursor, depth, u, p) + } + cursor = skipWhiteSpace(buf, cursor) + if buf[cursor] == 'n' { + if err := validateNull(buf, cursor); err != nil { + return 0, err + } + cursor += 4 + **(**interface{})(unsafe.Pointer(&p)) = nil + return cursor, nil + } + return 0, d.errUnmarshalType(rv.Type(), cursor) + } + + iface := rv.Interface() + ifaceHeader := (*emptyInterface)(unsafe.Pointer(&iface)) + typ := ifaceHeader.typ + if ifaceHeader.ptr == nil || d.typ == typ || typ == nil { + // concrete type is empty interface + return d.decodeEmptyInterface(ctx, cursor, depth, p) + } + if typ.Kind() == reflect.Ptr && typ.Elem() == d.typ || typ.Kind() != reflect.Ptr { + return d.decodeEmptyInterface(ctx, cursor, depth, p) + } + cursor = skipWhiteSpace(buf, cursor) + if buf[cursor] == 'n' { + if err := validateNull(buf, cursor); err != nil { + return 0, err + } + cursor += 4 + **(**interface{})(unsafe.Pointer(&p)) = nil + return cursor, nil + } + decoder, err := CompileToGetDecoder(typ) + if err != nil { + return 0, err + } + return decoder.Decode(ctx, cursor, depth, ifaceHeader.ptr) +} + +func (d *interfaceDecoder) decodeEmptyInterface(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) { + buf := ctx.Buf + cursor = skipWhiteSpace(buf, cursor) + switch buf[cursor] { + case '{': + var v map[string]interface{} + ptr := unsafe.Pointer(&v) + cursor, err := d.mapDecoder.Decode(ctx, cursor, depth, ptr) + if err != nil { + return 0, err + } + **(**interface{})(unsafe.Pointer(&p)) = v + return cursor, nil + case '[': + var v []interface{} + ptr := unsafe.Pointer(&v) + cursor, err := d.sliceDecoder.Decode(ctx, cursor, depth, ptr) + if err != nil { + return 0, err + } + **(**interface{})(unsafe.Pointer(&p)) = v + return cursor, nil + case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + return d.floatDecoder.Decode(ctx, cursor, depth, p) + case '"': + var v string + ptr := unsafe.Pointer(&v) + cursor, err := d.stringDecoder.Decode(ctx, cursor, depth, ptr) + if err != nil { + return 0, err + } + **(**interface{})(unsafe.Pointer(&p)) = v + return cursor, nil + case 't': + if err := validateTrue(buf, cursor); err != nil { + return 0, err + } + cursor += 4 + **(**interface{})(unsafe.Pointer(&p)) = true + return cursor, nil + case 'f': + if err := validateFalse(buf, cursor); err != nil { + return 0, err + } + cursor += 5 + **(**interface{})(unsafe.Pointer(&p)) = false + return cursor, nil + case 'n': + if err := validateNull(buf, cursor); err != nil { + return 0, err + } + cursor += 4 + **(**interface{})(unsafe.Pointer(&p)) = nil + return cursor, nil + } + return cursor, errors.ErrInvalidBeginningOfValue(buf[cursor], cursor) +} + +func NewPathDecoder() Decoder { + ifaceDecoder := &interfaceDecoder{ + typ: emptyInterfaceType, + structName: "", + fieldName: "", + floatDecoder: newFloatDecoder("", "", func(p unsafe.Pointer, v float64) { + *(*interface{})(p) = v + }), + numberDecoder: newNumberDecoder("", "", func(p unsafe.Pointer, v json.Number) { + *(*interface{})(p) = v + }), + stringDecoder: newStringDecoder("", ""), + } + ifaceDecoder.sliceDecoder = newSliceDecoder( + ifaceDecoder, + emptyInterfaceType, + emptyInterfaceType.Size(), + "", "", + ) + ifaceDecoder.mapDecoder = newMapDecoder( + interfaceMapType, + stringType, + ifaceDecoder.stringDecoder, + interfaceMapType.Elem(), + ifaceDecoder, + "", "", + ) + return ifaceDecoder +} + +var ( + truebytes = []byte("true") + falsebytes = []byte("false") +) + +func (d *interfaceDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) { + buf := ctx.Buf + cursor = skipWhiteSpace(buf, cursor) + switch buf[cursor] { + case '{': + return d.mapDecoder.DecodePath(ctx, cursor, depth) + case '[': + return d.sliceDecoder.DecodePath(ctx, cursor, depth) + case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + return d.floatDecoder.DecodePath(ctx, cursor, depth) + case '"': + return d.stringDecoder.DecodePath(ctx, cursor, depth) + case 't': + if err := validateTrue(buf, cursor); err != nil { + return nil, 0, err + } + cursor += 4 + return [][]byte{truebytes}, cursor, nil + case 'f': + if err := validateFalse(buf, cursor); err != nil { + return nil, 0, err + } + cursor += 5 + return [][]byte{falsebytes}, cursor, nil + case 'n': + if err := validateNull(buf, cursor); err != nil { + return nil, 0, err + } + cursor += 4 + return [][]byte{nullbytes}, cursor, nil + } + return nil, cursor, errors.ErrInvalidBeginningOfValue(buf[cursor], cursor) +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/invalid.go b/vendor/github.com/goccy/go-json/internal/decoder/invalid.go new file mode 100644 index 000000000..4c9721b09 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/invalid.go @@ -0,0 +1,55 @@ +package decoder + +import ( + "reflect" + "unsafe" + + "github.com/goccy/go-json/internal/errors" + "github.com/goccy/go-json/internal/runtime" +) + +type invalidDecoder struct { + typ *runtime.Type + kind reflect.Kind + structName string + fieldName string +} + +func newInvalidDecoder(typ *runtime.Type, structName, fieldName string) *invalidDecoder { + return &invalidDecoder{ + typ: typ, + kind: typ.Kind(), + structName: structName, + fieldName: fieldName, + } +} + +func (d *invalidDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error { + return &errors.UnmarshalTypeError{ + Value: "object", + Type: runtime.RType2Type(d.typ), + Offset: s.totalOffset(), + Struct: d.structName, + Field: d.fieldName, + } +} + +func (d *invalidDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) { + return 0, &errors.UnmarshalTypeError{ + Value: "object", + Type: runtime.RType2Type(d.typ), + Offset: cursor, + Struct: d.structName, + Field: d.fieldName, + } +} + +func (d *invalidDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) { + return nil, 0, &errors.UnmarshalTypeError{ + Value: "object", + Type: runtime.RType2Type(d.typ), + Offset: cursor, + Struct: d.structName, + Field: d.fieldName, + } +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/map.go b/vendor/github.com/goccy/go-json/internal/decoder/map.go new file mode 100644 index 000000000..07a9caea6 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/map.go @@ -0,0 +1,280 @@ +package decoder + +import ( + "reflect" + "unsafe" + + "github.com/goccy/go-json/internal/errors" + "github.com/goccy/go-json/internal/runtime" +) + +type mapDecoder struct { + mapType *runtime.Type + keyType *runtime.Type + valueType *runtime.Type + canUseAssignFaststrType bool + keyDecoder Decoder + valueDecoder Decoder + structName string + fieldName string +} + +func newMapDecoder(mapType *runtime.Type, keyType *runtime.Type, keyDec Decoder, valueType *runtime.Type, valueDec Decoder, structName, fieldName string) *mapDecoder { + return &mapDecoder{ + mapType: mapType, + keyDecoder: keyDec, + keyType: keyType, + canUseAssignFaststrType: canUseAssignFaststrType(keyType, valueType), + valueType: valueType, + valueDecoder: valueDec, + structName: structName, + fieldName: fieldName, + } +} + +const ( + mapMaxElemSize = 128 +) + +// See detail: https://github.com/goccy/go-json/pull/283 +func canUseAssignFaststrType(key *runtime.Type, value *runtime.Type) bool { + indirectElem := value.Size() > mapMaxElemSize + if indirectElem { + return false + } + return key.Kind() == reflect.String +} + +//go:linkname makemap reflect.makemap +func makemap(*runtime.Type, int) unsafe.Pointer + +//nolint:golint +//go:linkname mapassign_faststr runtime.mapassign_faststr +//go:noescape +func mapassign_faststr(t *runtime.Type, m unsafe.Pointer, s string) unsafe.Pointer + +//go:linkname mapassign reflect.mapassign +//go:noescape +func mapassign(t *runtime.Type, m unsafe.Pointer, k, v unsafe.Pointer) + +func (d *mapDecoder) mapassign(t *runtime.Type, m, k, v unsafe.Pointer) { + if d.canUseAssignFaststrType { + mapV := mapassign_faststr(t, m, *(*string)(k)) + typedmemmove(d.valueType, mapV, v) + } else { + mapassign(t, m, k, v) + } +} + +func (d *mapDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error { + depth++ + if depth > maxDecodeNestingDepth { + return errors.ErrExceededMaxDepth(s.char(), s.cursor) + } + + switch s.skipWhiteSpace() { + case 'n': + if err := nullBytes(s); err != nil { + return err + } + **(**unsafe.Pointer)(unsafe.Pointer(&p)) = nil + return nil + case '{': + default: + return errors.ErrExpected("{ character for map value", s.totalOffset()) + } + mapValue := *(*unsafe.Pointer)(p) + if mapValue == nil { + mapValue = makemap(d.mapType, 0) + } + s.cursor++ + if s.skipWhiteSpace() == '}' { + *(*unsafe.Pointer)(p) = mapValue + s.cursor++ + return nil + } + for { + k := unsafe_New(d.keyType) + if err := d.keyDecoder.DecodeStream(s, depth, k); err != nil { + return err + } + s.skipWhiteSpace() + if !s.equalChar(':') { + return errors.ErrExpected("colon after object key", s.totalOffset()) + } + s.cursor++ + v := unsafe_New(d.valueType) + if err := d.valueDecoder.DecodeStream(s, depth, v); err != nil { + return err + } + d.mapassign(d.mapType, mapValue, k, v) + s.skipWhiteSpace() + if s.equalChar('}') { + **(**unsafe.Pointer)(unsafe.Pointer(&p)) = mapValue + s.cursor++ + return nil + } + if !s.equalChar(',') { + return errors.ErrExpected("comma after object value", s.totalOffset()) + } + s.cursor++ + } +} + +func (d *mapDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) { + buf := ctx.Buf + depth++ + if depth > maxDecodeNestingDepth { + return 0, errors.ErrExceededMaxDepth(buf[cursor], cursor) + } + + cursor = skipWhiteSpace(buf, cursor) + buflen := int64(len(buf)) + if buflen < 2 { + return 0, errors.ErrExpected("{} for map", cursor) + } + switch buf[cursor] { + case 'n': + if err := validateNull(buf, cursor); err != nil { + return 0, err + } + cursor += 4 + **(**unsafe.Pointer)(unsafe.Pointer(&p)) = nil + return cursor, nil + case '{': + default: + return 0, errors.ErrExpected("{ character for map value", cursor) + } + cursor++ + cursor = skipWhiteSpace(buf, cursor) + mapValue := *(*unsafe.Pointer)(p) + if mapValue == nil { + mapValue = makemap(d.mapType, 0) + } + if buf[cursor] == '}' { + **(**unsafe.Pointer)(unsafe.Pointer(&p)) = mapValue + cursor++ + return cursor, nil + } + for { + k := unsafe_New(d.keyType) + keyCursor, err := d.keyDecoder.Decode(ctx, cursor, depth, k) + if err != nil { + return 0, err + } + cursor = skipWhiteSpace(buf, keyCursor) + if buf[cursor] != ':' { + return 0, errors.ErrExpected("colon after object key", cursor) + } + cursor++ + v := unsafe_New(d.valueType) + valueCursor, err := d.valueDecoder.Decode(ctx, cursor, depth, v) + if err != nil { + return 0, err + } + d.mapassign(d.mapType, mapValue, k, v) + cursor = skipWhiteSpace(buf, valueCursor) + if buf[cursor] == '}' { + **(**unsafe.Pointer)(unsafe.Pointer(&p)) = mapValue + cursor++ + return cursor, nil + } + if buf[cursor] != ',' { + return 0, errors.ErrExpected("comma after object value", cursor) + } + cursor++ + } +} + +func (d *mapDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) { + buf := ctx.Buf + depth++ + if depth > maxDecodeNestingDepth { + return nil, 0, errors.ErrExceededMaxDepth(buf[cursor], cursor) + } + + cursor = skipWhiteSpace(buf, cursor) + buflen := int64(len(buf)) + if buflen < 2 { + return nil, 0, errors.ErrExpected("{} for map", cursor) + } + switch buf[cursor] { + case 'n': + if err := validateNull(buf, cursor); err != nil { + return nil, 0, err + } + cursor += 4 + return [][]byte{nullbytes}, cursor, nil + case '{': + default: + return nil, 0, errors.ErrExpected("{ character for map value", cursor) + } + cursor++ + cursor = skipWhiteSpace(buf, cursor) + if buf[cursor] == '}' { + cursor++ + return nil, cursor, nil + } + keyDecoder, ok := d.keyDecoder.(*stringDecoder) + if !ok { + return nil, 0, &errors.UnmarshalTypeError{ + Value: "string", + Type: reflect.TypeOf(""), + Offset: cursor, + Struct: d.structName, + Field: d.fieldName, + } + } + ret := [][]byte{} + for { + key, keyCursor, err := keyDecoder.decodeByte(buf, cursor) + if err != nil { + return nil, 0, err + } + cursor = skipWhiteSpace(buf, keyCursor) + if buf[cursor] != ':' { + return nil, 0, errors.ErrExpected("colon after object key", cursor) + } + cursor++ + child, found, err := ctx.Option.Path.Field(string(key)) + if err != nil { + return nil, 0, err + } + if found { + if child != nil { + oldPath := ctx.Option.Path.node + ctx.Option.Path.node = child + paths, c, err := d.valueDecoder.DecodePath(ctx, cursor, depth) + if err != nil { + return nil, 0, err + } + ctx.Option.Path.node = oldPath + ret = append(ret, paths...) + cursor = c + } else { + start := cursor + end, err := skipValue(buf, cursor, depth) + if err != nil { + return nil, 0, err + } + ret = append(ret, buf[start:end]) + cursor = end + } + } else { + c, err := skipValue(buf, cursor, depth) + if err != nil { + return nil, 0, err + } + cursor = c + } + cursor = skipWhiteSpace(buf, cursor) + if buf[cursor] == '}' { + cursor++ + return ret, cursor, nil + } + if buf[cursor] != ',' { + return nil, 0, errors.ErrExpected("comma after object value", cursor) + } + cursor++ + } +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/number.go b/vendor/github.com/goccy/go-json/internal/decoder/number.go new file mode 100644 index 000000000..10e5435e6 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/number.go @@ -0,0 +1,123 @@ +package decoder + +import ( + "encoding/json" + "strconv" + "unsafe" + + "github.com/goccy/go-json/internal/errors" +) + +type numberDecoder struct { + stringDecoder *stringDecoder + op func(unsafe.Pointer, json.Number) + structName string + fieldName string +} + +func newNumberDecoder(structName, fieldName string, op func(unsafe.Pointer, json.Number)) *numberDecoder { + return &numberDecoder{ + stringDecoder: newStringDecoder(structName, fieldName), + op: op, + structName: structName, + fieldName: fieldName, + } +} + +func (d *numberDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error { + bytes, err := d.decodeStreamByte(s) + if err != nil { + return err + } + if _, err := strconv.ParseFloat(*(*string)(unsafe.Pointer(&bytes)), 64); err != nil { + return errors.ErrSyntax(err.Error(), s.totalOffset()) + } + d.op(p, json.Number(string(bytes))) + s.reset() + return nil +} + +func (d *numberDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) { + bytes, c, err := d.decodeByte(ctx.Buf, cursor) + if err != nil { + return 0, err + } + if _, err := strconv.ParseFloat(*(*string)(unsafe.Pointer(&bytes)), 64); err != nil { + return 0, errors.ErrSyntax(err.Error(), c) + } + cursor = c + s := *(*string)(unsafe.Pointer(&bytes)) + d.op(p, json.Number(s)) + return cursor, nil +} + +func (d *numberDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) { + bytes, c, err := d.decodeByte(ctx.Buf, cursor) + if err != nil { + return nil, 0, err + } + if bytes == nil { + return [][]byte{nullbytes}, c, nil + } + return [][]byte{bytes}, c, nil +} + +func (d *numberDecoder) decodeStreamByte(s *Stream) ([]byte, error) { + start := s.cursor + for { + switch s.char() { + case ' ', '\n', '\t', '\r': + s.cursor++ + continue + case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + return floatBytes(s), nil + case 'n': + if err := nullBytes(s); err != nil { + return nil, err + } + return nil, nil + case '"': + return d.stringDecoder.decodeStreamByte(s) + case nul: + if s.read() { + continue + } + goto ERROR + default: + goto ERROR + } + } +ERROR: + if s.cursor == start { + return nil, errors.ErrInvalidBeginningOfValue(s.char(), s.totalOffset()) + } + return nil, errors.ErrUnexpectedEndOfJSON("json.Number", s.totalOffset()) +} + +func (d *numberDecoder) decodeByte(buf []byte, cursor int64) ([]byte, int64, error) { + for { + switch buf[cursor] { + case ' ', '\n', '\t', '\r': + cursor++ + continue + case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + start := cursor + cursor++ + for floatTable[buf[cursor]] { + cursor++ + } + num := buf[start:cursor] + return num, cursor, nil + case 'n': + if err := validateNull(buf, cursor); err != nil { + return nil, 0, err + } + cursor += 4 + return nil, cursor, nil + case '"': + return d.stringDecoder.decodeByte(buf, cursor) + default: + return nil, 0, errors.ErrUnexpectedEndOfJSON("json.Number", cursor) + } + } +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/option.go b/vendor/github.com/goccy/go-json/internal/decoder/option.go new file mode 100644 index 000000000..502f772eb --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/option.go @@ -0,0 +1,17 @@ +package decoder + +import "context" + +type OptionFlags uint8 + +const ( + FirstWinOption OptionFlags = 1 << iota + ContextOption + PathOption +) + +type Option struct { + Flags OptionFlags + Context context.Context + Path *Path +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/path.go b/vendor/github.com/goccy/go-json/internal/decoder/path.go new file mode 100644 index 000000000..a15ff69e3 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/path.go @@ -0,0 +1,670 @@ +package decoder + +import ( + "fmt" + "reflect" + "strconv" + + "github.com/goccy/go-json/internal/errors" + "github.com/goccy/go-json/internal/runtime" +) + +type PathString string + +func (s PathString) Build() (*Path, error) { + builder := new(PathBuilder) + return builder.Build([]rune(s)) +} + +type PathBuilder struct { + root PathNode + node PathNode + singleQuotePathSelector bool + doubleQuotePathSelector bool +} + +func (b *PathBuilder) Build(buf []rune) (*Path, error) { + node, err := b.build(buf) + if err != nil { + return nil, err + } + return &Path{ + node: node, + RootSelectorOnly: node == nil, + SingleQuotePathSelector: b.singleQuotePathSelector, + DoubleQuotePathSelector: b.doubleQuotePathSelector, + }, nil +} + +func (b *PathBuilder) build(buf []rune) (PathNode, error) { + if len(buf) == 0 { + return nil, errors.ErrEmptyPath() + } + if buf[0] != '$' { + return nil, errors.ErrInvalidPath("JSON Path must start with a $ character") + } + if len(buf) == 1 { + return nil, nil + } + buf = buf[1:] + offset, err := b.buildNext(buf) + if err != nil { + return nil, err + } + if len(buf) > offset { + return nil, errors.ErrInvalidPath("remain invalid path %q", buf[offset:]) + } + return b.root, nil +} + +func (b *PathBuilder) buildNextCharIfExists(buf []rune, cursor int) (int, error) { + if len(buf) > cursor { + offset, err := b.buildNext(buf[cursor:]) + if err != nil { + return 0, err + } + return cursor + 1 + offset, nil + } + return cursor, nil +} + +func (b *PathBuilder) buildNext(buf []rune) (int, error) { + switch buf[0] { + case '.': + if len(buf) == 1 { + return 0, errors.ErrInvalidPath("JSON Path ends with dot character") + } + offset, err := b.buildSelector(buf[1:]) + if err != nil { + return 0, err + } + return offset + 1, nil + case '[': + if len(buf) == 1 { + return 0, errors.ErrInvalidPath("JSON Path ends with left bracket character") + } + offset, err := b.buildIndex(buf[1:]) + if err != nil { + return 0, err + } + return offset + 1, nil + default: + return 0, errors.ErrInvalidPath("expect dot or left bracket character. but found %c character", buf[0]) + } +} + +func (b *PathBuilder) buildSelector(buf []rune) (int, error) { + switch buf[0] { + case '.': + if len(buf) == 1 { + return 0, errors.ErrInvalidPath("JSON Path ends with double dot character") + } + offset, err := b.buildPathRecursive(buf[1:]) + if err != nil { + return 0, err + } + return 1 + offset, nil + case '[', ']', '$', '*': + return 0, errors.ErrInvalidPath("found invalid path character %c after dot", buf[0]) + } + for cursor := 0; cursor < len(buf); cursor++ { + switch buf[cursor] { + case '$', '*', ']': + return 0, errors.ErrInvalidPath("found %c character in field selector context", buf[cursor]) + case '.': + if cursor+1 >= len(buf) { + return 0, errors.ErrInvalidPath("JSON Path ends with dot character") + } + selector := buf[:cursor] + b.addSelectorNode(string(selector)) + offset, err := b.buildSelector(buf[cursor+1:]) + if err != nil { + return 0, err + } + return cursor + 1 + offset, nil + case '[': + if cursor+1 >= len(buf) { + return 0, errors.ErrInvalidPath("JSON Path ends with left bracket character") + } + selector := buf[:cursor] + b.addSelectorNode(string(selector)) + offset, err := b.buildIndex(buf[cursor+1:]) + if err != nil { + return 0, err + } + return cursor + 1 + offset, nil + case '"': + if cursor+1 >= len(buf) { + return 0, errors.ErrInvalidPath("JSON Path ends with double quote character") + } + offset, err := b.buildQuoteSelector(buf[cursor+1:], DoubleQuotePathSelector) + if err != nil { + return 0, err + } + return cursor + 1 + offset, nil + } + } + b.addSelectorNode(string(buf)) + return len(buf), nil +} + +func (b *PathBuilder) buildQuoteSelector(buf []rune, sel QuotePathSelector) (int, error) { + switch buf[0] { + case '[', ']', '$', '.', '*', '\'', '"': + return 0, errors.ErrInvalidPath("found invalid path character %c after quote", buf[0]) + } + for cursor := 0; cursor < len(buf); cursor++ { + switch buf[cursor] { + case '\'': + if sel != SingleQuotePathSelector { + return 0, errors.ErrInvalidPath("found double quote character in field selector with single quote context") + } + if len(buf) <= cursor+1 { + return 0, errors.ErrInvalidPath("JSON Path ends with single quote character in field selector context") + } + if buf[cursor+1] != ']' { + return 0, errors.ErrInvalidPath("expect right bracket for field selector with single quote but found %c", buf[cursor+1]) + } + selector := buf[:cursor] + b.addSelectorNode(string(selector)) + b.singleQuotePathSelector = true + return b.buildNextCharIfExists(buf, cursor+2) + case '"': + if sel != DoubleQuotePathSelector { + return 0, errors.ErrInvalidPath("found single quote character in field selector with double quote context") + } + selector := buf[:cursor] + b.addSelectorNode(string(selector)) + b.doubleQuotePathSelector = true + return b.buildNextCharIfExists(buf, cursor+1) + } + } + return 0, errors.ErrInvalidPath("couldn't find quote character in selector quote path context") +} + +func (b *PathBuilder) buildPathRecursive(buf []rune) (int, error) { + switch buf[0] { + case '.', '[', ']', '$', '*': + return 0, errors.ErrInvalidPath("found invalid path character %c after double dot", buf[0]) + } + for cursor := 0; cursor < len(buf); cursor++ { + switch buf[cursor] { + case '$', '*', ']': + return 0, errors.ErrInvalidPath("found %c character in field selector context", buf[cursor]) + case '.': + if cursor+1 >= len(buf) { + return 0, errors.ErrInvalidPath("JSON Path ends with dot character") + } + selector := buf[:cursor] + b.addRecursiveNode(string(selector)) + offset, err := b.buildSelector(buf[cursor+1:]) + if err != nil { + return 0, err + } + return cursor + 1 + offset, nil + case '[': + if cursor+1 >= len(buf) { + return 0, errors.ErrInvalidPath("JSON Path ends with left bracket character") + } + selector := buf[:cursor] + b.addRecursiveNode(string(selector)) + offset, err := b.buildIndex(buf[cursor+1:]) + if err != nil { + return 0, err + } + return cursor + 1 + offset, nil + } + } + b.addRecursiveNode(string(buf)) + return len(buf), nil +} + +func (b *PathBuilder) buildIndex(buf []rune) (int, error) { + switch buf[0] { + case '.', '[', ']', '$': + return 0, errors.ErrInvalidPath("found invalid path character %c after left bracket", buf[0]) + case '\'': + if len(buf) == 1 { + return 0, errors.ErrInvalidPath("JSON Path ends with single quote character") + } + offset, err := b.buildQuoteSelector(buf[1:], SingleQuotePathSelector) + if err != nil { + return 0, err + } + return 1 + offset, nil + case '*': + if len(buf) == 1 { + return 0, errors.ErrInvalidPath("JSON Path ends with star character") + } + if buf[1] != ']' { + return 0, errors.ErrInvalidPath("expect right bracket character for index all path but found %c character", buf[1]) + } + b.addIndexAllNode() + offset := len("*]") + if len(buf) > 2 { + buildOffset, err := b.buildNext(buf[2:]) + if err != nil { + return 0, err + } + return offset + buildOffset, nil + } + return offset, nil + } + + for cursor := 0; cursor < len(buf); cursor++ { + switch buf[cursor] { + case ']': + index, err := strconv.ParseInt(string(buf[:cursor]), 10, 64) + if err != nil { + return 0, errors.ErrInvalidPath("%q is unexpected index path", buf[:cursor]) + } + b.addIndexNode(int(index)) + return b.buildNextCharIfExists(buf, cursor+1) + } + } + return 0, errors.ErrInvalidPath("couldn't find right bracket character in index path context") +} + +func (b *PathBuilder) addIndexAllNode() { + node := newPathIndexAllNode() + if b.root == nil { + b.root = node + b.node = node + } else { + b.node = b.node.chain(node) + } +} + +func (b *PathBuilder) addRecursiveNode(selector string) { + node := newPathRecursiveNode(selector) + if b.root == nil { + b.root = node + b.node = node + } else { + b.node = b.node.chain(node) + } +} + +func (b *PathBuilder) addSelectorNode(name string) { + node := newPathSelectorNode(name) + if b.root == nil { + b.root = node + b.node = node + } else { + b.node = b.node.chain(node) + } +} + +func (b *PathBuilder) addIndexNode(idx int) { + node := newPathIndexNode(idx) + if b.root == nil { + b.root = node + b.node = node + } else { + b.node = b.node.chain(node) + } +} + +type QuotePathSelector int + +const ( + SingleQuotePathSelector QuotePathSelector = 1 + DoubleQuotePathSelector QuotePathSelector = 2 +) + +type Path struct { + node PathNode + RootSelectorOnly bool + SingleQuotePathSelector bool + DoubleQuotePathSelector bool +} + +func (p *Path) Field(sel string) (PathNode, bool, error) { + if p.node == nil { + return nil, false, nil + } + return p.node.Field(sel) +} + +func (p *Path) Get(src, dst reflect.Value) error { + if p.node == nil { + return nil + } + return p.node.Get(src, dst) +} + +func (p *Path) String() string { + if p.node == nil { + return "$" + } + return p.node.String() +} + +type PathNode interface { + fmt.Stringer + Index(idx int) (PathNode, bool, error) + Field(fieldName string) (PathNode, bool, error) + Get(src, dst reflect.Value) error + chain(PathNode) PathNode + target() bool + single() bool +} + +type BasePathNode struct { + child PathNode +} + +func (n *BasePathNode) chain(node PathNode) PathNode { + n.child = node + return node +} + +func (n *BasePathNode) target() bool { + return n.child == nil +} + +func (n *BasePathNode) single() bool { + return true +} + +type PathSelectorNode struct { + *BasePathNode + selector string +} + +func newPathSelectorNode(selector string) *PathSelectorNode { + return &PathSelectorNode{ + BasePathNode: &BasePathNode{}, + selector: selector, + } +} + +func (n *PathSelectorNode) Index(idx int) (PathNode, bool, error) { + return nil, false, &errors.PathError{} +} + +func (n *PathSelectorNode) Field(fieldName string) (PathNode, bool, error) { + if n.selector == fieldName { + return n.child, true, nil + } + return nil, false, nil +} + +func (n *PathSelectorNode) Get(src, dst reflect.Value) error { + switch src.Type().Kind() { + case reflect.Map: + iter := src.MapRange() + for iter.Next() { + key, ok := iter.Key().Interface().(string) + if !ok { + return fmt.Errorf("invalid map key type %T", src.Type().Key()) + } + child, found, err := n.Field(key) + if err != nil { + return err + } + if found { + if child != nil { + return child.Get(iter.Value(), dst) + } + return AssignValue(iter.Value(), dst) + } + } + case reflect.Struct: + typ := src.Type() + for i := 0; i < typ.Len(); i++ { + tag := runtime.StructTagFromField(typ.Field(i)) + child, found, err := n.Field(tag.Key) + if err != nil { + return err + } + if found { + if child != nil { + return child.Get(src.Field(i), dst) + } + return AssignValue(src.Field(i), dst) + } + } + case reflect.Ptr: + return n.Get(src.Elem(), dst) + case reflect.Interface: + return n.Get(reflect.ValueOf(src.Interface()), dst) + case reflect.Float64, reflect.String, reflect.Bool: + return AssignValue(src, dst) + } + return fmt.Errorf("failed to get %s value from %s", n.selector, src.Type()) +} + +func (n *PathSelectorNode) String() string { + s := fmt.Sprintf(".%s", n.selector) + if n.child != nil { + s += n.child.String() + } + return s +} + +type PathIndexNode struct { + *BasePathNode + selector int +} + +func newPathIndexNode(selector int) *PathIndexNode { + return &PathIndexNode{ + BasePathNode: &BasePathNode{}, + selector: selector, + } +} + +func (n *PathIndexNode) Index(idx int) (PathNode, bool, error) { + if n.selector == idx { + return n.child, true, nil + } + return nil, false, nil +} + +func (n *PathIndexNode) Field(fieldName string) (PathNode, bool, error) { + return nil, false, &errors.PathError{} +} + +func (n *PathIndexNode) Get(src, dst reflect.Value) error { + switch src.Type().Kind() { + case reflect.Array, reflect.Slice: + if src.Len() > n.selector { + if n.child != nil { + return n.child.Get(src.Index(n.selector), dst) + } + return AssignValue(src.Index(n.selector), dst) + } + case reflect.Ptr: + return n.Get(src.Elem(), dst) + case reflect.Interface: + return n.Get(reflect.ValueOf(src.Interface()), dst) + } + return fmt.Errorf("failed to get [%d] value from %s", n.selector, src.Type()) +} + +func (n *PathIndexNode) String() string { + s := fmt.Sprintf("[%d]", n.selector) + if n.child != nil { + s += n.child.String() + } + return s +} + +type PathIndexAllNode struct { + *BasePathNode +} + +func newPathIndexAllNode() *PathIndexAllNode { + return &PathIndexAllNode{ + BasePathNode: &BasePathNode{}, + } +} + +func (n *PathIndexAllNode) Index(idx int) (PathNode, bool, error) { + return n.child, true, nil +} + +func (n *PathIndexAllNode) Field(fieldName string) (PathNode, bool, error) { + return nil, false, &errors.PathError{} +} + +func (n *PathIndexAllNode) Get(src, dst reflect.Value) error { + switch src.Type().Kind() { + case reflect.Array, reflect.Slice: + var arr []interface{} + for i := 0; i < src.Len(); i++ { + var v interface{} + rv := reflect.ValueOf(&v) + if n.child != nil { + if err := n.child.Get(src.Index(i), rv); err != nil { + return err + } + } else { + if err := AssignValue(src.Index(i), rv); err != nil { + return err + } + } + arr = append(arr, v) + } + if err := AssignValue(reflect.ValueOf(arr), dst); err != nil { + return err + } + return nil + case reflect.Ptr: + return n.Get(src.Elem(), dst) + case reflect.Interface: + return n.Get(reflect.ValueOf(src.Interface()), dst) + } + return fmt.Errorf("failed to get all value from %s", src.Type()) +} + +func (n *PathIndexAllNode) String() string { + s := "[*]" + if n.child != nil { + s += n.child.String() + } + return s +} + +type PathRecursiveNode struct { + *BasePathNode + selector string +} + +func newPathRecursiveNode(selector string) *PathRecursiveNode { + node := newPathSelectorNode(selector) + return &PathRecursiveNode{ + BasePathNode: &BasePathNode{ + child: node, + }, + selector: selector, + } +} + +func (n *PathRecursiveNode) Field(fieldName string) (PathNode, bool, error) { + if n.selector == fieldName { + return n.child, true, nil + } + return nil, false, nil +} + +func (n *PathRecursiveNode) Index(_ int) (PathNode, bool, error) { + return n, true, nil +} + +func valueToSliceValue(v interface{}) []interface{} { + rv := reflect.ValueOf(v) + ret := []interface{}{} + if rv.Type().Kind() == reflect.Slice || rv.Type().Kind() == reflect.Array { + for i := 0; i < rv.Len(); i++ { + ret = append(ret, rv.Index(i).Interface()) + } + return ret + } + return []interface{}{v} +} + +func (n *PathRecursiveNode) Get(src, dst reflect.Value) error { + if n.child == nil { + return fmt.Errorf("failed to get by recursive path ..%s", n.selector) + } + var arr []interface{} + switch src.Type().Kind() { + case reflect.Map: + iter := src.MapRange() + for iter.Next() { + key, ok := iter.Key().Interface().(string) + if !ok { + return fmt.Errorf("invalid map key type %T", src.Type().Key()) + } + child, found, err := n.Field(key) + if err != nil { + return err + } + if found { + var v interface{} + rv := reflect.ValueOf(&v) + _ = child.Get(iter.Value(), rv) + arr = append(arr, valueToSliceValue(v)...) + } else { + var v interface{} + rv := reflect.ValueOf(&v) + _ = n.Get(iter.Value(), rv) + if v != nil { + arr = append(arr, valueToSliceValue(v)...) + } + } + } + _ = AssignValue(reflect.ValueOf(arr), dst) + return nil + case reflect.Struct: + typ := src.Type() + for i := 0; i < typ.Len(); i++ { + tag := runtime.StructTagFromField(typ.Field(i)) + child, found, err := n.Field(tag.Key) + if err != nil { + return err + } + if found { + var v interface{} + rv := reflect.ValueOf(&v) + _ = child.Get(src.Field(i), rv) + arr = append(arr, valueToSliceValue(v)...) + } else { + var v interface{} + rv := reflect.ValueOf(&v) + _ = n.Get(src.Field(i), rv) + if v != nil { + arr = append(arr, valueToSliceValue(v)...) + } + } + } + _ = AssignValue(reflect.ValueOf(arr), dst) + return nil + case reflect.Array, reflect.Slice: + for i := 0; i < src.Len(); i++ { + var v interface{} + rv := reflect.ValueOf(&v) + _ = n.Get(src.Index(i), rv) + if v != nil { + arr = append(arr, valueToSliceValue(v)...) + } + } + _ = AssignValue(reflect.ValueOf(arr), dst) + return nil + case reflect.Ptr: + return n.Get(src.Elem(), dst) + case reflect.Interface: + return n.Get(reflect.ValueOf(src.Interface()), dst) + } + return fmt.Errorf("failed to get %s value from %s", n.selector, src.Type()) +} + +func (n *PathRecursiveNode) String() string { + s := fmt.Sprintf("..%s", n.selector) + if n.child != nil { + s += n.child.String() + } + return s +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/ptr.go b/vendor/github.com/goccy/go-json/internal/decoder/ptr.go new file mode 100644 index 000000000..de12e105c --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/ptr.go @@ -0,0 +1,96 @@ +package decoder + +import ( + "fmt" + "unsafe" + + "github.com/goccy/go-json/internal/runtime" +) + +type ptrDecoder struct { + dec Decoder + typ *runtime.Type + structName string + fieldName string +} + +func newPtrDecoder(dec Decoder, typ *runtime.Type, structName, fieldName string) *ptrDecoder { + return &ptrDecoder{ + dec: dec, + typ: typ, + structName: structName, + fieldName: fieldName, + } +} + +func (d *ptrDecoder) contentDecoder() Decoder { + dec, ok := d.dec.(*ptrDecoder) + if !ok { + return d.dec + } + return dec.contentDecoder() +} + +//nolint:golint +//go:linkname unsafe_New reflect.unsafe_New +func unsafe_New(*runtime.Type) unsafe.Pointer + +func UnsafeNew(t *runtime.Type) unsafe.Pointer { + return unsafe_New(t) +} + +func (d *ptrDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error { + if s.skipWhiteSpace() == nul { + s.read() + } + if s.char() == 'n' { + if err := nullBytes(s); err != nil { + return err + } + *(*unsafe.Pointer)(p) = nil + return nil + } + var newptr unsafe.Pointer + if *(*unsafe.Pointer)(p) == nil { + newptr = unsafe_New(d.typ) + *(*unsafe.Pointer)(p) = newptr + } else { + newptr = *(*unsafe.Pointer)(p) + } + if err := d.dec.DecodeStream(s, depth, newptr); err != nil { + return err + } + return nil +} + +func (d *ptrDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) { + buf := ctx.Buf + cursor = skipWhiteSpace(buf, cursor) + if buf[cursor] == 'n' { + if err := validateNull(buf, cursor); err != nil { + return 0, err + } + if p != nil { + *(*unsafe.Pointer)(p) = nil + } + cursor += 4 + return cursor, nil + } + var newptr unsafe.Pointer + if *(*unsafe.Pointer)(p) == nil { + newptr = unsafe_New(d.typ) + *(*unsafe.Pointer)(p) = newptr + } else { + newptr = *(*unsafe.Pointer)(p) + } + c, err := d.dec.Decode(ctx, cursor, depth, newptr) + if err != nil { + return 0, err + } + cursor = c + return cursor, nil +} + +func (d *ptrDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) { + return nil, 0, fmt.Errorf("json: ptr decoder does not support decode path") +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/slice.go b/vendor/github.com/goccy/go-json/internal/decoder/slice.go new file mode 100644 index 000000000..30a23e4b5 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/slice.go @@ -0,0 +1,380 @@ +package decoder + +import ( + "reflect" + "sync" + "unsafe" + + "github.com/goccy/go-json/internal/errors" + "github.com/goccy/go-json/internal/runtime" +) + +var ( + sliceType = runtime.Type2RType( + reflect.TypeOf((*sliceHeader)(nil)).Elem(), + ) + nilSlice = unsafe.Pointer(&sliceHeader{}) +) + +type sliceDecoder struct { + elemType *runtime.Type + isElemPointerType bool + valueDecoder Decoder + size uintptr + arrayPool sync.Pool + structName string + fieldName string +} + +// If use reflect.SliceHeader, data type is uintptr. +// In this case, Go compiler cannot trace reference created by newArray(). +// So, define using unsafe.Pointer as data type +type sliceHeader struct { + data unsafe.Pointer + len int + cap int +} + +const ( + defaultSliceCapacity = 2 +) + +func newSliceDecoder(dec Decoder, elemType *runtime.Type, size uintptr, structName, fieldName string) *sliceDecoder { + return &sliceDecoder{ + valueDecoder: dec, + elemType: elemType, + isElemPointerType: elemType.Kind() == reflect.Ptr || elemType.Kind() == reflect.Map, + size: size, + arrayPool: sync.Pool{ + New: func() interface{} { + return &sliceHeader{ + data: newArray(elemType, defaultSliceCapacity), + len: 0, + cap: defaultSliceCapacity, + } + }, + }, + structName: structName, + fieldName: fieldName, + } +} + +func (d *sliceDecoder) newSlice(src *sliceHeader) *sliceHeader { + slice := d.arrayPool.Get().(*sliceHeader) + if src.len > 0 { + // copy original elem + if slice.cap < src.cap { + data := newArray(d.elemType, src.cap) + slice = &sliceHeader{data: data, len: src.len, cap: src.cap} + } else { + slice.len = src.len + } + copySlice(d.elemType, *slice, *src) + } else { + slice.len = 0 + } + return slice +} + +func (d *sliceDecoder) releaseSlice(p *sliceHeader) { + d.arrayPool.Put(p) +} + +//go:linkname copySlice reflect.typedslicecopy +func copySlice(elemType *runtime.Type, dst, src sliceHeader) int + +//go:linkname newArray reflect.unsafe_NewArray +func newArray(*runtime.Type, int) unsafe.Pointer + +//go:linkname typedmemmove reflect.typedmemmove +func typedmemmove(t *runtime.Type, dst, src unsafe.Pointer) + +func (d *sliceDecoder) errNumber(offset int64) *errors.UnmarshalTypeError { + return &errors.UnmarshalTypeError{ + Value: "number", + Type: reflect.SliceOf(runtime.RType2Type(d.elemType)), + Struct: d.structName, + Field: d.fieldName, + Offset: offset, + } +} + +func (d *sliceDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error { + depth++ + if depth > maxDecodeNestingDepth { + return errors.ErrExceededMaxDepth(s.char(), s.cursor) + } + + for { + switch s.char() { + case ' ', '\n', '\t', '\r': + s.cursor++ + continue + case 'n': + if err := nullBytes(s); err != nil { + return err + } + typedmemmove(sliceType, p, nilSlice) + return nil + case '[': + s.cursor++ + if s.skipWhiteSpace() == ']' { + dst := (*sliceHeader)(p) + if dst.data == nil { + dst.data = newArray(d.elemType, 0) + } else { + dst.len = 0 + } + s.cursor++ + return nil + } + idx := 0 + slice := d.newSlice((*sliceHeader)(p)) + srcLen := slice.len + capacity := slice.cap + data := slice.data + for { + if capacity <= idx { + src := sliceHeader{data: data, len: idx, cap: capacity} + capacity *= 2 + data = newArray(d.elemType, capacity) + dst := sliceHeader{data: data, len: idx, cap: capacity} + copySlice(d.elemType, dst, src) + } + ep := unsafe.Pointer(uintptr(data) + uintptr(idx)*d.size) + + // if srcLen is greater than idx, keep the original reference + if srcLen <= idx { + if d.isElemPointerType { + **(**unsafe.Pointer)(unsafe.Pointer(&ep)) = nil // initialize elem pointer + } else { + // assign new element to the slice + typedmemmove(d.elemType, ep, unsafe_New(d.elemType)) + } + } + + if err := d.valueDecoder.DecodeStream(s, depth, ep); err != nil { + return err + } + s.skipWhiteSpace() + RETRY: + switch s.char() { + case ']': + slice.cap = capacity + slice.len = idx + 1 + slice.data = data + dst := (*sliceHeader)(p) + dst.len = idx + 1 + if dst.len > dst.cap { + dst.data = newArray(d.elemType, dst.len) + dst.cap = dst.len + } + copySlice(d.elemType, *dst, *slice) + d.releaseSlice(slice) + s.cursor++ + return nil + case ',': + idx++ + case nul: + if s.read() { + goto RETRY + } + slice.cap = capacity + slice.data = data + d.releaseSlice(slice) + goto ERROR + default: + slice.cap = capacity + slice.data = data + d.releaseSlice(slice) + goto ERROR + } + s.cursor++ + } + case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + return d.errNumber(s.totalOffset()) + case nul: + if s.read() { + continue + } + goto ERROR + default: + goto ERROR + } + } +ERROR: + return errors.ErrUnexpectedEndOfJSON("slice", s.totalOffset()) +} + +func (d *sliceDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) { + buf := ctx.Buf + depth++ + if depth > maxDecodeNestingDepth { + return 0, errors.ErrExceededMaxDepth(buf[cursor], cursor) + } + + for { + switch buf[cursor] { + case ' ', '\n', '\t', '\r': + cursor++ + continue + case 'n': + if err := validateNull(buf, cursor); err != nil { + return 0, err + } + cursor += 4 + typedmemmove(sliceType, p, nilSlice) + return cursor, nil + case '[': + cursor++ + cursor = skipWhiteSpace(buf, cursor) + if buf[cursor] == ']' { + dst := (*sliceHeader)(p) + if dst.data == nil { + dst.data = newArray(d.elemType, 0) + } else { + dst.len = 0 + } + cursor++ + return cursor, nil + } + idx := 0 + slice := d.newSlice((*sliceHeader)(p)) + srcLen := slice.len + capacity := slice.cap + data := slice.data + for { + if capacity <= idx { + src := sliceHeader{data: data, len: idx, cap: capacity} + capacity *= 2 + data = newArray(d.elemType, capacity) + dst := sliceHeader{data: data, len: idx, cap: capacity} + copySlice(d.elemType, dst, src) + } + ep := unsafe.Pointer(uintptr(data) + uintptr(idx)*d.size) + // if srcLen is greater than idx, keep the original reference + if srcLen <= idx { + if d.isElemPointerType { + **(**unsafe.Pointer)(unsafe.Pointer(&ep)) = nil // initialize elem pointer + } else { + // assign new element to the slice + typedmemmove(d.elemType, ep, unsafe_New(d.elemType)) + } + } + c, err := d.valueDecoder.Decode(ctx, cursor, depth, ep) + if err != nil { + return 0, err + } + cursor = c + cursor = skipWhiteSpace(buf, cursor) + switch buf[cursor] { + case ']': + slice.cap = capacity + slice.len = idx + 1 + slice.data = data + dst := (*sliceHeader)(p) + dst.len = idx + 1 + if dst.len > dst.cap { + dst.data = newArray(d.elemType, dst.len) + dst.cap = dst.len + } + copySlice(d.elemType, *dst, *slice) + d.releaseSlice(slice) + cursor++ + return cursor, nil + case ',': + idx++ + default: + slice.cap = capacity + slice.data = data + d.releaseSlice(slice) + return 0, errors.ErrInvalidCharacter(buf[cursor], "slice", cursor) + } + cursor++ + } + case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + return 0, d.errNumber(cursor) + default: + return 0, errors.ErrUnexpectedEndOfJSON("slice", cursor) + } + } +} + +func (d *sliceDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) { + buf := ctx.Buf + depth++ + if depth > maxDecodeNestingDepth { + return nil, 0, errors.ErrExceededMaxDepth(buf[cursor], cursor) + } + + ret := [][]byte{} + for { + switch buf[cursor] { + case ' ', '\n', '\t', '\r': + cursor++ + continue + case 'n': + if err := validateNull(buf, cursor); err != nil { + return nil, 0, err + } + cursor += 4 + return [][]byte{nullbytes}, cursor, nil + case '[': + cursor++ + cursor = skipWhiteSpace(buf, cursor) + if buf[cursor] == ']' { + cursor++ + return ret, cursor, nil + } + idx := 0 + for { + child, found, err := ctx.Option.Path.node.Index(idx) + if err != nil { + return nil, 0, err + } + if found { + if child != nil { + oldPath := ctx.Option.Path.node + ctx.Option.Path.node = child + paths, c, err := d.valueDecoder.DecodePath(ctx, cursor, depth) + if err != nil { + return nil, 0, err + } + ctx.Option.Path.node = oldPath + ret = append(ret, paths...) + cursor = c + } else { + start := cursor + end, err := skipValue(buf, cursor, depth) + if err != nil { + return nil, 0, err + } + ret = append(ret, buf[start:end]) + cursor = end + } + } else { + c, err := skipValue(buf, cursor, depth) + if err != nil { + return nil, 0, err + } + cursor = c + } + cursor = skipWhiteSpace(buf, cursor) + switch buf[cursor] { + case ']': + cursor++ + return ret, cursor, nil + case ',': + idx++ + default: + return nil, 0, errors.ErrInvalidCharacter(buf[cursor], "slice", cursor) + } + cursor++ + } + case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + return nil, 0, d.errNumber(cursor) + default: + return nil, 0, errors.ErrUnexpectedEndOfJSON("slice", cursor) + } + } +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/stream.go b/vendor/github.com/goccy/go-json/internal/decoder/stream.go new file mode 100644 index 000000000..a383f7259 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/stream.go @@ -0,0 +1,556 @@ +package decoder + +import ( + "bytes" + "encoding/json" + "io" + "strconv" + "unsafe" + + "github.com/goccy/go-json/internal/errors" +) + +const ( + initBufSize = 512 +) + +type Stream struct { + buf []byte + bufSize int64 + length int64 + r io.Reader + offset int64 + cursor int64 + filledBuffer bool + allRead bool + UseNumber bool + DisallowUnknownFields bool + Option *Option +} + +func NewStream(r io.Reader) *Stream { + return &Stream{ + r: r, + bufSize: initBufSize, + buf: make([]byte, initBufSize), + Option: &Option{}, + } +} + +func (s *Stream) TotalOffset() int64 { + return s.totalOffset() +} + +func (s *Stream) Buffered() io.Reader { + buflen := int64(len(s.buf)) + for i := s.cursor; i < buflen; i++ { + if s.buf[i] == nul { + return bytes.NewReader(s.buf[s.cursor:i]) + } + } + return bytes.NewReader(s.buf[s.cursor:]) +} + +func (s *Stream) PrepareForDecode() error { + for { + switch s.char() { + case ' ', '\t', '\r', '\n': + s.cursor++ + continue + case ',', ':': + s.cursor++ + return nil + case nul: + if s.read() { + continue + } + return io.EOF + } + break + } + return nil +} + +func (s *Stream) totalOffset() int64 { + return s.offset + s.cursor +} + +func (s *Stream) char() byte { + return s.buf[s.cursor] +} + +func (s *Stream) equalChar(c byte) bool { + cur := s.buf[s.cursor] + if cur == nul { + s.read() + cur = s.buf[s.cursor] + } + return cur == c +} + +func (s *Stream) stat() ([]byte, int64, unsafe.Pointer) { + return s.buf, s.cursor, (*sliceHeader)(unsafe.Pointer(&s.buf)).data +} + +func (s *Stream) bufptr() unsafe.Pointer { + return (*sliceHeader)(unsafe.Pointer(&s.buf)).data +} + +func (s *Stream) statForRetry() ([]byte, int64, unsafe.Pointer) { + s.cursor-- // for retry ( because caller progress cursor position in each loop ) + return s.buf, s.cursor, (*sliceHeader)(unsafe.Pointer(&s.buf)).data +} + +func (s *Stream) Reset() { + s.reset() + s.bufSize = int64(len(s.buf)) +} + +func (s *Stream) More() bool { + for { + switch s.char() { + case ' ', '\n', '\r', '\t': + s.cursor++ + continue + case '}', ']': + return false + case nul: + if s.read() { + continue + } + return false + } + break + } + return true +} + +func (s *Stream) Token() (interface{}, error) { + for { + c := s.char() + switch c { + case ' ', '\n', '\r', '\t': + s.cursor++ + case '{', '[', ']', '}': + s.cursor++ + return json.Delim(c), nil + case ',', ':': + s.cursor++ + case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + bytes := floatBytes(s) + str := *(*string)(unsafe.Pointer(&bytes)) + if s.UseNumber { + return json.Number(str), nil + } + f64, err := strconv.ParseFloat(str, 64) + if err != nil { + return nil, err + } + return f64, nil + case '"': + bytes, err := stringBytes(s) + if err != nil { + return nil, err + } + return string(bytes), nil + case 't': + if err := trueBytes(s); err != nil { + return nil, err + } + return true, nil + case 'f': + if err := falseBytes(s); err != nil { + return nil, err + } + return false, nil + case 'n': + if err := nullBytes(s); err != nil { + return nil, err + } + return nil, nil + case nul: + if s.read() { + continue + } + goto END + default: + return nil, errors.ErrInvalidCharacter(s.char(), "token", s.totalOffset()) + } + } +END: + return nil, io.EOF +} + +func (s *Stream) reset() { + s.offset += s.cursor + s.buf = s.buf[s.cursor:] + s.length -= s.cursor + s.cursor = 0 +} + +func (s *Stream) readBuf() []byte { + if s.filledBuffer { + s.bufSize *= 2 + remainBuf := s.buf + s.buf = make([]byte, s.bufSize) + copy(s.buf, remainBuf) + } + remainLen := s.length - s.cursor + remainNotNulCharNum := int64(0) + for i := int64(0); i < remainLen; i++ { + if s.buf[s.cursor+i] == nul { + break + } + remainNotNulCharNum++ + } + s.length = s.cursor + remainNotNulCharNum + return s.buf[s.cursor+remainNotNulCharNum:] +} + +func (s *Stream) read() bool { + if s.allRead { + return false + } + buf := s.readBuf() + last := len(buf) - 1 + buf[last] = nul + n, err := s.r.Read(buf[:last]) + s.length += int64(n) + if n == last { + s.filledBuffer = true + } else { + s.filledBuffer = false + } + if err == io.EOF { + s.allRead = true + } else if err != nil { + return false + } + return true +} + +func (s *Stream) skipWhiteSpace() byte { + p := s.bufptr() +LOOP: + c := char(p, s.cursor) + switch c { + case ' ', '\n', '\t', '\r': + s.cursor++ + goto LOOP + case nul: + if s.read() { + p = s.bufptr() + goto LOOP + } + } + return c +} + +func (s *Stream) skipObject(depth int64) error { + braceCount := 1 + _, cursor, p := s.stat() + for { + switch char(p, cursor) { + case '{': + braceCount++ + depth++ + if depth > maxDecodeNestingDepth { + return errors.ErrExceededMaxDepth(s.char(), s.cursor) + } + case '}': + braceCount-- + depth-- + if braceCount == 0 { + s.cursor = cursor + 1 + return nil + } + case '[': + depth++ + if depth > maxDecodeNestingDepth { + return errors.ErrExceededMaxDepth(s.char(), s.cursor) + } + case ']': + depth-- + case '"': + for { + cursor++ + switch char(p, cursor) { + case '\\': + cursor++ + if char(p, cursor) == nul { + s.cursor = cursor + if s.read() { + _, cursor, p = s.stat() + continue + } + return errors.ErrUnexpectedEndOfJSON("string of object", cursor) + } + case '"': + goto SWITCH_OUT + case nul: + s.cursor = cursor + if s.read() { + _, cursor, p = s.statForRetry() + continue + } + return errors.ErrUnexpectedEndOfJSON("string of object", cursor) + } + } + case nul: + s.cursor = cursor + if s.read() { + _, cursor, p = s.stat() + continue + } + return errors.ErrUnexpectedEndOfJSON("object of object", cursor) + } + SWITCH_OUT: + cursor++ + } +} + +func (s *Stream) skipArray(depth int64) error { + bracketCount := 1 + _, cursor, p := s.stat() + for { + switch char(p, cursor) { + case '[': + bracketCount++ + depth++ + if depth > maxDecodeNestingDepth { + return errors.ErrExceededMaxDepth(s.char(), s.cursor) + } + case ']': + bracketCount-- + depth-- + if bracketCount == 0 { + s.cursor = cursor + 1 + return nil + } + case '{': + depth++ + if depth > maxDecodeNestingDepth { + return errors.ErrExceededMaxDepth(s.char(), s.cursor) + } + case '}': + depth-- + case '"': + for { + cursor++ + switch char(p, cursor) { + case '\\': + cursor++ + if char(p, cursor) == nul { + s.cursor = cursor + if s.read() { + _, cursor, p = s.stat() + continue + } + return errors.ErrUnexpectedEndOfJSON("string of object", cursor) + } + case '"': + goto SWITCH_OUT + case nul: + s.cursor = cursor + if s.read() { + _, cursor, p = s.statForRetry() + continue + } + return errors.ErrUnexpectedEndOfJSON("string of object", cursor) + } + } + case nul: + s.cursor = cursor + if s.read() { + _, cursor, p = s.stat() + continue + } + return errors.ErrUnexpectedEndOfJSON("array of object", cursor) + } + SWITCH_OUT: + cursor++ + } +} + +func (s *Stream) skipValue(depth int64) error { + _, cursor, p := s.stat() + for { + switch char(p, cursor) { + case ' ', '\n', '\t', '\r': + cursor++ + continue + case nul: + s.cursor = cursor + if s.read() { + _, cursor, p = s.stat() + continue + } + return errors.ErrUnexpectedEndOfJSON("value of object", s.totalOffset()) + case '{': + s.cursor = cursor + 1 + return s.skipObject(depth + 1) + case '[': + s.cursor = cursor + 1 + return s.skipArray(depth + 1) + case '"': + for { + cursor++ + switch char(p, cursor) { + case '\\': + cursor++ + if char(p, cursor) == nul { + s.cursor = cursor + if s.read() { + _, cursor, p = s.stat() + continue + } + return errors.ErrUnexpectedEndOfJSON("value of string", s.totalOffset()) + } + case '"': + s.cursor = cursor + 1 + return nil + case nul: + s.cursor = cursor + if s.read() { + _, cursor, p = s.statForRetry() + continue + } + return errors.ErrUnexpectedEndOfJSON("value of string", s.totalOffset()) + } + } + case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + for { + cursor++ + c := char(p, cursor) + if floatTable[c] { + continue + } else if c == nul { + if s.read() { + _, cursor, p = s.stat() + continue + } + } + s.cursor = cursor + return nil + } + case 't': + s.cursor = cursor + if err := trueBytes(s); err != nil { + return err + } + return nil + case 'f': + s.cursor = cursor + if err := falseBytes(s); err != nil { + return err + } + return nil + case 'n': + s.cursor = cursor + if err := nullBytes(s); err != nil { + return err + } + return nil + } + cursor++ + } +} + +func nullBytes(s *Stream) error { + // current cursor's character is 'n' + s.cursor++ + if s.char() != 'u' { + if err := retryReadNull(s); err != nil { + return err + } + } + s.cursor++ + if s.char() != 'l' { + if err := retryReadNull(s); err != nil { + return err + } + } + s.cursor++ + if s.char() != 'l' { + if err := retryReadNull(s); err != nil { + return err + } + } + s.cursor++ + return nil +} + +func retryReadNull(s *Stream) error { + if s.char() == nul && s.read() { + return nil + } + return errors.ErrInvalidCharacter(s.char(), "null", s.totalOffset()) +} + +func trueBytes(s *Stream) error { + // current cursor's character is 't' + s.cursor++ + if s.char() != 'r' { + if err := retryReadTrue(s); err != nil { + return err + } + } + s.cursor++ + if s.char() != 'u' { + if err := retryReadTrue(s); err != nil { + return err + } + } + s.cursor++ + if s.char() != 'e' { + if err := retryReadTrue(s); err != nil { + return err + } + } + s.cursor++ + return nil +} + +func retryReadTrue(s *Stream) error { + if s.char() == nul && s.read() { + return nil + } + return errors.ErrInvalidCharacter(s.char(), "bool(true)", s.totalOffset()) +} + +func falseBytes(s *Stream) error { + // current cursor's character is 'f' + s.cursor++ + if s.char() != 'a' { + if err := retryReadFalse(s); err != nil { + return err + } + } + s.cursor++ + if s.char() != 'l' { + if err := retryReadFalse(s); err != nil { + return err + } + } + s.cursor++ + if s.char() != 's' { + if err := retryReadFalse(s); err != nil { + return err + } + } + s.cursor++ + if s.char() != 'e' { + if err := retryReadFalse(s); err != nil { + return err + } + } + s.cursor++ + return nil +} + +func retryReadFalse(s *Stream) error { + if s.char() == nul && s.read() { + return nil + } + return errors.ErrInvalidCharacter(s.char(), "bool(false)", s.totalOffset()) +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/string.go b/vendor/github.com/goccy/go-json/internal/decoder/string.go new file mode 100644 index 000000000..32602c908 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/string.go @@ -0,0 +1,452 @@ +package decoder + +import ( + "bytes" + "fmt" + "reflect" + "unicode" + "unicode/utf16" + "unicode/utf8" + "unsafe" + + "github.com/goccy/go-json/internal/errors" +) + +type stringDecoder struct { + structName string + fieldName string +} + +func newStringDecoder(structName, fieldName string) *stringDecoder { + return &stringDecoder{ + structName: structName, + fieldName: fieldName, + } +} + +func (d *stringDecoder) errUnmarshalType(typeName string, offset int64) *errors.UnmarshalTypeError { + return &errors.UnmarshalTypeError{ + Value: typeName, + Type: reflect.TypeOf(""), + Offset: offset, + Struct: d.structName, + Field: d.fieldName, + } +} + +func (d *stringDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error { + bytes, err := d.decodeStreamByte(s) + if err != nil { + return err + } + if bytes == nil { + return nil + } + **(**string)(unsafe.Pointer(&p)) = *(*string)(unsafe.Pointer(&bytes)) + s.reset() + return nil +} + +func (d *stringDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) { + bytes, c, err := d.decodeByte(ctx.Buf, cursor) + if err != nil { + return 0, err + } + if bytes == nil { + return c, nil + } + cursor = c + **(**string)(unsafe.Pointer(&p)) = *(*string)(unsafe.Pointer(&bytes)) + return cursor, nil +} + +func (d *stringDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) { + bytes, c, err := d.decodeByte(ctx.Buf, cursor) + if err != nil { + return nil, 0, err + } + if bytes == nil { + return [][]byte{nullbytes}, c, nil + } + return [][]byte{bytes}, c, nil +} + +var ( + hexToInt = [256]int{ + '0': 0, + '1': 1, + '2': 2, + '3': 3, + '4': 4, + '5': 5, + '6': 6, + '7': 7, + '8': 8, + '9': 9, + 'A': 10, + 'B': 11, + 'C': 12, + 'D': 13, + 'E': 14, + 'F': 15, + 'a': 10, + 'b': 11, + 'c': 12, + 'd': 13, + 'e': 14, + 'f': 15, + } +) + +func unicodeToRune(code []byte) rune { + var r rune + for i := 0; i < len(code); i++ { + r = r*16 + rune(hexToInt[code[i]]) + } + return r +} + +func readAtLeast(s *Stream, n int64, p *unsafe.Pointer) bool { + for s.cursor+n >= s.length { + if !s.read() { + return false + } + *p = s.bufptr() + } + return true +} + +func decodeUnicodeRune(s *Stream, p unsafe.Pointer) (rune, int64, unsafe.Pointer, error) { + const defaultOffset = 5 + const surrogateOffset = 11 + + if !readAtLeast(s, defaultOffset, &p) { + return rune(0), 0, nil, errors.ErrInvalidCharacter(s.char(), "escaped string", s.totalOffset()) + } + + r := unicodeToRune(s.buf[s.cursor+1 : s.cursor+defaultOffset]) + if utf16.IsSurrogate(r) { + if !readAtLeast(s, surrogateOffset, &p) { + return unicode.ReplacementChar, defaultOffset, p, nil + } + if s.buf[s.cursor+defaultOffset] != '\\' || s.buf[s.cursor+defaultOffset+1] != 'u' { + return unicode.ReplacementChar, defaultOffset, p, nil + } + r2 := unicodeToRune(s.buf[s.cursor+defaultOffset+2 : s.cursor+surrogateOffset]) + if r := utf16.DecodeRune(r, r2); r != unicode.ReplacementChar { + return r, surrogateOffset, p, nil + } + } + return r, defaultOffset, p, nil +} + +func decodeUnicode(s *Stream, p unsafe.Pointer) (unsafe.Pointer, error) { + const backSlashAndULen = 2 // length of \u + + r, offset, pp, err := decodeUnicodeRune(s, p) + if err != nil { + return nil, err + } + unicode := []byte(string(r)) + unicodeLen := int64(len(unicode)) + s.buf = append(append(s.buf[:s.cursor-1], unicode...), s.buf[s.cursor+offset:]...) + unicodeOrgLen := offset - 1 + s.length = s.length - (backSlashAndULen + (unicodeOrgLen - unicodeLen)) + s.cursor = s.cursor - backSlashAndULen + unicodeLen + return pp, nil +} + +func decodeEscapeString(s *Stream, p unsafe.Pointer) (unsafe.Pointer, error) { + s.cursor++ +RETRY: + switch s.buf[s.cursor] { + case '"': + s.buf[s.cursor] = '"' + case '\\': + s.buf[s.cursor] = '\\' + case '/': + s.buf[s.cursor] = '/' + case 'b': + s.buf[s.cursor] = '\b' + case 'f': + s.buf[s.cursor] = '\f' + case 'n': + s.buf[s.cursor] = '\n' + case 'r': + s.buf[s.cursor] = '\r' + case 't': + s.buf[s.cursor] = '\t' + case 'u': + return decodeUnicode(s, p) + case nul: + if !s.read() { + return nil, errors.ErrInvalidCharacter(s.char(), "escaped string", s.totalOffset()) + } + p = s.bufptr() + goto RETRY + default: + return nil, errors.ErrUnexpectedEndOfJSON("string", s.totalOffset()) + } + s.buf = append(s.buf[:s.cursor-1], s.buf[s.cursor:]...) + s.length-- + s.cursor-- + p = s.bufptr() + return p, nil +} + +var ( + runeErrBytes = []byte(string(utf8.RuneError)) + runeErrBytesLen = int64(len(runeErrBytes)) +) + +func stringBytes(s *Stream) ([]byte, error) { + _, cursor, p := s.stat() + cursor++ // skip double quote char + start := cursor + for { + switch char(p, cursor) { + case '\\': + s.cursor = cursor + pp, err := decodeEscapeString(s, p) + if err != nil { + return nil, err + } + p = pp + cursor = s.cursor + case '"': + literal := s.buf[start:cursor] + cursor++ + s.cursor = cursor + return literal, nil + case + // 0x00 is nul, 0x5c is '\\', 0x22 is '"' . + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, // 0x00-0x0F + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, // 0x10-0x1F + 0x20, 0x21 /*0x22,*/, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, // 0x20-0x2F + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, // 0x30-0x3F + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, // 0x40-0x4F + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B /*0x5C,*/, 0x5D, 0x5E, 0x5F, // 0x50-0x5F + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, // 0x60-0x6F + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F: // 0x70-0x7F + // character is ASCII. skip to next char + case + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, // 0x80-0x8F + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, // 0x90-0x9F + 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, // 0xA0-0xAF + 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, // 0xB0-0xBF + 0xC0, 0xC1, // 0xC0-0xC1 + 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF: // 0xF5-0xFE + // character is invalid + s.buf = append(append(append([]byte{}, s.buf[:cursor]...), runeErrBytes...), s.buf[cursor+1:]...) + _, _, p = s.stat() + cursor += runeErrBytesLen + s.length += runeErrBytesLen + continue + case nul: + s.cursor = cursor + if s.read() { + _, cursor, p = s.stat() + continue + } + goto ERROR + case 0xEF: + // RuneError is {0xEF, 0xBF, 0xBD} + if s.buf[cursor+1] == 0xBF && s.buf[cursor+2] == 0xBD { + // found RuneError: skip + cursor += 2 + break + } + fallthrough + default: + // multi bytes character + if !utf8.FullRune(s.buf[cursor : len(s.buf)-1]) { + s.cursor = cursor + if s.read() { + _, cursor, p = s.stat() + continue + } + goto ERROR + } + r, size := utf8.DecodeRune(s.buf[cursor:]) + if r == utf8.RuneError { + s.buf = append(append(append([]byte{}, s.buf[:cursor]...), runeErrBytes...), s.buf[cursor+1:]...) + cursor += runeErrBytesLen + s.length += runeErrBytesLen + _, _, p = s.stat() + } else { + cursor += int64(size) + } + continue + } + cursor++ + } +ERROR: + return nil, errors.ErrUnexpectedEndOfJSON("string", s.totalOffset()) +} + +func (d *stringDecoder) decodeStreamByte(s *Stream) ([]byte, error) { + for { + switch s.char() { + case ' ', '\n', '\t', '\r': + s.cursor++ + continue + case '[': + return nil, d.errUnmarshalType("array", s.totalOffset()) + case '{': + return nil, d.errUnmarshalType("object", s.totalOffset()) + case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + return nil, d.errUnmarshalType("number", s.totalOffset()) + case '"': + return stringBytes(s) + case 'n': + if err := nullBytes(s); err != nil { + return nil, err + } + return nil, nil + case nul: + if s.read() { + continue + } + } + break + } + return nil, errors.ErrInvalidBeginningOfValue(s.char(), s.totalOffset()) +} + +func (d *stringDecoder) decodeByte(buf []byte, cursor int64) ([]byte, int64, error) { + for { + switch buf[cursor] { + case ' ', '\n', '\t', '\r': + cursor++ + case '[': + return nil, 0, d.errUnmarshalType("array", cursor) + case '{': + return nil, 0, d.errUnmarshalType("object", cursor) + case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + return nil, 0, d.errUnmarshalType("number", cursor) + case '"': + cursor++ + start := cursor + b := (*sliceHeader)(unsafe.Pointer(&buf)).data + escaped := 0 + for { + switch char(b, cursor) { + case '\\': + escaped++ + cursor++ + switch char(b, cursor) { + case '"', '\\', '/', 'b', 'f', 'n', 'r', 't': + cursor++ + case 'u': + buflen := int64(len(buf)) + if cursor+5 >= buflen { + return nil, 0, errors.ErrUnexpectedEndOfJSON("escaped string", cursor) + } + for i := int64(1); i <= 4; i++ { + c := char(b, cursor+i) + if !(('0' <= c && c <= '9') || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F')) { + return nil, 0, errors.ErrSyntax(fmt.Sprintf("json: invalid character %c in \\u hexadecimal character escape", c), cursor+i) + } + } + cursor += 5 + default: + return nil, 0, errors.ErrUnexpectedEndOfJSON("escaped string", cursor) + } + continue + case '"': + literal := buf[start:cursor] + if escaped > 0 { + literal = literal[:unescapeString(literal)] + } + cursor++ + return literal, cursor, nil + case nul: + return nil, 0, errors.ErrUnexpectedEndOfJSON("string", cursor) + } + cursor++ + } + case 'n': + if err := validateNull(buf, cursor); err != nil { + return nil, 0, err + } + cursor += 4 + return nil, cursor, nil + default: + return nil, 0, errors.ErrInvalidBeginningOfValue(buf[cursor], cursor) + } + } +} + +var unescapeMap = [256]byte{ + '"': '"', + '\\': '\\', + '/': '/', + 'b': '\b', + 'f': '\f', + 'n': '\n', + 'r': '\r', + 't': '\t', +} + +func unsafeAdd(ptr unsafe.Pointer, offset int) unsafe.Pointer { + return unsafe.Pointer(uintptr(ptr) + uintptr(offset)) +} + +func unescapeString(buf []byte) int { + p := (*sliceHeader)(unsafe.Pointer(&buf)).data + end := unsafeAdd(p, len(buf)) + src := unsafeAdd(p, bytes.IndexByte(buf, '\\')) + dst := src + for src != end { + c := char(src, 0) + if c == '\\' { + escapeChar := char(src, 1) + if escapeChar != 'u' { + *(*byte)(dst) = unescapeMap[escapeChar] + src = unsafeAdd(src, 2) + dst = unsafeAdd(dst, 1) + } else { + v1 := hexToInt[char(src, 2)] + v2 := hexToInt[char(src, 3)] + v3 := hexToInt[char(src, 4)] + v4 := hexToInt[char(src, 5)] + code := rune((v1 << 12) | (v2 << 8) | (v3 << 4) | v4) + if code >= 0xd800 && code < 0xdc00 && uintptr(unsafeAdd(src, 11)) < uintptr(end) { + if char(src, 6) == '\\' && char(src, 7) == 'u' { + v1 := hexToInt[char(src, 8)] + v2 := hexToInt[char(src, 9)] + v3 := hexToInt[char(src, 10)] + v4 := hexToInt[char(src, 11)] + lo := rune((v1 << 12) | (v2 << 8) | (v3 << 4) | v4) + if lo >= 0xdc00 && lo < 0xe000 { + code = (code-0xd800)<<10 | (lo - 0xdc00) + 0x10000 + src = unsafeAdd(src, 6) + } + } + } + var b [utf8.UTFMax]byte + n := utf8.EncodeRune(b[:], code) + switch n { + case 4: + *(*byte)(unsafeAdd(dst, 3)) = b[3] + fallthrough + case 3: + *(*byte)(unsafeAdd(dst, 2)) = b[2] + fallthrough + case 2: + *(*byte)(unsafeAdd(dst, 1)) = b[1] + fallthrough + case 1: + *(*byte)(unsafeAdd(dst, 0)) = b[0] + } + src = unsafeAdd(src, 6) + dst = unsafeAdd(dst, n) + } + } else { + *(*byte)(dst) = c + src = unsafeAdd(src, 1) + dst = unsafeAdd(dst, 1) + } + } + return int(uintptr(dst) - uintptr(p)) +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/struct.go b/vendor/github.com/goccy/go-json/internal/decoder/struct.go new file mode 100644 index 000000000..313da153b --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/struct.go @@ -0,0 +1,845 @@ +package decoder + +import ( + "fmt" + "math" + "math/bits" + "sort" + "strings" + "unicode" + "unicode/utf16" + "unsafe" + + "github.com/goccy/go-json/internal/errors" +) + +type structFieldSet struct { + dec Decoder + offset uintptr + isTaggedKey bool + fieldIdx int + key string + keyLen int64 + err error +} + +type structDecoder struct { + fieldMap map[string]*structFieldSet + fieldUniqueNameNum int + stringDecoder *stringDecoder + structName string + fieldName string + isTriedOptimize bool + keyBitmapUint8 [][256]uint8 + keyBitmapUint16 [][256]uint16 + sortedFieldSets []*structFieldSet + keyDecoder func(*structDecoder, []byte, int64) (int64, *structFieldSet, error) + keyStreamDecoder func(*structDecoder, *Stream) (*structFieldSet, string, error) +} + +var ( + largeToSmallTable [256]byte +) + +func init() { + for i := 0; i < 256; i++ { + c := i + if 'A' <= c && c <= 'Z' { + c += 'a' - 'A' + } + largeToSmallTable[i] = byte(c) + } +} + +func toASCIILower(s string) string { + b := []byte(s) + for i := range b { + b[i] = largeToSmallTable[b[i]] + } + return string(b) +} + +func newStructDecoder(structName, fieldName string, fieldMap map[string]*structFieldSet) *structDecoder { + return &structDecoder{ + fieldMap: fieldMap, + stringDecoder: newStringDecoder(structName, fieldName), + structName: structName, + fieldName: fieldName, + keyDecoder: decodeKey, + keyStreamDecoder: decodeKeyStream, + } +} + +const ( + allowOptimizeMaxKeyLen = 64 + allowOptimizeMaxFieldLen = 16 +) + +func (d *structDecoder) tryOptimize() { + fieldUniqueNameMap := map[string]int{} + fieldIdx := -1 + for k, v := range d.fieldMap { + lower := strings.ToLower(k) + idx, exists := fieldUniqueNameMap[lower] + if exists { + v.fieldIdx = idx + } else { + fieldIdx++ + v.fieldIdx = fieldIdx + } + fieldUniqueNameMap[lower] = fieldIdx + } + d.fieldUniqueNameNum = len(fieldUniqueNameMap) + + if d.isTriedOptimize { + return + } + fieldMap := map[string]*structFieldSet{} + conflicted := map[string]struct{}{} + for k, v := range d.fieldMap { + key := strings.ToLower(k) + if key != k { + if key != toASCIILower(k) { + d.isTriedOptimize = true + return + } + // already exists same key (e.g. Hello and HELLO has same lower case key + if _, exists := conflicted[key]; exists { + d.isTriedOptimize = true + return + } + conflicted[key] = struct{}{} + } + if field, exists := fieldMap[key]; exists { + if field != v { + d.isTriedOptimize = true + return + } + } + fieldMap[key] = v + } + + if len(fieldMap) > allowOptimizeMaxFieldLen { + d.isTriedOptimize = true + return + } + + var maxKeyLen int + sortedKeys := []string{} + for key := range fieldMap { + keyLen := len(key) + if keyLen > allowOptimizeMaxKeyLen { + d.isTriedOptimize = true + return + } + if maxKeyLen < keyLen { + maxKeyLen = keyLen + } + sortedKeys = append(sortedKeys, key) + } + sort.Strings(sortedKeys) + + // By allocating one extra capacity than `maxKeyLen`, + // it is possible to avoid the process of comparing the index of the key with the length of the bitmap each time. + bitmapLen := maxKeyLen + 1 + if len(sortedKeys) <= 8 { + keyBitmap := make([][256]uint8, bitmapLen) + for i, key := range sortedKeys { + for j := 0; j < len(key); j++ { + c := key[j] + keyBitmap[j][c] |= (1 << uint(i)) + } + d.sortedFieldSets = append(d.sortedFieldSets, fieldMap[key]) + } + d.keyBitmapUint8 = keyBitmap + d.keyDecoder = decodeKeyByBitmapUint8 + d.keyStreamDecoder = decodeKeyByBitmapUint8Stream + } else { + keyBitmap := make([][256]uint16, bitmapLen) + for i, key := range sortedKeys { + for j := 0; j < len(key); j++ { + c := key[j] + keyBitmap[j][c] |= (1 << uint(i)) + } + d.sortedFieldSets = append(d.sortedFieldSets, fieldMap[key]) + } + d.keyBitmapUint16 = keyBitmap + d.keyDecoder = decodeKeyByBitmapUint16 + d.keyStreamDecoder = decodeKeyByBitmapUint16Stream + } +} + +// decode from '\uXXXX' +func decodeKeyCharByUnicodeRune(buf []byte, cursor int64) ([]byte, int64, error) { + const defaultOffset = 4 + const surrogateOffset = 6 + + if cursor+defaultOffset >= int64(len(buf)) { + return nil, 0, errors.ErrUnexpectedEndOfJSON("escaped string", cursor) + } + + r := unicodeToRune(buf[cursor : cursor+defaultOffset]) + if utf16.IsSurrogate(r) { + cursor += defaultOffset + if cursor+surrogateOffset >= int64(len(buf)) || buf[cursor] != '\\' || buf[cursor+1] != 'u' { + return []byte(string(unicode.ReplacementChar)), cursor + defaultOffset - 1, nil + } + cursor += 2 + r2 := unicodeToRune(buf[cursor : cursor+defaultOffset]) + if r := utf16.DecodeRune(r, r2); r != unicode.ReplacementChar { + return []byte(string(r)), cursor + defaultOffset - 1, nil + } + } + return []byte(string(r)), cursor + defaultOffset - 1, nil +} + +func decodeKeyCharByEscapedChar(buf []byte, cursor int64) ([]byte, int64, error) { + c := buf[cursor] + cursor++ + switch c { + case '"': + return []byte{'"'}, cursor, nil + case '\\': + return []byte{'\\'}, cursor, nil + case '/': + return []byte{'/'}, cursor, nil + case 'b': + return []byte{'\b'}, cursor, nil + case 'f': + return []byte{'\f'}, cursor, nil + case 'n': + return []byte{'\n'}, cursor, nil + case 'r': + return []byte{'\r'}, cursor, nil + case 't': + return []byte{'\t'}, cursor, nil + case 'u': + return decodeKeyCharByUnicodeRune(buf, cursor) + } + return nil, cursor, nil +} + +func decodeKeyByBitmapUint8(d *structDecoder, buf []byte, cursor int64) (int64, *structFieldSet, error) { + var ( + curBit uint8 = math.MaxUint8 + ) + b := (*sliceHeader)(unsafe.Pointer(&buf)).data + for { + switch char(b, cursor) { + case ' ', '\n', '\t', '\r': + cursor++ + case '"': + cursor++ + c := char(b, cursor) + switch c { + case '"': + cursor++ + return cursor, nil, nil + case nul: + return 0, nil, errors.ErrUnexpectedEndOfJSON("string", cursor) + } + keyIdx := 0 + bitmap := d.keyBitmapUint8 + start := cursor + for { + c := char(b, cursor) + switch c { + case '"': + fieldSetIndex := bits.TrailingZeros8(curBit) + field := d.sortedFieldSets[fieldSetIndex] + keyLen := cursor - start + cursor++ + if keyLen < field.keyLen { + // early match + return cursor, nil, nil + } + return cursor, field, nil + case nul: + return 0, nil, errors.ErrUnexpectedEndOfJSON("string", cursor) + case '\\': + cursor++ + chars, nextCursor, err := decodeKeyCharByEscapedChar(buf, cursor) + if err != nil { + return 0, nil, err + } + for _, c := range chars { + curBit &= bitmap[keyIdx][largeToSmallTable[c]] + if curBit == 0 { + return decodeKeyNotFound(b, cursor) + } + keyIdx++ + } + cursor = nextCursor + default: + curBit &= bitmap[keyIdx][largeToSmallTable[c]] + if curBit == 0 { + return decodeKeyNotFound(b, cursor) + } + keyIdx++ + } + cursor++ + } + default: + return cursor, nil, errors.ErrInvalidBeginningOfValue(char(b, cursor), cursor) + } + } +} + +func decodeKeyByBitmapUint16(d *structDecoder, buf []byte, cursor int64) (int64, *structFieldSet, error) { + var ( + curBit uint16 = math.MaxUint16 + ) + b := (*sliceHeader)(unsafe.Pointer(&buf)).data + for { + switch char(b, cursor) { + case ' ', '\n', '\t', '\r': + cursor++ + case '"': + cursor++ + c := char(b, cursor) + switch c { + case '"': + cursor++ + return cursor, nil, nil + case nul: + return 0, nil, errors.ErrUnexpectedEndOfJSON("string", cursor) + } + keyIdx := 0 + bitmap := d.keyBitmapUint16 + start := cursor + for { + c := char(b, cursor) + switch c { + case '"': + fieldSetIndex := bits.TrailingZeros16(curBit) + field := d.sortedFieldSets[fieldSetIndex] + keyLen := cursor - start + cursor++ + if keyLen < field.keyLen { + // early match + return cursor, nil, nil + } + return cursor, field, nil + case nul: + return 0, nil, errors.ErrUnexpectedEndOfJSON("string", cursor) + case '\\': + cursor++ + chars, nextCursor, err := decodeKeyCharByEscapedChar(buf, cursor) + if err != nil { + return 0, nil, err + } + for _, c := range chars { + curBit &= bitmap[keyIdx][largeToSmallTable[c]] + if curBit == 0 { + return decodeKeyNotFound(b, cursor) + } + keyIdx++ + } + cursor = nextCursor + default: + curBit &= bitmap[keyIdx][largeToSmallTable[c]] + if curBit == 0 { + return decodeKeyNotFound(b, cursor) + } + keyIdx++ + } + cursor++ + } + default: + return cursor, nil, errors.ErrInvalidBeginningOfValue(char(b, cursor), cursor) + } + } +} + +func decodeKeyNotFound(b unsafe.Pointer, cursor int64) (int64, *structFieldSet, error) { + for { + cursor++ + switch char(b, cursor) { + case '"': + cursor++ + return cursor, nil, nil + case '\\': + cursor++ + if char(b, cursor) == nul { + return 0, nil, errors.ErrUnexpectedEndOfJSON("string", cursor) + } + case nul: + return 0, nil, errors.ErrUnexpectedEndOfJSON("string", cursor) + } + } +} + +func decodeKey(d *structDecoder, buf []byte, cursor int64) (int64, *structFieldSet, error) { + key, c, err := d.stringDecoder.decodeByte(buf, cursor) + if err != nil { + return 0, nil, err + } + cursor = c + k := *(*string)(unsafe.Pointer(&key)) + field, exists := d.fieldMap[k] + if !exists { + return cursor, nil, nil + } + return cursor, field, nil +} + +func decodeKeyByBitmapUint8Stream(d *structDecoder, s *Stream) (*structFieldSet, string, error) { + var ( + curBit uint8 = math.MaxUint8 + ) + _, cursor, p := s.stat() + for { + switch char(p, cursor) { + case ' ', '\n', '\t', '\r': + cursor++ + case nul: + s.cursor = cursor + if s.read() { + _, cursor, p = s.stat() + continue + } + return nil, "", errors.ErrInvalidBeginningOfValue(char(p, cursor), s.totalOffset()) + case '"': + cursor++ + FIRST_CHAR: + start := cursor + switch char(p, cursor) { + case '"': + cursor++ + s.cursor = cursor + return nil, "", nil + case nul: + s.cursor = cursor + if s.read() { + _, cursor, p = s.stat() + goto FIRST_CHAR + } + return nil, "", errors.ErrUnexpectedEndOfJSON("string", s.totalOffset()) + } + keyIdx := 0 + bitmap := d.keyBitmapUint8 + for { + c := char(p, cursor) + switch c { + case '"': + fieldSetIndex := bits.TrailingZeros8(curBit) + field := d.sortedFieldSets[fieldSetIndex] + keyLen := cursor - start + cursor++ + s.cursor = cursor + if keyLen < field.keyLen { + // early match + return nil, field.key, nil + } + return field, field.key, nil + case nul: + s.cursor = cursor + if s.read() { + _, cursor, p = s.stat() + continue + } + return nil, "", errors.ErrUnexpectedEndOfJSON("string", s.totalOffset()) + case '\\': + s.cursor = cursor + 1 // skip '\' char + chars, err := decodeKeyCharByEscapeCharStream(s) + if err != nil { + return nil, "", err + } + cursor = s.cursor + for _, c := range chars { + curBit &= bitmap[keyIdx][largeToSmallTable[c]] + if curBit == 0 { + s.cursor = cursor + return decodeKeyNotFoundStream(s, start) + } + keyIdx++ + } + default: + curBit &= bitmap[keyIdx][largeToSmallTable[c]] + if curBit == 0 { + s.cursor = cursor + return decodeKeyNotFoundStream(s, start) + } + keyIdx++ + } + cursor++ + } + default: + return nil, "", errors.ErrInvalidBeginningOfValue(char(p, cursor), s.totalOffset()) + } + } +} + +func decodeKeyByBitmapUint16Stream(d *structDecoder, s *Stream) (*structFieldSet, string, error) { + var ( + curBit uint16 = math.MaxUint16 + ) + _, cursor, p := s.stat() + for { + switch char(p, cursor) { + case ' ', '\n', '\t', '\r': + cursor++ + case nul: + s.cursor = cursor + if s.read() { + _, cursor, p = s.stat() + continue + } + return nil, "", errors.ErrInvalidBeginningOfValue(char(p, cursor), s.totalOffset()) + case '"': + cursor++ + FIRST_CHAR: + start := cursor + switch char(p, cursor) { + case '"': + cursor++ + s.cursor = cursor + return nil, "", nil + case nul: + s.cursor = cursor + if s.read() { + _, cursor, p = s.stat() + goto FIRST_CHAR + } + return nil, "", errors.ErrUnexpectedEndOfJSON("string", s.totalOffset()) + } + keyIdx := 0 + bitmap := d.keyBitmapUint16 + for { + c := char(p, cursor) + switch c { + case '"': + fieldSetIndex := bits.TrailingZeros16(curBit) + field := d.sortedFieldSets[fieldSetIndex] + keyLen := cursor - start + cursor++ + s.cursor = cursor + if keyLen < field.keyLen { + // early match + return nil, field.key, nil + } + return field, field.key, nil + case nul: + s.cursor = cursor + if s.read() { + _, cursor, p = s.stat() + continue + } + return nil, "", errors.ErrUnexpectedEndOfJSON("string", s.totalOffset()) + case '\\': + s.cursor = cursor + 1 // skip '\' char + chars, err := decodeKeyCharByEscapeCharStream(s) + if err != nil { + return nil, "", err + } + cursor = s.cursor + for _, c := range chars { + curBit &= bitmap[keyIdx][largeToSmallTable[c]] + if curBit == 0 { + s.cursor = cursor + return decodeKeyNotFoundStream(s, start) + } + keyIdx++ + } + default: + curBit &= bitmap[keyIdx][largeToSmallTable[c]] + if curBit == 0 { + s.cursor = cursor + return decodeKeyNotFoundStream(s, start) + } + keyIdx++ + } + cursor++ + } + default: + return nil, "", errors.ErrInvalidBeginningOfValue(char(p, cursor), s.totalOffset()) + } + } +} + +// decode from '\uXXXX' +func decodeKeyCharByUnicodeRuneStream(s *Stream) ([]byte, error) { + const defaultOffset = 4 + const surrogateOffset = 6 + + if s.cursor+defaultOffset >= s.length { + if !s.read() { + return nil, errors.ErrInvalidCharacter(s.char(), "escaped unicode char", s.totalOffset()) + } + } + + r := unicodeToRune(s.buf[s.cursor : s.cursor+defaultOffset]) + if utf16.IsSurrogate(r) { + s.cursor += defaultOffset + if s.cursor+surrogateOffset >= s.length { + s.read() + } + if s.cursor+surrogateOffset >= s.length || s.buf[s.cursor] != '\\' || s.buf[s.cursor+1] != 'u' { + s.cursor += defaultOffset - 1 + return []byte(string(unicode.ReplacementChar)), nil + } + r2 := unicodeToRune(s.buf[s.cursor+defaultOffset+2 : s.cursor+surrogateOffset]) + if r := utf16.DecodeRune(r, r2); r != unicode.ReplacementChar { + s.cursor += defaultOffset - 1 + return []byte(string(r)), nil + } + } + s.cursor += defaultOffset - 1 + return []byte(string(r)), nil +} + +func decodeKeyCharByEscapeCharStream(s *Stream) ([]byte, error) { + c := s.buf[s.cursor] + s.cursor++ +RETRY: + switch c { + case '"': + return []byte{'"'}, nil + case '\\': + return []byte{'\\'}, nil + case '/': + return []byte{'/'}, nil + case 'b': + return []byte{'\b'}, nil + case 'f': + return []byte{'\f'}, nil + case 'n': + return []byte{'\n'}, nil + case 'r': + return []byte{'\r'}, nil + case 't': + return []byte{'\t'}, nil + case 'u': + return decodeKeyCharByUnicodeRuneStream(s) + case nul: + if !s.read() { + return nil, errors.ErrInvalidCharacter(s.char(), "escaped char", s.totalOffset()) + } + goto RETRY + default: + return nil, errors.ErrUnexpectedEndOfJSON("struct field", s.totalOffset()) + } +} + +func decodeKeyNotFoundStream(s *Stream, start int64) (*structFieldSet, string, error) { + buf, cursor, p := s.stat() + for { + cursor++ + switch char(p, cursor) { + case '"': + b := buf[start:cursor] + key := *(*string)(unsafe.Pointer(&b)) + cursor++ + s.cursor = cursor + return nil, key, nil + case '\\': + cursor++ + if char(p, cursor) == nul { + s.cursor = cursor + if !s.read() { + return nil, "", errors.ErrUnexpectedEndOfJSON("string", s.totalOffset()) + } + buf, cursor, p = s.statForRetry() + } + case nul: + s.cursor = cursor + if !s.read() { + return nil, "", errors.ErrUnexpectedEndOfJSON("string", s.totalOffset()) + } + buf, cursor, p = s.statForRetry() + } + } +} + +func decodeKeyStream(d *structDecoder, s *Stream) (*structFieldSet, string, error) { + key, err := d.stringDecoder.decodeStreamByte(s) + if err != nil { + return nil, "", err + } + k := *(*string)(unsafe.Pointer(&key)) + return d.fieldMap[k], k, nil +} + +func (d *structDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error { + depth++ + if depth > maxDecodeNestingDepth { + return errors.ErrExceededMaxDepth(s.char(), s.cursor) + } + + c := s.skipWhiteSpace() + switch c { + case 'n': + if err := nullBytes(s); err != nil { + return err + } + return nil + default: + if s.char() != '{' { + return errors.ErrInvalidBeginningOfValue(s.char(), s.totalOffset()) + } + } + s.cursor++ + if s.skipWhiteSpace() == '}' { + s.cursor++ + return nil + } + var ( + seenFields map[int]struct{} + seenFieldNum int + ) + firstWin := (s.Option.Flags & FirstWinOption) != 0 + if firstWin { + seenFields = make(map[int]struct{}, d.fieldUniqueNameNum) + } + for { + s.reset() + field, key, err := d.keyStreamDecoder(d, s) + if err != nil { + return err + } + if s.skipWhiteSpace() != ':' { + return errors.ErrExpected("colon after object key", s.totalOffset()) + } + s.cursor++ + if field != nil { + if field.err != nil { + return field.err + } + if firstWin { + if _, exists := seenFields[field.fieldIdx]; exists { + if err := s.skipValue(depth); err != nil { + return err + } + } else { + if err := field.dec.DecodeStream(s, depth, unsafe.Pointer(uintptr(p)+field.offset)); err != nil { + return err + } + seenFieldNum++ + if d.fieldUniqueNameNum <= seenFieldNum { + return s.skipObject(depth) + } + seenFields[field.fieldIdx] = struct{}{} + } + } else { + if err := field.dec.DecodeStream(s, depth, unsafe.Pointer(uintptr(p)+field.offset)); err != nil { + return err + } + } + } else if s.DisallowUnknownFields { + return fmt.Errorf("json: unknown field %q", key) + } else { + if err := s.skipValue(depth); err != nil { + return err + } + } + c := s.skipWhiteSpace() + if c == '}' { + s.cursor++ + return nil + } + if c != ',' { + return errors.ErrExpected("comma after object element", s.totalOffset()) + } + s.cursor++ + } +} + +func (d *structDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) { + buf := ctx.Buf + depth++ + if depth > maxDecodeNestingDepth { + return 0, errors.ErrExceededMaxDepth(buf[cursor], cursor) + } + buflen := int64(len(buf)) + cursor = skipWhiteSpace(buf, cursor) + b := (*sliceHeader)(unsafe.Pointer(&buf)).data + switch char(b, cursor) { + case 'n': + if err := validateNull(buf, cursor); err != nil { + return 0, err + } + cursor += 4 + return cursor, nil + case '{': + default: + return 0, errors.ErrInvalidBeginningOfValue(char(b, cursor), cursor) + } + cursor++ + cursor = skipWhiteSpace(buf, cursor) + if buf[cursor] == '}' { + cursor++ + return cursor, nil + } + var ( + seenFields map[int]struct{} + seenFieldNum int + ) + firstWin := (ctx.Option.Flags & FirstWinOption) != 0 + if firstWin { + seenFields = make(map[int]struct{}, d.fieldUniqueNameNum) + } + for { + c, field, err := d.keyDecoder(d, buf, cursor) + if err != nil { + return 0, err + } + cursor = skipWhiteSpace(buf, c) + if char(b, cursor) != ':' { + return 0, errors.ErrExpected("colon after object key", cursor) + } + cursor++ + if cursor >= buflen { + return 0, errors.ErrExpected("object value after colon", cursor) + } + if field != nil { + if field.err != nil { + return 0, field.err + } + if firstWin { + if _, exists := seenFields[field.fieldIdx]; exists { + c, err := skipValue(buf, cursor, depth) + if err != nil { + return 0, err + } + cursor = c + } else { + c, err := field.dec.Decode(ctx, cursor, depth, unsafe.Pointer(uintptr(p)+field.offset)) + if err != nil { + return 0, err + } + cursor = c + seenFieldNum++ + if d.fieldUniqueNameNum <= seenFieldNum { + return skipObject(buf, cursor, depth) + } + seenFields[field.fieldIdx] = struct{}{} + } + } else { + c, err := field.dec.Decode(ctx, cursor, depth, unsafe.Pointer(uintptr(p)+field.offset)) + if err != nil { + return 0, err + } + cursor = c + } + } else { + c, err := skipValue(buf, cursor, depth) + if err != nil { + return 0, err + } + cursor = c + } + cursor = skipWhiteSpace(buf, cursor) + if char(b, cursor) == '}' { + cursor++ + return cursor, nil + } + if char(b, cursor) != ',' { + return 0, errors.ErrExpected("comma after object element", cursor) + } + cursor++ + } +} + +func (d *structDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) { + return nil, 0, fmt.Errorf("json: struct decoder does not support decode path") +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/type.go b/vendor/github.com/goccy/go-json/internal/decoder/type.go new file mode 100644 index 000000000..beaf3ab86 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/type.go @@ -0,0 +1,30 @@ +package decoder + +import ( + "context" + "encoding" + "encoding/json" + "reflect" + "unsafe" +) + +type Decoder interface { + Decode(*RuntimeContext, int64, int64, unsafe.Pointer) (int64, error) + DecodePath(*RuntimeContext, int64, int64) ([][]byte, int64, error) + DecodeStream(*Stream, int64, unsafe.Pointer) error +} + +const ( + nul = '\000' + maxDecodeNestingDepth = 10000 +) + +type unmarshalerContext interface { + UnmarshalJSON(context.Context, []byte) error +} + +var ( + unmarshalJSONType = reflect.TypeOf((*json.Unmarshaler)(nil)).Elem() + unmarshalJSONContextType = reflect.TypeOf((*unmarshalerContext)(nil)).Elem() + unmarshalTextType = reflect.TypeOf((*encoding.TextUnmarshaler)(nil)).Elem() +) diff --git a/vendor/github.com/goccy/go-json/internal/decoder/uint.go b/vendor/github.com/goccy/go-json/internal/decoder/uint.go new file mode 100644 index 000000000..4131731b8 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/uint.go @@ -0,0 +1,194 @@ +package decoder + +import ( + "fmt" + "reflect" + "unsafe" + + "github.com/goccy/go-json/internal/errors" + "github.com/goccy/go-json/internal/runtime" +) + +type uintDecoder struct { + typ *runtime.Type + kind reflect.Kind + op func(unsafe.Pointer, uint64) + structName string + fieldName string +} + +func newUintDecoder(typ *runtime.Type, structName, fieldName string, op func(unsafe.Pointer, uint64)) *uintDecoder { + return &uintDecoder{ + typ: typ, + kind: typ.Kind(), + op: op, + structName: structName, + fieldName: fieldName, + } +} + +func (d *uintDecoder) typeError(buf []byte, offset int64) *errors.UnmarshalTypeError { + return &errors.UnmarshalTypeError{ + Value: fmt.Sprintf("number %s", string(buf)), + Type: runtime.RType2Type(d.typ), + Offset: offset, + } +} + +var ( + pow10u64 = [...]uint64{ + 1e00, 1e01, 1e02, 1e03, 1e04, 1e05, 1e06, 1e07, 1e08, 1e09, + 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, + } + pow10u64Len = len(pow10u64) +) + +func (d *uintDecoder) parseUint(b []byte) (uint64, error) { + maxDigit := len(b) + if maxDigit > pow10u64Len { + return 0, fmt.Errorf("invalid length of number") + } + sum := uint64(0) + for i := 0; i < maxDigit; i++ { + c := uint64(b[i]) - 48 + digitValue := pow10u64[maxDigit-i-1] + sum += c * digitValue + } + return sum, nil +} + +func (d *uintDecoder) decodeStreamByte(s *Stream) ([]byte, error) { + for { + switch s.char() { + case ' ', '\n', '\t', '\r': + s.cursor++ + continue + case '0': + s.cursor++ + return numZeroBuf, nil + case '1', '2', '3', '4', '5', '6', '7', '8', '9': + start := s.cursor + for { + s.cursor++ + if numTable[s.char()] { + continue + } else if s.char() == nul { + if s.read() { + s.cursor-- // for retry current character + continue + } + } + break + } + num := s.buf[start:s.cursor] + return num, nil + case 'n': + if err := nullBytes(s); err != nil { + return nil, err + } + return nil, nil + case nul: + if s.read() { + continue + } + default: + return nil, d.typeError([]byte{s.char()}, s.totalOffset()) + } + break + } + return nil, errors.ErrUnexpectedEndOfJSON("number(unsigned integer)", s.totalOffset()) +} + +func (d *uintDecoder) decodeByte(buf []byte, cursor int64) ([]byte, int64, error) { + for { + switch buf[cursor] { + case ' ', '\n', '\t', '\r': + cursor++ + continue + case '0': + cursor++ + return numZeroBuf, cursor, nil + case '1', '2', '3', '4', '5', '6', '7', '8', '9': + start := cursor + cursor++ + for numTable[buf[cursor]] { + cursor++ + } + num := buf[start:cursor] + return num, cursor, nil + case 'n': + if err := validateNull(buf, cursor); err != nil { + return nil, 0, err + } + cursor += 4 + return nil, cursor, nil + default: + return nil, 0, d.typeError([]byte{buf[cursor]}, cursor) + } + } +} + +func (d *uintDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error { + bytes, err := d.decodeStreamByte(s) + if err != nil { + return err + } + if bytes == nil { + return nil + } + u64, err := d.parseUint(bytes) + if err != nil { + return d.typeError(bytes, s.totalOffset()) + } + switch d.kind { + case reflect.Uint8: + if (1 << 8) <= u64 { + return d.typeError(bytes, s.totalOffset()) + } + case reflect.Uint16: + if (1 << 16) <= u64 { + return d.typeError(bytes, s.totalOffset()) + } + case reflect.Uint32: + if (1 << 32) <= u64 { + return d.typeError(bytes, s.totalOffset()) + } + } + d.op(p, u64) + return nil +} + +func (d *uintDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) { + bytes, c, err := d.decodeByte(ctx.Buf, cursor) + if err != nil { + return 0, err + } + if bytes == nil { + return c, nil + } + cursor = c + u64, err := d.parseUint(bytes) + if err != nil { + return 0, d.typeError(bytes, cursor) + } + switch d.kind { + case reflect.Uint8: + if (1 << 8) <= u64 { + return 0, d.typeError(bytes, cursor) + } + case reflect.Uint16: + if (1 << 16) <= u64 { + return 0, d.typeError(bytes, cursor) + } + case reflect.Uint32: + if (1 << 32) <= u64 { + return 0, d.typeError(bytes, cursor) + } + } + d.op(p, u64) + return cursor, nil +} + +func (d *uintDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) { + return nil, 0, fmt.Errorf("json: uint decoder does not support decode path") +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/unmarshal_json.go b/vendor/github.com/goccy/go-json/internal/decoder/unmarshal_json.go new file mode 100644 index 000000000..4cd6dbd57 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/unmarshal_json.go @@ -0,0 +1,104 @@ +package decoder + +import ( + "context" + "encoding/json" + "fmt" + "unsafe" + + "github.com/goccy/go-json/internal/errors" + "github.com/goccy/go-json/internal/runtime" +) + +type unmarshalJSONDecoder struct { + typ *runtime.Type + structName string + fieldName string +} + +func newUnmarshalJSONDecoder(typ *runtime.Type, structName, fieldName string) *unmarshalJSONDecoder { + return &unmarshalJSONDecoder{ + typ: typ, + structName: structName, + fieldName: fieldName, + } +} + +func (d *unmarshalJSONDecoder) annotateError(cursor int64, err error) { + switch e := err.(type) { + case *errors.UnmarshalTypeError: + e.Struct = d.structName + e.Field = d.fieldName + case *errors.SyntaxError: + e.Offset = cursor + } +} + +func (d *unmarshalJSONDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error { + s.skipWhiteSpace() + start := s.cursor + if err := s.skipValue(depth); err != nil { + return err + } + src := s.buf[start:s.cursor] + dst := make([]byte, len(src)) + copy(dst, src) + + v := *(*interface{})(unsafe.Pointer(&emptyInterface{ + typ: d.typ, + ptr: p, + })) + switch v := v.(type) { + case unmarshalerContext: + var ctx context.Context + if (s.Option.Flags & ContextOption) != 0 { + ctx = s.Option.Context + } else { + ctx = context.Background() + } + if err := v.UnmarshalJSON(ctx, dst); err != nil { + d.annotateError(s.cursor, err) + return err + } + case json.Unmarshaler: + if err := v.UnmarshalJSON(dst); err != nil { + d.annotateError(s.cursor, err) + return err + } + } + return nil +} + +func (d *unmarshalJSONDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) { + buf := ctx.Buf + cursor = skipWhiteSpace(buf, cursor) + start := cursor + end, err := skipValue(buf, cursor, depth) + if err != nil { + return 0, err + } + src := buf[start:end] + dst := make([]byte, len(src)) + copy(dst, src) + + v := *(*interface{})(unsafe.Pointer(&emptyInterface{ + typ: d.typ, + ptr: p, + })) + if (ctx.Option.Flags & ContextOption) != 0 { + if err := v.(unmarshalerContext).UnmarshalJSON(ctx.Option.Context, dst); err != nil { + d.annotateError(cursor, err) + return 0, err + } + } else { + if err := v.(json.Unmarshaler).UnmarshalJSON(dst); err != nil { + d.annotateError(cursor, err) + return 0, err + } + } + return end, nil +} + +func (d *unmarshalJSONDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) { + return nil, 0, fmt.Errorf("json: unmarshal json decoder does not support decode path") +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/unmarshal_text.go b/vendor/github.com/goccy/go-json/internal/decoder/unmarshal_text.go new file mode 100644 index 000000000..6d37993f0 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/unmarshal_text.go @@ -0,0 +1,285 @@ +package decoder + +import ( + "bytes" + "encoding" + "fmt" + "unicode" + "unicode/utf16" + "unicode/utf8" + "unsafe" + + "github.com/goccy/go-json/internal/errors" + "github.com/goccy/go-json/internal/runtime" +) + +type unmarshalTextDecoder struct { + typ *runtime.Type + structName string + fieldName string +} + +func newUnmarshalTextDecoder(typ *runtime.Type, structName, fieldName string) *unmarshalTextDecoder { + return &unmarshalTextDecoder{ + typ: typ, + structName: structName, + fieldName: fieldName, + } +} + +func (d *unmarshalTextDecoder) annotateError(cursor int64, err error) { + switch e := err.(type) { + case *errors.UnmarshalTypeError: + e.Struct = d.structName + e.Field = d.fieldName + case *errors.SyntaxError: + e.Offset = cursor + } +} + +var ( + nullbytes = []byte(`null`) +) + +func (d *unmarshalTextDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error { + s.skipWhiteSpace() + start := s.cursor + if err := s.skipValue(depth); err != nil { + return err + } + src := s.buf[start:s.cursor] + if len(src) > 0 { + switch src[0] { + case '[': + return &errors.UnmarshalTypeError{ + Value: "array", + Type: runtime.RType2Type(d.typ), + Offset: s.totalOffset(), + } + case '{': + return &errors.UnmarshalTypeError{ + Value: "object", + Type: runtime.RType2Type(d.typ), + Offset: s.totalOffset(), + } + case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + return &errors.UnmarshalTypeError{ + Value: "number", + Type: runtime.RType2Type(d.typ), + Offset: s.totalOffset(), + } + case 'n': + if bytes.Equal(src, nullbytes) { + *(*unsafe.Pointer)(p) = nil + return nil + } + } + } + dst := make([]byte, len(src)) + copy(dst, src) + + if b, ok := unquoteBytes(dst); ok { + dst = b + } + v := *(*interface{})(unsafe.Pointer(&emptyInterface{ + typ: d.typ, + ptr: p, + })) + if err := v.(encoding.TextUnmarshaler).UnmarshalText(dst); err != nil { + d.annotateError(s.cursor, err) + return err + } + return nil +} + +func (d *unmarshalTextDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) { + buf := ctx.Buf + cursor = skipWhiteSpace(buf, cursor) + start := cursor + end, err := skipValue(buf, cursor, depth) + if err != nil { + return 0, err + } + src := buf[start:end] + if len(src) > 0 { + switch src[0] { + case '[': + return 0, &errors.UnmarshalTypeError{ + Value: "array", + Type: runtime.RType2Type(d.typ), + Offset: start, + } + case '{': + return 0, &errors.UnmarshalTypeError{ + Value: "object", + Type: runtime.RType2Type(d.typ), + Offset: start, + } + case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + return 0, &errors.UnmarshalTypeError{ + Value: "number", + Type: runtime.RType2Type(d.typ), + Offset: start, + } + case 'n': + if bytes.Equal(src, nullbytes) { + *(*unsafe.Pointer)(p) = nil + return end, nil + } + } + } + + if s, ok := unquoteBytes(src); ok { + src = s + } + v := *(*interface{})(unsafe.Pointer(&emptyInterface{ + typ: d.typ, + ptr: *(*unsafe.Pointer)(unsafe.Pointer(&p)), + })) + if err := v.(encoding.TextUnmarshaler).UnmarshalText(src); err != nil { + d.annotateError(cursor, err) + return 0, err + } + return end, nil +} + +func (d *unmarshalTextDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) { + return nil, 0, fmt.Errorf("json: unmarshal text decoder does not support decode path") +} + +func unquoteBytes(s []byte) (t []byte, ok bool) { + length := len(s) + if length < 2 || s[0] != '"' || s[length-1] != '"' { + return + } + s = s[1 : length-1] + length -= 2 + + // Check for unusual characters. If there are none, + // then no unquoting is needed, so return a slice of the + // original bytes. + r := 0 + for r < length { + c := s[r] + if c == '\\' || c == '"' || c < ' ' { + break + } + if c < utf8.RuneSelf { + r++ + continue + } + rr, size := utf8.DecodeRune(s[r:]) + if rr == utf8.RuneError && size == 1 { + break + } + r += size + } + if r == length { + return s, true + } + + b := make([]byte, length+2*utf8.UTFMax) + w := copy(b, s[0:r]) + for r < length { + // Out of room? Can only happen if s is full of + // malformed UTF-8 and we're replacing each + // byte with RuneError. + if w >= len(b)-2*utf8.UTFMax { + nb := make([]byte, (len(b)+utf8.UTFMax)*2) + copy(nb, b[0:w]) + b = nb + } + switch c := s[r]; { + case c == '\\': + r++ + if r >= length { + return + } + switch s[r] { + default: + return + case '"', '\\', '/', '\'': + b[w] = s[r] + r++ + w++ + case 'b': + b[w] = '\b' + r++ + w++ + case 'f': + b[w] = '\f' + r++ + w++ + case 'n': + b[w] = '\n' + r++ + w++ + case 'r': + b[w] = '\r' + r++ + w++ + case 't': + b[w] = '\t' + r++ + w++ + case 'u': + r-- + rr := getu4(s[r:]) + if rr < 0 { + return + } + r += 6 + if utf16.IsSurrogate(rr) { + rr1 := getu4(s[r:]) + if dec := utf16.DecodeRune(rr, rr1); dec != unicode.ReplacementChar { + // A valid pair; consume. + r += 6 + w += utf8.EncodeRune(b[w:], dec) + break + } + // Invalid surrogate; fall back to replacement rune. + rr = unicode.ReplacementChar + } + w += utf8.EncodeRune(b[w:], rr) + } + + // Quote, control characters are invalid. + case c == '"', c < ' ': + return + + // ASCII + case c < utf8.RuneSelf: + b[w] = c + r++ + w++ + + // Coerce to well-formed UTF-8. + default: + rr, size := utf8.DecodeRune(s[r:]) + r += size + w += utf8.EncodeRune(b[w:], rr) + } + } + return b[0:w], true +} + +func getu4(s []byte) rune { + if len(s) < 6 || s[0] != '\\' || s[1] != 'u' { + return -1 + } + var r rune + for _, c := range s[2:6] { + switch { + case '0' <= c && c <= '9': + c = c - '0' + case 'a' <= c && c <= 'f': + c = c - 'a' + 10 + case 'A' <= c && c <= 'F': + c = c - 'A' + 10 + default: + return -1 + } + r = r*16 + rune(c) + } + return r +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/wrapped_string.go b/vendor/github.com/goccy/go-json/internal/decoder/wrapped_string.go new file mode 100644 index 000000000..0c4e2e6ea --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/decoder/wrapped_string.go @@ -0,0 +1,73 @@ +package decoder + +import ( + "fmt" + "reflect" + "unsafe" + + "github.com/goccy/go-json/internal/runtime" +) + +type wrappedStringDecoder struct { + typ *runtime.Type + dec Decoder + stringDecoder *stringDecoder + structName string + fieldName string + isPtrType bool +} + +func newWrappedStringDecoder(typ *runtime.Type, dec Decoder, structName, fieldName string) *wrappedStringDecoder { + return &wrappedStringDecoder{ + typ: typ, + dec: dec, + stringDecoder: newStringDecoder(structName, fieldName), + structName: structName, + fieldName: fieldName, + isPtrType: typ.Kind() == reflect.Ptr, + } +} + +func (d *wrappedStringDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error { + bytes, err := d.stringDecoder.decodeStreamByte(s) + if err != nil { + return err + } + if bytes == nil { + if d.isPtrType { + *(*unsafe.Pointer)(p) = nil + } + return nil + } + b := make([]byte, len(bytes)+1) + copy(b, bytes) + if _, err := d.dec.Decode(&RuntimeContext{Buf: b}, 0, depth, p); err != nil { + return err + } + return nil +} + +func (d *wrappedStringDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) { + bytes, c, err := d.stringDecoder.decodeByte(ctx.Buf, cursor) + if err != nil { + return 0, err + } + if bytes == nil { + if d.isPtrType { + *(*unsafe.Pointer)(p) = nil + } + return c, nil + } + bytes = append(bytes, nul) + oldBuf := ctx.Buf + ctx.Buf = bytes + if _, err := d.dec.Decode(ctx, 0, depth, p); err != nil { + return 0, err + } + ctx.Buf = oldBuf + return c, nil +} + +func (d *wrappedStringDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) { + return nil, 0, fmt.Errorf("json: wrapped string decoder does not support decode path") +} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/code.go b/vendor/github.com/goccy/go-json/internal/encoder/code.go new file mode 100644 index 000000000..5b08faefc --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/code.go @@ -0,0 +1,1023 @@ +package encoder + +import ( + "fmt" + "reflect" + "unsafe" + + "github.com/goccy/go-json/internal/runtime" +) + +type Code interface { + Kind() CodeKind + ToOpcode(*compileContext) Opcodes + Filter(*FieldQuery) Code +} + +type AnonymousCode interface { + ToAnonymousOpcode(*compileContext) Opcodes +} + +type Opcodes []*Opcode + +func (o Opcodes) First() *Opcode { + if len(o) == 0 { + return nil + } + return o[0] +} + +func (o Opcodes) Last() *Opcode { + if len(o) == 0 { + return nil + } + return o[len(o)-1] +} + +func (o Opcodes) Add(codes ...*Opcode) Opcodes { + return append(o, codes...) +} + +type CodeKind int + +const ( + CodeKindInterface CodeKind = iota + CodeKindPtr + CodeKindInt + CodeKindUint + CodeKindFloat + CodeKindString + CodeKindBool + CodeKindStruct + CodeKindMap + CodeKindSlice + CodeKindArray + CodeKindBytes + CodeKindMarshalJSON + CodeKindMarshalText + CodeKindRecursive +) + +type IntCode struct { + typ *runtime.Type + bitSize uint8 + isString bool + isPtr bool +} + +func (c *IntCode) Kind() CodeKind { + return CodeKindInt +} + +func (c *IntCode) ToOpcode(ctx *compileContext) Opcodes { + var code *Opcode + switch { + case c.isPtr: + code = newOpCode(ctx, c.typ, OpIntPtr) + case c.isString: + code = newOpCode(ctx, c.typ, OpIntString) + default: + code = newOpCode(ctx, c.typ, OpInt) + } + code.NumBitSize = c.bitSize + ctx.incIndex() + return Opcodes{code} +} + +func (c *IntCode) Filter(_ *FieldQuery) Code { + return c +} + +type UintCode struct { + typ *runtime.Type + bitSize uint8 + isString bool + isPtr bool +} + +func (c *UintCode) Kind() CodeKind { + return CodeKindUint +} + +func (c *UintCode) ToOpcode(ctx *compileContext) Opcodes { + var code *Opcode + switch { + case c.isPtr: + code = newOpCode(ctx, c.typ, OpUintPtr) + case c.isString: + code = newOpCode(ctx, c.typ, OpUintString) + default: + code = newOpCode(ctx, c.typ, OpUint) + } + code.NumBitSize = c.bitSize + ctx.incIndex() + return Opcodes{code} +} + +func (c *UintCode) Filter(_ *FieldQuery) Code { + return c +} + +type FloatCode struct { + typ *runtime.Type + bitSize uint8 + isPtr bool +} + +func (c *FloatCode) Kind() CodeKind { + return CodeKindFloat +} + +func (c *FloatCode) ToOpcode(ctx *compileContext) Opcodes { + var code *Opcode + switch { + case c.isPtr: + switch c.bitSize { + case 32: + code = newOpCode(ctx, c.typ, OpFloat32Ptr) + default: + code = newOpCode(ctx, c.typ, OpFloat64Ptr) + } + default: + switch c.bitSize { + case 32: + code = newOpCode(ctx, c.typ, OpFloat32) + default: + code = newOpCode(ctx, c.typ, OpFloat64) + } + } + ctx.incIndex() + return Opcodes{code} +} + +func (c *FloatCode) Filter(_ *FieldQuery) Code { + return c +} + +type StringCode struct { + typ *runtime.Type + isPtr bool +} + +func (c *StringCode) Kind() CodeKind { + return CodeKindString +} + +func (c *StringCode) ToOpcode(ctx *compileContext) Opcodes { + isJSONNumberType := c.typ == runtime.Type2RType(jsonNumberType) + var code *Opcode + if c.isPtr { + if isJSONNumberType { + code = newOpCode(ctx, c.typ, OpNumberPtr) + } else { + code = newOpCode(ctx, c.typ, OpStringPtr) + } + } else { + if isJSONNumberType { + code = newOpCode(ctx, c.typ, OpNumber) + } else { + code = newOpCode(ctx, c.typ, OpString) + } + } + ctx.incIndex() + return Opcodes{code} +} + +func (c *StringCode) Filter(_ *FieldQuery) Code { + return c +} + +type BoolCode struct { + typ *runtime.Type + isPtr bool +} + +func (c *BoolCode) Kind() CodeKind { + return CodeKindBool +} + +func (c *BoolCode) ToOpcode(ctx *compileContext) Opcodes { + var code *Opcode + switch { + case c.isPtr: + code = newOpCode(ctx, c.typ, OpBoolPtr) + default: + code = newOpCode(ctx, c.typ, OpBool) + } + ctx.incIndex() + return Opcodes{code} +} + +func (c *BoolCode) Filter(_ *FieldQuery) Code { + return c +} + +type BytesCode struct { + typ *runtime.Type + isPtr bool +} + +func (c *BytesCode) Kind() CodeKind { + return CodeKindBytes +} + +func (c *BytesCode) ToOpcode(ctx *compileContext) Opcodes { + var code *Opcode + switch { + case c.isPtr: + code = newOpCode(ctx, c.typ, OpBytesPtr) + default: + code = newOpCode(ctx, c.typ, OpBytes) + } + ctx.incIndex() + return Opcodes{code} +} + +func (c *BytesCode) Filter(_ *FieldQuery) Code { + return c +} + +type SliceCode struct { + typ *runtime.Type + value Code +} + +func (c *SliceCode) Kind() CodeKind { + return CodeKindSlice +} + +func (c *SliceCode) ToOpcode(ctx *compileContext) Opcodes { + // header => opcode => elem => end + // ^ | + // |________| + size := c.typ.Elem().Size() + header := newSliceHeaderCode(ctx, c.typ) + ctx.incIndex() + + ctx.incIndent() + codes := c.value.ToOpcode(ctx) + ctx.decIndent() + + codes.First().Flags |= IndirectFlags + elemCode := newSliceElemCode(ctx, c.typ.Elem(), header, size) + ctx.incIndex() + end := newOpCode(ctx, c.typ, OpSliceEnd) + ctx.incIndex() + header.End = end + header.Next = codes.First() + codes.Last().Next = elemCode + elemCode.Next = codes.First() + elemCode.End = end + return Opcodes{header}.Add(codes...).Add(elemCode).Add(end) +} + +func (c *SliceCode) Filter(_ *FieldQuery) Code { + return c +} + +type ArrayCode struct { + typ *runtime.Type + value Code +} + +func (c *ArrayCode) Kind() CodeKind { + return CodeKindArray +} + +func (c *ArrayCode) ToOpcode(ctx *compileContext) Opcodes { + // header => opcode => elem => end + // ^ | + // |________| + elem := c.typ.Elem() + alen := c.typ.Len() + size := elem.Size() + + header := newArrayHeaderCode(ctx, c.typ, alen) + ctx.incIndex() + + ctx.incIndent() + codes := c.value.ToOpcode(ctx) + ctx.decIndent() + + codes.First().Flags |= IndirectFlags + + elemCode := newArrayElemCode(ctx, elem, header, alen, size) + ctx.incIndex() + + end := newOpCode(ctx, c.typ, OpArrayEnd) + ctx.incIndex() + + header.End = end + header.Next = codes.First() + codes.Last().Next = elemCode + elemCode.Next = codes.First() + elemCode.End = end + + return Opcodes{header}.Add(codes...).Add(elemCode).Add(end) +} + +func (c *ArrayCode) Filter(_ *FieldQuery) Code { + return c +} + +type MapCode struct { + typ *runtime.Type + key Code + value Code +} + +func (c *MapCode) Kind() CodeKind { + return CodeKindMap +} + +func (c *MapCode) ToOpcode(ctx *compileContext) Opcodes { + // header => code => value => code => key => code => value => code => end + // ^ | + // |_______________________| + header := newMapHeaderCode(ctx, c.typ) + ctx.incIndex() + + keyCodes := c.key.ToOpcode(ctx) + + value := newMapValueCode(ctx, c.typ.Elem(), header) + ctx.incIndex() + + ctx.incIndent() + valueCodes := c.value.ToOpcode(ctx) + ctx.decIndent() + + valueCodes.First().Flags |= IndirectFlags + + key := newMapKeyCode(ctx, c.typ.Key(), header) + ctx.incIndex() + + end := newMapEndCode(ctx, c.typ, header) + ctx.incIndex() + + header.Next = keyCodes.First() + keyCodes.Last().Next = value + value.Next = valueCodes.First() + valueCodes.Last().Next = key + key.Next = keyCodes.First() + + header.End = end + key.End = end + value.End = end + return Opcodes{header}.Add(keyCodes...).Add(value).Add(valueCodes...).Add(key).Add(end) +} + +func (c *MapCode) Filter(_ *FieldQuery) Code { + return c +} + +type StructCode struct { + typ *runtime.Type + fields []*StructFieldCode + isPtr bool + disableIndirectConversion bool + isIndirect bool + isRecursive bool +} + +func (c *StructCode) Kind() CodeKind { + return CodeKindStruct +} + +func (c *StructCode) lastFieldCode(field *StructFieldCode, firstField *Opcode) *Opcode { + if isEmbeddedStruct(field) { + return c.lastAnonymousFieldCode(firstField) + } + lastField := firstField + for lastField.NextField != nil { + lastField = lastField.NextField + } + return lastField +} + +func (c *StructCode) lastAnonymousFieldCode(firstField *Opcode) *Opcode { + // firstField is special StructHead operation for anonymous structure. + // So, StructHead's next operation is truly struct head operation. + for firstField.Op == OpStructHead || firstField.Op == OpStructField { + firstField = firstField.Next + } + lastField := firstField + for lastField.NextField != nil { + lastField = lastField.NextField + } + return lastField +} + +func (c *StructCode) ToOpcode(ctx *compileContext) Opcodes { + // header => code => structField => code => end + // ^ | + // |__________| + if c.isRecursive { + recursive := newRecursiveCode(ctx, c.typ, &CompiledCode{}) + recursive.Type = c.typ + ctx.incIndex() + *ctx.recursiveCodes = append(*ctx.recursiveCodes, recursive) + return Opcodes{recursive} + } + codes := Opcodes{} + var prevField *Opcode + ctx.incIndent() + for idx, field := range c.fields { + isFirstField := idx == 0 + isEndField := idx == len(c.fields)-1 + fieldCodes := field.ToOpcode(ctx, isFirstField, isEndField) + for _, code := range fieldCodes { + if c.isIndirect { + code.Flags |= IndirectFlags + } + } + firstField := fieldCodes.First() + if len(codes) > 0 { + codes.Last().Next = firstField + firstField.Idx = codes.First().Idx + } + if prevField != nil { + prevField.NextField = firstField + } + if isEndField { + endField := fieldCodes.Last() + if len(codes) > 0 { + codes.First().End = endField + } else { + firstField.End = endField + } + codes = codes.Add(fieldCodes...) + break + } + prevField = c.lastFieldCode(field, firstField) + codes = codes.Add(fieldCodes...) + } + if len(codes) == 0 { + head := &Opcode{ + Op: OpStructHead, + Idx: opcodeOffset(ctx.ptrIndex), + Type: c.typ, + DisplayIdx: ctx.opcodeIndex, + Indent: ctx.indent, + } + ctx.incOpcodeIndex() + end := &Opcode{ + Op: OpStructEnd, + Idx: opcodeOffset(ctx.ptrIndex), + DisplayIdx: ctx.opcodeIndex, + Indent: ctx.indent, + } + head.NextField = end + head.Next = end + head.End = end + codes = codes.Add(head, end) + ctx.incIndex() + } + ctx.decIndent() + ctx.structTypeToCodes[uintptr(unsafe.Pointer(c.typ))] = codes + return codes +} + +func (c *StructCode) ToAnonymousOpcode(ctx *compileContext) Opcodes { + // header => code => structField => code => end + // ^ | + // |__________| + if c.isRecursive { + recursive := newRecursiveCode(ctx, c.typ, &CompiledCode{}) + recursive.Type = c.typ + ctx.incIndex() + *ctx.recursiveCodes = append(*ctx.recursiveCodes, recursive) + return Opcodes{recursive} + } + codes := Opcodes{} + var prevField *Opcode + for idx, field := range c.fields { + isFirstField := idx == 0 + isEndField := idx == len(c.fields)-1 + fieldCodes := field.ToAnonymousOpcode(ctx, isFirstField, isEndField) + for _, code := range fieldCodes { + if c.isIndirect { + code.Flags |= IndirectFlags + } + } + firstField := fieldCodes.First() + if len(codes) > 0 { + codes.Last().Next = firstField + firstField.Idx = codes.First().Idx + } + if prevField != nil { + prevField.NextField = firstField + } + if isEndField { + lastField := fieldCodes.Last() + if len(codes) > 0 { + codes.First().End = lastField + } else { + firstField.End = lastField + } + } + prevField = firstField + codes = codes.Add(fieldCodes...) + } + return codes +} + +func (c *StructCode) removeFieldsByTags(tags runtime.StructTags) { + fields := make([]*StructFieldCode, 0, len(c.fields)) + for _, field := range c.fields { + if field.isAnonymous { + structCode := field.getAnonymousStruct() + if structCode != nil && !structCode.isRecursive { + structCode.removeFieldsByTags(tags) + if len(structCode.fields) > 0 { + fields = append(fields, field) + } + continue + } + } + if tags.ExistsKey(field.key) { + continue + } + fields = append(fields, field) + } + c.fields = fields +} + +func (c *StructCode) enableIndirect() { + if c.isIndirect { + return + } + c.isIndirect = true + if len(c.fields) == 0 { + return + } + structCode := c.fields[0].getStruct() + if structCode == nil { + return + } + structCode.enableIndirect() +} + +func (c *StructCode) Filter(query *FieldQuery) Code { + fieldMap := map[string]*FieldQuery{} + for _, field := range query.Fields { + fieldMap[field.Name] = field + } + fields := make([]*StructFieldCode, 0, len(c.fields)) + for _, field := range c.fields { + query, exists := fieldMap[field.key] + if !exists { + continue + } + fieldCode := &StructFieldCode{ + typ: field.typ, + key: field.key, + tag: field.tag, + value: field.value, + offset: field.offset, + isAnonymous: field.isAnonymous, + isTaggedKey: field.isTaggedKey, + isNilableType: field.isNilableType, + isNilCheck: field.isNilCheck, + isAddrForMarshaler: field.isAddrForMarshaler, + isNextOpPtrType: field.isNextOpPtrType, + } + if len(query.Fields) > 0 { + fieldCode.value = fieldCode.value.Filter(query) + } + fields = append(fields, fieldCode) + } + return &StructCode{ + typ: c.typ, + fields: fields, + isPtr: c.isPtr, + disableIndirectConversion: c.disableIndirectConversion, + isIndirect: c.isIndirect, + isRecursive: c.isRecursive, + } +} + +type StructFieldCode struct { + typ *runtime.Type + key string + tag *runtime.StructTag + value Code + offset uintptr + isAnonymous bool + isTaggedKey bool + isNilableType bool + isNilCheck bool + isAddrForMarshaler bool + isNextOpPtrType bool + isMarshalerContext bool +} + +func (c *StructFieldCode) getStruct() *StructCode { + value := c.value + ptr, ok := value.(*PtrCode) + if ok { + value = ptr.value + } + structCode, ok := value.(*StructCode) + if ok { + return structCode + } + return nil +} + +func (c *StructFieldCode) getAnonymousStruct() *StructCode { + if !c.isAnonymous { + return nil + } + return c.getStruct() +} + +func optimizeStructHeader(code *Opcode, tag *runtime.StructTag) OpType { + headType := code.ToHeaderType(tag.IsString) + if tag.IsOmitEmpty { + headType = headType.HeadToOmitEmptyHead() + } + return headType +} + +func optimizeStructField(code *Opcode, tag *runtime.StructTag) OpType { + fieldType := code.ToFieldType(tag.IsString) + if tag.IsOmitEmpty { + fieldType = fieldType.FieldToOmitEmptyField() + } + return fieldType +} + +func (c *StructFieldCode) headerOpcodes(ctx *compileContext, field *Opcode, valueCodes Opcodes) Opcodes { + value := valueCodes.First() + op := optimizeStructHeader(value, c.tag) + field.Op = op + if value.Flags&MarshalerContextFlags != 0 { + field.Flags |= MarshalerContextFlags + } + field.NumBitSize = value.NumBitSize + field.PtrNum = value.PtrNum + field.FieldQuery = value.FieldQuery + fieldCodes := Opcodes{field} + if op.IsMultipleOpHead() { + field.Next = value + fieldCodes = fieldCodes.Add(valueCodes...) + } else { + ctx.decIndex() + } + return fieldCodes +} + +func (c *StructFieldCode) fieldOpcodes(ctx *compileContext, field *Opcode, valueCodes Opcodes) Opcodes { + value := valueCodes.First() + op := optimizeStructField(value, c.tag) + field.Op = op + if value.Flags&MarshalerContextFlags != 0 { + field.Flags |= MarshalerContextFlags + } + field.NumBitSize = value.NumBitSize + field.PtrNum = value.PtrNum + field.FieldQuery = value.FieldQuery + + fieldCodes := Opcodes{field} + if op.IsMultipleOpField() { + field.Next = value + fieldCodes = fieldCodes.Add(valueCodes...) + } else { + ctx.decIndex() + } + return fieldCodes +} + +func (c *StructFieldCode) addStructEndCode(ctx *compileContext, codes Opcodes) Opcodes { + end := &Opcode{ + Op: OpStructEnd, + Idx: opcodeOffset(ctx.ptrIndex), + DisplayIdx: ctx.opcodeIndex, + Indent: ctx.indent, + } + codes.Last().Next = end + code := codes.First() + for code.Op == OpStructField || code.Op == OpStructHead { + code = code.Next + } + for code.NextField != nil { + code = code.NextField + } + code.NextField = end + + codes = codes.Add(end) + ctx.incOpcodeIndex() + return codes +} + +func (c *StructFieldCode) structKey(ctx *compileContext) string { + if ctx.escapeKey { + rctx := &RuntimeContext{Option: &Option{Flag: HTMLEscapeOption}} + return fmt.Sprintf(`%s:`, string(AppendString(rctx, []byte{}, c.key))) + } + return fmt.Sprintf(`"%s":`, c.key) +} + +func (c *StructFieldCode) flags() OpFlags { + var flags OpFlags + if c.isTaggedKey { + flags |= IsTaggedKeyFlags + } + if c.isNilableType { + flags |= IsNilableTypeFlags + } + if c.isNilCheck { + flags |= NilCheckFlags + } + if c.isAddrForMarshaler { + flags |= AddrForMarshalerFlags + } + if c.isNextOpPtrType { + flags |= IsNextOpPtrTypeFlags + } + if c.isAnonymous { + flags |= AnonymousKeyFlags + } + if c.isMarshalerContext { + flags |= MarshalerContextFlags + } + return flags +} + +func (c *StructFieldCode) toValueOpcodes(ctx *compileContext) Opcodes { + if c.isAnonymous { + anonymCode, ok := c.value.(AnonymousCode) + if ok { + return anonymCode.ToAnonymousOpcode(ctx) + } + } + return c.value.ToOpcode(ctx) +} + +func (c *StructFieldCode) ToOpcode(ctx *compileContext, isFirstField, isEndField bool) Opcodes { + field := &Opcode{ + Idx: opcodeOffset(ctx.ptrIndex), + Flags: c.flags(), + Key: c.structKey(ctx), + Offset: uint32(c.offset), + Type: c.typ, + DisplayIdx: ctx.opcodeIndex, + Indent: ctx.indent, + DisplayKey: c.key, + } + ctx.incIndex() + valueCodes := c.toValueOpcodes(ctx) + if isFirstField { + codes := c.headerOpcodes(ctx, field, valueCodes) + if isEndField { + codes = c.addStructEndCode(ctx, codes) + } + return codes + } + codes := c.fieldOpcodes(ctx, field, valueCodes) + if isEndField { + if isEnableStructEndOptimization(c.value) { + field.Op = field.Op.FieldToEnd() + } else { + codes = c.addStructEndCode(ctx, codes) + } + } + return codes +} + +func (c *StructFieldCode) ToAnonymousOpcode(ctx *compileContext, isFirstField, isEndField bool) Opcodes { + field := &Opcode{ + Idx: opcodeOffset(ctx.ptrIndex), + Flags: c.flags() | AnonymousHeadFlags, + Key: c.structKey(ctx), + Offset: uint32(c.offset), + Type: c.typ, + DisplayIdx: ctx.opcodeIndex, + Indent: ctx.indent, + DisplayKey: c.key, + } + ctx.incIndex() + valueCodes := c.toValueOpcodes(ctx) + if isFirstField { + return c.headerOpcodes(ctx, field, valueCodes) + } + return c.fieldOpcodes(ctx, field, valueCodes) +} + +func isEnableStructEndOptimization(value Code) bool { + switch value.Kind() { + case CodeKindInt, + CodeKindUint, + CodeKindFloat, + CodeKindString, + CodeKindBool, + CodeKindBytes: + return true + case CodeKindPtr: + return isEnableStructEndOptimization(value.(*PtrCode).value) + default: + return false + } +} + +type InterfaceCode struct { + typ *runtime.Type + fieldQuery *FieldQuery + isPtr bool +} + +func (c *InterfaceCode) Kind() CodeKind { + return CodeKindInterface +} + +func (c *InterfaceCode) ToOpcode(ctx *compileContext) Opcodes { + var code *Opcode + switch { + case c.isPtr: + code = newOpCode(ctx, c.typ, OpInterfacePtr) + default: + code = newOpCode(ctx, c.typ, OpInterface) + } + code.FieldQuery = c.fieldQuery + if c.typ.NumMethod() > 0 { + code.Flags |= NonEmptyInterfaceFlags + } + ctx.incIndex() + return Opcodes{code} +} + +func (c *InterfaceCode) Filter(query *FieldQuery) Code { + return &InterfaceCode{ + typ: c.typ, + fieldQuery: query, + isPtr: c.isPtr, + } +} + +type MarshalJSONCode struct { + typ *runtime.Type + fieldQuery *FieldQuery + isAddrForMarshaler bool + isNilableType bool + isMarshalerContext bool +} + +func (c *MarshalJSONCode) Kind() CodeKind { + return CodeKindMarshalJSON +} + +func (c *MarshalJSONCode) ToOpcode(ctx *compileContext) Opcodes { + code := newOpCode(ctx, c.typ, OpMarshalJSON) + code.FieldQuery = c.fieldQuery + if c.isAddrForMarshaler { + code.Flags |= AddrForMarshalerFlags + } + if c.isMarshalerContext { + code.Flags |= MarshalerContextFlags + } + if c.isNilableType { + code.Flags |= IsNilableTypeFlags + } else { + code.Flags &= ^IsNilableTypeFlags + } + ctx.incIndex() + return Opcodes{code} +} + +func (c *MarshalJSONCode) Filter(query *FieldQuery) Code { + return &MarshalJSONCode{ + typ: c.typ, + fieldQuery: query, + isAddrForMarshaler: c.isAddrForMarshaler, + isNilableType: c.isNilableType, + isMarshalerContext: c.isMarshalerContext, + } +} + +type MarshalTextCode struct { + typ *runtime.Type + fieldQuery *FieldQuery + isAddrForMarshaler bool + isNilableType bool +} + +func (c *MarshalTextCode) Kind() CodeKind { + return CodeKindMarshalText +} + +func (c *MarshalTextCode) ToOpcode(ctx *compileContext) Opcodes { + code := newOpCode(ctx, c.typ, OpMarshalText) + code.FieldQuery = c.fieldQuery + if c.isAddrForMarshaler { + code.Flags |= AddrForMarshalerFlags + } + if c.isNilableType { + code.Flags |= IsNilableTypeFlags + } else { + code.Flags &= ^IsNilableTypeFlags + } + ctx.incIndex() + return Opcodes{code} +} + +func (c *MarshalTextCode) Filter(query *FieldQuery) Code { + return &MarshalTextCode{ + typ: c.typ, + fieldQuery: query, + isAddrForMarshaler: c.isAddrForMarshaler, + isNilableType: c.isNilableType, + } +} + +type PtrCode struct { + typ *runtime.Type + value Code + ptrNum uint8 +} + +func (c *PtrCode) Kind() CodeKind { + return CodeKindPtr +} + +func (c *PtrCode) ToOpcode(ctx *compileContext) Opcodes { + codes := c.value.ToOpcode(ctx) + codes.First().Op = convertPtrOp(codes.First()) + codes.First().PtrNum = c.ptrNum + return codes +} + +func (c *PtrCode) ToAnonymousOpcode(ctx *compileContext) Opcodes { + var codes Opcodes + anonymCode, ok := c.value.(AnonymousCode) + if ok { + codes = anonymCode.ToAnonymousOpcode(ctx) + } else { + codes = c.value.ToOpcode(ctx) + } + codes.First().Op = convertPtrOp(codes.First()) + codes.First().PtrNum = c.ptrNum + return codes +} + +func (c *PtrCode) Filter(query *FieldQuery) Code { + return &PtrCode{ + typ: c.typ, + value: c.value.Filter(query), + ptrNum: c.ptrNum, + } +} + +func convertPtrOp(code *Opcode) OpType { + ptrHeadOp := code.Op.HeadToPtrHead() + if code.Op != ptrHeadOp { + if code.PtrNum > 0 { + // ptr field and ptr head + code.PtrNum-- + } + return ptrHeadOp + } + switch code.Op { + case OpInt: + return OpIntPtr + case OpUint: + return OpUintPtr + case OpFloat32: + return OpFloat32Ptr + case OpFloat64: + return OpFloat64Ptr + case OpString: + return OpStringPtr + case OpBool: + return OpBoolPtr + case OpBytes: + return OpBytesPtr + case OpNumber: + return OpNumberPtr + case OpArray: + return OpArrayPtr + case OpSlice: + return OpSlicePtr + case OpMap: + return OpMapPtr + case OpMarshalJSON: + return OpMarshalJSONPtr + case OpMarshalText: + return OpMarshalTextPtr + case OpInterface: + return OpInterfacePtr + case OpRecursive: + return OpRecursivePtr + } + return code.Op +} + +func isEmbeddedStruct(field *StructFieldCode) bool { + if !field.isAnonymous { + return false + } + t := field.typ + if t.Kind() == reflect.Ptr { + t = t.Elem() + } + return t.Kind() == reflect.Struct +} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/compact.go b/vendor/github.com/goccy/go-json/internal/encoder/compact.go new file mode 100644 index 000000000..0eb9545d8 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/compact.go @@ -0,0 +1,286 @@ +package encoder + +import ( + "bytes" + "fmt" + "strconv" + "unsafe" + + "github.com/goccy/go-json/internal/errors" +) + +var ( + isWhiteSpace = [256]bool{ + ' ': true, + '\n': true, + '\t': true, + '\r': true, + } + isHTMLEscapeChar = [256]bool{ + '<': true, + '>': true, + '&': true, + } + nul = byte('\000') +) + +func Compact(buf *bytes.Buffer, src []byte, escape bool) error { + if len(src) == 0 { + return errors.ErrUnexpectedEndOfJSON("", 0) + } + buf.Grow(len(src)) + dst := buf.Bytes() + + ctx := TakeRuntimeContext() + ctxBuf := ctx.Buf[:0] + ctxBuf = append(append(ctxBuf, src...), nul) + ctx.Buf = ctxBuf + + if err := compactAndWrite(buf, dst, ctxBuf, escape); err != nil { + ReleaseRuntimeContext(ctx) + return err + } + ReleaseRuntimeContext(ctx) + return nil +} + +func compactAndWrite(buf *bytes.Buffer, dst []byte, src []byte, escape bool) error { + dst, err := compact(dst, src, escape) + if err != nil { + return err + } + if _, err := buf.Write(dst); err != nil { + return err + } + return nil +} + +func compact(dst, src []byte, escape bool) ([]byte, error) { + buf, cursor, err := compactValue(dst, src, 0, escape) + if err != nil { + return nil, err + } + if err := validateEndBuf(src, cursor); err != nil { + return nil, err + } + return buf, nil +} + +func validateEndBuf(src []byte, cursor int64) error { + for { + switch src[cursor] { + case ' ', '\t', '\n', '\r': + cursor++ + continue + case nul: + return nil + } + return errors.ErrSyntax( + fmt.Sprintf("invalid character '%c' after top-level value", src[cursor]), + cursor+1, + ) + } +} + +func skipWhiteSpace(buf []byte, cursor int64) int64 { +LOOP: + if isWhiteSpace[buf[cursor]] { + cursor++ + goto LOOP + } + return cursor +} + +func compactValue(dst, src []byte, cursor int64, escape bool) ([]byte, int64, error) { + for { + switch src[cursor] { + case ' ', '\t', '\n', '\r': + cursor++ + continue + case '{': + return compactObject(dst, src, cursor, escape) + case '}': + return nil, 0, errors.ErrSyntax("unexpected character '}'", cursor) + case '[': + return compactArray(dst, src, cursor, escape) + case ']': + return nil, 0, errors.ErrSyntax("unexpected character ']'", cursor) + case '"': + return compactString(dst, src, cursor, escape) + case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + return compactNumber(dst, src, cursor) + case 't': + return compactTrue(dst, src, cursor) + case 'f': + return compactFalse(dst, src, cursor) + case 'n': + return compactNull(dst, src, cursor) + default: + return nil, 0, errors.ErrSyntax(fmt.Sprintf("unexpected character '%c'", src[cursor]), cursor) + } + } +} + +func compactObject(dst, src []byte, cursor int64, escape bool) ([]byte, int64, error) { + if src[cursor] == '{' { + dst = append(dst, '{') + } else { + return nil, 0, errors.ErrExpected("expected { character for object value", cursor) + } + cursor = skipWhiteSpace(src, cursor+1) + if src[cursor] == '}' { + dst = append(dst, '}') + return dst, cursor + 1, nil + } + var err error + for { + cursor = skipWhiteSpace(src, cursor) + dst, cursor, err = compactString(dst, src, cursor, escape) + if err != nil { + return nil, 0, err + } + cursor = skipWhiteSpace(src, cursor) + if src[cursor] != ':' { + return nil, 0, errors.ErrExpected("colon after object key", cursor) + } + dst = append(dst, ':') + dst, cursor, err = compactValue(dst, src, cursor+1, escape) + if err != nil { + return nil, 0, err + } + cursor = skipWhiteSpace(src, cursor) + switch src[cursor] { + case '}': + dst = append(dst, '}') + cursor++ + return dst, cursor, nil + case ',': + dst = append(dst, ',') + default: + return nil, 0, errors.ErrExpected("comma after object value", cursor) + } + cursor++ + } +} + +func compactArray(dst, src []byte, cursor int64, escape bool) ([]byte, int64, error) { + if src[cursor] == '[' { + dst = append(dst, '[') + } else { + return nil, 0, errors.ErrExpected("expected [ character for array value", cursor) + } + cursor = skipWhiteSpace(src, cursor+1) + if src[cursor] == ']' { + dst = append(dst, ']') + return dst, cursor + 1, nil + } + var err error + for { + dst, cursor, err = compactValue(dst, src, cursor, escape) + if err != nil { + return nil, 0, err + } + cursor = skipWhiteSpace(src, cursor) + switch src[cursor] { + case ']': + dst = append(dst, ']') + cursor++ + return dst, cursor, nil + case ',': + dst = append(dst, ',') + default: + return nil, 0, errors.ErrExpected("comma after array value", cursor) + } + cursor++ + } +} + +func compactString(dst, src []byte, cursor int64, escape bool) ([]byte, int64, error) { + if src[cursor] != '"' { + return nil, 0, errors.ErrInvalidCharacter(src[cursor], "string", cursor) + } + start := cursor + for { + cursor++ + c := src[cursor] + if escape { + if isHTMLEscapeChar[c] { + dst = append(dst, src[start:cursor]...) + dst = append(dst, `\u00`...) + dst = append(dst, hex[c>>4], hex[c&0xF]) + start = cursor + 1 + } else if c == 0xE2 && cursor+2 < int64(len(src)) && src[cursor+1] == 0x80 && src[cursor+2]&^1 == 0xA8 { + dst = append(dst, src[start:cursor]...) + dst = append(dst, `\u202`...) + dst = append(dst, hex[src[cursor+2]&0xF]) + cursor += 2 + start = cursor + 3 + } + } + switch c { + case '\\': + cursor++ + if src[cursor] == nul { + return nil, 0, errors.ErrUnexpectedEndOfJSON("string", int64(len(src))) + } + case '"': + cursor++ + return append(dst, src[start:cursor]...), cursor, nil + case nul: + return nil, 0, errors.ErrUnexpectedEndOfJSON("string", int64(len(src))) + } + } +} + +func compactNumber(dst, src []byte, cursor int64) ([]byte, int64, error) { + start := cursor + for { + cursor++ + if floatTable[src[cursor]] { + continue + } + break + } + num := src[start:cursor] + if _, err := strconv.ParseFloat(*(*string)(unsafe.Pointer(&num)), 64); err != nil { + return nil, 0, err + } + dst = append(dst, num...) + return dst, cursor, nil +} + +func compactTrue(dst, src []byte, cursor int64) ([]byte, int64, error) { + if cursor+3 >= int64(len(src)) { + return nil, 0, errors.ErrUnexpectedEndOfJSON("true", cursor) + } + if !bytes.Equal(src[cursor:cursor+4], []byte(`true`)) { + return nil, 0, errors.ErrInvalidCharacter(src[cursor], "true", cursor) + } + dst = append(dst, "true"...) + cursor += 4 + return dst, cursor, nil +} + +func compactFalse(dst, src []byte, cursor int64) ([]byte, int64, error) { + if cursor+4 >= int64(len(src)) { + return nil, 0, errors.ErrUnexpectedEndOfJSON("false", cursor) + } + if !bytes.Equal(src[cursor:cursor+5], []byte(`false`)) { + return nil, 0, errors.ErrInvalidCharacter(src[cursor], "false", cursor) + } + dst = append(dst, "false"...) + cursor += 5 + return dst, cursor, nil +} + +func compactNull(dst, src []byte, cursor int64) ([]byte, int64, error) { + if cursor+3 >= int64(len(src)) { + return nil, 0, errors.ErrUnexpectedEndOfJSON("null", cursor) + } + if !bytes.Equal(src[cursor:cursor+4], []byte(`null`)) { + return nil, 0, errors.ErrInvalidCharacter(src[cursor], "null", cursor) + } + dst = append(dst, "null"...) + cursor += 4 + return dst, cursor, nil +} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/compiler.go b/vendor/github.com/goccy/go-json/internal/encoder/compiler.go new file mode 100644 index 000000000..3ae39ba8c --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/compiler.go @@ -0,0 +1,935 @@ +package encoder + +import ( + "context" + "encoding" + "encoding/json" + "reflect" + "sync/atomic" + "unsafe" + + "github.com/goccy/go-json/internal/errors" + "github.com/goccy/go-json/internal/runtime" +) + +type marshalerContext interface { + MarshalJSON(context.Context) ([]byte, error) +} + +var ( + marshalJSONType = reflect.TypeOf((*json.Marshaler)(nil)).Elem() + marshalJSONContextType = reflect.TypeOf((*marshalerContext)(nil)).Elem() + marshalTextType = reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem() + jsonNumberType = reflect.TypeOf(json.Number("")) + cachedOpcodeSets []*OpcodeSet + cachedOpcodeMap unsafe.Pointer // map[uintptr]*OpcodeSet + typeAddr *runtime.TypeAddr +) + +func init() { + typeAddr = runtime.AnalyzeTypeAddr() + if typeAddr == nil { + typeAddr = &runtime.TypeAddr{} + } + cachedOpcodeSets = make([]*OpcodeSet, typeAddr.AddrRange>>typeAddr.AddrShift+1) +} + +func loadOpcodeMap() map[uintptr]*OpcodeSet { + p := atomic.LoadPointer(&cachedOpcodeMap) + return *(*map[uintptr]*OpcodeSet)(unsafe.Pointer(&p)) +} + +func storeOpcodeSet(typ uintptr, set *OpcodeSet, m map[uintptr]*OpcodeSet) { + newOpcodeMap := make(map[uintptr]*OpcodeSet, len(m)+1) + newOpcodeMap[typ] = set + + for k, v := range m { + newOpcodeMap[k] = v + } + + atomic.StorePointer(&cachedOpcodeMap, *(*unsafe.Pointer)(unsafe.Pointer(&newOpcodeMap))) +} + +func compileToGetCodeSetSlowPath(typeptr uintptr) (*OpcodeSet, error) { + opcodeMap := loadOpcodeMap() + if codeSet, exists := opcodeMap[typeptr]; exists { + return codeSet, nil + } + codeSet, err := newCompiler().compile(typeptr) + if err != nil { + return nil, err + } + storeOpcodeSet(typeptr, codeSet, opcodeMap) + return codeSet, nil +} + +func getFilteredCodeSetIfNeeded(ctx *RuntimeContext, codeSet *OpcodeSet) (*OpcodeSet, error) { + if (ctx.Option.Flag & ContextOption) == 0 { + return codeSet, nil + } + query := FieldQueryFromContext(ctx.Option.Context) + if query == nil { + return codeSet, nil + } + ctx.Option.Flag |= FieldQueryOption + cacheCodeSet := codeSet.getQueryCache(query.Hash()) + if cacheCodeSet != nil { + return cacheCodeSet, nil + } + queryCodeSet, err := newCompiler().codeToOpcodeSet(codeSet.Type, codeSet.Code.Filter(query)) + if err != nil { + return nil, err + } + codeSet.setQueryCache(query.Hash(), queryCodeSet) + return queryCodeSet, nil +} + +type Compiler struct { + structTypeToCode map[uintptr]*StructCode +} + +func newCompiler() *Compiler { + return &Compiler{ + structTypeToCode: map[uintptr]*StructCode{}, + } +} + +func (c *Compiler) compile(typeptr uintptr) (*OpcodeSet, error) { + // noescape trick for header.typ ( reflect.*rtype ) + typ := *(**runtime.Type)(unsafe.Pointer(&typeptr)) + code, err := c.typeToCode(typ) + if err != nil { + return nil, err + } + return c.codeToOpcodeSet(typ, code) +} + +func (c *Compiler) codeToOpcodeSet(typ *runtime.Type, code Code) (*OpcodeSet, error) { + noescapeKeyCode := c.codeToOpcode(&compileContext{ + structTypeToCodes: map[uintptr]Opcodes{}, + recursiveCodes: &Opcodes{}, + }, typ, code) + if err := noescapeKeyCode.Validate(); err != nil { + return nil, err + } + escapeKeyCode := c.codeToOpcode(&compileContext{ + structTypeToCodes: map[uintptr]Opcodes{}, + recursiveCodes: &Opcodes{}, + escapeKey: true, + }, typ, code) + noescapeKeyCode = copyOpcode(noescapeKeyCode) + escapeKeyCode = copyOpcode(escapeKeyCode) + setTotalLengthToInterfaceOp(noescapeKeyCode) + setTotalLengthToInterfaceOp(escapeKeyCode) + interfaceNoescapeKeyCode := copyToInterfaceOpcode(noescapeKeyCode) + interfaceEscapeKeyCode := copyToInterfaceOpcode(escapeKeyCode) + codeLength := noescapeKeyCode.TotalLength() + return &OpcodeSet{ + Type: typ, + NoescapeKeyCode: noescapeKeyCode, + EscapeKeyCode: escapeKeyCode, + InterfaceNoescapeKeyCode: interfaceNoescapeKeyCode, + InterfaceEscapeKeyCode: interfaceEscapeKeyCode, + CodeLength: codeLength, + EndCode: ToEndCode(interfaceNoescapeKeyCode), + Code: code, + QueryCache: map[string]*OpcodeSet{}, + }, nil +} + +func (c *Compiler) typeToCode(typ *runtime.Type) (Code, error) { + switch { + case c.implementsMarshalJSON(typ): + return c.marshalJSONCode(typ) + case c.implementsMarshalText(typ): + return c.marshalTextCode(typ) + } + + isPtr := false + orgType := typ + if typ.Kind() == reflect.Ptr { + typ = typ.Elem() + isPtr = true + } + switch { + case c.implementsMarshalJSON(typ): + return c.marshalJSONCode(orgType) + case c.implementsMarshalText(typ): + return c.marshalTextCode(orgType) + } + switch typ.Kind() { + case reflect.Slice: + elem := typ.Elem() + if elem.Kind() == reflect.Uint8 { + p := runtime.PtrTo(elem) + if !c.implementsMarshalJSONType(p) && !p.Implements(marshalTextType) { + return c.bytesCode(typ, isPtr) + } + } + return c.sliceCode(typ) + case reflect.Map: + if isPtr { + return c.ptrCode(runtime.PtrTo(typ)) + } + return c.mapCode(typ) + case reflect.Struct: + return c.structCode(typ, isPtr) + case reflect.Int: + return c.intCode(typ, isPtr) + case reflect.Int8: + return c.int8Code(typ, isPtr) + case reflect.Int16: + return c.int16Code(typ, isPtr) + case reflect.Int32: + return c.int32Code(typ, isPtr) + case reflect.Int64: + return c.int64Code(typ, isPtr) + case reflect.Uint, reflect.Uintptr: + return c.uintCode(typ, isPtr) + case reflect.Uint8: + return c.uint8Code(typ, isPtr) + case reflect.Uint16: + return c.uint16Code(typ, isPtr) + case reflect.Uint32: + return c.uint32Code(typ, isPtr) + case reflect.Uint64: + return c.uint64Code(typ, isPtr) + case reflect.Float32: + return c.float32Code(typ, isPtr) + case reflect.Float64: + return c.float64Code(typ, isPtr) + case reflect.String: + return c.stringCode(typ, isPtr) + case reflect.Bool: + return c.boolCode(typ, isPtr) + case reflect.Interface: + return c.interfaceCode(typ, isPtr) + default: + if isPtr && typ.Implements(marshalTextType) { + typ = orgType + } + return c.typeToCodeWithPtr(typ, isPtr) + } +} + +func (c *Compiler) typeToCodeWithPtr(typ *runtime.Type, isPtr bool) (Code, error) { + switch { + case c.implementsMarshalJSON(typ): + return c.marshalJSONCode(typ) + case c.implementsMarshalText(typ): + return c.marshalTextCode(typ) + } + switch typ.Kind() { + case reflect.Ptr: + return c.ptrCode(typ) + case reflect.Slice: + elem := typ.Elem() + if elem.Kind() == reflect.Uint8 { + p := runtime.PtrTo(elem) + if !c.implementsMarshalJSONType(p) && !p.Implements(marshalTextType) { + return c.bytesCode(typ, false) + } + } + return c.sliceCode(typ) + case reflect.Array: + return c.arrayCode(typ) + case reflect.Map: + return c.mapCode(typ) + case reflect.Struct: + return c.structCode(typ, isPtr) + case reflect.Interface: + return c.interfaceCode(typ, false) + case reflect.Int: + return c.intCode(typ, false) + case reflect.Int8: + return c.int8Code(typ, false) + case reflect.Int16: + return c.int16Code(typ, false) + case reflect.Int32: + return c.int32Code(typ, false) + case reflect.Int64: + return c.int64Code(typ, false) + case reflect.Uint: + return c.uintCode(typ, false) + case reflect.Uint8: + return c.uint8Code(typ, false) + case reflect.Uint16: + return c.uint16Code(typ, false) + case reflect.Uint32: + return c.uint32Code(typ, false) + case reflect.Uint64: + return c.uint64Code(typ, false) + case reflect.Uintptr: + return c.uintCode(typ, false) + case reflect.Float32: + return c.float32Code(typ, false) + case reflect.Float64: + return c.float64Code(typ, false) + case reflect.String: + return c.stringCode(typ, false) + case reflect.Bool: + return c.boolCode(typ, false) + } + return nil, &errors.UnsupportedTypeError{Type: runtime.RType2Type(typ)} +} + +const intSize = 32 << (^uint(0) >> 63) + +//nolint:unparam +func (c *Compiler) intCode(typ *runtime.Type, isPtr bool) (*IntCode, error) { + return &IntCode{typ: typ, bitSize: intSize, isPtr: isPtr}, nil +} + +//nolint:unparam +func (c *Compiler) int8Code(typ *runtime.Type, isPtr bool) (*IntCode, error) { + return &IntCode{typ: typ, bitSize: 8, isPtr: isPtr}, nil +} + +//nolint:unparam +func (c *Compiler) int16Code(typ *runtime.Type, isPtr bool) (*IntCode, error) { + return &IntCode{typ: typ, bitSize: 16, isPtr: isPtr}, nil +} + +//nolint:unparam +func (c *Compiler) int32Code(typ *runtime.Type, isPtr bool) (*IntCode, error) { + return &IntCode{typ: typ, bitSize: 32, isPtr: isPtr}, nil +} + +//nolint:unparam +func (c *Compiler) int64Code(typ *runtime.Type, isPtr bool) (*IntCode, error) { + return &IntCode{typ: typ, bitSize: 64, isPtr: isPtr}, nil +} + +//nolint:unparam +func (c *Compiler) uintCode(typ *runtime.Type, isPtr bool) (*UintCode, error) { + return &UintCode{typ: typ, bitSize: intSize, isPtr: isPtr}, nil +} + +//nolint:unparam +func (c *Compiler) uint8Code(typ *runtime.Type, isPtr bool) (*UintCode, error) { + return &UintCode{typ: typ, bitSize: 8, isPtr: isPtr}, nil +} + +//nolint:unparam +func (c *Compiler) uint16Code(typ *runtime.Type, isPtr bool) (*UintCode, error) { + return &UintCode{typ: typ, bitSize: 16, isPtr: isPtr}, nil +} + +//nolint:unparam +func (c *Compiler) uint32Code(typ *runtime.Type, isPtr bool) (*UintCode, error) { + return &UintCode{typ: typ, bitSize: 32, isPtr: isPtr}, nil +} + +//nolint:unparam +func (c *Compiler) uint64Code(typ *runtime.Type, isPtr bool) (*UintCode, error) { + return &UintCode{typ: typ, bitSize: 64, isPtr: isPtr}, nil +} + +//nolint:unparam +func (c *Compiler) float32Code(typ *runtime.Type, isPtr bool) (*FloatCode, error) { + return &FloatCode{typ: typ, bitSize: 32, isPtr: isPtr}, nil +} + +//nolint:unparam +func (c *Compiler) float64Code(typ *runtime.Type, isPtr bool) (*FloatCode, error) { + return &FloatCode{typ: typ, bitSize: 64, isPtr: isPtr}, nil +} + +//nolint:unparam +func (c *Compiler) stringCode(typ *runtime.Type, isPtr bool) (*StringCode, error) { + return &StringCode{typ: typ, isPtr: isPtr}, nil +} + +//nolint:unparam +func (c *Compiler) boolCode(typ *runtime.Type, isPtr bool) (*BoolCode, error) { + return &BoolCode{typ: typ, isPtr: isPtr}, nil +} + +//nolint:unparam +func (c *Compiler) intStringCode(typ *runtime.Type) (*IntCode, error) { + return &IntCode{typ: typ, bitSize: intSize, isString: true}, nil +} + +//nolint:unparam +func (c *Compiler) int8StringCode(typ *runtime.Type) (*IntCode, error) { + return &IntCode{typ: typ, bitSize: 8, isString: true}, nil +} + +//nolint:unparam +func (c *Compiler) int16StringCode(typ *runtime.Type) (*IntCode, error) { + return &IntCode{typ: typ, bitSize: 16, isString: true}, nil +} + +//nolint:unparam +func (c *Compiler) int32StringCode(typ *runtime.Type) (*IntCode, error) { + return &IntCode{typ: typ, bitSize: 32, isString: true}, nil +} + +//nolint:unparam +func (c *Compiler) int64StringCode(typ *runtime.Type) (*IntCode, error) { + return &IntCode{typ: typ, bitSize: 64, isString: true}, nil +} + +//nolint:unparam +func (c *Compiler) uintStringCode(typ *runtime.Type) (*UintCode, error) { + return &UintCode{typ: typ, bitSize: intSize, isString: true}, nil +} + +//nolint:unparam +func (c *Compiler) uint8StringCode(typ *runtime.Type) (*UintCode, error) { + return &UintCode{typ: typ, bitSize: 8, isString: true}, nil +} + +//nolint:unparam +func (c *Compiler) uint16StringCode(typ *runtime.Type) (*UintCode, error) { + return &UintCode{typ: typ, bitSize: 16, isString: true}, nil +} + +//nolint:unparam +func (c *Compiler) uint32StringCode(typ *runtime.Type) (*UintCode, error) { + return &UintCode{typ: typ, bitSize: 32, isString: true}, nil +} + +//nolint:unparam +func (c *Compiler) uint64StringCode(typ *runtime.Type) (*UintCode, error) { + return &UintCode{typ: typ, bitSize: 64, isString: true}, nil +} + +//nolint:unparam +func (c *Compiler) bytesCode(typ *runtime.Type, isPtr bool) (*BytesCode, error) { + return &BytesCode{typ: typ, isPtr: isPtr}, nil +} + +//nolint:unparam +func (c *Compiler) interfaceCode(typ *runtime.Type, isPtr bool) (*InterfaceCode, error) { + return &InterfaceCode{typ: typ, isPtr: isPtr}, nil +} + +//nolint:unparam +func (c *Compiler) marshalJSONCode(typ *runtime.Type) (*MarshalJSONCode, error) { + return &MarshalJSONCode{ + typ: typ, + isAddrForMarshaler: c.isPtrMarshalJSONType(typ), + isNilableType: c.isNilableType(typ), + isMarshalerContext: typ.Implements(marshalJSONContextType) || runtime.PtrTo(typ).Implements(marshalJSONContextType), + }, nil +} + +//nolint:unparam +func (c *Compiler) marshalTextCode(typ *runtime.Type) (*MarshalTextCode, error) { + return &MarshalTextCode{ + typ: typ, + isAddrForMarshaler: c.isPtrMarshalTextType(typ), + isNilableType: c.isNilableType(typ), + }, nil +} + +func (c *Compiler) ptrCode(typ *runtime.Type) (*PtrCode, error) { + code, err := c.typeToCodeWithPtr(typ.Elem(), true) + if err != nil { + return nil, err + } + ptr, ok := code.(*PtrCode) + if ok { + return &PtrCode{typ: typ, value: ptr.value, ptrNum: ptr.ptrNum + 1}, nil + } + return &PtrCode{typ: typ, value: code, ptrNum: 1}, nil +} + +func (c *Compiler) sliceCode(typ *runtime.Type) (*SliceCode, error) { + elem := typ.Elem() + code, err := c.listElemCode(elem) + if err != nil { + return nil, err + } + if code.Kind() == CodeKindStruct { + structCode := code.(*StructCode) + structCode.enableIndirect() + } + return &SliceCode{typ: typ, value: code}, nil +} + +func (c *Compiler) arrayCode(typ *runtime.Type) (*ArrayCode, error) { + elem := typ.Elem() + code, err := c.listElemCode(elem) + if err != nil { + return nil, err + } + if code.Kind() == CodeKindStruct { + structCode := code.(*StructCode) + structCode.enableIndirect() + } + return &ArrayCode{typ: typ, value: code}, nil +} + +func (c *Compiler) mapCode(typ *runtime.Type) (*MapCode, error) { + keyCode, err := c.mapKeyCode(typ.Key()) + if err != nil { + return nil, err + } + valueCode, err := c.mapValueCode(typ.Elem()) + if err != nil { + return nil, err + } + if valueCode.Kind() == CodeKindStruct { + structCode := valueCode.(*StructCode) + structCode.enableIndirect() + } + return &MapCode{typ: typ, key: keyCode, value: valueCode}, nil +} + +func (c *Compiler) listElemCode(typ *runtime.Type) (Code, error) { + switch { + case c.isPtrMarshalJSONType(typ): + return c.marshalJSONCode(typ) + case !typ.Implements(marshalTextType) && runtime.PtrTo(typ).Implements(marshalTextType): + return c.marshalTextCode(typ) + case typ.Kind() == reflect.Map: + return c.ptrCode(runtime.PtrTo(typ)) + default: + // isPtr was originally used to indicate whether the type of top level is pointer. + // However, since the slice/array element is a specification that can get the pointer address, explicitly set isPtr to true. + // See here for related issues: https://github.com/goccy/go-json/issues/370 + code, err := c.typeToCodeWithPtr(typ, true) + if err != nil { + return nil, err + } + ptr, ok := code.(*PtrCode) + if ok { + if ptr.value.Kind() == CodeKindMap { + ptr.ptrNum++ + } + } + return code, nil + } +} + +func (c *Compiler) mapKeyCode(typ *runtime.Type) (Code, error) { + switch { + case c.implementsMarshalText(typ): + return c.marshalTextCode(typ) + } + switch typ.Kind() { + case reflect.Ptr: + return c.ptrCode(typ) + case reflect.String: + return c.stringCode(typ, false) + case reflect.Int: + return c.intStringCode(typ) + case reflect.Int8: + return c.int8StringCode(typ) + case reflect.Int16: + return c.int16StringCode(typ) + case reflect.Int32: + return c.int32StringCode(typ) + case reflect.Int64: + return c.int64StringCode(typ) + case reflect.Uint: + return c.uintStringCode(typ) + case reflect.Uint8: + return c.uint8StringCode(typ) + case reflect.Uint16: + return c.uint16StringCode(typ) + case reflect.Uint32: + return c.uint32StringCode(typ) + case reflect.Uint64: + return c.uint64StringCode(typ) + case reflect.Uintptr: + return c.uintStringCode(typ) + } + return nil, &errors.UnsupportedTypeError{Type: runtime.RType2Type(typ)} +} + +func (c *Compiler) mapValueCode(typ *runtime.Type) (Code, error) { + switch typ.Kind() { + case reflect.Map: + return c.ptrCode(runtime.PtrTo(typ)) + default: + code, err := c.typeToCodeWithPtr(typ, false) + if err != nil { + return nil, err + } + ptr, ok := code.(*PtrCode) + if ok { + if ptr.value.Kind() == CodeKindMap { + ptr.ptrNum++ + } + } + return code, nil + } +} + +func (c *Compiler) structCode(typ *runtime.Type, isPtr bool) (*StructCode, error) { + typeptr := uintptr(unsafe.Pointer(typ)) + if code, exists := c.structTypeToCode[typeptr]; exists { + derefCode := *code + derefCode.isRecursive = true + return &derefCode, nil + } + indirect := runtime.IfaceIndir(typ) + code := &StructCode{typ: typ, isPtr: isPtr, isIndirect: indirect} + c.structTypeToCode[typeptr] = code + + fieldNum := typ.NumField() + tags := c.typeToStructTags(typ) + fields := []*StructFieldCode{} + for i, tag := range tags { + isOnlyOneFirstField := i == 0 && fieldNum == 1 + field, err := c.structFieldCode(code, tag, isPtr, isOnlyOneFirstField) + if err != nil { + return nil, err + } + if field.isAnonymous { + structCode := field.getAnonymousStruct() + if structCode != nil { + structCode.removeFieldsByTags(tags) + if c.isAssignableIndirect(field, isPtr) { + if indirect { + structCode.isIndirect = true + } else { + structCode.isIndirect = false + } + } + } + } else { + structCode := field.getStruct() + if structCode != nil { + if indirect { + // if parent is indirect type, set child indirect property to true + structCode.isIndirect = true + } else { + // if parent is not indirect type, set child indirect property to false. + // but if parent's indirect is false and isPtr is true, then indirect must be true. + // Do this only if indirectConversion is enabled at the end of compileStruct. + structCode.isIndirect = false + } + } + } + fields = append(fields, field) + } + fieldMap := c.getFieldMap(fields) + duplicatedFieldMap := c.getDuplicatedFieldMap(fieldMap) + code.fields = c.filteredDuplicatedFields(fields, duplicatedFieldMap) + if !code.disableIndirectConversion && !indirect && isPtr { + code.enableIndirect() + } + delete(c.structTypeToCode, typeptr) + return code, nil +} + +func toElemType(t *runtime.Type) *runtime.Type { + for t.Kind() == reflect.Ptr { + t = t.Elem() + } + return t +} + +func (c *Compiler) structFieldCode(structCode *StructCode, tag *runtime.StructTag, isPtr, isOnlyOneFirstField bool) (*StructFieldCode, error) { + field := tag.Field + fieldType := runtime.Type2RType(field.Type) + isIndirectSpecialCase := isPtr && isOnlyOneFirstField + fieldCode := &StructFieldCode{ + typ: fieldType, + key: tag.Key, + tag: tag, + offset: field.Offset, + isAnonymous: field.Anonymous && !tag.IsTaggedKey && toElemType(fieldType).Kind() == reflect.Struct, + isTaggedKey: tag.IsTaggedKey, + isNilableType: c.isNilableType(fieldType), + isNilCheck: true, + } + switch { + case c.isMovePointerPositionFromHeadToFirstMarshalJSONFieldCase(fieldType, isIndirectSpecialCase): + code, err := c.marshalJSONCode(fieldType) + if err != nil { + return nil, err + } + fieldCode.value = code + fieldCode.isAddrForMarshaler = true + fieldCode.isNilCheck = false + structCode.isIndirect = false + structCode.disableIndirectConversion = true + case c.isMovePointerPositionFromHeadToFirstMarshalTextFieldCase(fieldType, isIndirectSpecialCase): + code, err := c.marshalTextCode(fieldType) + if err != nil { + return nil, err + } + fieldCode.value = code + fieldCode.isAddrForMarshaler = true + fieldCode.isNilCheck = false + structCode.isIndirect = false + structCode.disableIndirectConversion = true + case isPtr && c.isPtrMarshalJSONType(fieldType): + // *struct{ field T } + // func (*T) MarshalJSON() ([]byte, error) + code, err := c.marshalJSONCode(fieldType) + if err != nil { + return nil, err + } + fieldCode.value = code + fieldCode.isAddrForMarshaler = true + fieldCode.isNilCheck = false + case isPtr && c.isPtrMarshalTextType(fieldType): + // *struct{ field T } + // func (*T) MarshalText() ([]byte, error) + code, err := c.marshalTextCode(fieldType) + if err != nil { + return nil, err + } + fieldCode.value = code + fieldCode.isAddrForMarshaler = true + fieldCode.isNilCheck = false + default: + code, err := c.typeToCodeWithPtr(fieldType, isPtr) + if err != nil { + return nil, err + } + switch code.Kind() { + case CodeKindPtr, CodeKindInterface: + fieldCode.isNextOpPtrType = true + } + fieldCode.value = code + } + return fieldCode, nil +} + +func (c *Compiler) isAssignableIndirect(fieldCode *StructFieldCode, isPtr bool) bool { + if isPtr { + return false + } + codeType := fieldCode.value.Kind() + if codeType == CodeKindMarshalJSON { + return false + } + if codeType == CodeKindMarshalText { + return false + } + return true +} + +func (c *Compiler) getFieldMap(fields []*StructFieldCode) map[string][]*StructFieldCode { + fieldMap := map[string][]*StructFieldCode{} + for _, field := range fields { + if field.isAnonymous { + for k, v := range c.getAnonymousFieldMap(field) { + fieldMap[k] = append(fieldMap[k], v...) + } + continue + } + fieldMap[field.key] = append(fieldMap[field.key], field) + } + return fieldMap +} + +func (c *Compiler) getAnonymousFieldMap(field *StructFieldCode) map[string][]*StructFieldCode { + fieldMap := map[string][]*StructFieldCode{} + structCode := field.getAnonymousStruct() + if structCode == nil || structCode.isRecursive { + fieldMap[field.key] = append(fieldMap[field.key], field) + return fieldMap + } + for k, v := range c.getFieldMapFromAnonymousParent(structCode.fields) { + fieldMap[k] = append(fieldMap[k], v...) + } + return fieldMap +} + +func (c *Compiler) getFieldMapFromAnonymousParent(fields []*StructFieldCode) map[string][]*StructFieldCode { + fieldMap := map[string][]*StructFieldCode{} + for _, field := range fields { + if field.isAnonymous { + for k, v := range c.getAnonymousFieldMap(field) { + // Do not handle tagged key when embedding more than once + for _, vv := range v { + vv.isTaggedKey = false + } + fieldMap[k] = append(fieldMap[k], v...) + } + continue + } + fieldMap[field.key] = append(fieldMap[field.key], field) + } + return fieldMap +} + +func (c *Compiler) getDuplicatedFieldMap(fieldMap map[string][]*StructFieldCode) map[*StructFieldCode]struct{} { + duplicatedFieldMap := map[*StructFieldCode]struct{}{} + for _, fields := range fieldMap { + if len(fields) == 1 { + continue + } + if c.isTaggedKeyOnly(fields) { + for _, field := range fields { + if field.isTaggedKey { + continue + } + duplicatedFieldMap[field] = struct{}{} + } + } else { + for _, field := range fields { + duplicatedFieldMap[field] = struct{}{} + } + } + } + return duplicatedFieldMap +} + +func (c *Compiler) filteredDuplicatedFields(fields []*StructFieldCode, duplicatedFieldMap map[*StructFieldCode]struct{}) []*StructFieldCode { + filteredFields := make([]*StructFieldCode, 0, len(fields)) + for _, field := range fields { + if field.isAnonymous { + structCode := field.getAnonymousStruct() + if structCode != nil && !structCode.isRecursive { + structCode.fields = c.filteredDuplicatedFields(structCode.fields, duplicatedFieldMap) + if len(structCode.fields) > 0 { + filteredFields = append(filteredFields, field) + } + continue + } + } + if _, exists := duplicatedFieldMap[field]; exists { + continue + } + filteredFields = append(filteredFields, field) + } + return filteredFields +} + +func (c *Compiler) isTaggedKeyOnly(fields []*StructFieldCode) bool { + var taggedKeyFieldCount int + for _, field := range fields { + if field.isTaggedKey { + taggedKeyFieldCount++ + } + } + return taggedKeyFieldCount == 1 +} + +func (c *Compiler) typeToStructTags(typ *runtime.Type) runtime.StructTags { + tags := runtime.StructTags{} + fieldNum := typ.NumField() + for i := 0; i < fieldNum; i++ { + field := typ.Field(i) + if runtime.IsIgnoredStructField(field) { + continue + } + tags = append(tags, runtime.StructTagFromField(field)) + } + return tags +} + +// *struct{ field T } => struct { field *T } +// func (*T) MarshalJSON() ([]byte, error) +func (c *Compiler) isMovePointerPositionFromHeadToFirstMarshalJSONFieldCase(typ *runtime.Type, isIndirectSpecialCase bool) bool { + return isIndirectSpecialCase && !c.isNilableType(typ) && c.isPtrMarshalJSONType(typ) +} + +// *struct{ field T } => struct { field *T } +// func (*T) MarshalText() ([]byte, error) +func (c *Compiler) isMovePointerPositionFromHeadToFirstMarshalTextFieldCase(typ *runtime.Type, isIndirectSpecialCase bool) bool { + return isIndirectSpecialCase && !c.isNilableType(typ) && c.isPtrMarshalTextType(typ) +} + +func (c *Compiler) implementsMarshalJSON(typ *runtime.Type) bool { + if !c.implementsMarshalJSONType(typ) { + return false + } + if typ.Kind() != reflect.Ptr { + return true + } + // type kind is reflect.Ptr + if !c.implementsMarshalJSONType(typ.Elem()) { + return true + } + // needs to dereference + return false +} + +func (c *Compiler) implementsMarshalText(typ *runtime.Type) bool { + if !typ.Implements(marshalTextType) { + return false + } + if typ.Kind() != reflect.Ptr { + return true + } + // type kind is reflect.Ptr + if !typ.Elem().Implements(marshalTextType) { + return true + } + // needs to dereference + return false +} + +func (c *Compiler) isNilableType(typ *runtime.Type) bool { + if !runtime.IfaceIndir(typ) { + return true + } + switch typ.Kind() { + case reflect.Ptr: + return true + case reflect.Map: + return true + case reflect.Func: + return true + default: + return false + } +} + +func (c *Compiler) implementsMarshalJSONType(typ *runtime.Type) bool { + return typ.Implements(marshalJSONType) || typ.Implements(marshalJSONContextType) +} + +func (c *Compiler) isPtrMarshalJSONType(typ *runtime.Type) bool { + return !c.implementsMarshalJSONType(typ) && c.implementsMarshalJSONType(runtime.PtrTo(typ)) +} + +func (c *Compiler) isPtrMarshalTextType(typ *runtime.Type) bool { + return !typ.Implements(marshalTextType) && runtime.PtrTo(typ).Implements(marshalTextType) +} + +func (c *Compiler) codeToOpcode(ctx *compileContext, typ *runtime.Type, code Code) *Opcode { + codes := code.ToOpcode(ctx) + codes.Last().Next = newEndOp(ctx, typ) + c.linkRecursiveCode(ctx) + return codes.First() +} + +func (c *Compiler) linkRecursiveCode(ctx *compileContext) { + recursiveCodes := map[uintptr]*CompiledCode{} + for _, recursive := range *ctx.recursiveCodes { + typeptr := uintptr(unsafe.Pointer(recursive.Type)) + codes := ctx.structTypeToCodes[typeptr] + if recursiveCode, ok := recursiveCodes[typeptr]; ok { + *recursive.Jmp = *recursiveCode + continue + } + + code := copyOpcode(codes.First()) + code.Op = code.Op.PtrHeadToHead() + lastCode := newEndOp(&compileContext{}, recursive.Type) + lastCode.Op = OpRecursiveEnd + + // OpRecursiveEnd must set before call TotalLength + code.End.Next = lastCode + + totalLength := code.TotalLength() + + // Idx, ElemIdx, Length must set after call TotalLength + lastCode.Idx = uint32((totalLength + 1) * uintptrSize) + lastCode.ElemIdx = lastCode.Idx + uintptrSize + lastCode.Length = lastCode.Idx + 2*uintptrSize + + // extend length to alloc slot for elemIdx + length + curTotalLength := uintptr(recursive.TotalLength()) + 3 + nextTotalLength := uintptr(totalLength) + 3 + + compiled := recursive.Jmp + compiled.Code = code + compiled.CurLen = curTotalLength + compiled.NextLen = nextTotalLength + compiled.Linked = true + + recursiveCodes[typeptr] = compiled + } +} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/compiler_norace.go b/vendor/github.com/goccy/go-json/internal/encoder/compiler_norace.go new file mode 100644 index 000000000..20c93cbf7 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/compiler_norace.go @@ -0,0 +1,32 @@ +//go:build !race +// +build !race + +package encoder + +func CompileToGetCodeSet(ctx *RuntimeContext, typeptr uintptr) (*OpcodeSet, error) { + if typeptr > typeAddr.MaxTypeAddr || typeptr < typeAddr.BaseTypeAddr { + codeSet, err := compileToGetCodeSetSlowPath(typeptr) + if err != nil { + return nil, err + } + return getFilteredCodeSetIfNeeded(ctx, codeSet) + } + index := (typeptr - typeAddr.BaseTypeAddr) >> typeAddr.AddrShift + if codeSet := cachedOpcodeSets[index]; codeSet != nil { + filtered, err := getFilteredCodeSetIfNeeded(ctx, codeSet) + if err != nil { + return nil, err + } + return filtered, nil + } + codeSet, err := newCompiler().compile(typeptr) + if err != nil { + return nil, err + } + filtered, err := getFilteredCodeSetIfNeeded(ctx, codeSet) + if err != nil { + return nil, err + } + cachedOpcodeSets[index] = codeSet + return filtered, nil +} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/compiler_race.go b/vendor/github.com/goccy/go-json/internal/encoder/compiler_race.go new file mode 100644 index 000000000..13ba23fdf --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/compiler_race.go @@ -0,0 +1,45 @@ +//go:build race +// +build race + +package encoder + +import ( + "sync" +) + +var setsMu sync.RWMutex + +func CompileToGetCodeSet(ctx *RuntimeContext, typeptr uintptr) (*OpcodeSet, error) { + if typeptr > typeAddr.MaxTypeAddr || typeptr < typeAddr.BaseTypeAddr { + codeSet, err := compileToGetCodeSetSlowPath(typeptr) + if err != nil { + return nil, err + } + return getFilteredCodeSetIfNeeded(ctx, codeSet) + } + index := (typeptr - typeAddr.BaseTypeAddr) >> typeAddr.AddrShift + setsMu.RLock() + if codeSet := cachedOpcodeSets[index]; codeSet != nil { + filtered, err := getFilteredCodeSetIfNeeded(ctx, codeSet) + if err != nil { + setsMu.RUnlock() + return nil, err + } + setsMu.RUnlock() + return filtered, nil + } + setsMu.RUnlock() + + codeSet, err := newCompiler().compile(typeptr) + if err != nil { + return nil, err + } + filtered, err := getFilteredCodeSetIfNeeded(ctx, codeSet) + if err != nil { + return nil, err + } + setsMu.Lock() + cachedOpcodeSets[index] = codeSet + setsMu.Unlock() + return filtered, nil +} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/context.go b/vendor/github.com/goccy/go-json/internal/encoder/context.go new file mode 100644 index 000000000..3833d0c86 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/context.go @@ -0,0 +1,105 @@ +package encoder + +import ( + "context" + "sync" + "unsafe" + + "github.com/goccy/go-json/internal/runtime" +) + +type compileContext struct { + opcodeIndex uint32 + ptrIndex int + indent uint32 + escapeKey bool + structTypeToCodes map[uintptr]Opcodes + recursiveCodes *Opcodes +} + +func (c *compileContext) incIndent() { + c.indent++ +} + +func (c *compileContext) decIndent() { + c.indent-- +} + +func (c *compileContext) incIndex() { + c.incOpcodeIndex() + c.incPtrIndex() +} + +func (c *compileContext) decIndex() { + c.decOpcodeIndex() + c.decPtrIndex() +} + +func (c *compileContext) incOpcodeIndex() { + c.opcodeIndex++ +} + +func (c *compileContext) decOpcodeIndex() { + c.opcodeIndex-- +} + +func (c *compileContext) incPtrIndex() { + c.ptrIndex++ +} + +func (c *compileContext) decPtrIndex() { + c.ptrIndex-- +} + +const ( + bufSize = 1024 +) + +var ( + runtimeContextPool = sync.Pool{ + New: func() interface{} { + return &RuntimeContext{ + Buf: make([]byte, 0, bufSize), + Ptrs: make([]uintptr, 128), + KeepRefs: make([]unsafe.Pointer, 0, 8), + Option: &Option{}, + } + }, + } +) + +type RuntimeContext struct { + Context context.Context + Buf []byte + MarshalBuf []byte + Ptrs []uintptr + KeepRefs []unsafe.Pointer + SeenPtr []uintptr + BaseIndent uint32 + Prefix []byte + IndentStr []byte + Option *Option +} + +func (c *RuntimeContext) Init(p uintptr, codelen int) { + if len(c.Ptrs) < codelen { + c.Ptrs = make([]uintptr, codelen) + } + c.Ptrs[0] = p + c.KeepRefs = c.KeepRefs[:0] + c.SeenPtr = c.SeenPtr[:0] + c.BaseIndent = 0 +} + +func (c *RuntimeContext) Ptr() uintptr { + header := (*runtime.SliceHeader)(unsafe.Pointer(&c.Ptrs)) + return uintptr(header.Data) +} + +func TakeRuntimeContext() *RuntimeContext { + return runtimeContextPool.Get().(*RuntimeContext) +} + +func ReleaseRuntimeContext(ctx *RuntimeContext) { + runtimeContextPool.Put(ctx) +} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/decode_rune.go b/vendor/github.com/goccy/go-json/internal/encoder/decode_rune.go new file mode 100644 index 000000000..35c959d48 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/decode_rune.go @@ -0,0 +1,126 @@ +package encoder + +import "unicode/utf8" + +const ( + // The default lowest and highest continuation byte. + locb = 128 //0b10000000 + hicb = 191 //0b10111111 + + // These names of these constants are chosen to give nice alignment in the + // table below. The first nibble is an index into acceptRanges or F for + // special one-byte cases. The second nibble is the Rune length or the + // Status for the special one-byte case. + xx = 0xF1 // invalid: size 1 + as = 0xF0 // ASCII: size 1 + s1 = 0x02 // accept 0, size 2 + s2 = 0x13 // accept 1, size 3 + s3 = 0x03 // accept 0, size 3 + s4 = 0x23 // accept 2, size 3 + s5 = 0x34 // accept 3, size 4 + s6 = 0x04 // accept 0, size 4 + s7 = 0x44 // accept 4, size 4 +) + +// first is information about the first byte in a UTF-8 sequence. +var first = [256]uint8{ + // 1 2 3 4 5 6 7 8 9 A B C D E F + as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, // 0x00-0x0F + as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, // 0x10-0x1F + as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, // 0x20-0x2F + as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, // 0x30-0x3F + as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, // 0x40-0x4F + as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, // 0x50-0x5F + as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, // 0x60-0x6F + as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, // 0x70-0x7F + // 1 2 3 4 5 6 7 8 9 A B C D E F + xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, // 0x80-0x8F + xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, // 0x90-0x9F + xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, // 0xA0-0xAF + xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, // 0xB0-0xBF + xx, xx, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, // 0xC0-0xCF + s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, // 0xD0-0xDF + s2, s3, s3, s3, s3, s3, s3, s3, s3, s3, s3, s3, s3, s4, s3, s3, // 0xE0-0xEF + s5, s6, s6, s6, s7, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, // 0xF0-0xFF +} + +const ( + lineSep = byte(168) //'\u2028' + paragraphSep = byte(169) //'\u2029' +) + +type decodeRuneState int + +const ( + validUTF8State decodeRuneState = iota + runeErrorState + lineSepState + paragraphSepState +) + +func decodeRuneInString(s string) (decodeRuneState, int) { + n := len(s) + s0 := s[0] + x := first[s0] + if x >= as { + // The following code simulates an additional check for x == xx and + // handling the ASCII and invalid cases accordingly. This mask-and-or + // approach prevents an additional branch. + mask := rune(x) << 31 >> 31 // Create 0x0000 or 0xFFFF. + if rune(s[0])&^mask|utf8.RuneError&mask == utf8.RuneError { + return runeErrorState, 1 + } + return validUTF8State, 1 + } + sz := int(x & 7) + if n < sz { + return runeErrorState, 1 + } + s1 := s[1] + switch x >> 4 { + case 0: + if s1 < locb || hicb < s1 { + return runeErrorState, 1 + } + case 1: + if s1 < 0xA0 || hicb < s1 { + return runeErrorState, 1 + } + case 2: + if s1 < locb || 0x9F < s1 { + return runeErrorState, 1 + } + case 3: + if s1 < 0x90 || hicb < s1 { + return runeErrorState, 1 + } + case 4: + if s1 < locb || 0x8F < s1 { + return runeErrorState, 1 + } + } + if sz <= 2 { + return validUTF8State, 2 + } + s2 := s[2] + if s2 < locb || hicb < s2 { + return runeErrorState, 1 + } + if sz <= 3 { + // separator character prefixes: [2]byte{226, 128} + if s0 == 226 && s1 == 128 { + switch s2 { + case lineSep: + return lineSepState, 3 + case paragraphSep: + return paragraphSepState, 3 + } + } + return validUTF8State, 3 + } + s3 := s[3] + if s3 < locb || hicb < s3 { + return runeErrorState, 1 + } + return validUTF8State, 4 +} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/encoder.go b/vendor/github.com/goccy/go-json/internal/encoder/encoder.go new file mode 100644 index 000000000..14eb6a0d6 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/encoder.go @@ -0,0 +1,596 @@ +package encoder + +import ( + "bytes" + "encoding" + "encoding/base64" + "encoding/json" + "fmt" + "math" + "reflect" + "strconv" + "strings" + "sync" + "unsafe" + + "github.com/goccy/go-json/internal/errors" + "github.com/goccy/go-json/internal/runtime" +) + +func (t OpType) IsMultipleOpHead() bool { + switch t { + case OpStructHead: + return true + case OpStructHeadSlice: + return true + case OpStructHeadArray: + return true + case OpStructHeadMap: + return true + case OpStructHeadStruct: + return true + case OpStructHeadOmitEmpty: + return true + case OpStructHeadOmitEmptySlice: + return true + case OpStructHeadOmitEmptyArray: + return true + case OpStructHeadOmitEmptyMap: + return true + case OpStructHeadOmitEmptyStruct: + return true + case OpStructHeadSlicePtr: + return true + case OpStructHeadOmitEmptySlicePtr: + return true + case OpStructHeadArrayPtr: + return true + case OpStructHeadOmitEmptyArrayPtr: + return true + case OpStructHeadMapPtr: + return true + case OpStructHeadOmitEmptyMapPtr: + return true + } + return false +} + +func (t OpType) IsMultipleOpField() bool { + switch t { + case OpStructField: + return true + case OpStructFieldSlice: + return true + case OpStructFieldArray: + return true + case OpStructFieldMap: + return true + case OpStructFieldStruct: + return true + case OpStructFieldOmitEmpty: + return true + case OpStructFieldOmitEmptySlice: + return true + case OpStructFieldOmitEmptyArray: + return true + case OpStructFieldOmitEmptyMap: + return true + case OpStructFieldOmitEmptyStruct: + return true + case OpStructFieldSlicePtr: + return true + case OpStructFieldOmitEmptySlicePtr: + return true + case OpStructFieldArrayPtr: + return true + case OpStructFieldOmitEmptyArrayPtr: + return true + case OpStructFieldMapPtr: + return true + case OpStructFieldOmitEmptyMapPtr: + return true + } + return false +} + +type OpcodeSet struct { + Type *runtime.Type + NoescapeKeyCode *Opcode + EscapeKeyCode *Opcode + InterfaceNoescapeKeyCode *Opcode + InterfaceEscapeKeyCode *Opcode + CodeLength int + EndCode *Opcode + Code Code + QueryCache map[string]*OpcodeSet + cacheMu sync.RWMutex +} + +func (s *OpcodeSet) getQueryCache(hash string) *OpcodeSet { + s.cacheMu.RLock() + codeSet := s.QueryCache[hash] + s.cacheMu.RUnlock() + return codeSet +} + +func (s *OpcodeSet) setQueryCache(hash string, codeSet *OpcodeSet) { + s.cacheMu.Lock() + s.QueryCache[hash] = codeSet + s.cacheMu.Unlock() +} + +type CompiledCode struct { + Code *Opcode + Linked bool // whether recursive code already have linked + CurLen uintptr + NextLen uintptr +} + +const StartDetectingCyclesAfter = 1000 + +func Load(base uintptr, idx uintptr) uintptr { + addr := base + idx + return **(**uintptr)(unsafe.Pointer(&addr)) +} + +func Store(base uintptr, idx uintptr, p uintptr) { + addr := base + idx + **(**uintptr)(unsafe.Pointer(&addr)) = p +} + +func LoadNPtr(base uintptr, idx uintptr, ptrNum int) uintptr { + addr := base + idx + p := **(**uintptr)(unsafe.Pointer(&addr)) + if p == 0 { + return 0 + } + return PtrToPtr(p) + /* + for i := 0; i < ptrNum; i++ { + if p == 0 { + return p + } + p = PtrToPtr(p) + } + return p + */ +} + +func PtrToUint64(p uintptr) uint64 { return **(**uint64)(unsafe.Pointer(&p)) } +func PtrToFloat32(p uintptr) float32 { return **(**float32)(unsafe.Pointer(&p)) } +func PtrToFloat64(p uintptr) float64 { return **(**float64)(unsafe.Pointer(&p)) } +func PtrToBool(p uintptr) bool { return **(**bool)(unsafe.Pointer(&p)) } +func PtrToBytes(p uintptr) []byte { return **(**[]byte)(unsafe.Pointer(&p)) } +func PtrToNumber(p uintptr) json.Number { return **(**json.Number)(unsafe.Pointer(&p)) } +func PtrToString(p uintptr) string { return **(**string)(unsafe.Pointer(&p)) } +func PtrToSlice(p uintptr) *runtime.SliceHeader { return *(**runtime.SliceHeader)(unsafe.Pointer(&p)) } +func PtrToPtr(p uintptr) uintptr { + return uintptr(**(**unsafe.Pointer)(unsafe.Pointer(&p))) +} +func PtrToNPtr(p uintptr, ptrNum int) uintptr { + for i := 0; i < ptrNum; i++ { + if p == 0 { + return 0 + } + p = PtrToPtr(p) + } + return p +} + +func PtrToUnsafePtr(p uintptr) unsafe.Pointer { + return *(*unsafe.Pointer)(unsafe.Pointer(&p)) +} +func PtrToInterface(code *Opcode, p uintptr) interface{} { + return *(*interface{})(unsafe.Pointer(&emptyInterface{ + typ: code.Type, + ptr: *(*unsafe.Pointer)(unsafe.Pointer(&p)), + })) +} + +func ErrUnsupportedValue(code *Opcode, ptr uintptr) *errors.UnsupportedValueError { + v := *(*interface{})(unsafe.Pointer(&emptyInterface{ + typ: code.Type, + ptr: *(*unsafe.Pointer)(unsafe.Pointer(&ptr)), + })) + return &errors.UnsupportedValueError{ + Value: reflect.ValueOf(v), + Str: fmt.Sprintf("encountered a cycle via %s", code.Type), + } +} + +func ErrUnsupportedFloat(v float64) *errors.UnsupportedValueError { + return &errors.UnsupportedValueError{ + Value: reflect.ValueOf(v), + Str: strconv.FormatFloat(v, 'g', -1, 64), + } +} + +func ErrMarshalerWithCode(code *Opcode, err error) *errors.MarshalerError { + return &errors.MarshalerError{ + Type: runtime.RType2Type(code.Type), + Err: err, + } +} + +type emptyInterface struct { + typ *runtime.Type + ptr unsafe.Pointer +} + +type MapItem struct { + Key []byte + Value []byte +} + +type Mapslice struct { + Items []MapItem +} + +func (m *Mapslice) Len() int { + return len(m.Items) +} + +func (m *Mapslice) Less(i, j int) bool { + return bytes.Compare(m.Items[i].Key, m.Items[j].Key) < 0 +} + +func (m *Mapslice) Swap(i, j int) { + m.Items[i], m.Items[j] = m.Items[j], m.Items[i] +} + +//nolint:structcheck,unused +type mapIter struct { + key unsafe.Pointer + elem unsafe.Pointer + t unsafe.Pointer + h unsafe.Pointer + buckets unsafe.Pointer + bptr unsafe.Pointer + overflow unsafe.Pointer + oldoverflow unsafe.Pointer + startBucket uintptr + offset uint8 + wrapped bool + B uint8 + i uint8 + bucket uintptr + checkBucket uintptr +} + +type MapContext struct { + Start int + First int + Idx int + Slice *Mapslice + Buf []byte + Len int + Iter mapIter +} + +var mapContextPool = sync.Pool{ + New: func() interface{} { + return &MapContext{ + Slice: &Mapslice{}, + } + }, +} + +func NewMapContext(mapLen int, unorderedMap bool) *MapContext { + ctx := mapContextPool.Get().(*MapContext) + if !unorderedMap { + if len(ctx.Slice.Items) < mapLen { + ctx.Slice.Items = make([]MapItem, mapLen) + } else { + ctx.Slice.Items = ctx.Slice.Items[:mapLen] + } + } + ctx.Buf = ctx.Buf[:0] + ctx.Iter = mapIter{} + ctx.Idx = 0 + ctx.Len = mapLen + return ctx +} + +func ReleaseMapContext(c *MapContext) { + mapContextPool.Put(c) +} + +//go:linkname MapIterInit runtime.mapiterinit +//go:noescape +func MapIterInit(mapType *runtime.Type, m unsafe.Pointer, it *mapIter) + +//go:linkname MapIterKey reflect.mapiterkey +//go:noescape +func MapIterKey(it *mapIter) unsafe.Pointer + +//go:linkname MapIterNext reflect.mapiternext +//go:noescape +func MapIterNext(it *mapIter) + +//go:linkname MapLen reflect.maplen +//go:noescape +func MapLen(m unsafe.Pointer) int + +func AppendByteSlice(_ *RuntimeContext, b []byte, src []byte) []byte { + if src == nil { + return append(b, `null`...) + } + encodedLen := base64.StdEncoding.EncodedLen(len(src)) + b = append(b, '"') + pos := len(b) + remainLen := cap(b[pos:]) + var buf []byte + if remainLen > encodedLen { + buf = b[pos : pos+encodedLen] + } else { + buf = make([]byte, encodedLen) + } + base64.StdEncoding.Encode(buf, src) + return append(append(b, buf...), '"') +} + +func AppendFloat32(_ *RuntimeContext, b []byte, v float32) []byte { + f64 := float64(v) + abs := math.Abs(f64) + fmt := byte('f') + // Note: Must use float32 comparisons for underlying float32 value to get precise cutoffs right. + if abs != 0 { + f32 := float32(abs) + if f32 < 1e-6 || f32 >= 1e21 { + fmt = 'e' + } + } + return strconv.AppendFloat(b, f64, fmt, -1, 32) +} + +func AppendFloat64(_ *RuntimeContext, b []byte, v float64) []byte { + abs := math.Abs(v) + fmt := byte('f') + // Note: Must use float32 comparisons for underlying float32 value to get precise cutoffs right. + if abs != 0 { + if abs < 1e-6 || abs >= 1e21 { + fmt = 'e' + } + } + return strconv.AppendFloat(b, v, fmt, -1, 64) +} + +func AppendBool(_ *RuntimeContext, b []byte, v bool) []byte { + if v { + return append(b, "true"...) + } + return append(b, "false"...) +} + +var ( + floatTable = [256]bool{ + '0': true, + '1': true, + '2': true, + '3': true, + '4': true, + '5': true, + '6': true, + '7': true, + '8': true, + '9': true, + '.': true, + 'e': true, + 'E': true, + '+': true, + '-': true, + } +) + +func AppendNumber(_ *RuntimeContext, b []byte, n json.Number) ([]byte, error) { + if len(n) == 0 { + return append(b, '0'), nil + } + for i := 0; i < len(n); i++ { + if !floatTable[n[i]] { + return nil, fmt.Errorf("json: invalid number literal %q", n) + } + } + b = append(b, n...) + return b, nil +} + +func AppendMarshalJSON(ctx *RuntimeContext, code *Opcode, b []byte, v interface{}) ([]byte, error) { + rv := reflect.ValueOf(v) // convert by dynamic interface type + if (code.Flags & AddrForMarshalerFlags) != 0 { + if rv.CanAddr() { + rv = rv.Addr() + } else { + newV := reflect.New(rv.Type()) + newV.Elem().Set(rv) + rv = newV + } + } + v = rv.Interface() + var bb []byte + if (code.Flags & MarshalerContextFlags) != 0 { + marshaler, ok := v.(marshalerContext) + if !ok { + return AppendNull(ctx, b), nil + } + stdctx := ctx.Option.Context + if ctx.Option.Flag&FieldQueryOption != 0 { + stdctx = SetFieldQueryToContext(stdctx, code.FieldQuery) + } + b, err := marshaler.MarshalJSON(stdctx) + if err != nil { + return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err} + } + bb = b + } else { + marshaler, ok := v.(json.Marshaler) + if !ok { + return AppendNull(ctx, b), nil + } + b, err := marshaler.MarshalJSON() + if err != nil { + return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err} + } + bb = b + } + marshalBuf := ctx.MarshalBuf[:0] + marshalBuf = append(append(marshalBuf, bb...), nul) + compactedBuf, err := compact(b, marshalBuf, (ctx.Option.Flag&HTMLEscapeOption) != 0) + if err != nil { + return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err} + } + ctx.MarshalBuf = marshalBuf + return compactedBuf, nil +} + +func AppendMarshalJSONIndent(ctx *RuntimeContext, code *Opcode, b []byte, v interface{}) ([]byte, error) { + rv := reflect.ValueOf(v) // convert by dynamic interface type + if (code.Flags & AddrForMarshalerFlags) != 0 { + if rv.CanAddr() { + rv = rv.Addr() + } else { + newV := reflect.New(rv.Type()) + newV.Elem().Set(rv) + rv = newV + } + } + v = rv.Interface() + var bb []byte + if (code.Flags & MarshalerContextFlags) != 0 { + marshaler, ok := v.(marshalerContext) + if !ok { + return AppendNull(ctx, b), nil + } + b, err := marshaler.MarshalJSON(ctx.Option.Context) + if err != nil { + return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err} + } + bb = b + } else { + marshaler, ok := v.(json.Marshaler) + if !ok { + return AppendNull(ctx, b), nil + } + b, err := marshaler.MarshalJSON() + if err != nil { + return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err} + } + bb = b + } + marshalBuf := ctx.MarshalBuf[:0] + marshalBuf = append(append(marshalBuf, bb...), nul) + indentedBuf, err := doIndent( + b, + marshalBuf, + string(ctx.Prefix)+strings.Repeat(string(ctx.IndentStr), int(ctx.BaseIndent+code.Indent)), + string(ctx.IndentStr), + (ctx.Option.Flag&HTMLEscapeOption) != 0, + ) + if err != nil { + return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err} + } + ctx.MarshalBuf = marshalBuf + return indentedBuf, nil +} + +func AppendMarshalText(ctx *RuntimeContext, code *Opcode, b []byte, v interface{}) ([]byte, error) { + rv := reflect.ValueOf(v) // convert by dynamic interface type + if (code.Flags & AddrForMarshalerFlags) != 0 { + if rv.CanAddr() { + rv = rv.Addr() + } else { + newV := reflect.New(rv.Type()) + newV.Elem().Set(rv) + rv = newV + } + } + v = rv.Interface() + marshaler, ok := v.(encoding.TextMarshaler) + if !ok { + return AppendNull(ctx, b), nil + } + bytes, err := marshaler.MarshalText() + if err != nil { + return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err} + } + return AppendString(ctx, b, *(*string)(unsafe.Pointer(&bytes))), nil +} + +func AppendMarshalTextIndent(ctx *RuntimeContext, code *Opcode, b []byte, v interface{}) ([]byte, error) { + rv := reflect.ValueOf(v) // convert by dynamic interface type + if (code.Flags & AddrForMarshalerFlags) != 0 { + if rv.CanAddr() { + rv = rv.Addr() + } else { + newV := reflect.New(rv.Type()) + newV.Elem().Set(rv) + rv = newV + } + } + v = rv.Interface() + marshaler, ok := v.(encoding.TextMarshaler) + if !ok { + return AppendNull(ctx, b), nil + } + bytes, err := marshaler.MarshalText() + if err != nil { + return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err} + } + return AppendString(ctx, b, *(*string)(unsafe.Pointer(&bytes))), nil +} + +func AppendNull(_ *RuntimeContext, b []byte) []byte { + return append(b, "null"...) +} + +func AppendComma(_ *RuntimeContext, b []byte) []byte { + return append(b, ',') +} + +func AppendCommaIndent(_ *RuntimeContext, b []byte) []byte { + return append(b, ',', '\n') +} + +func AppendStructEnd(_ *RuntimeContext, b []byte) []byte { + return append(b, '}', ',') +} + +func AppendStructEndIndent(ctx *RuntimeContext, code *Opcode, b []byte) []byte { + b = append(b, '\n') + b = append(b, ctx.Prefix...) + indentNum := ctx.BaseIndent + code.Indent - 1 + for i := uint32(0); i < indentNum; i++ { + b = append(b, ctx.IndentStr...) + } + return append(b, '}', ',', '\n') +} + +func AppendIndent(ctx *RuntimeContext, b []byte, indent uint32) []byte { + b = append(b, ctx.Prefix...) + indentNum := ctx.BaseIndent + indent + for i := uint32(0); i < indentNum; i++ { + b = append(b, ctx.IndentStr...) + } + return b +} + +func IsNilForMarshaler(v interface{}) bool { + rv := reflect.ValueOf(v) + switch rv.Kind() { + case reflect.Bool: + return !rv.Bool() + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return rv.Int() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return rv.Uint() == 0 + case reflect.Float32, reflect.Float64: + return math.Float64bits(rv.Float()) == 0 + case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Func: + return rv.IsNil() + case reflect.Slice: + return rv.IsNil() || rv.Len() == 0 + case reflect.String: + return rv.Len() == 0 + } + return false +} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/indent.go b/vendor/github.com/goccy/go-json/internal/encoder/indent.go new file mode 100644 index 000000000..dfe04b5e3 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/indent.go @@ -0,0 +1,211 @@ +package encoder + +import ( + "bytes" + "fmt" + + "github.com/goccy/go-json/internal/errors" +) + +func takeIndentSrcRuntimeContext(src []byte) (*RuntimeContext, []byte) { + ctx := TakeRuntimeContext() + buf := ctx.Buf[:0] + buf = append(append(buf, src...), nul) + ctx.Buf = buf + return ctx, buf +} + +func Indent(buf *bytes.Buffer, src []byte, prefix, indentStr string) error { + if len(src) == 0 { + return errors.ErrUnexpectedEndOfJSON("", 0) + } + + srcCtx, srcBuf := takeIndentSrcRuntimeContext(src) + dstCtx := TakeRuntimeContext() + dst := dstCtx.Buf[:0] + + dst, err := indentAndWrite(buf, dst, srcBuf, prefix, indentStr) + if err != nil { + ReleaseRuntimeContext(srcCtx) + ReleaseRuntimeContext(dstCtx) + return err + } + dstCtx.Buf = dst + ReleaseRuntimeContext(srcCtx) + ReleaseRuntimeContext(dstCtx) + return nil +} + +func indentAndWrite(buf *bytes.Buffer, dst []byte, src []byte, prefix, indentStr string) ([]byte, error) { + dst, err := doIndent(dst, src, prefix, indentStr, false) + if err != nil { + return nil, err + } + if _, err := buf.Write(dst); err != nil { + return nil, err + } + return dst, nil +} + +func doIndent(dst, src []byte, prefix, indentStr string, escape bool) ([]byte, error) { + buf, cursor, err := indentValue(dst, src, 0, 0, []byte(prefix), []byte(indentStr), escape) + if err != nil { + return nil, err + } + if err := validateEndBuf(src, cursor); err != nil { + return nil, err + } + return buf, nil +} + +func indentValue( + dst []byte, + src []byte, + indentNum int, + cursor int64, + prefix []byte, + indentBytes []byte, + escape bool) ([]byte, int64, error) { + for { + switch src[cursor] { + case ' ', '\t', '\n', '\r': + cursor++ + continue + case '{': + return indentObject(dst, src, indentNum, cursor, prefix, indentBytes, escape) + case '}': + return nil, 0, errors.ErrSyntax("unexpected character '}'", cursor) + case '[': + return indentArray(dst, src, indentNum, cursor, prefix, indentBytes, escape) + case ']': + return nil, 0, errors.ErrSyntax("unexpected character ']'", cursor) + case '"': + return compactString(dst, src, cursor, escape) + case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + return compactNumber(dst, src, cursor) + case 't': + return compactTrue(dst, src, cursor) + case 'f': + return compactFalse(dst, src, cursor) + case 'n': + return compactNull(dst, src, cursor) + default: + return nil, 0, errors.ErrSyntax(fmt.Sprintf("unexpected character '%c'", src[cursor]), cursor) + } + } +} + +func indentObject( + dst []byte, + src []byte, + indentNum int, + cursor int64, + prefix []byte, + indentBytes []byte, + escape bool) ([]byte, int64, error) { + if src[cursor] == '{' { + dst = append(dst, '{') + } else { + return nil, 0, errors.ErrExpected("expected { character for object value", cursor) + } + cursor = skipWhiteSpace(src, cursor+1) + if src[cursor] == '}' { + dst = append(dst, '}') + return dst, cursor + 1, nil + } + indentNum++ + var err error + for { + dst = append(append(dst, '\n'), prefix...) + for i := 0; i < indentNum; i++ { + dst = append(dst, indentBytes...) + } + cursor = skipWhiteSpace(src, cursor) + dst, cursor, err = compactString(dst, src, cursor, escape) + if err != nil { + return nil, 0, err + } + cursor = skipWhiteSpace(src, cursor) + if src[cursor] != ':' { + return nil, 0, errors.ErrSyntax( + fmt.Sprintf("invalid character '%c' after object key", src[cursor]), + cursor+1, + ) + } + dst = append(dst, ':', ' ') + dst, cursor, err = indentValue(dst, src, indentNum, cursor+1, prefix, indentBytes, escape) + if err != nil { + return nil, 0, err + } + cursor = skipWhiteSpace(src, cursor) + switch src[cursor] { + case '}': + dst = append(append(dst, '\n'), prefix...) + for i := 0; i < indentNum-1; i++ { + dst = append(dst, indentBytes...) + } + dst = append(dst, '}') + cursor++ + return dst, cursor, nil + case ',': + dst = append(dst, ',') + default: + return nil, 0, errors.ErrSyntax( + fmt.Sprintf("invalid character '%c' after object key:value pair", src[cursor]), + cursor+1, + ) + } + cursor++ + } +} + +func indentArray( + dst []byte, + src []byte, + indentNum int, + cursor int64, + prefix []byte, + indentBytes []byte, + escape bool) ([]byte, int64, error) { + if src[cursor] == '[' { + dst = append(dst, '[') + } else { + return nil, 0, errors.ErrExpected("expected [ character for array value", cursor) + } + cursor = skipWhiteSpace(src, cursor+1) + if src[cursor] == ']' { + dst = append(dst, ']') + return dst, cursor + 1, nil + } + indentNum++ + var err error + for { + dst = append(append(dst, '\n'), prefix...) + for i := 0; i < indentNum; i++ { + dst = append(dst, indentBytes...) + } + dst, cursor, err = indentValue(dst, src, indentNum, cursor, prefix, indentBytes, escape) + if err != nil { + return nil, 0, err + } + cursor = skipWhiteSpace(src, cursor) + switch src[cursor] { + case ']': + dst = append(append(dst, '\n'), prefix...) + for i := 0; i < indentNum-1; i++ { + dst = append(dst, indentBytes...) + } + dst = append(dst, ']') + cursor++ + return dst, cursor, nil + case ',': + dst = append(dst, ',') + default: + return nil, 0, errors.ErrSyntax( + fmt.Sprintf("invalid character '%c' after array value", src[cursor]), + cursor+1, + ) + } + cursor++ + } +} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/int.go b/vendor/github.com/goccy/go-json/internal/encoder/int.go new file mode 100644 index 000000000..85f079609 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/int.go @@ -0,0 +1,152 @@ +package encoder + +import ( + "unsafe" +) + +var endianness int + +func init() { + var b [2]byte + *(*uint16)(unsafe.Pointer(&b)) = uint16(0xABCD) + + switch b[0] { + case 0xCD: + endianness = 0 // LE + case 0xAB: + endianness = 1 // BE + default: + panic("could not determine endianness") + } +} + +// "00010203...96979899" cast to []uint16 +var intLELookup = [100]uint16{ + 0x3030, 0x3130, 0x3230, 0x3330, 0x3430, 0x3530, 0x3630, 0x3730, 0x3830, 0x3930, + 0x3031, 0x3131, 0x3231, 0x3331, 0x3431, 0x3531, 0x3631, 0x3731, 0x3831, 0x3931, + 0x3032, 0x3132, 0x3232, 0x3332, 0x3432, 0x3532, 0x3632, 0x3732, 0x3832, 0x3932, + 0x3033, 0x3133, 0x3233, 0x3333, 0x3433, 0x3533, 0x3633, 0x3733, 0x3833, 0x3933, + 0x3034, 0x3134, 0x3234, 0x3334, 0x3434, 0x3534, 0x3634, 0x3734, 0x3834, 0x3934, + 0x3035, 0x3135, 0x3235, 0x3335, 0x3435, 0x3535, 0x3635, 0x3735, 0x3835, 0x3935, + 0x3036, 0x3136, 0x3236, 0x3336, 0x3436, 0x3536, 0x3636, 0x3736, 0x3836, 0x3936, + 0x3037, 0x3137, 0x3237, 0x3337, 0x3437, 0x3537, 0x3637, 0x3737, 0x3837, 0x3937, + 0x3038, 0x3138, 0x3238, 0x3338, 0x3438, 0x3538, 0x3638, 0x3738, 0x3838, 0x3938, + 0x3039, 0x3139, 0x3239, 0x3339, 0x3439, 0x3539, 0x3639, 0x3739, 0x3839, 0x3939, +} + +var intBELookup = [100]uint16{ + 0x3030, 0x3031, 0x3032, 0x3033, 0x3034, 0x3035, 0x3036, 0x3037, 0x3038, 0x3039, + 0x3130, 0x3131, 0x3132, 0x3133, 0x3134, 0x3135, 0x3136, 0x3137, 0x3138, 0x3139, + 0x3230, 0x3231, 0x3232, 0x3233, 0x3234, 0x3235, 0x3236, 0x3237, 0x3238, 0x3239, + 0x3330, 0x3331, 0x3332, 0x3333, 0x3334, 0x3335, 0x3336, 0x3337, 0x3338, 0x3339, + 0x3430, 0x3431, 0x3432, 0x3433, 0x3434, 0x3435, 0x3436, 0x3437, 0x3438, 0x3439, + 0x3530, 0x3531, 0x3532, 0x3533, 0x3534, 0x3535, 0x3536, 0x3537, 0x3538, 0x3539, + 0x3630, 0x3631, 0x3632, 0x3633, 0x3634, 0x3635, 0x3636, 0x3637, 0x3638, 0x3639, + 0x3730, 0x3731, 0x3732, 0x3733, 0x3734, 0x3735, 0x3736, 0x3737, 0x3738, 0x3739, + 0x3830, 0x3831, 0x3832, 0x3833, 0x3834, 0x3835, 0x3836, 0x3837, 0x3838, 0x3839, + 0x3930, 0x3931, 0x3932, 0x3933, 0x3934, 0x3935, 0x3936, 0x3937, 0x3938, 0x3939, +} + +var intLookup = [2]*[100]uint16{&intLELookup, &intBELookup} + +func numMask(numBitSize uint8) uint64 { + return 1<>(code.NumBitSize-1))&1 == 1 + if !negative { + if n < 10 { + return append(out, byte(n+'0')) + } else if n < 100 { + u := intLELookup[n] + return append(out, byte(u), byte(u>>8)) + } + } else { + n = -n & mask + } + + lookup := intLookup[endianness] + + var b [22]byte + u := (*[11]uint16)(unsafe.Pointer(&b)) + i := 11 + + for n >= 100 { + j := n % 100 + n /= 100 + i-- + u[i] = lookup[j] + } + + i-- + u[i] = lookup[n] + + i *= 2 // convert to byte index + if n < 10 { + i++ // remove leading zero + } + if negative { + i-- + b[i] = '-' + } + + return append(out, b[i:]...) +} + +func AppendUint(_ *RuntimeContext, out []byte, p uintptr, code *Opcode) []byte { + var u64 uint64 + switch code.NumBitSize { + case 8: + u64 = (uint64)(**(**uint8)(unsafe.Pointer(&p))) + case 16: + u64 = (uint64)(**(**uint16)(unsafe.Pointer(&p))) + case 32: + u64 = (uint64)(**(**uint32)(unsafe.Pointer(&p))) + case 64: + u64 = **(**uint64)(unsafe.Pointer(&p)) + } + mask := numMask(code.NumBitSize) + n := u64 & mask + if n < 10 { + return append(out, byte(n+'0')) + } else if n < 100 { + u := intLELookup[n] + return append(out, byte(u), byte(u>>8)) + } + + lookup := intLookup[endianness] + + var b [22]byte + u := (*[11]uint16)(unsafe.Pointer(&b)) + i := 11 + + for n >= 100 { + j := n % 100 + n /= 100 + i-- + u[i] = lookup[j] + } + + i-- + u[i] = lookup[n] + + i *= 2 // convert to byte index + if n < 10 { + i++ // remove leading zero + } + return append(out, b[i:]...) +} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/map112.go b/vendor/github.com/goccy/go-json/internal/encoder/map112.go new file mode 100644 index 000000000..e96ffadf7 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/map112.go @@ -0,0 +1,9 @@ +//go:build !go1.13 +// +build !go1.13 + +package encoder + +import "unsafe" + +//go:linkname MapIterValue reflect.mapitervalue +func MapIterValue(it *mapIter) unsafe.Pointer diff --git a/vendor/github.com/goccy/go-json/internal/encoder/map113.go b/vendor/github.com/goccy/go-json/internal/encoder/map113.go new file mode 100644 index 000000000..9b69dcc36 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/map113.go @@ -0,0 +1,9 @@ +//go:build go1.13 +// +build go1.13 + +package encoder + +import "unsafe" + +//go:linkname MapIterValue reflect.mapiterelem +func MapIterValue(it *mapIter) unsafe.Pointer diff --git a/vendor/github.com/goccy/go-json/internal/encoder/opcode.go b/vendor/github.com/goccy/go-json/internal/encoder/opcode.go new file mode 100644 index 000000000..df22f5542 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/opcode.go @@ -0,0 +1,752 @@ +package encoder + +import ( + "bytes" + "fmt" + "sort" + "strings" + "unsafe" + + "github.com/goccy/go-json/internal/runtime" +) + +const uintptrSize = 4 << (^uintptr(0) >> 63) + +type OpFlags uint16 + +const ( + AnonymousHeadFlags OpFlags = 1 << 0 + AnonymousKeyFlags OpFlags = 1 << 1 + IndirectFlags OpFlags = 1 << 2 + IsTaggedKeyFlags OpFlags = 1 << 3 + NilCheckFlags OpFlags = 1 << 4 + AddrForMarshalerFlags OpFlags = 1 << 5 + IsNextOpPtrTypeFlags OpFlags = 1 << 6 + IsNilableTypeFlags OpFlags = 1 << 7 + MarshalerContextFlags OpFlags = 1 << 8 + NonEmptyInterfaceFlags OpFlags = 1 << 9 +) + +type Opcode struct { + Op OpType // operation type + Idx uint32 // offset to access ptr + Next *Opcode // next opcode + End *Opcode // array/slice/struct/map end + NextField *Opcode // next struct field + Key string // struct field key + Offset uint32 // offset size from struct header + PtrNum uint8 // pointer number: e.g. double pointer is 2. + NumBitSize uint8 + Flags OpFlags + + Type *runtime.Type // go type + Jmp *CompiledCode // for recursive call + FieldQuery *FieldQuery // field query for Interface / MarshalJSON / MarshalText + ElemIdx uint32 // offset to access array/slice elem + Length uint32 // offset to access slice length or array length + Indent uint32 // indent number + Size uint32 // array/slice elem size + DisplayIdx uint32 // opcode index + DisplayKey string // key text to display +} + +func (c *Opcode) Validate() error { + var prevIdx uint32 + for code := c; !code.IsEnd(); { + if prevIdx != 0 { + if code.DisplayIdx != prevIdx+1 { + return fmt.Errorf( + "invalid index. previous display index is %d but next is %d. dump = %s", + prevIdx, code.DisplayIdx, c.Dump(), + ) + } + } + prevIdx = code.DisplayIdx + code = code.IterNext() + } + return nil +} + +func (c *Opcode) IterNext() *Opcode { + if c == nil { + return nil + } + switch c.Op.CodeType() { + case CodeArrayElem, CodeSliceElem, CodeMapKey: + return c.End + default: + return c.Next + } +} + +func (c *Opcode) IsEnd() bool { + if c == nil { + return true + } + return c.Op == OpEnd || c.Op == OpInterfaceEnd || c.Op == OpRecursiveEnd +} + +func (c *Opcode) MaxIdx() uint32 { + max := uint32(0) + for _, value := range []uint32{ + c.Idx, + c.ElemIdx, + c.Length, + c.Size, + } { + if max < value { + max = value + } + } + return max +} + +func (c *Opcode) ToHeaderType(isString bool) OpType { + switch c.Op { + case OpInt: + if isString { + return OpStructHeadIntString + } + return OpStructHeadInt + case OpIntPtr: + if isString { + return OpStructHeadIntPtrString + } + return OpStructHeadIntPtr + case OpUint: + if isString { + return OpStructHeadUintString + } + return OpStructHeadUint + case OpUintPtr: + if isString { + return OpStructHeadUintPtrString + } + return OpStructHeadUintPtr + case OpFloat32: + if isString { + return OpStructHeadFloat32String + } + return OpStructHeadFloat32 + case OpFloat32Ptr: + if isString { + return OpStructHeadFloat32PtrString + } + return OpStructHeadFloat32Ptr + case OpFloat64: + if isString { + return OpStructHeadFloat64String + } + return OpStructHeadFloat64 + case OpFloat64Ptr: + if isString { + return OpStructHeadFloat64PtrString + } + return OpStructHeadFloat64Ptr + case OpString: + if isString { + return OpStructHeadStringString + } + return OpStructHeadString + case OpStringPtr: + if isString { + return OpStructHeadStringPtrString + } + return OpStructHeadStringPtr + case OpNumber: + if isString { + return OpStructHeadNumberString + } + return OpStructHeadNumber + case OpNumberPtr: + if isString { + return OpStructHeadNumberPtrString + } + return OpStructHeadNumberPtr + case OpBool: + if isString { + return OpStructHeadBoolString + } + return OpStructHeadBool + case OpBoolPtr: + if isString { + return OpStructHeadBoolPtrString + } + return OpStructHeadBoolPtr + case OpBytes: + return OpStructHeadBytes + case OpBytesPtr: + return OpStructHeadBytesPtr + case OpMap: + return OpStructHeadMap + case OpMapPtr: + c.Op = OpMap + return OpStructHeadMapPtr + case OpArray: + return OpStructHeadArray + case OpArrayPtr: + c.Op = OpArray + return OpStructHeadArrayPtr + case OpSlice: + return OpStructHeadSlice + case OpSlicePtr: + c.Op = OpSlice + return OpStructHeadSlicePtr + case OpMarshalJSON: + return OpStructHeadMarshalJSON + case OpMarshalJSONPtr: + return OpStructHeadMarshalJSONPtr + case OpMarshalText: + return OpStructHeadMarshalText + case OpMarshalTextPtr: + return OpStructHeadMarshalTextPtr + } + return OpStructHead +} + +func (c *Opcode) ToFieldType(isString bool) OpType { + switch c.Op { + case OpInt: + if isString { + return OpStructFieldIntString + } + return OpStructFieldInt + case OpIntPtr: + if isString { + return OpStructFieldIntPtrString + } + return OpStructFieldIntPtr + case OpUint: + if isString { + return OpStructFieldUintString + } + return OpStructFieldUint + case OpUintPtr: + if isString { + return OpStructFieldUintPtrString + } + return OpStructFieldUintPtr + case OpFloat32: + if isString { + return OpStructFieldFloat32String + } + return OpStructFieldFloat32 + case OpFloat32Ptr: + if isString { + return OpStructFieldFloat32PtrString + } + return OpStructFieldFloat32Ptr + case OpFloat64: + if isString { + return OpStructFieldFloat64String + } + return OpStructFieldFloat64 + case OpFloat64Ptr: + if isString { + return OpStructFieldFloat64PtrString + } + return OpStructFieldFloat64Ptr + case OpString: + if isString { + return OpStructFieldStringString + } + return OpStructFieldString + case OpStringPtr: + if isString { + return OpStructFieldStringPtrString + } + return OpStructFieldStringPtr + case OpNumber: + if isString { + return OpStructFieldNumberString + } + return OpStructFieldNumber + case OpNumberPtr: + if isString { + return OpStructFieldNumberPtrString + } + return OpStructFieldNumberPtr + case OpBool: + if isString { + return OpStructFieldBoolString + } + return OpStructFieldBool + case OpBoolPtr: + if isString { + return OpStructFieldBoolPtrString + } + return OpStructFieldBoolPtr + case OpBytes: + return OpStructFieldBytes + case OpBytesPtr: + return OpStructFieldBytesPtr + case OpMap: + return OpStructFieldMap + case OpMapPtr: + c.Op = OpMap + return OpStructFieldMapPtr + case OpArray: + return OpStructFieldArray + case OpArrayPtr: + c.Op = OpArray + return OpStructFieldArrayPtr + case OpSlice: + return OpStructFieldSlice + case OpSlicePtr: + c.Op = OpSlice + return OpStructFieldSlicePtr + case OpMarshalJSON: + return OpStructFieldMarshalJSON + case OpMarshalJSONPtr: + return OpStructFieldMarshalJSONPtr + case OpMarshalText: + return OpStructFieldMarshalText + case OpMarshalTextPtr: + return OpStructFieldMarshalTextPtr + } + return OpStructField +} + +func newOpCode(ctx *compileContext, typ *runtime.Type, op OpType) *Opcode { + return newOpCodeWithNext(ctx, typ, op, newEndOp(ctx, typ)) +} + +func opcodeOffset(idx int) uint32 { + return uint32(idx) * uintptrSize +} + +func getCodeAddrByIdx(head *Opcode, idx uint32) *Opcode { + addr := uintptr(unsafe.Pointer(head)) + uintptr(idx)*unsafe.Sizeof(Opcode{}) + return *(**Opcode)(unsafe.Pointer(&addr)) +} + +func copyOpcode(code *Opcode) *Opcode { + codeNum := ToEndCode(code).DisplayIdx + 1 + codeSlice := make([]Opcode, codeNum) + head := (*Opcode)((*runtime.SliceHeader)(unsafe.Pointer(&codeSlice)).Data) + ptr := head + c := code + for { + *ptr = Opcode{ + Op: c.Op, + Key: c.Key, + PtrNum: c.PtrNum, + NumBitSize: c.NumBitSize, + Flags: c.Flags, + Idx: c.Idx, + Offset: c.Offset, + Type: c.Type, + FieldQuery: c.FieldQuery, + DisplayIdx: c.DisplayIdx, + DisplayKey: c.DisplayKey, + ElemIdx: c.ElemIdx, + Length: c.Length, + Size: c.Size, + Indent: c.Indent, + Jmp: c.Jmp, + } + if c.End != nil { + ptr.End = getCodeAddrByIdx(head, c.End.DisplayIdx) + } + if c.NextField != nil { + ptr.NextField = getCodeAddrByIdx(head, c.NextField.DisplayIdx) + } + if c.Next != nil { + ptr.Next = getCodeAddrByIdx(head, c.Next.DisplayIdx) + } + if c.IsEnd() { + break + } + ptr = getCodeAddrByIdx(head, c.DisplayIdx+1) + c = c.IterNext() + } + return head +} + +func setTotalLengthToInterfaceOp(code *Opcode) { + for c := code; !c.IsEnd(); { + if c.Op == OpInterface || c.Op == OpInterfacePtr { + c.Length = uint32(code.TotalLength()) + } + c = c.IterNext() + } +} + +func ToEndCode(code *Opcode) *Opcode { + c := code + for !c.IsEnd() { + c = c.IterNext() + } + return c +} + +func copyToInterfaceOpcode(code *Opcode) *Opcode { + copied := copyOpcode(code) + c := copied + c = ToEndCode(c) + c.Idx += uintptrSize + c.ElemIdx = c.Idx + uintptrSize + c.Length = c.Idx + 2*uintptrSize + c.Op = OpInterfaceEnd + return copied +} + +func newOpCodeWithNext(ctx *compileContext, typ *runtime.Type, op OpType, next *Opcode) *Opcode { + return &Opcode{ + Op: op, + Idx: opcodeOffset(ctx.ptrIndex), + Next: next, + Type: typ, + DisplayIdx: ctx.opcodeIndex, + Indent: ctx.indent, + } +} + +func newEndOp(ctx *compileContext, typ *runtime.Type) *Opcode { + return newOpCodeWithNext(ctx, typ, OpEnd, nil) +} + +func (c *Opcode) TotalLength() int { + var idx int + code := c + for !code.IsEnd() { + maxIdx := int(code.MaxIdx() / uintptrSize) + if idx < maxIdx { + idx = maxIdx + } + if code.Op == OpRecursiveEnd { + break + } + code = code.IterNext() + } + maxIdx := int(code.MaxIdx() / uintptrSize) + if idx < maxIdx { + idx = maxIdx + } + return idx + 1 +} + +func (c *Opcode) dumpHead(code *Opcode) string { + var length uint32 + if code.Op.CodeType() == CodeArrayHead { + length = code.Length + } else { + length = code.Length / uintptrSize + } + return fmt.Sprintf( + `[%03d]%s%s ([idx:%d][elemIdx:%d][length:%d])`, + code.DisplayIdx, + strings.Repeat("-", int(code.Indent)), + code.Op, + code.Idx/uintptrSize, + code.ElemIdx/uintptrSize, + length, + ) +} + +func (c *Opcode) dumpMapHead(code *Opcode) string { + return fmt.Sprintf( + `[%03d]%s%s ([idx:%d])`, + code.DisplayIdx, + strings.Repeat("-", int(code.Indent)), + code.Op, + code.Idx/uintptrSize, + ) +} + +func (c *Opcode) dumpMapEnd(code *Opcode) string { + return fmt.Sprintf( + `[%03d]%s%s ([idx:%d])`, + code.DisplayIdx, + strings.Repeat("-", int(code.Indent)), + code.Op, + code.Idx/uintptrSize, + ) +} + +func (c *Opcode) dumpElem(code *Opcode) string { + var length uint32 + if code.Op.CodeType() == CodeArrayElem { + length = code.Length + } else { + length = code.Length / uintptrSize + } + return fmt.Sprintf( + `[%03d]%s%s ([idx:%d][elemIdx:%d][length:%d][size:%d])`, + code.DisplayIdx, + strings.Repeat("-", int(code.Indent)), + code.Op, + code.Idx/uintptrSize, + code.ElemIdx/uintptrSize, + length, + code.Size, + ) +} + +func (c *Opcode) dumpField(code *Opcode) string { + return fmt.Sprintf( + `[%03d]%s%s ([idx:%d][key:%s][offset:%d])`, + code.DisplayIdx, + strings.Repeat("-", int(code.Indent)), + code.Op, + code.Idx/uintptrSize, + code.DisplayKey, + code.Offset, + ) +} + +func (c *Opcode) dumpKey(code *Opcode) string { + return fmt.Sprintf( + `[%03d]%s%s ([idx:%d])`, + code.DisplayIdx, + strings.Repeat("-", int(code.Indent)), + code.Op, + code.Idx/uintptrSize, + ) +} + +func (c *Opcode) dumpValue(code *Opcode) string { + return fmt.Sprintf( + `[%03d]%s%s ([idx:%d])`, + code.DisplayIdx, + strings.Repeat("-", int(code.Indent)), + code.Op, + code.Idx/uintptrSize, + ) +} + +func (c *Opcode) Dump() string { + codes := []string{} + for code := c; !code.IsEnd(); { + switch code.Op.CodeType() { + case CodeSliceHead: + codes = append(codes, c.dumpHead(code)) + code = code.Next + case CodeMapHead: + codes = append(codes, c.dumpMapHead(code)) + code = code.Next + case CodeArrayElem, CodeSliceElem: + codes = append(codes, c.dumpElem(code)) + code = code.End + case CodeMapKey: + codes = append(codes, c.dumpKey(code)) + code = code.End + case CodeMapValue: + codes = append(codes, c.dumpValue(code)) + code = code.Next + case CodeMapEnd: + codes = append(codes, c.dumpMapEnd(code)) + code = code.Next + case CodeStructField: + codes = append(codes, c.dumpField(code)) + code = code.Next + case CodeStructEnd: + codes = append(codes, c.dumpField(code)) + code = code.Next + default: + codes = append(codes, fmt.Sprintf( + "[%03d]%s%s ([idx:%d])", + code.DisplayIdx, + strings.Repeat("-", int(code.Indent)), + code.Op, + code.Idx/uintptrSize, + )) + code = code.Next + } + } + return strings.Join(codes, "\n") +} + +func (c *Opcode) DumpDOT() string { + type edge struct { + from, to *Opcode + label string + weight int + } + var edges []edge + + b := &bytes.Buffer{} + fmt.Fprintf(b, "digraph \"%p\" {\n", c.Type) + fmt.Fprintln(b, "mclimit=1.5;\nrankdir=TD;\nordering=out;\nnode[shape=box];") + for code := c; !code.IsEnd(); { + label := code.Op.String() + fmt.Fprintf(b, "\"%p\" [label=%q];\n", code, label) + if p := code.Next; p != nil { + edges = append(edges, edge{ + from: code, + to: p, + label: "Next", + weight: 10, + }) + } + if p := code.NextField; p != nil { + edges = append(edges, edge{ + from: code, + to: p, + label: "NextField", + weight: 2, + }) + } + if p := code.End; p != nil { + edges = append(edges, edge{ + from: code, + to: p, + label: "End", + weight: 1, + }) + } + if p := code.Jmp; p != nil { + edges = append(edges, edge{ + from: code, + to: p.Code, + label: "Jmp", + weight: 1, + }) + } + + switch code.Op.CodeType() { + case CodeSliceHead: + code = code.Next + case CodeMapHead: + code = code.Next + case CodeArrayElem, CodeSliceElem: + code = code.End + case CodeMapKey: + code = code.End + case CodeMapValue: + code = code.Next + case CodeMapEnd: + code = code.Next + case CodeStructField: + code = code.Next + case CodeStructEnd: + code = code.Next + default: + code = code.Next + } + if code.IsEnd() { + fmt.Fprintf(b, "\"%p\" [label=%q];\n", code, code.Op.String()) + } + } + sort.Slice(edges, func(i, j int) bool { + return edges[i].to.DisplayIdx < edges[j].to.DisplayIdx + }) + for _, e := range edges { + fmt.Fprintf(b, "\"%p\" -> \"%p\" [label=%q][weight=%d];\n", e.from, e.to, e.label, e.weight) + } + fmt.Fprint(b, "}") + return b.String() +} + +func newSliceHeaderCode(ctx *compileContext, typ *runtime.Type) *Opcode { + idx := opcodeOffset(ctx.ptrIndex) + ctx.incPtrIndex() + elemIdx := opcodeOffset(ctx.ptrIndex) + ctx.incPtrIndex() + length := opcodeOffset(ctx.ptrIndex) + return &Opcode{ + Op: OpSlice, + Type: typ, + Idx: idx, + DisplayIdx: ctx.opcodeIndex, + ElemIdx: elemIdx, + Length: length, + Indent: ctx.indent, + } +} + +func newSliceElemCode(ctx *compileContext, typ *runtime.Type, head *Opcode, size uintptr) *Opcode { + return &Opcode{ + Op: OpSliceElem, + Type: typ, + Idx: head.Idx, + DisplayIdx: ctx.opcodeIndex, + ElemIdx: head.ElemIdx, + Length: head.Length, + Indent: ctx.indent, + Size: uint32(size), + } +} + +func newArrayHeaderCode(ctx *compileContext, typ *runtime.Type, alen int) *Opcode { + idx := opcodeOffset(ctx.ptrIndex) + ctx.incPtrIndex() + elemIdx := opcodeOffset(ctx.ptrIndex) + return &Opcode{ + Op: OpArray, + Type: typ, + Idx: idx, + DisplayIdx: ctx.opcodeIndex, + ElemIdx: elemIdx, + Indent: ctx.indent, + Length: uint32(alen), + } +} + +func newArrayElemCode(ctx *compileContext, typ *runtime.Type, head *Opcode, length int, size uintptr) *Opcode { + return &Opcode{ + Op: OpArrayElem, + Type: typ, + Idx: head.Idx, + DisplayIdx: ctx.opcodeIndex, + ElemIdx: head.ElemIdx, + Length: uint32(length), + Indent: ctx.indent, + Size: uint32(size), + } +} + +func newMapHeaderCode(ctx *compileContext, typ *runtime.Type) *Opcode { + idx := opcodeOffset(ctx.ptrIndex) + ctx.incPtrIndex() + return &Opcode{ + Op: OpMap, + Type: typ, + Idx: idx, + DisplayIdx: ctx.opcodeIndex, + Indent: ctx.indent, + } +} + +func newMapKeyCode(ctx *compileContext, typ *runtime.Type, head *Opcode) *Opcode { + return &Opcode{ + Op: OpMapKey, + Type: typ, + Idx: head.Idx, + DisplayIdx: ctx.opcodeIndex, + Indent: ctx.indent, + } +} + +func newMapValueCode(ctx *compileContext, typ *runtime.Type, head *Opcode) *Opcode { + return &Opcode{ + Op: OpMapValue, + Type: typ, + Idx: head.Idx, + DisplayIdx: ctx.opcodeIndex, + Indent: ctx.indent, + } +} + +func newMapEndCode(ctx *compileContext, typ *runtime.Type, head *Opcode) *Opcode { + return &Opcode{ + Op: OpMapEnd, + Type: typ, + Idx: head.Idx, + DisplayIdx: ctx.opcodeIndex, + Indent: ctx.indent, + Next: newEndOp(ctx, typ), + } +} + +func newRecursiveCode(ctx *compileContext, typ *runtime.Type, jmp *CompiledCode) *Opcode { + return &Opcode{ + Op: OpRecursive, + Type: typ, + Idx: opcodeOffset(ctx.ptrIndex), + Next: newEndOp(ctx, typ), + DisplayIdx: ctx.opcodeIndex, + Indent: ctx.indent, + Jmp: jmp, + } +} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/option.go b/vendor/github.com/goccy/go-json/internal/encoder/option.go new file mode 100644 index 000000000..12c58e46c --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/option.go @@ -0,0 +1,48 @@ +package encoder + +import ( + "context" + "io" +) + +type OptionFlag uint8 + +const ( + HTMLEscapeOption OptionFlag = 1 << iota + IndentOption + UnorderedMapOption + DebugOption + ColorizeOption + ContextOption + NormalizeUTF8Option + FieldQueryOption +) + +type Option struct { + Flag OptionFlag + ColorScheme *ColorScheme + Context context.Context + DebugOut io.Writer + DebugDOTOut io.WriteCloser +} + +type EncodeFormat struct { + Header string + Footer string +} + +type EncodeFormatScheme struct { + Int EncodeFormat + Uint EncodeFormat + Float EncodeFormat + Bool EncodeFormat + String EncodeFormat + Binary EncodeFormat + ObjectKey EncodeFormat + Null EncodeFormat +} + +type ( + ColorScheme = EncodeFormatScheme + ColorFormat = EncodeFormat +) diff --git a/vendor/github.com/goccy/go-json/internal/encoder/optype.go b/vendor/github.com/goccy/go-json/internal/encoder/optype.go new file mode 100644 index 000000000..5c1241b47 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/optype.go @@ -0,0 +1,932 @@ +// Code generated by internal/cmd/generator. DO NOT EDIT! +package encoder + +import ( + "strings" +) + +type CodeType int + +const ( + CodeOp CodeType = 0 + CodeArrayHead CodeType = 1 + CodeArrayElem CodeType = 2 + CodeSliceHead CodeType = 3 + CodeSliceElem CodeType = 4 + CodeMapHead CodeType = 5 + CodeMapKey CodeType = 6 + CodeMapValue CodeType = 7 + CodeMapEnd CodeType = 8 + CodeRecursive CodeType = 9 + CodeStructField CodeType = 10 + CodeStructEnd CodeType = 11 +) + +var opTypeStrings = [400]string{ + "End", + "Interface", + "Ptr", + "SliceElem", + "SliceEnd", + "ArrayElem", + "ArrayEnd", + "MapKey", + "MapValue", + "MapEnd", + "Recursive", + "RecursivePtr", + "RecursiveEnd", + "InterfaceEnd", + "Int", + "Uint", + "Float32", + "Float64", + "Bool", + "String", + "Bytes", + "Number", + "Array", + "Map", + "Slice", + "Struct", + "MarshalJSON", + "MarshalText", + "IntString", + "UintString", + "Float32String", + "Float64String", + "BoolString", + "StringString", + "NumberString", + "IntPtr", + "UintPtr", + "Float32Ptr", + "Float64Ptr", + "BoolPtr", + "StringPtr", + "BytesPtr", + "NumberPtr", + "ArrayPtr", + "MapPtr", + "SlicePtr", + "MarshalJSONPtr", + "MarshalTextPtr", + "InterfacePtr", + "IntPtrString", + "UintPtrString", + "Float32PtrString", + "Float64PtrString", + "BoolPtrString", + "StringPtrString", + "NumberPtrString", + "StructHeadInt", + "StructHeadOmitEmptyInt", + "StructPtrHeadInt", + "StructPtrHeadOmitEmptyInt", + "StructHeadUint", + "StructHeadOmitEmptyUint", + "StructPtrHeadUint", + "StructPtrHeadOmitEmptyUint", + "StructHeadFloat32", + "StructHeadOmitEmptyFloat32", + "StructPtrHeadFloat32", + "StructPtrHeadOmitEmptyFloat32", + "StructHeadFloat64", + "StructHeadOmitEmptyFloat64", + "StructPtrHeadFloat64", + "StructPtrHeadOmitEmptyFloat64", + "StructHeadBool", + "StructHeadOmitEmptyBool", + "StructPtrHeadBool", + "StructPtrHeadOmitEmptyBool", + "StructHeadString", + "StructHeadOmitEmptyString", + "StructPtrHeadString", + "StructPtrHeadOmitEmptyString", + "StructHeadBytes", + "StructHeadOmitEmptyBytes", + "StructPtrHeadBytes", + "StructPtrHeadOmitEmptyBytes", + "StructHeadNumber", + "StructHeadOmitEmptyNumber", + "StructPtrHeadNumber", + "StructPtrHeadOmitEmptyNumber", + "StructHeadArray", + "StructHeadOmitEmptyArray", + "StructPtrHeadArray", + "StructPtrHeadOmitEmptyArray", + "StructHeadMap", + "StructHeadOmitEmptyMap", + "StructPtrHeadMap", + "StructPtrHeadOmitEmptyMap", + "StructHeadSlice", + "StructHeadOmitEmptySlice", + "StructPtrHeadSlice", + "StructPtrHeadOmitEmptySlice", + "StructHeadStruct", + "StructHeadOmitEmptyStruct", + "StructPtrHeadStruct", + "StructPtrHeadOmitEmptyStruct", + "StructHeadMarshalJSON", + "StructHeadOmitEmptyMarshalJSON", + "StructPtrHeadMarshalJSON", + "StructPtrHeadOmitEmptyMarshalJSON", + "StructHeadMarshalText", + "StructHeadOmitEmptyMarshalText", + "StructPtrHeadMarshalText", + "StructPtrHeadOmitEmptyMarshalText", + "StructHeadIntString", + "StructHeadOmitEmptyIntString", + "StructPtrHeadIntString", + "StructPtrHeadOmitEmptyIntString", + "StructHeadUintString", + "StructHeadOmitEmptyUintString", + "StructPtrHeadUintString", + "StructPtrHeadOmitEmptyUintString", + "StructHeadFloat32String", + "StructHeadOmitEmptyFloat32String", + "StructPtrHeadFloat32String", + "StructPtrHeadOmitEmptyFloat32String", + "StructHeadFloat64String", + "StructHeadOmitEmptyFloat64String", + "StructPtrHeadFloat64String", + "StructPtrHeadOmitEmptyFloat64String", + "StructHeadBoolString", + "StructHeadOmitEmptyBoolString", + "StructPtrHeadBoolString", + "StructPtrHeadOmitEmptyBoolString", + "StructHeadStringString", + "StructHeadOmitEmptyStringString", + "StructPtrHeadStringString", + "StructPtrHeadOmitEmptyStringString", + "StructHeadNumberString", + "StructHeadOmitEmptyNumberString", + "StructPtrHeadNumberString", + "StructPtrHeadOmitEmptyNumberString", + "StructHeadIntPtr", + "StructHeadOmitEmptyIntPtr", + "StructPtrHeadIntPtr", + "StructPtrHeadOmitEmptyIntPtr", + "StructHeadUintPtr", + "StructHeadOmitEmptyUintPtr", + "StructPtrHeadUintPtr", + "StructPtrHeadOmitEmptyUintPtr", + "StructHeadFloat32Ptr", + "StructHeadOmitEmptyFloat32Ptr", + "StructPtrHeadFloat32Ptr", + "StructPtrHeadOmitEmptyFloat32Ptr", + "StructHeadFloat64Ptr", + "StructHeadOmitEmptyFloat64Ptr", + "StructPtrHeadFloat64Ptr", + "StructPtrHeadOmitEmptyFloat64Ptr", + "StructHeadBoolPtr", + "StructHeadOmitEmptyBoolPtr", + "StructPtrHeadBoolPtr", + "StructPtrHeadOmitEmptyBoolPtr", + "StructHeadStringPtr", + "StructHeadOmitEmptyStringPtr", + "StructPtrHeadStringPtr", + "StructPtrHeadOmitEmptyStringPtr", + "StructHeadBytesPtr", + "StructHeadOmitEmptyBytesPtr", + "StructPtrHeadBytesPtr", + "StructPtrHeadOmitEmptyBytesPtr", + "StructHeadNumberPtr", + "StructHeadOmitEmptyNumberPtr", + "StructPtrHeadNumberPtr", + "StructPtrHeadOmitEmptyNumberPtr", + "StructHeadArrayPtr", + "StructHeadOmitEmptyArrayPtr", + "StructPtrHeadArrayPtr", + "StructPtrHeadOmitEmptyArrayPtr", + "StructHeadMapPtr", + "StructHeadOmitEmptyMapPtr", + "StructPtrHeadMapPtr", + "StructPtrHeadOmitEmptyMapPtr", + "StructHeadSlicePtr", + "StructHeadOmitEmptySlicePtr", + "StructPtrHeadSlicePtr", + "StructPtrHeadOmitEmptySlicePtr", + "StructHeadMarshalJSONPtr", + "StructHeadOmitEmptyMarshalJSONPtr", + "StructPtrHeadMarshalJSONPtr", + "StructPtrHeadOmitEmptyMarshalJSONPtr", + "StructHeadMarshalTextPtr", + "StructHeadOmitEmptyMarshalTextPtr", + "StructPtrHeadMarshalTextPtr", + "StructPtrHeadOmitEmptyMarshalTextPtr", + "StructHeadInterfacePtr", + "StructHeadOmitEmptyInterfacePtr", + "StructPtrHeadInterfacePtr", + "StructPtrHeadOmitEmptyInterfacePtr", + "StructHeadIntPtrString", + "StructHeadOmitEmptyIntPtrString", + "StructPtrHeadIntPtrString", + "StructPtrHeadOmitEmptyIntPtrString", + "StructHeadUintPtrString", + "StructHeadOmitEmptyUintPtrString", + "StructPtrHeadUintPtrString", + "StructPtrHeadOmitEmptyUintPtrString", + "StructHeadFloat32PtrString", + "StructHeadOmitEmptyFloat32PtrString", + "StructPtrHeadFloat32PtrString", + "StructPtrHeadOmitEmptyFloat32PtrString", + "StructHeadFloat64PtrString", + "StructHeadOmitEmptyFloat64PtrString", + "StructPtrHeadFloat64PtrString", + "StructPtrHeadOmitEmptyFloat64PtrString", + "StructHeadBoolPtrString", + "StructHeadOmitEmptyBoolPtrString", + "StructPtrHeadBoolPtrString", + "StructPtrHeadOmitEmptyBoolPtrString", + "StructHeadStringPtrString", + "StructHeadOmitEmptyStringPtrString", + "StructPtrHeadStringPtrString", + "StructPtrHeadOmitEmptyStringPtrString", + "StructHeadNumberPtrString", + "StructHeadOmitEmptyNumberPtrString", + "StructPtrHeadNumberPtrString", + "StructPtrHeadOmitEmptyNumberPtrString", + "StructHead", + "StructHeadOmitEmpty", + "StructPtrHead", + "StructPtrHeadOmitEmpty", + "StructFieldInt", + "StructFieldOmitEmptyInt", + "StructEndInt", + "StructEndOmitEmptyInt", + "StructFieldUint", + "StructFieldOmitEmptyUint", + "StructEndUint", + "StructEndOmitEmptyUint", + "StructFieldFloat32", + "StructFieldOmitEmptyFloat32", + "StructEndFloat32", + "StructEndOmitEmptyFloat32", + "StructFieldFloat64", + "StructFieldOmitEmptyFloat64", + "StructEndFloat64", + "StructEndOmitEmptyFloat64", + "StructFieldBool", + "StructFieldOmitEmptyBool", + "StructEndBool", + "StructEndOmitEmptyBool", + "StructFieldString", + "StructFieldOmitEmptyString", + "StructEndString", + "StructEndOmitEmptyString", + "StructFieldBytes", + "StructFieldOmitEmptyBytes", + "StructEndBytes", + "StructEndOmitEmptyBytes", + "StructFieldNumber", + "StructFieldOmitEmptyNumber", + "StructEndNumber", + "StructEndOmitEmptyNumber", + "StructFieldArray", + "StructFieldOmitEmptyArray", + "StructEndArray", + "StructEndOmitEmptyArray", + "StructFieldMap", + "StructFieldOmitEmptyMap", + "StructEndMap", + "StructEndOmitEmptyMap", + "StructFieldSlice", + "StructFieldOmitEmptySlice", + "StructEndSlice", + "StructEndOmitEmptySlice", + "StructFieldStruct", + "StructFieldOmitEmptyStruct", + "StructEndStruct", + "StructEndOmitEmptyStruct", + "StructFieldMarshalJSON", + "StructFieldOmitEmptyMarshalJSON", + "StructEndMarshalJSON", + "StructEndOmitEmptyMarshalJSON", + "StructFieldMarshalText", + "StructFieldOmitEmptyMarshalText", + "StructEndMarshalText", + "StructEndOmitEmptyMarshalText", + "StructFieldIntString", + "StructFieldOmitEmptyIntString", + "StructEndIntString", + "StructEndOmitEmptyIntString", + "StructFieldUintString", + "StructFieldOmitEmptyUintString", + "StructEndUintString", + "StructEndOmitEmptyUintString", + "StructFieldFloat32String", + "StructFieldOmitEmptyFloat32String", + "StructEndFloat32String", + "StructEndOmitEmptyFloat32String", + "StructFieldFloat64String", + "StructFieldOmitEmptyFloat64String", + "StructEndFloat64String", + "StructEndOmitEmptyFloat64String", + "StructFieldBoolString", + "StructFieldOmitEmptyBoolString", + "StructEndBoolString", + "StructEndOmitEmptyBoolString", + "StructFieldStringString", + "StructFieldOmitEmptyStringString", + "StructEndStringString", + "StructEndOmitEmptyStringString", + "StructFieldNumberString", + "StructFieldOmitEmptyNumberString", + "StructEndNumberString", + "StructEndOmitEmptyNumberString", + "StructFieldIntPtr", + "StructFieldOmitEmptyIntPtr", + "StructEndIntPtr", + "StructEndOmitEmptyIntPtr", + "StructFieldUintPtr", + "StructFieldOmitEmptyUintPtr", + "StructEndUintPtr", + "StructEndOmitEmptyUintPtr", + "StructFieldFloat32Ptr", + "StructFieldOmitEmptyFloat32Ptr", + "StructEndFloat32Ptr", + "StructEndOmitEmptyFloat32Ptr", + "StructFieldFloat64Ptr", + "StructFieldOmitEmptyFloat64Ptr", + "StructEndFloat64Ptr", + "StructEndOmitEmptyFloat64Ptr", + "StructFieldBoolPtr", + "StructFieldOmitEmptyBoolPtr", + "StructEndBoolPtr", + "StructEndOmitEmptyBoolPtr", + "StructFieldStringPtr", + "StructFieldOmitEmptyStringPtr", + "StructEndStringPtr", + "StructEndOmitEmptyStringPtr", + "StructFieldBytesPtr", + "StructFieldOmitEmptyBytesPtr", + "StructEndBytesPtr", + "StructEndOmitEmptyBytesPtr", + "StructFieldNumberPtr", + "StructFieldOmitEmptyNumberPtr", + "StructEndNumberPtr", + "StructEndOmitEmptyNumberPtr", + "StructFieldArrayPtr", + "StructFieldOmitEmptyArrayPtr", + "StructEndArrayPtr", + "StructEndOmitEmptyArrayPtr", + "StructFieldMapPtr", + "StructFieldOmitEmptyMapPtr", + "StructEndMapPtr", + "StructEndOmitEmptyMapPtr", + "StructFieldSlicePtr", + "StructFieldOmitEmptySlicePtr", + "StructEndSlicePtr", + "StructEndOmitEmptySlicePtr", + "StructFieldMarshalJSONPtr", + "StructFieldOmitEmptyMarshalJSONPtr", + "StructEndMarshalJSONPtr", + "StructEndOmitEmptyMarshalJSONPtr", + "StructFieldMarshalTextPtr", + "StructFieldOmitEmptyMarshalTextPtr", + "StructEndMarshalTextPtr", + "StructEndOmitEmptyMarshalTextPtr", + "StructFieldInterfacePtr", + "StructFieldOmitEmptyInterfacePtr", + "StructEndInterfacePtr", + "StructEndOmitEmptyInterfacePtr", + "StructFieldIntPtrString", + "StructFieldOmitEmptyIntPtrString", + "StructEndIntPtrString", + "StructEndOmitEmptyIntPtrString", + "StructFieldUintPtrString", + "StructFieldOmitEmptyUintPtrString", + "StructEndUintPtrString", + "StructEndOmitEmptyUintPtrString", + "StructFieldFloat32PtrString", + "StructFieldOmitEmptyFloat32PtrString", + "StructEndFloat32PtrString", + "StructEndOmitEmptyFloat32PtrString", + "StructFieldFloat64PtrString", + "StructFieldOmitEmptyFloat64PtrString", + "StructEndFloat64PtrString", + "StructEndOmitEmptyFloat64PtrString", + "StructFieldBoolPtrString", + "StructFieldOmitEmptyBoolPtrString", + "StructEndBoolPtrString", + "StructEndOmitEmptyBoolPtrString", + "StructFieldStringPtrString", + "StructFieldOmitEmptyStringPtrString", + "StructEndStringPtrString", + "StructEndOmitEmptyStringPtrString", + "StructFieldNumberPtrString", + "StructFieldOmitEmptyNumberPtrString", + "StructEndNumberPtrString", + "StructEndOmitEmptyNumberPtrString", + "StructField", + "StructFieldOmitEmpty", + "StructEnd", + "StructEndOmitEmpty", +} + +type OpType uint16 + +const ( + OpEnd OpType = 0 + OpInterface OpType = 1 + OpPtr OpType = 2 + OpSliceElem OpType = 3 + OpSliceEnd OpType = 4 + OpArrayElem OpType = 5 + OpArrayEnd OpType = 6 + OpMapKey OpType = 7 + OpMapValue OpType = 8 + OpMapEnd OpType = 9 + OpRecursive OpType = 10 + OpRecursivePtr OpType = 11 + OpRecursiveEnd OpType = 12 + OpInterfaceEnd OpType = 13 + OpInt OpType = 14 + OpUint OpType = 15 + OpFloat32 OpType = 16 + OpFloat64 OpType = 17 + OpBool OpType = 18 + OpString OpType = 19 + OpBytes OpType = 20 + OpNumber OpType = 21 + OpArray OpType = 22 + OpMap OpType = 23 + OpSlice OpType = 24 + OpStruct OpType = 25 + OpMarshalJSON OpType = 26 + OpMarshalText OpType = 27 + OpIntString OpType = 28 + OpUintString OpType = 29 + OpFloat32String OpType = 30 + OpFloat64String OpType = 31 + OpBoolString OpType = 32 + OpStringString OpType = 33 + OpNumberString OpType = 34 + OpIntPtr OpType = 35 + OpUintPtr OpType = 36 + OpFloat32Ptr OpType = 37 + OpFloat64Ptr OpType = 38 + OpBoolPtr OpType = 39 + OpStringPtr OpType = 40 + OpBytesPtr OpType = 41 + OpNumberPtr OpType = 42 + OpArrayPtr OpType = 43 + OpMapPtr OpType = 44 + OpSlicePtr OpType = 45 + OpMarshalJSONPtr OpType = 46 + OpMarshalTextPtr OpType = 47 + OpInterfacePtr OpType = 48 + OpIntPtrString OpType = 49 + OpUintPtrString OpType = 50 + OpFloat32PtrString OpType = 51 + OpFloat64PtrString OpType = 52 + OpBoolPtrString OpType = 53 + OpStringPtrString OpType = 54 + OpNumberPtrString OpType = 55 + OpStructHeadInt OpType = 56 + OpStructHeadOmitEmptyInt OpType = 57 + OpStructPtrHeadInt OpType = 58 + OpStructPtrHeadOmitEmptyInt OpType = 59 + OpStructHeadUint OpType = 60 + OpStructHeadOmitEmptyUint OpType = 61 + OpStructPtrHeadUint OpType = 62 + OpStructPtrHeadOmitEmptyUint OpType = 63 + OpStructHeadFloat32 OpType = 64 + OpStructHeadOmitEmptyFloat32 OpType = 65 + OpStructPtrHeadFloat32 OpType = 66 + OpStructPtrHeadOmitEmptyFloat32 OpType = 67 + OpStructHeadFloat64 OpType = 68 + OpStructHeadOmitEmptyFloat64 OpType = 69 + OpStructPtrHeadFloat64 OpType = 70 + OpStructPtrHeadOmitEmptyFloat64 OpType = 71 + OpStructHeadBool OpType = 72 + OpStructHeadOmitEmptyBool OpType = 73 + OpStructPtrHeadBool OpType = 74 + OpStructPtrHeadOmitEmptyBool OpType = 75 + OpStructHeadString OpType = 76 + OpStructHeadOmitEmptyString OpType = 77 + OpStructPtrHeadString OpType = 78 + OpStructPtrHeadOmitEmptyString OpType = 79 + OpStructHeadBytes OpType = 80 + OpStructHeadOmitEmptyBytes OpType = 81 + OpStructPtrHeadBytes OpType = 82 + OpStructPtrHeadOmitEmptyBytes OpType = 83 + OpStructHeadNumber OpType = 84 + OpStructHeadOmitEmptyNumber OpType = 85 + OpStructPtrHeadNumber OpType = 86 + OpStructPtrHeadOmitEmptyNumber OpType = 87 + OpStructHeadArray OpType = 88 + OpStructHeadOmitEmptyArray OpType = 89 + OpStructPtrHeadArray OpType = 90 + OpStructPtrHeadOmitEmptyArray OpType = 91 + OpStructHeadMap OpType = 92 + OpStructHeadOmitEmptyMap OpType = 93 + OpStructPtrHeadMap OpType = 94 + OpStructPtrHeadOmitEmptyMap OpType = 95 + OpStructHeadSlice OpType = 96 + OpStructHeadOmitEmptySlice OpType = 97 + OpStructPtrHeadSlice OpType = 98 + OpStructPtrHeadOmitEmptySlice OpType = 99 + OpStructHeadStruct OpType = 100 + OpStructHeadOmitEmptyStruct OpType = 101 + OpStructPtrHeadStruct OpType = 102 + OpStructPtrHeadOmitEmptyStruct OpType = 103 + OpStructHeadMarshalJSON OpType = 104 + OpStructHeadOmitEmptyMarshalJSON OpType = 105 + OpStructPtrHeadMarshalJSON OpType = 106 + OpStructPtrHeadOmitEmptyMarshalJSON OpType = 107 + OpStructHeadMarshalText OpType = 108 + OpStructHeadOmitEmptyMarshalText OpType = 109 + OpStructPtrHeadMarshalText OpType = 110 + OpStructPtrHeadOmitEmptyMarshalText OpType = 111 + OpStructHeadIntString OpType = 112 + OpStructHeadOmitEmptyIntString OpType = 113 + OpStructPtrHeadIntString OpType = 114 + OpStructPtrHeadOmitEmptyIntString OpType = 115 + OpStructHeadUintString OpType = 116 + OpStructHeadOmitEmptyUintString OpType = 117 + OpStructPtrHeadUintString OpType = 118 + OpStructPtrHeadOmitEmptyUintString OpType = 119 + OpStructHeadFloat32String OpType = 120 + OpStructHeadOmitEmptyFloat32String OpType = 121 + OpStructPtrHeadFloat32String OpType = 122 + OpStructPtrHeadOmitEmptyFloat32String OpType = 123 + OpStructHeadFloat64String OpType = 124 + OpStructHeadOmitEmptyFloat64String OpType = 125 + OpStructPtrHeadFloat64String OpType = 126 + OpStructPtrHeadOmitEmptyFloat64String OpType = 127 + OpStructHeadBoolString OpType = 128 + OpStructHeadOmitEmptyBoolString OpType = 129 + OpStructPtrHeadBoolString OpType = 130 + OpStructPtrHeadOmitEmptyBoolString OpType = 131 + OpStructHeadStringString OpType = 132 + OpStructHeadOmitEmptyStringString OpType = 133 + OpStructPtrHeadStringString OpType = 134 + OpStructPtrHeadOmitEmptyStringString OpType = 135 + OpStructHeadNumberString OpType = 136 + OpStructHeadOmitEmptyNumberString OpType = 137 + OpStructPtrHeadNumberString OpType = 138 + OpStructPtrHeadOmitEmptyNumberString OpType = 139 + OpStructHeadIntPtr OpType = 140 + OpStructHeadOmitEmptyIntPtr OpType = 141 + OpStructPtrHeadIntPtr OpType = 142 + OpStructPtrHeadOmitEmptyIntPtr OpType = 143 + OpStructHeadUintPtr OpType = 144 + OpStructHeadOmitEmptyUintPtr OpType = 145 + OpStructPtrHeadUintPtr OpType = 146 + OpStructPtrHeadOmitEmptyUintPtr OpType = 147 + OpStructHeadFloat32Ptr OpType = 148 + OpStructHeadOmitEmptyFloat32Ptr OpType = 149 + OpStructPtrHeadFloat32Ptr OpType = 150 + OpStructPtrHeadOmitEmptyFloat32Ptr OpType = 151 + OpStructHeadFloat64Ptr OpType = 152 + OpStructHeadOmitEmptyFloat64Ptr OpType = 153 + OpStructPtrHeadFloat64Ptr OpType = 154 + OpStructPtrHeadOmitEmptyFloat64Ptr OpType = 155 + OpStructHeadBoolPtr OpType = 156 + OpStructHeadOmitEmptyBoolPtr OpType = 157 + OpStructPtrHeadBoolPtr OpType = 158 + OpStructPtrHeadOmitEmptyBoolPtr OpType = 159 + OpStructHeadStringPtr OpType = 160 + OpStructHeadOmitEmptyStringPtr OpType = 161 + OpStructPtrHeadStringPtr OpType = 162 + OpStructPtrHeadOmitEmptyStringPtr OpType = 163 + OpStructHeadBytesPtr OpType = 164 + OpStructHeadOmitEmptyBytesPtr OpType = 165 + OpStructPtrHeadBytesPtr OpType = 166 + OpStructPtrHeadOmitEmptyBytesPtr OpType = 167 + OpStructHeadNumberPtr OpType = 168 + OpStructHeadOmitEmptyNumberPtr OpType = 169 + OpStructPtrHeadNumberPtr OpType = 170 + OpStructPtrHeadOmitEmptyNumberPtr OpType = 171 + OpStructHeadArrayPtr OpType = 172 + OpStructHeadOmitEmptyArrayPtr OpType = 173 + OpStructPtrHeadArrayPtr OpType = 174 + OpStructPtrHeadOmitEmptyArrayPtr OpType = 175 + OpStructHeadMapPtr OpType = 176 + OpStructHeadOmitEmptyMapPtr OpType = 177 + OpStructPtrHeadMapPtr OpType = 178 + OpStructPtrHeadOmitEmptyMapPtr OpType = 179 + OpStructHeadSlicePtr OpType = 180 + OpStructHeadOmitEmptySlicePtr OpType = 181 + OpStructPtrHeadSlicePtr OpType = 182 + OpStructPtrHeadOmitEmptySlicePtr OpType = 183 + OpStructHeadMarshalJSONPtr OpType = 184 + OpStructHeadOmitEmptyMarshalJSONPtr OpType = 185 + OpStructPtrHeadMarshalJSONPtr OpType = 186 + OpStructPtrHeadOmitEmptyMarshalJSONPtr OpType = 187 + OpStructHeadMarshalTextPtr OpType = 188 + OpStructHeadOmitEmptyMarshalTextPtr OpType = 189 + OpStructPtrHeadMarshalTextPtr OpType = 190 + OpStructPtrHeadOmitEmptyMarshalTextPtr OpType = 191 + OpStructHeadInterfacePtr OpType = 192 + OpStructHeadOmitEmptyInterfacePtr OpType = 193 + OpStructPtrHeadInterfacePtr OpType = 194 + OpStructPtrHeadOmitEmptyInterfacePtr OpType = 195 + OpStructHeadIntPtrString OpType = 196 + OpStructHeadOmitEmptyIntPtrString OpType = 197 + OpStructPtrHeadIntPtrString OpType = 198 + OpStructPtrHeadOmitEmptyIntPtrString OpType = 199 + OpStructHeadUintPtrString OpType = 200 + OpStructHeadOmitEmptyUintPtrString OpType = 201 + OpStructPtrHeadUintPtrString OpType = 202 + OpStructPtrHeadOmitEmptyUintPtrString OpType = 203 + OpStructHeadFloat32PtrString OpType = 204 + OpStructHeadOmitEmptyFloat32PtrString OpType = 205 + OpStructPtrHeadFloat32PtrString OpType = 206 + OpStructPtrHeadOmitEmptyFloat32PtrString OpType = 207 + OpStructHeadFloat64PtrString OpType = 208 + OpStructHeadOmitEmptyFloat64PtrString OpType = 209 + OpStructPtrHeadFloat64PtrString OpType = 210 + OpStructPtrHeadOmitEmptyFloat64PtrString OpType = 211 + OpStructHeadBoolPtrString OpType = 212 + OpStructHeadOmitEmptyBoolPtrString OpType = 213 + OpStructPtrHeadBoolPtrString OpType = 214 + OpStructPtrHeadOmitEmptyBoolPtrString OpType = 215 + OpStructHeadStringPtrString OpType = 216 + OpStructHeadOmitEmptyStringPtrString OpType = 217 + OpStructPtrHeadStringPtrString OpType = 218 + OpStructPtrHeadOmitEmptyStringPtrString OpType = 219 + OpStructHeadNumberPtrString OpType = 220 + OpStructHeadOmitEmptyNumberPtrString OpType = 221 + OpStructPtrHeadNumberPtrString OpType = 222 + OpStructPtrHeadOmitEmptyNumberPtrString OpType = 223 + OpStructHead OpType = 224 + OpStructHeadOmitEmpty OpType = 225 + OpStructPtrHead OpType = 226 + OpStructPtrHeadOmitEmpty OpType = 227 + OpStructFieldInt OpType = 228 + OpStructFieldOmitEmptyInt OpType = 229 + OpStructEndInt OpType = 230 + OpStructEndOmitEmptyInt OpType = 231 + OpStructFieldUint OpType = 232 + OpStructFieldOmitEmptyUint OpType = 233 + OpStructEndUint OpType = 234 + OpStructEndOmitEmptyUint OpType = 235 + OpStructFieldFloat32 OpType = 236 + OpStructFieldOmitEmptyFloat32 OpType = 237 + OpStructEndFloat32 OpType = 238 + OpStructEndOmitEmptyFloat32 OpType = 239 + OpStructFieldFloat64 OpType = 240 + OpStructFieldOmitEmptyFloat64 OpType = 241 + OpStructEndFloat64 OpType = 242 + OpStructEndOmitEmptyFloat64 OpType = 243 + OpStructFieldBool OpType = 244 + OpStructFieldOmitEmptyBool OpType = 245 + OpStructEndBool OpType = 246 + OpStructEndOmitEmptyBool OpType = 247 + OpStructFieldString OpType = 248 + OpStructFieldOmitEmptyString OpType = 249 + OpStructEndString OpType = 250 + OpStructEndOmitEmptyString OpType = 251 + OpStructFieldBytes OpType = 252 + OpStructFieldOmitEmptyBytes OpType = 253 + OpStructEndBytes OpType = 254 + OpStructEndOmitEmptyBytes OpType = 255 + OpStructFieldNumber OpType = 256 + OpStructFieldOmitEmptyNumber OpType = 257 + OpStructEndNumber OpType = 258 + OpStructEndOmitEmptyNumber OpType = 259 + OpStructFieldArray OpType = 260 + OpStructFieldOmitEmptyArray OpType = 261 + OpStructEndArray OpType = 262 + OpStructEndOmitEmptyArray OpType = 263 + OpStructFieldMap OpType = 264 + OpStructFieldOmitEmptyMap OpType = 265 + OpStructEndMap OpType = 266 + OpStructEndOmitEmptyMap OpType = 267 + OpStructFieldSlice OpType = 268 + OpStructFieldOmitEmptySlice OpType = 269 + OpStructEndSlice OpType = 270 + OpStructEndOmitEmptySlice OpType = 271 + OpStructFieldStruct OpType = 272 + OpStructFieldOmitEmptyStruct OpType = 273 + OpStructEndStruct OpType = 274 + OpStructEndOmitEmptyStruct OpType = 275 + OpStructFieldMarshalJSON OpType = 276 + OpStructFieldOmitEmptyMarshalJSON OpType = 277 + OpStructEndMarshalJSON OpType = 278 + OpStructEndOmitEmptyMarshalJSON OpType = 279 + OpStructFieldMarshalText OpType = 280 + OpStructFieldOmitEmptyMarshalText OpType = 281 + OpStructEndMarshalText OpType = 282 + OpStructEndOmitEmptyMarshalText OpType = 283 + OpStructFieldIntString OpType = 284 + OpStructFieldOmitEmptyIntString OpType = 285 + OpStructEndIntString OpType = 286 + OpStructEndOmitEmptyIntString OpType = 287 + OpStructFieldUintString OpType = 288 + OpStructFieldOmitEmptyUintString OpType = 289 + OpStructEndUintString OpType = 290 + OpStructEndOmitEmptyUintString OpType = 291 + OpStructFieldFloat32String OpType = 292 + OpStructFieldOmitEmptyFloat32String OpType = 293 + OpStructEndFloat32String OpType = 294 + OpStructEndOmitEmptyFloat32String OpType = 295 + OpStructFieldFloat64String OpType = 296 + OpStructFieldOmitEmptyFloat64String OpType = 297 + OpStructEndFloat64String OpType = 298 + OpStructEndOmitEmptyFloat64String OpType = 299 + OpStructFieldBoolString OpType = 300 + OpStructFieldOmitEmptyBoolString OpType = 301 + OpStructEndBoolString OpType = 302 + OpStructEndOmitEmptyBoolString OpType = 303 + OpStructFieldStringString OpType = 304 + OpStructFieldOmitEmptyStringString OpType = 305 + OpStructEndStringString OpType = 306 + OpStructEndOmitEmptyStringString OpType = 307 + OpStructFieldNumberString OpType = 308 + OpStructFieldOmitEmptyNumberString OpType = 309 + OpStructEndNumberString OpType = 310 + OpStructEndOmitEmptyNumberString OpType = 311 + OpStructFieldIntPtr OpType = 312 + OpStructFieldOmitEmptyIntPtr OpType = 313 + OpStructEndIntPtr OpType = 314 + OpStructEndOmitEmptyIntPtr OpType = 315 + OpStructFieldUintPtr OpType = 316 + OpStructFieldOmitEmptyUintPtr OpType = 317 + OpStructEndUintPtr OpType = 318 + OpStructEndOmitEmptyUintPtr OpType = 319 + OpStructFieldFloat32Ptr OpType = 320 + OpStructFieldOmitEmptyFloat32Ptr OpType = 321 + OpStructEndFloat32Ptr OpType = 322 + OpStructEndOmitEmptyFloat32Ptr OpType = 323 + OpStructFieldFloat64Ptr OpType = 324 + OpStructFieldOmitEmptyFloat64Ptr OpType = 325 + OpStructEndFloat64Ptr OpType = 326 + OpStructEndOmitEmptyFloat64Ptr OpType = 327 + OpStructFieldBoolPtr OpType = 328 + OpStructFieldOmitEmptyBoolPtr OpType = 329 + OpStructEndBoolPtr OpType = 330 + OpStructEndOmitEmptyBoolPtr OpType = 331 + OpStructFieldStringPtr OpType = 332 + OpStructFieldOmitEmptyStringPtr OpType = 333 + OpStructEndStringPtr OpType = 334 + OpStructEndOmitEmptyStringPtr OpType = 335 + OpStructFieldBytesPtr OpType = 336 + OpStructFieldOmitEmptyBytesPtr OpType = 337 + OpStructEndBytesPtr OpType = 338 + OpStructEndOmitEmptyBytesPtr OpType = 339 + OpStructFieldNumberPtr OpType = 340 + OpStructFieldOmitEmptyNumberPtr OpType = 341 + OpStructEndNumberPtr OpType = 342 + OpStructEndOmitEmptyNumberPtr OpType = 343 + OpStructFieldArrayPtr OpType = 344 + OpStructFieldOmitEmptyArrayPtr OpType = 345 + OpStructEndArrayPtr OpType = 346 + OpStructEndOmitEmptyArrayPtr OpType = 347 + OpStructFieldMapPtr OpType = 348 + OpStructFieldOmitEmptyMapPtr OpType = 349 + OpStructEndMapPtr OpType = 350 + OpStructEndOmitEmptyMapPtr OpType = 351 + OpStructFieldSlicePtr OpType = 352 + OpStructFieldOmitEmptySlicePtr OpType = 353 + OpStructEndSlicePtr OpType = 354 + OpStructEndOmitEmptySlicePtr OpType = 355 + OpStructFieldMarshalJSONPtr OpType = 356 + OpStructFieldOmitEmptyMarshalJSONPtr OpType = 357 + OpStructEndMarshalJSONPtr OpType = 358 + OpStructEndOmitEmptyMarshalJSONPtr OpType = 359 + OpStructFieldMarshalTextPtr OpType = 360 + OpStructFieldOmitEmptyMarshalTextPtr OpType = 361 + OpStructEndMarshalTextPtr OpType = 362 + OpStructEndOmitEmptyMarshalTextPtr OpType = 363 + OpStructFieldInterfacePtr OpType = 364 + OpStructFieldOmitEmptyInterfacePtr OpType = 365 + OpStructEndInterfacePtr OpType = 366 + OpStructEndOmitEmptyInterfacePtr OpType = 367 + OpStructFieldIntPtrString OpType = 368 + OpStructFieldOmitEmptyIntPtrString OpType = 369 + OpStructEndIntPtrString OpType = 370 + OpStructEndOmitEmptyIntPtrString OpType = 371 + OpStructFieldUintPtrString OpType = 372 + OpStructFieldOmitEmptyUintPtrString OpType = 373 + OpStructEndUintPtrString OpType = 374 + OpStructEndOmitEmptyUintPtrString OpType = 375 + OpStructFieldFloat32PtrString OpType = 376 + OpStructFieldOmitEmptyFloat32PtrString OpType = 377 + OpStructEndFloat32PtrString OpType = 378 + OpStructEndOmitEmptyFloat32PtrString OpType = 379 + OpStructFieldFloat64PtrString OpType = 380 + OpStructFieldOmitEmptyFloat64PtrString OpType = 381 + OpStructEndFloat64PtrString OpType = 382 + OpStructEndOmitEmptyFloat64PtrString OpType = 383 + OpStructFieldBoolPtrString OpType = 384 + OpStructFieldOmitEmptyBoolPtrString OpType = 385 + OpStructEndBoolPtrString OpType = 386 + OpStructEndOmitEmptyBoolPtrString OpType = 387 + OpStructFieldStringPtrString OpType = 388 + OpStructFieldOmitEmptyStringPtrString OpType = 389 + OpStructEndStringPtrString OpType = 390 + OpStructEndOmitEmptyStringPtrString OpType = 391 + OpStructFieldNumberPtrString OpType = 392 + OpStructFieldOmitEmptyNumberPtrString OpType = 393 + OpStructEndNumberPtrString OpType = 394 + OpStructEndOmitEmptyNumberPtrString OpType = 395 + OpStructField OpType = 396 + OpStructFieldOmitEmpty OpType = 397 + OpStructEnd OpType = 398 + OpStructEndOmitEmpty OpType = 399 +) + +func (t OpType) String() string { + if int(t) >= 400 { + return "" + } + return opTypeStrings[int(t)] +} + +func (t OpType) CodeType() CodeType { + if strings.Contains(t.String(), "Struct") { + if strings.Contains(t.String(), "End") { + return CodeStructEnd + } + return CodeStructField + } + switch t { + case OpArray, OpArrayPtr: + return CodeArrayHead + case OpArrayElem: + return CodeArrayElem + case OpSlice, OpSlicePtr: + return CodeSliceHead + case OpSliceElem: + return CodeSliceElem + case OpMap, OpMapPtr: + return CodeMapHead + case OpMapKey: + return CodeMapKey + case OpMapValue: + return CodeMapValue + case OpMapEnd: + return CodeMapEnd + } + + return CodeOp +} + +func (t OpType) HeadToPtrHead() OpType { + if strings.Index(t.String(), "PtrHead") > 0 { + return t + } + + idx := strings.Index(t.String(), "Head") + if idx == -1 { + return t + } + suffix := "PtrHead" + t.String()[idx+len("Head"):] + + const toPtrOffset = 2 + if strings.Contains(OpType(int(t)+toPtrOffset).String(), suffix) { + return OpType(int(t) + toPtrOffset) + } + return t +} + +func (t OpType) HeadToOmitEmptyHead() OpType { + const toOmitEmptyOffset = 1 + if strings.Contains(OpType(int(t)+toOmitEmptyOffset).String(), "OmitEmpty") { + return OpType(int(t) + toOmitEmptyOffset) + } + + return t +} + +func (t OpType) PtrHeadToHead() OpType { + idx := strings.Index(t.String(), "PtrHead") + if idx == -1 { + return t + } + suffix := t.String()[idx+len("Ptr"):] + + const toPtrOffset = 2 + if strings.Contains(OpType(int(t)-toPtrOffset).String(), suffix) { + return OpType(int(t) - toPtrOffset) + } + return t +} + +func (t OpType) FieldToEnd() OpType { + idx := strings.Index(t.String(), "Field") + if idx == -1 { + return t + } + suffix := t.String()[idx+len("Field"):] + if suffix == "" || suffix == "OmitEmpty" { + return t + } + const toEndOffset = 2 + if strings.Contains(OpType(int(t)+toEndOffset).String(), "End"+suffix) { + return OpType(int(t) + toEndOffset) + } + return t +} + +func (t OpType) FieldToOmitEmptyField() OpType { + const toOmitEmptyOffset = 1 + if strings.Contains(OpType(int(t)+toOmitEmptyOffset).String(), "OmitEmpty") { + return OpType(int(t) + toOmitEmptyOffset) + } + return t +} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/query.go b/vendor/github.com/goccy/go-json/internal/encoder/query.go new file mode 100644 index 000000000..1e1850cc1 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/query.go @@ -0,0 +1,135 @@ +package encoder + +import ( + "context" + "fmt" + "reflect" +) + +var ( + Marshal func(interface{}) ([]byte, error) + Unmarshal func([]byte, interface{}) error +) + +type FieldQuery struct { + Name string + Fields []*FieldQuery + hash string +} + +func (q *FieldQuery) Hash() string { + if q.hash != "" { + return q.hash + } + b, _ := Marshal(q) + q.hash = string(b) + return q.hash +} + +func (q *FieldQuery) MarshalJSON() ([]byte, error) { + if q.Name != "" { + if len(q.Fields) > 0 { + return Marshal(map[string][]*FieldQuery{q.Name: q.Fields}) + } + return Marshal(q.Name) + } + return Marshal(q.Fields) +} + +func (q *FieldQuery) QueryString() (FieldQueryString, error) { + b, err := Marshal(q) + if err != nil { + return "", err + } + return FieldQueryString(b), nil +} + +type FieldQueryString string + +func (s FieldQueryString) Build() (*FieldQuery, error) { + var query interface{} + if err := Unmarshal([]byte(s), &query); err != nil { + return nil, err + } + return s.build(reflect.ValueOf(query)) +} + +func (s FieldQueryString) build(v reflect.Value) (*FieldQuery, error) { + switch v.Type().Kind() { + case reflect.String: + return s.buildString(v) + case reflect.Map: + return s.buildMap(v) + case reflect.Slice: + return s.buildSlice(v) + case reflect.Interface: + return s.build(reflect.ValueOf(v.Interface())) + } + return nil, fmt.Errorf("failed to build field query") +} + +func (s FieldQueryString) buildString(v reflect.Value) (*FieldQuery, error) { + b := []byte(v.String()) + switch b[0] { + case '[', '{': + var query interface{} + if err := Unmarshal(b, &query); err != nil { + return nil, err + } + if str, ok := query.(string); ok { + return &FieldQuery{Name: str}, nil + } + return s.build(reflect.ValueOf(query)) + } + return &FieldQuery{Name: string(b)}, nil +} + +func (s FieldQueryString) buildSlice(v reflect.Value) (*FieldQuery, error) { + fields := make([]*FieldQuery, 0, v.Len()) + for i := 0; i < v.Len(); i++ { + def, err := s.build(v.Index(i)) + if err != nil { + return nil, err + } + fields = append(fields, def) + } + return &FieldQuery{Fields: fields}, nil +} + +func (s FieldQueryString) buildMap(v reflect.Value) (*FieldQuery, error) { + keys := v.MapKeys() + if len(keys) != 1 { + return nil, fmt.Errorf("failed to build field query object") + } + key := keys[0] + if key.Type().Kind() != reflect.String { + return nil, fmt.Errorf("failed to build field query. invalid object key type") + } + name := key.String() + def, err := s.build(v.MapIndex(key)) + if err != nil { + return nil, err + } + return &FieldQuery{ + Name: name, + Fields: def.Fields, + }, nil +} + +type queryKey struct{} + +func FieldQueryFromContext(ctx context.Context) *FieldQuery { + query := ctx.Value(queryKey{}) + if query == nil { + return nil + } + q, ok := query.(*FieldQuery) + if !ok { + return nil + } + return q +} + +func SetFieldQueryToContext(ctx context.Context, query *FieldQuery) context.Context { + return context.WithValue(ctx, queryKey{}, query) +} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/string.go b/vendor/github.com/goccy/go-json/internal/encoder/string.go new file mode 100644 index 000000000..e4152b27c --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/string.go @@ -0,0 +1,459 @@ +package encoder + +import ( + "math/bits" + "reflect" + "unsafe" +) + +const ( + lsb = 0x0101010101010101 + msb = 0x8080808080808080 +) + +var hex = "0123456789abcdef" + +//nolint:govet +func stringToUint64Slice(s string) []uint64 { + return *(*[]uint64)(unsafe.Pointer(&reflect.SliceHeader{ + Data: ((*reflect.StringHeader)(unsafe.Pointer(&s))).Data, + Len: len(s) / 8, + Cap: len(s) / 8, + })) +} + +func AppendString(ctx *RuntimeContext, buf []byte, s string) []byte { + if ctx.Option.Flag&HTMLEscapeOption != 0 { + if ctx.Option.Flag&NormalizeUTF8Option != 0 { + return appendNormalizedHTMLString(buf, s) + } + return appendHTMLString(buf, s) + } + if ctx.Option.Flag&NormalizeUTF8Option != 0 { + return appendNormalizedString(buf, s) + } + return appendString(buf, s) +} + +func appendNormalizedHTMLString(buf []byte, s string) []byte { + valLen := len(s) + if valLen == 0 { + return append(buf, `""`...) + } + buf = append(buf, '"') + var ( + i, j int + ) + if valLen >= 8 { + chunks := stringToUint64Slice(s) + for _, n := range chunks { + // combine masks before checking for the MSB of each byte. We include + // `n` in the mask to check whether any of the *input* byte MSBs were + // set (i.e. the byte was outside the ASCII range). + mask := n | (n - (lsb * 0x20)) | + ((n ^ (lsb * '"')) - lsb) | + ((n ^ (lsb * '\\')) - lsb) | + ((n ^ (lsb * '<')) - lsb) | + ((n ^ (lsb * '>')) - lsb) | + ((n ^ (lsb * '&')) - lsb) + if (mask & msb) != 0 { + j = bits.TrailingZeros64(mask&msb) / 8 + goto ESCAPE_END + } + } + for i := len(chunks) * 8; i < valLen; i++ { + if needEscapeHTMLNormalizeUTF8[s[i]] { + j = i + goto ESCAPE_END + } + } + // no found any escape characters. + return append(append(buf, s...), '"') + } +ESCAPE_END: + for j < valLen { + c := s[j] + + if !needEscapeHTMLNormalizeUTF8[c] { + // fast path: most of the time, printable ascii characters are used + j++ + continue + } + + switch c { + case '\\', '"': + buf = append(buf, s[i:j]...) + buf = append(buf, '\\', c) + i = j + 1 + j = j + 1 + continue + + case '\n': + buf = append(buf, s[i:j]...) + buf = append(buf, '\\', 'n') + i = j + 1 + j = j + 1 + continue + + case '\r': + buf = append(buf, s[i:j]...) + buf = append(buf, '\\', 'r') + i = j + 1 + j = j + 1 + continue + + case '\t': + buf = append(buf, s[i:j]...) + buf = append(buf, '\\', 't') + i = j + 1 + j = j + 1 + continue + + case '<', '>', '&': + buf = append(buf, s[i:j]...) + buf = append(buf, `\u00`...) + buf = append(buf, hex[c>>4], hex[c&0xF]) + i = j + 1 + j = j + 1 + continue + + case 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x0B, 0x0C, 0x0E, 0x0F, // 0x00-0x0F + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F: // 0x10-0x1F + buf = append(buf, s[i:j]...) + buf = append(buf, `\u00`...) + buf = append(buf, hex[c>>4], hex[c&0xF]) + i = j + 1 + j = j + 1 + continue + } + state, size := decodeRuneInString(s[j:]) + switch state { + case runeErrorState: + buf = append(buf, s[i:j]...) + buf = append(buf, `\ufffd`...) + i = j + 1 + j = j + 1 + continue + // U+2028 is LINE SEPARATOR. + // U+2029 is PARAGRAPH SEPARATOR. + // They are both technically valid characters in JSON strings, + // but don't work in JSONP, which has to be evaluated as JavaScript, + // and can lead to security holes there. It is valid JSON to + // escape them, so we do so unconditionally. + // See http://timelessrepo.com/json-isnt-a-javascript-subset for discussion. + case lineSepState: + buf = append(buf, s[i:j]...) + buf = append(buf, `\u2028`...) + i = j + 3 + j = j + 3 + continue + case paragraphSepState: + buf = append(buf, s[i:j]...) + buf = append(buf, `\u2029`...) + i = j + 3 + j = j + 3 + continue + } + j += size + } + + return append(append(buf, s[i:]...), '"') +} + +func appendHTMLString(buf []byte, s string) []byte { + valLen := len(s) + if valLen == 0 { + return append(buf, `""`...) + } + buf = append(buf, '"') + var ( + i, j int + ) + if valLen >= 8 { + chunks := stringToUint64Slice(s) + for _, n := range chunks { + // combine masks before checking for the MSB of each byte. We include + // `n` in the mask to check whether any of the *input* byte MSBs were + // set (i.e. the byte was outside the ASCII range). + mask := n | (n - (lsb * 0x20)) | + ((n ^ (lsb * '"')) - lsb) | + ((n ^ (lsb * '\\')) - lsb) | + ((n ^ (lsb * '<')) - lsb) | + ((n ^ (lsb * '>')) - lsb) | + ((n ^ (lsb * '&')) - lsb) + if (mask & msb) != 0 { + j = bits.TrailingZeros64(mask&msb) / 8 + goto ESCAPE_END + } + } + for i := len(chunks) * 8; i < valLen; i++ { + if needEscapeHTML[s[i]] { + j = i + goto ESCAPE_END + } + } + // no found any escape characters. + return append(append(buf, s...), '"') + } +ESCAPE_END: + for j < valLen { + c := s[j] + + if !needEscapeHTML[c] { + // fast path: most of the time, printable ascii characters are used + j++ + continue + } + + switch c { + case '\\', '"': + buf = append(buf, s[i:j]...) + buf = append(buf, '\\', c) + i = j + 1 + j = j + 1 + continue + + case '\n': + buf = append(buf, s[i:j]...) + buf = append(buf, '\\', 'n') + i = j + 1 + j = j + 1 + continue + + case '\r': + buf = append(buf, s[i:j]...) + buf = append(buf, '\\', 'r') + i = j + 1 + j = j + 1 + continue + + case '\t': + buf = append(buf, s[i:j]...) + buf = append(buf, '\\', 't') + i = j + 1 + j = j + 1 + continue + + case '<', '>', '&': + buf = append(buf, s[i:j]...) + buf = append(buf, `\u00`...) + buf = append(buf, hex[c>>4], hex[c&0xF]) + i = j + 1 + j = j + 1 + continue + + case 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x0B, 0x0C, 0x0E, 0x0F, // 0x00-0x0F + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F: // 0x10-0x1F + buf = append(buf, s[i:j]...) + buf = append(buf, `\u00`...) + buf = append(buf, hex[c>>4], hex[c&0xF]) + i = j + 1 + j = j + 1 + continue + } + j++ + } + + return append(append(buf, s[i:]...), '"') +} + +func appendNormalizedString(buf []byte, s string) []byte { + valLen := len(s) + if valLen == 0 { + return append(buf, `""`...) + } + buf = append(buf, '"') + var ( + i, j int + ) + if valLen >= 8 { + chunks := stringToUint64Slice(s) + for _, n := range chunks { + // combine masks before checking for the MSB of each byte. We include + // `n` in the mask to check whether any of the *input* byte MSBs were + // set (i.e. the byte was outside the ASCII range). + mask := n | (n - (lsb * 0x20)) | + ((n ^ (lsb * '"')) - lsb) | + ((n ^ (lsb * '\\')) - lsb) + if (mask & msb) != 0 { + j = bits.TrailingZeros64(mask&msb) / 8 + goto ESCAPE_END + } + } + valLen := len(s) + for i := len(chunks) * 8; i < valLen; i++ { + if needEscapeNormalizeUTF8[s[i]] { + j = i + goto ESCAPE_END + } + } + return append(append(buf, s...), '"') + } +ESCAPE_END: + for j < valLen { + c := s[j] + + if !needEscapeNormalizeUTF8[c] { + // fast path: most of the time, printable ascii characters are used + j++ + continue + } + + switch c { + case '\\', '"': + buf = append(buf, s[i:j]...) + buf = append(buf, '\\', c) + i = j + 1 + j = j + 1 + continue + + case '\n': + buf = append(buf, s[i:j]...) + buf = append(buf, '\\', 'n') + i = j + 1 + j = j + 1 + continue + + case '\r': + buf = append(buf, s[i:j]...) + buf = append(buf, '\\', 'r') + i = j + 1 + j = j + 1 + continue + + case '\t': + buf = append(buf, s[i:j]...) + buf = append(buf, '\\', 't') + i = j + 1 + j = j + 1 + continue + + case 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x0B, 0x0C, 0x0E, 0x0F, // 0x00-0x0F + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F: // 0x10-0x1F + buf = append(buf, s[i:j]...) + buf = append(buf, `\u00`...) + buf = append(buf, hex[c>>4], hex[c&0xF]) + i = j + 1 + j = j + 1 + continue + } + + state, size := decodeRuneInString(s[j:]) + switch state { + case runeErrorState: + buf = append(buf, s[i:j]...) + buf = append(buf, `\ufffd`...) + i = j + 1 + j = j + 1 + continue + // U+2028 is LINE SEPARATOR. + // U+2029 is PARAGRAPH SEPARATOR. + // They are both technically valid characters in JSON strings, + // but don't work in JSONP, which has to be evaluated as JavaScript, + // and can lead to security holes there. It is valid JSON to + // escape them, so we do so unconditionally. + // See http://timelessrepo.com/json-isnt-a-javascript-subset for discussion. + case lineSepState: + buf = append(buf, s[i:j]...) + buf = append(buf, `\u2028`...) + i = j + 3 + j = j + 3 + continue + case paragraphSepState: + buf = append(buf, s[i:j]...) + buf = append(buf, `\u2029`...) + i = j + 3 + j = j + 3 + continue + } + j += size + } + + return append(append(buf, s[i:]...), '"') +} + +func appendString(buf []byte, s string) []byte { + valLen := len(s) + if valLen == 0 { + return append(buf, `""`...) + } + buf = append(buf, '"') + var ( + i, j int + ) + if valLen >= 8 { + chunks := stringToUint64Slice(s) + for _, n := range chunks { + // combine masks before checking for the MSB of each byte. We include + // `n` in the mask to check whether any of the *input* byte MSBs were + // set (i.e. the byte was outside the ASCII range). + mask := n | (n - (lsb * 0x20)) | + ((n ^ (lsb * '"')) - lsb) | + ((n ^ (lsb * '\\')) - lsb) + if (mask & msb) != 0 { + j = bits.TrailingZeros64(mask&msb) / 8 + goto ESCAPE_END + } + } + valLen := len(s) + for i := len(chunks) * 8; i < valLen; i++ { + if needEscape[s[i]] { + j = i + goto ESCAPE_END + } + } + return append(append(buf, s...), '"') + } +ESCAPE_END: + for j < valLen { + c := s[j] + + if !needEscape[c] { + // fast path: most of the time, printable ascii characters are used + j++ + continue + } + + switch c { + case '\\', '"': + buf = append(buf, s[i:j]...) + buf = append(buf, '\\', c) + i = j + 1 + j = j + 1 + continue + + case '\n': + buf = append(buf, s[i:j]...) + buf = append(buf, '\\', 'n') + i = j + 1 + j = j + 1 + continue + + case '\r': + buf = append(buf, s[i:j]...) + buf = append(buf, '\\', 'r') + i = j + 1 + j = j + 1 + continue + + case '\t': + buf = append(buf, s[i:j]...) + buf = append(buf, '\\', 't') + i = j + 1 + j = j + 1 + continue + + case 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x0B, 0x0C, 0x0E, 0x0F, // 0x00-0x0F + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F: // 0x10-0x1F + buf = append(buf, s[i:j]...) + buf = append(buf, `\u00`...) + buf = append(buf, hex[c>>4], hex[c&0xF]) + i = j + 1 + j = j + 1 + continue + } + j++ + } + + return append(append(buf, s[i:]...), '"') +} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/string_table.go b/vendor/github.com/goccy/go-json/internal/encoder/string_table.go new file mode 100644 index 000000000..ebe42c92d --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/string_table.go @@ -0,0 +1,415 @@ +package encoder + +var needEscapeHTMLNormalizeUTF8 = [256]bool{ + '"': true, + '&': true, + '<': true, + '>': true, + '\\': true, + 0x00: true, + 0x01: true, + 0x02: true, + 0x03: true, + 0x04: true, + 0x05: true, + 0x06: true, + 0x07: true, + 0x08: true, + 0x09: true, + 0x0a: true, + 0x0b: true, + 0x0c: true, + 0x0d: true, + 0x0e: true, + 0x0f: true, + 0x10: true, + 0x11: true, + 0x12: true, + 0x13: true, + 0x14: true, + 0x15: true, + 0x16: true, + 0x17: true, + 0x18: true, + 0x19: true, + 0x1a: true, + 0x1b: true, + 0x1c: true, + 0x1d: true, + 0x1e: true, + 0x1f: true, + /* 0x20 - 0x7f */ + 0x80: true, + 0x81: true, + 0x82: true, + 0x83: true, + 0x84: true, + 0x85: true, + 0x86: true, + 0x87: true, + 0x88: true, + 0x89: true, + 0x8a: true, + 0x8b: true, + 0x8c: true, + 0x8d: true, + 0x8e: true, + 0x8f: true, + 0x90: true, + 0x91: true, + 0x92: true, + 0x93: true, + 0x94: true, + 0x95: true, + 0x96: true, + 0x97: true, + 0x98: true, + 0x99: true, + 0x9a: true, + 0x9b: true, + 0x9c: true, + 0x9d: true, + 0x9e: true, + 0x9f: true, + 0xa0: true, + 0xa1: true, + 0xa2: true, + 0xa3: true, + 0xa4: true, + 0xa5: true, + 0xa6: true, + 0xa7: true, + 0xa8: true, + 0xa9: true, + 0xaa: true, + 0xab: true, + 0xac: true, + 0xad: true, + 0xae: true, + 0xaf: true, + 0xb0: true, + 0xb1: true, + 0xb2: true, + 0xb3: true, + 0xb4: true, + 0xb5: true, + 0xb6: true, + 0xb7: true, + 0xb8: true, + 0xb9: true, + 0xba: true, + 0xbb: true, + 0xbc: true, + 0xbd: true, + 0xbe: true, + 0xbf: true, + 0xc0: true, + 0xc1: true, + 0xc2: true, + 0xc3: true, + 0xc4: true, + 0xc5: true, + 0xc6: true, + 0xc7: true, + 0xc8: true, + 0xc9: true, + 0xca: true, + 0xcb: true, + 0xcc: true, + 0xcd: true, + 0xce: true, + 0xcf: true, + 0xd0: true, + 0xd1: true, + 0xd2: true, + 0xd3: true, + 0xd4: true, + 0xd5: true, + 0xd6: true, + 0xd7: true, + 0xd8: true, + 0xd9: true, + 0xda: true, + 0xdb: true, + 0xdc: true, + 0xdd: true, + 0xde: true, + 0xdf: true, + 0xe0: true, + 0xe1: true, + 0xe2: true, + 0xe3: true, + 0xe4: true, + 0xe5: true, + 0xe6: true, + 0xe7: true, + 0xe8: true, + 0xe9: true, + 0xea: true, + 0xeb: true, + 0xec: true, + 0xed: true, + 0xee: true, + 0xef: true, + 0xf0: true, + 0xf1: true, + 0xf2: true, + 0xf3: true, + 0xf4: true, + 0xf5: true, + 0xf6: true, + 0xf7: true, + 0xf8: true, + 0xf9: true, + 0xfa: true, + 0xfb: true, + 0xfc: true, + 0xfd: true, + 0xfe: true, + 0xff: true, +} + +var needEscapeNormalizeUTF8 = [256]bool{ + '"': true, + '\\': true, + 0x00: true, + 0x01: true, + 0x02: true, + 0x03: true, + 0x04: true, + 0x05: true, + 0x06: true, + 0x07: true, + 0x08: true, + 0x09: true, + 0x0a: true, + 0x0b: true, + 0x0c: true, + 0x0d: true, + 0x0e: true, + 0x0f: true, + 0x10: true, + 0x11: true, + 0x12: true, + 0x13: true, + 0x14: true, + 0x15: true, + 0x16: true, + 0x17: true, + 0x18: true, + 0x19: true, + 0x1a: true, + 0x1b: true, + 0x1c: true, + 0x1d: true, + 0x1e: true, + 0x1f: true, + /* 0x20 - 0x7f */ + 0x80: true, + 0x81: true, + 0x82: true, + 0x83: true, + 0x84: true, + 0x85: true, + 0x86: true, + 0x87: true, + 0x88: true, + 0x89: true, + 0x8a: true, + 0x8b: true, + 0x8c: true, + 0x8d: true, + 0x8e: true, + 0x8f: true, + 0x90: true, + 0x91: true, + 0x92: true, + 0x93: true, + 0x94: true, + 0x95: true, + 0x96: true, + 0x97: true, + 0x98: true, + 0x99: true, + 0x9a: true, + 0x9b: true, + 0x9c: true, + 0x9d: true, + 0x9e: true, + 0x9f: true, + 0xa0: true, + 0xa1: true, + 0xa2: true, + 0xa3: true, + 0xa4: true, + 0xa5: true, + 0xa6: true, + 0xa7: true, + 0xa8: true, + 0xa9: true, + 0xaa: true, + 0xab: true, + 0xac: true, + 0xad: true, + 0xae: true, + 0xaf: true, + 0xb0: true, + 0xb1: true, + 0xb2: true, + 0xb3: true, + 0xb4: true, + 0xb5: true, + 0xb6: true, + 0xb7: true, + 0xb8: true, + 0xb9: true, + 0xba: true, + 0xbb: true, + 0xbc: true, + 0xbd: true, + 0xbe: true, + 0xbf: true, + 0xc0: true, + 0xc1: true, + 0xc2: true, + 0xc3: true, + 0xc4: true, + 0xc5: true, + 0xc6: true, + 0xc7: true, + 0xc8: true, + 0xc9: true, + 0xca: true, + 0xcb: true, + 0xcc: true, + 0xcd: true, + 0xce: true, + 0xcf: true, + 0xd0: true, + 0xd1: true, + 0xd2: true, + 0xd3: true, + 0xd4: true, + 0xd5: true, + 0xd6: true, + 0xd7: true, + 0xd8: true, + 0xd9: true, + 0xda: true, + 0xdb: true, + 0xdc: true, + 0xdd: true, + 0xde: true, + 0xdf: true, + 0xe0: true, + 0xe1: true, + 0xe2: true, + 0xe3: true, + 0xe4: true, + 0xe5: true, + 0xe6: true, + 0xe7: true, + 0xe8: true, + 0xe9: true, + 0xea: true, + 0xeb: true, + 0xec: true, + 0xed: true, + 0xee: true, + 0xef: true, + 0xf0: true, + 0xf1: true, + 0xf2: true, + 0xf3: true, + 0xf4: true, + 0xf5: true, + 0xf6: true, + 0xf7: true, + 0xf8: true, + 0xf9: true, + 0xfa: true, + 0xfb: true, + 0xfc: true, + 0xfd: true, + 0xfe: true, + 0xff: true, +} + +var needEscapeHTML = [256]bool{ + '"': true, + '&': true, + '<': true, + '>': true, + '\\': true, + 0x00: true, + 0x01: true, + 0x02: true, + 0x03: true, + 0x04: true, + 0x05: true, + 0x06: true, + 0x07: true, + 0x08: true, + 0x09: true, + 0x0a: true, + 0x0b: true, + 0x0c: true, + 0x0d: true, + 0x0e: true, + 0x0f: true, + 0x10: true, + 0x11: true, + 0x12: true, + 0x13: true, + 0x14: true, + 0x15: true, + 0x16: true, + 0x17: true, + 0x18: true, + 0x19: true, + 0x1a: true, + 0x1b: true, + 0x1c: true, + 0x1d: true, + 0x1e: true, + 0x1f: true, + /* 0x20 - 0xff */ +} + +var needEscape = [256]bool{ + '"': true, + '\\': true, + 0x00: true, + 0x01: true, + 0x02: true, + 0x03: true, + 0x04: true, + 0x05: true, + 0x06: true, + 0x07: true, + 0x08: true, + 0x09: true, + 0x0a: true, + 0x0b: true, + 0x0c: true, + 0x0d: true, + 0x0e: true, + 0x0f: true, + 0x10: true, + 0x11: true, + 0x12: true, + 0x13: true, + 0x14: true, + 0x15: true, + 0x16: true, + 0x17: true, + 0x18: true, + 0x19: true, + 0x1a: true, + 0x1b: true, + 0x1c: true, + 0x1d: true, + 0x1e: true, + 0x1f: true, + /* 0x20 - 0xff */ +} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm/debug_vm.go b/vendor/github.com/goccy/go-json/internal/encoder/vm/debug_vm.go new file mode 100644 index 000000000..82b6dd47f --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/vm/debug_vm.go @@ -0,0 +1,41 @@ +package vm + +import ( + "fmt" + "io" + + "github.com/goccy/go-json/internal/encoder" +) + +func DebugRun(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) { + defer func() { + var code *encoder.Opcode + if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 { + code = codeSet.EscapeKeyCode + } else { + code = codeSet.NoescapeKeyCode + } + if wc := ctx.Option.DebugDOTOut; wc != nil { + _, _ = io.WriteString(wc, code.DumpDOT()) + wc.Close() + ctx.Option.DebugDOTOut = nil + } + + if err := recover(); err != nil { + w := ctx.Option.DebugOut + fmt.Fprintln(w, "=============[DEBUG]===============") + fmt.Fprintln(w, "* [TYPE]") + fmt.Fprintln(w, codeSet.Type) + fmt.Fprintf(w, "\n") + fmt.Fprintln(w, "* [ALL OPCODE]") + fmt.Fprintln(w, code.Dump()) + fmt.Fprintf(w, "\n") + fmt.Fprintln(w, "* [CONTEXT]") + fmt.Fprintf(w, "%+v\n", ctx) + fmt.Fprintln(w, "===================================") + panic(err) + } + }() + + return Run(ctx, b, codeSet) +} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm/hack.go b/vendor/github.com/goccy/go-json/internal/encoder/vm/hack.go new file mode 100644 index 000000000..65252b4a5 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/vm/hack.go @@ -0,0 +1,9 @@ +package vm + +import ( + // HACK: compile order + // `vm`, `vm_indent`, `vm_color`, `vm_color_indent` packages uses a lot of memory to compile, + // so forcibly make dependencies and avoid compiling in concurrent. + // dependency order: vm => vm_indent => vm_color => vm_color_indent + _ "github.com/goccy/go-json/internal/encoder/vm_indent" +) diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm/util.go b/vendor/github.com/goccy/go-json/internal/encoder/vm/util.go new file mode 100644 index 000000000..86291d7bb --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/vm/util.go @@ -0,0 +1,207 @@ +package vm + +import ( + "encoding/json" + "fmt" + "unsafe" + + "github.com/goccy/go-json/internal/encoder" + "github.com/goccy/go-json/internal/runtime" +) + +const uintptrSize = 4 << (^uintptr(0) >> 63) + +var ( + appendInt = encoder.AppendInt + appendUint = encoder.AppendUint + appendFloat32 = encoder.AppendFloat32 + appendFloat64 = encoder.AppendFloat64 + appendString = encoder.AppendString + appendByteSlice = encoder.AppendByteSlice + appendNumber = encoder.AppendNumber + errUnsupportedValue = encoder.ErrUnsupportedValue + errUnsupportedFloat = encoder.ErrUnsupportedFloat + mapiterinit = encoder.MapIterInit + mapiterkey = encoder.MapIterKey + mapitervalue = encoder.MapIterValue + mapiternext = encoder.MapIterNext + maplen = encoder.MapLen +) + +type emptyInterface struct { + typ *runtime.Type + ptr unsafe.Pointer +} + +type nonEmptyInterface struct { + itab *struct { + ityp *runtime.Type // static interface type + typ *runtime.Type // dynamic concrete type + // unused fields... + } + ptr unsafe.Pointer +} + +func errUnimplementedOp(op encoder.OpType) error { + return fmt.Errorf("encoder: opcode %s has not been implemented", op) +} + +func load(base uintptr, idx uint32) uintptr { + addr := base + uintptr(idx) + return **(**uintptr)(unsafe.Pointer(&addr)) +} + +func store(base uintptr, idx uint32, p uintptr) { + addr := base + uintptr(idx) + **(**uintptr)(unsafe.Pointer(&addr)) = p +} + +func loadNPtr(base uintptr, idx uint32, ptrNum uint8) uintptr { + addr := base + uintptr(idx) + p := **(**uintptr)(unsafe.Pointer(&addr)) + for i := uint8(0); i < ptrNum; i++ { + if p == 0 { + return 0 + } + p = ptrToPtr(p) + } + return p +} + +func ptrToUint64(p uintptr, bitSize uint8) uint64 { + switch bitSize { + case 8: + return (uint64)(**(**uint8)(unsafe.Pointer(&p))) + case 16: + return (uint64)(**(**uint16)(unsafe.Pointer(&p))) + case 32: + return (uint64)(**(**uint32)(unsafe.Pointer(&p))) + case 64: + return **(**uint64)(unsafe.Pointer(&p)) + } + return 0 +} +func ptrToFloat32(p uintptr) float32 { return **(**float32)(unsafe.Pointer(&p)) } +func ptrToFloat64(p uintptr) float64 { return **(**float64)(unsafe.Pointer(&p)) } +func ptrToBool(p uintptr) bool { return **(**bool)(unsafe.Pointer(&p)) } +func ptrToBytes(p uintptr) []byte { return **(**[]byte)(unsafe.Pointer(&p)) } +func ptrToNumber(p uintptr) json.Number { return **(**json.Number)(unsafe.Pointer(&p)) } +func ptrToString(p uintptr) string { return **(**string)(unsafe.Pointer(&p)) } +func ptrToSlice(p uintptr) *runtime.SliceHeader { return *(**runtime.SliceHeader)(unsafe.Pointer(&p)) } +func ptrToPtr(p uintptr) uintptr { + return uintptr(**(**unsafe.Pointer)(unsafe.Pointer(&p))) +} +func ptrToNPtr(p uintptr, ptrNum uint8) uintptr { + for i := uint8(0); i < ptrNum; i++ { + if p == 0 { + return 0 + } + p = ptrToPtr(p) + } + return p +} + +func ptrToUnsafePtr(p uintptr) unsafe.Pointer { + return *(*unsafe.Pointer)(unsafe.Pointer(&p)) +} +func ptrToInterface(code *encoder.Opcode, p uintptr) interface{} { + return *(*interface{})(unsafe.Pointer(&emptyInterface{ + typ: code.Type, + ptr: *(*unsafe.Pointer)(unsafe.Pointer(&p)), + })) +} + +func appendBool(_ *encoder.RuntimeContext, b []byte, v bool) []byte { + if v { + return append(b, "true"...) + } + return append(b, "false"...) +} + +func appendNull(_ *encoder.RuntimeContext, b []byte) []byte { + return append(b, "null"...) +} + +func appendComma(_ *encoder.RuntimeContext, b []byte) []byte { + return append(b, ',') +} + +func appendNullComma(_ *encoder.RuntimeContext, b []byte) []byte { + return append(b, "null,"...) +} + +func appendColon(_ *encoder.RuntimeContext, b []byte) []byte { + last := len(b) - 1 + b[last] = ':' + return b +} + +func appendMapKeyValue(_ *encoder.RuntimeContext, _ *encoder.Opcode, b, key, value []byte) []byte { + b = append(b, key...) + b[len(b)-1] = ':' + return append(b, value...) +} + +func appendMapEnd(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { + b[len(b)-1] = '}' + b = append(b, ',') + return b +} + +func appendMarshalJSON(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) { + return encoder.AppendMarshalJSON(ctx, code, b, v) +} + +func appendMarshalText(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) { + return encoder.AppendMarshalText(ctx, code, b, v) +} + +func appendArrayHead(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { + return append(b, '[') +} + +func appendArrayEnd(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { + last := len(b) - 1 + b[last] = ']' + return append(b, ',') +} + +func appendEmptyArray(_ *encoder.RuntimeContext, b []byte) []byte { + return append(b, '[', ']', ',') +} + +func appendEmptyObject(_ *encoder.RuntimeContext, b []byte) []byte { + return append(b, '{', '}', ',') +} + +func appendObjectEnd(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { + last := len(b) - 1 + b[last] = '}' + return append(b, ',') +} + +func appendStructHead(_ *encoder.RuntimeContext, b []byte) []byte { + return append(b, '{') +} + +func appendStructKey(_ *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { + return append(b, code.Key...) +} + +func appendStructEnd(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { + return append(b, '}', ',') +} + +func appendStructEndSkipLast(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { + last := len(b) - 1 + if b[last] == ',' { + b[last] = '}' + return appendComma(ctx, b) + } + return appendStructEnd(ctx, code, b) +} + +func restoreIndent(_ *encoder.RuntimeContext, _ *encoder.Opcode, _ uintptr) {} +func storeIndent(_ uintptr, _ *encoder.Opcode, _ uintptr) {} +func appendMapKeyIndent(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { return b } +func appendArrayElemIndent(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { return b } diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm/vm.go b/vendor/github.com/goccy/go-json/internal/encoder/vm/vm.go new file mode 100644 index 000000000..645d20f9f --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/vm/vm.go @@ -0,0 +1,4859 @@ +// Code generated by internal/cmd/generator. DO NOT EDIT! +package vm + +import ( + "math" + "reflect" + "sort" + "unsafe" + + "github.com/goccy/go-json/internal/encoder" + "github.com/goccy/go-json/internal/runtime" +) + +func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) { + recursiveLevel := 0 + ptrOffset := uintptr(0) + ctxptr := ctx.Ptr() + var code *encoder.Opcode + if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 { + code = codeSet.EscapeKeyCode + } else { + code = codeSet.NoescapeKeyCode + } + + for { + switch code.Op { + default: + return nil, errUnimplementedOp(code.Op) + case encoder.OpPtr: + p := load(ctxptr, code.Idx) + code = code.Next + store(ctxptr, code.Idx, ptrToPtr(p)) + case encoder.OpIntPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpInt: + b = appendInt(ctx, b, load(ctxptr, code.Idx), code) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpUintPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpUint: + b = appendUint(ctx, b, load(ctxptr, code.Idx), code) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpIntString: + b = append(b, '"') + b = appendInt(ctx, b, load(ctxptr, code.Idx), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpUintString: + b = append(b, '"') + b = appendUint(ctx, b, load(ctxptr, code.Idx), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpFloat32Ptr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpFloat32: + b = appendFloat32(ctx, b, ptrToFloat32(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpFloat64Ptr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpFloat64: + v := ptrToFloat64(load(ctxptr, code.Idx)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStringPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpString: + b = appendString(ctx, b, ptrToString(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpBoolPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpBool: + b = appendBool(ctx, b, ptrToBool(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpBytesPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpBytes: + b = appendByteSlice(ctx, b, ptrToBytes(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpNumberPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpNumber: + bb, err := appendNumber(ctx, b, ptrToNumber(load(ctxptr, code.Idx))) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpInterfacePtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpInterface: + p := load(ctxptr, code.Idx) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + if recursiveLevel > encoder.StartDetectingCyclesAfter { + for _, seen := range ctx.SeenPtr { + if p == seen { + return nil, errUnsupportedValue(code, p) + } + } + } + ctx.SeenPtr = append(ctx.SeenPtr, p) + var ( + typ *runtime.Type + ifacePtr unsafe.Pointer + ) + up := ptrToUnsafePtr(p) + if code.Flags&encoder.NonEmptyInterfaceFlags != 0 { + iface := (*nonEmptyInterface)(up) + ifacePtr = iface.ptr + if iface.itab != nil { + typ = iface.itab.typ + } + } else { + iface := (*emptyInterface)(up) + ifacePtr = iface.ptr + typ = iface.typ + } + if ifacePtr == nil { + isDirectedNil := typ != nil && typ.Kind() == reflect.Struct && !runtime.IfaceIndir(typ) + if !isDirectedNil { + b = appendNullComma(ctx, b) + code = code.Next + break + } + } + ctx.KeepRefs = append(ctx.KeepRefs, up) + ifaceCodeSet, err := encoder.CompileToGetCodeSet(ctx, uintptr(unsafe.Pointer(typ))) + if err != nil { + return nil, err + } + + totalLength := uintptr(code.Length) + 3 + nextTotalLength := uintptr(ifaceCodeSet.CodeLength) + 3 + + var c *encoder.Opcode + if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 { + c = ifaceCodeSet.InterfaceEscapeKeyCode + } else { + c = ifaceCodeSet.InterfaceNoescapeKeyCode + } + curlen := uintptr(len(ctx.Ptrs)) + offsetNum := ptrOffset / uintptrSize + oldOffset := ptrOffset + ptrOffset += totalLength * uintptrSize + oldBaseIndent := ctx.BaseIndent + ctx.BaseIndent += code.Indent + + newLen := offsetNum + totalLength + nextTotalLength + if curlen < newLen { + ctx.Ptrs = append(ctx.Ptrs, make([]uintptr, newLen-curlen)...) + } + ctxptr = ctx.Ptr() + ptrOffset // assign new ctxptr + + end := ifaceCodeSet.EndCode + store(ctxptr, c.Idx, uintptr(ifacePtr)) + store(ctxptr, end.Idx, oldOffset) + store(ctxptr, end.ElemIdx, uintptr(unsafe.Pointer(code.Next))) + storeIndent(ctxptr, end, uintptr(oldBaseIndent)) + code = c + recursiveLevel++ + case encoder.OpInterfaceEnd: + recursiveLevel-- + + // restore ctxptr + offset := load(ctxptr, code.Idx) + restoreIndent(ctx, code, ctxptr) + ctx.SeenPtr = ctx.SeenPtr[:len(ctx.SeenPtr)-1] + + codePtr := load(ctxptr, code.ElemIdx) + code = (*encoder.Opcode)(ptrToUnsafePtr(codePtr)) + ctxptr = ctx.Ptr() + offset + ptrOffset = offset + case encoder.OpMarshalJSONPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, ptrToPtr(p)) + fallthrough + case encoder.OpMarshalJSON: + p := load(ctxptr, code.Idx) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p) + } + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpMarshalTextPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, ptrToPtr(p)) + fallthrough + case encoder.OpMarshalText: + p := load(ctxptr, code.Idx) + if p == 0 { + b = append(b, `""`...) + b = appendComma(ctx, b) + code = code.Next + break + } + if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p) + } + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpSlicePtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.End.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpSlice: + p := load(ctxptr, code.Idx) + slice := ptrToSlice(p) + if p == 0 || slice.Data == nil { + b = appendNullComma(ctx, b) + code = code.End.Next + break + } + store(ctxptr, code.ElemIdx, 0) + store(ctxptr, code.Length, uintptr(slice.Len)) + store(ctxptr, code.Idx, uintptr(slice.Data)) + if slice.Len > 0 { + b = appendArrayHead(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, uintptr(slice.Data)) + } else { + b = appendEmptyArray(ctx, b) + code = code.End.Next + } + case encoder.OpSliceElem: + idx := load(ctxptr, code.ElemIdx) + length := load(ctxptr, code.Length) + idx++ + if idx < length { + b = appendArrayElemIndent(ctx, code, b) + store(ctxptr, code.ElemIdx, idx) + data := load(ctxptr, code.Idx) + size := uintptr(code.Size) + code = code.Next + store(ctxptr, code.Idx, data+idx*size) + } else { + b = appendArrayEnd(ctx, code, b) + code = code.End.Next + } + case encoder.OpArrayPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.End.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpArray: + p := load(ctxptr, code.Idx) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.End.Next + break + } + if code.Length > 0 { + b = appendArrayHead(ctx, code, b) + store(ctxptr, code.ElemIdx, 0) + code = code.Next + store(ctxptr, code.Idx, p) + } else { + b = appendEmptyArray(ctx, b) + code = code.End.Next + } + case encoder.OpArrayElem: + idx := load(ctxptr, code.ElemIdx) + idx++ + if idx < uintptr(code.Length) { + b = appendArrayElemIndent(ctx, code, b) + store(ctxptr, code.ElemIdx, idx) + p := load(ctxptr, code.Idx) + size := uintptr(code.Size) + code = code.Next + store(ctxptr, code.Idx, p+idx*size) + } else { + b = appendArrayEnd(ctx, code, b) + code = code.End.Next + } + case encoder.OpMapPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.End.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpMap: + p := load(ctxptr, code.Idx) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.End.Next + break + } + uptr := ptrToUnsafePtr(p) + mlen := maplen(uptr) + if mlen <= 0 { + b = appendEmptyObject(ctx, b) + code = code.End.Next + break + } + b = appendStructHead(ctx, b) + unorderedMap := (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 + mapCtx := encoder.NewMapContext(mlen, unorderedMap) + mapiterinit(code.Type, uptr, &mapCtx.Iter) + store(ctxptr, code.Idx, uintptr(unsafe.Pointer(mapCtx))) + ctx.KeepRefs = append(ctx.KeepRefs, unsafe.Pointer(mapCtx)) + if unorderedMap { + b = appendMapKeyIndent(ctx, code.Next, b) + } else { + mapCtx.Start = len(b) + mapCtx.First = len(b) + } + key := mapiterkey(&mapCtx.Iter) + store(ctxptr, code.Next.Idx, uintptr(key)) + code = code.Next + case encoder.OpMapKey: + mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx))) + idx := mapCtx.Idx + idx++ + if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 { + if idx < mapCtx.Len { + b = appendMapKeyIndent(ctx, code, b) + mapCtx.Idx = int(idx) + key := mapiterkey(&mapCtx.Iter) + store(ctxptr, code.Next.Idx, uintptr(key)) + code = code.Next + } else { + b = appendObjectEnd(ctx, code, b) + encoder.ReleaseMapContext(mapCtx) + code = code.End.Next + } + } else { + mapCtx.Slice.Items[mapCtx.Idx].Value = b[mapCtx.Start:len(b)] + if idx < mapCtx.Len { + mapCtx.Idx = int(idx) + mapCtx.Start = len(b) + key := mapiterkey(&mapCtx.Iter) + store(ctxptr, code.Next.Idx, uintptr(key)) + code = code.Next + } else { + code = code.End + } + } + case encoder.OpMapValue: + mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx))) + if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 { + b = appendColon(ctx, b) + } else { + mapCtx.Slice.Items[mapCtx.Idx].Key = b[mapCtx.Start:len(b)] + mapCtx.Start = len(b) + } + value := mapitervalue(&mapCtx.Iter) + store(ctxptr, code.Next.Idx, uintptr(value)) + mapiternext(&mapCtx.Iter) + code = code.Next + case encoder.OpMapEnd: + // this operation only used by sorted map. + mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx))) + sort.Sort(mapCtx.Slice) + buf := mapCtx.Buf + for _, item := range mapCtx.Slice.Items { + buf = appendMapKeyValue(ctx, code, buf, item.Key, item.Value) + } + buf = appendMapEnd(ctx, code, buf) + b = b[:mapCtx.First] + b = append(b, buf...) + mapCtx.Buf = buf + encoder.ReleaseMapContext(mapCtx) + code = code.Next + case encoder.OpRecursivePtr: + p := load(ctxptr, code.Idx) + if p == 0 { + code = code.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpRecursive: + ptr := load(ctxptr, code.Idx) + if ptr != 0 { + if recursiveLevel > encoder.StartDetectingCyclesAfter { + for _, seen := range ctx.SeenPtr { + if ptr == seen { + return nil, errUnsupportedValue(code, ptr) + } + } + } + } + ctx.SeenPtr = append(ctx.SeenPtr, ptr) + c := code.Jmp.Code + curlen := uintptr(len(ctx.Ptrs)) + offsetNum := ptrOffset / uintptrSize + oldOffset := ptrOffset + ptrOffset += code.Jmp.CurLen * uintptrSize + oldBaseIndent := ctx.BaseIndent + indentDiffFromTop := c.Indent - 1 + ctx.BaseIndent += code.Indent - indentDiffFromTop + + newLen := offsetNum + code.Jmp.CurLen + code.Jmp.NextLen + if curlen < newLen { + ctx.Ptrs = append(ctx.Ptrs, make([]uintptr, newLen-curlen)...) + } + ctxptr = ctx.Ptr() + ptrOffset // assign new ctxptr + + store(ctxptr, c.Idx, ptr) + store(ctxptr, c.End.Next.Idx, oldOffset) + store(ctxptr, c.End.Next.ElemIdx, uintptr(unsafe.Pointer(code.Next))) + storeIndent(ctxptr, c.End.Next, uintptr(oldBaseIndent)) + code = c + recursiveLevel++ + case encoder.OpRecursiveEnd: + recursiveLevel-- + + // restore ctxptr + restoreIndent(ctx, code, ctxptr) + offset := load(ctxptr, code.Idx) + ctx.SeenPtr = ctx.SeenPtr[:len(ctx.SeenPtr)-1] + + codePtr := load(ctxptr, code.ElemIdx) + code = (*encoder.Opcode)(ptrToUnsafePtr(codePtr)) + ctxptr = ctx.Ptr() + offset + ptrOffset = offset + case encoder.OpStructPtrHead: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHead: + p := load(ctxptr, code.Idx) + if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if len(code.Key) > 0 { + if (code.Flags&encoder.IsTaggedKeyFlags) != 0 || code.Flags&encoder.AnonymousKeyFlags == 0 { + b = appendStructKey(ctx, code, b) + } + } + p += uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructPtrHeadOmitEmpty: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmpty: + p := load(ctxptr, code.Idx) + if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + p += uintptr(code.Offset) + if p == 0 || (ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0) { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadInt: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadInt: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyInt: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyInt: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadIntString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadIntString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyIntString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyIntString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + p += uintptr(code.Offset) + u64 := ptrToUint64(p, code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadIntPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadIntPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendInt(ctx, b, p, code) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyIntPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyIntPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p, code) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadIntPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadIntPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyIntPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyIntPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadUint: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadUint: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyUint: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyUint: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadUintString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadUintString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyUintString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyUintString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadUintPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadUintPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendUint(ctx, b, p, code) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyUintPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyUintPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p, code) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadUintPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadUintPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendUint(ctx, b, p, code) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyUintPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyUintPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p, code) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadFloat32: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadFloat32: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat32: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyFloat32: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToFloat32(p + uintptr(code.Offset)) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadFloat32String: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadFloat32String: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat32String: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyFloat32String: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToFloat32(p + uintptr(code.Offset)) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadFloat32Ptr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadFloat32Ptr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendFloat32(ctx, b, ptrToFloat32(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat32Ptr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyFloat32Ptr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadFloat32PtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadFloat32PtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat32PtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyFloat32PtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadFloat64: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadFloat64: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + v := ptrToFloat64(p + uintptr(code.Offset)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat64: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyFloat64: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToFloat64(p + uintptr(code.Offset)) + if v == 0 { + code = code.NextField + } else { + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadFloat64String: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadFloat64String: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToFloat64(p + uintptr(code.Offset)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat64String: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyFloat64String: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToFloat64(p + uintptr(code.Offset)) + if v == 0 { + code = code.NextField + } else { + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadFloat64Ptr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadFloat64Ptr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat64Ptr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyFloat64Ptr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadFloat64PtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadFloat64PtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat64PtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyFloat64PtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToString(p + uintptr(code.Offset)) + if v == "" { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadStringString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadStringString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p+uintptr(code.Offset))))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyStringString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyStringString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToString(p + uintptr(code.Offset)) + if v == "" { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, v))) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadStringPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadStringPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendString(ctx, b, ptrToString(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyStringPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyStringPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, ptrToString(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadStringPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadStringPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyStringPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyStringPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadBool: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadBool: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyBool: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyBool: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToBool(p + uintptr(code.Offset)) + if v { + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + } else { + code = code.NextField + } + case encoder.OpStructPtrHeadBoolString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadBoolString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyBoolString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyBoolString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToBool(p + uintptr(code.Offset)) + if v { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + } else { + code = code.NextField + } + case encoder.OpStructPtrHeadBoolPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadBoolPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendBool(ctx, b, ptrToBool(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyBoolPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyBoolPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, ptrToBool(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadBoolPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadBoolPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p)) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyBoolPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyBoolPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p)) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadBytes: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadBytes: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyBytes: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyBytes: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToBytes(p + uintptr(code.Offset)) + if len(v) == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadBytesPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadBytesPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendByteSlice(ctx, b, ptrToBytes(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyBytesPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyBytesPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, ptrToBytes(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadNumber: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadNumber: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyNumber: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyNumber: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToNumber(p + uintptr(code.Offset)) + if v == "" { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, v) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + } + case encoder.OpStructPtrHeadNumberString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadNumberString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyNumberString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyNumberString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToNumber(p + uintptr(code.Offset)) + if v == "" { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, v) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadNumberPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadNumberPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyNumberPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyNumberPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + } + code = code.Next + case encoder.OpStructPtrHeadNumberPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadNumberPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = append(bb, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyNumberPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyNumberPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadArray, encoder.OpStructHeadSlice: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + p += uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructPtrHeadOmitEmptyArray: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyArray: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + p += uintptr(code.Offset) + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructPtrHeadOmitEmptySlice: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptySlice: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + p += uintptr(code.Offset) + slice := ptrToSlice(p) + if slice.Len == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadSlicePtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadSlicePtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNullComma(ctx, b) + code = code.NextField + } else { + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadOmitEmptyArrayPtr, encoder.OpStructPtrHeadOmitEmptySlicePtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyArrayPtr, encoder.OpStructHeadOmitEmptySlicePtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadMap: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadMap: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p + uintptr(code.Offset)) + } + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructPtrHeadOmitEmptyMap: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyMap: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p + uintptr(code.Offset)) + } + if maplen(ptrToUnsafePtr(p)) == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadMapPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadMapPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.NextField + break + } + p = ptrToPtr(p + uintptr(code.Offset)) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.NextField + } else { + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p, code.PtrNum) + } + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadOmitEmptyMapPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyMapPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if p == 0 { + code = code.NextField + break + } + p = ptrToPtr(p + uintptr(code.Offset)) + if p == 0 { + code = code.NextField + } else { + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p, code.PtrNum) + } + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadMarshalJSON: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if (code.Flags & encoder.IndirectFlags) != 0 { + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadMarshalJSON: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalJSON { + p = ptrToPtr(p) + } + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyMarshalJSON: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if (code.Flags & encoder.IndirectFlags) != 0 { + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyMarshalJSON: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { + p = ptrToPtr(p) + } + } + iface := ptrToInterface(code, p) + if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalJSON(ctx, code, b, iface) + if err != nil { + return nil, err + } + b = bb + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadMarshalJSONPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadMarshalJSONPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyMarshalJSONPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyMarshalJSONPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if p == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadMarshalText: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if (code.Flags & encoder.IndirectFlags) != 0 { + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadMarshalText: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalText { + p = ptrToPtr(p) + } + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyMarshalText: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if (code.Flags & encoder.IndirectFlags) != 0 { + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyMarshalText: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { + p = ptrToPtr(p) + } + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadMarshalTextPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadMarshalTextPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyMarshalTextPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyMarshalTextPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if p == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructField: + if code.Flags&encoder.IsTaggedKeyFlags != 0 || code.Flags&encoder.AnonymousKeyFlags == 0 { + b = appendStructKey(ctx, code, b) + } + p := load(ctxptr, code.Idx) + uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmpty: + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructFieldInt: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyInt: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldIntString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyIntString: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldIntPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendInt(ctx, b, p, code) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyIntPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p, code) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldIntPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyIntPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldUint: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyUint: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldUintString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyUintString: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldUintPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendUint(ctx, b, p, code) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyUintPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p, code) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldUintPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendUint(ctx, b, p, code) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyUintPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p, code) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat32: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat32: + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat32String: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat32String: + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat32Ptr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendFloat32(ctx, b, ptrToFloat32(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat32Ptr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat32PtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat32PtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat64: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + v := ptrToFloat64(p + uintptr(code.Offset)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat64: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if v != 0 { + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat64String: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat64String: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if v != 0 { + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat64Ptr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat64Ptr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat64PtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat64PtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyString: + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldStringString: + p := load(ctxptr, code.Idx) + s := ptrToString(p + uintptr(code.Offset)) + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, s))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyStringString: + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, v))) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldStringPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendString(ctx, b, ptrToString(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyStringPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, ptrToString(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldStringPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyStringPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldBool: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyBool: + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) + if v { + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldBoolString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyBoolString: + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) + if v { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldBoolPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendBool(ctx, b, ptrToBool(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyBoolPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, ptrToBool(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldBoolPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p)) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyBoolPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p)) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldBytes: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyBytes: + p := load(ctxptr, code.Idx) + v := ptrToBytes(p + uintptr(code.Offset)) + if len(v) > 0 { + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldBytesPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendByteSlice(ctx, b, ptrToBytes(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyBytesPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, ptrToBytes(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldNumber: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpStructFieldOmitEmptyNumber: + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, v) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + } + code = code.Next + case encoder.OpStructFieldNumberString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyNumberString: + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, v) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldNumberPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyNumberPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + } + code = code.Next + case encoder.OpStructFieldNumberPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = append(bb, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyNumberPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldMarshalJSON: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + p = ptrToPtr(p) + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyMarshalJSON: + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + p = ptrToPtr(p) + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + code = code.NextField + break + } + iface := ptrToInterface(code, p) + if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) { + code = code.NextField + break + } + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalJSON(ctx, code, b, iface) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpStructFieldMarshalJSONPtr: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyMarshalJSONPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + } + code = code.Next + case encoder.OpStructFieldMarshalText: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + p = ptrToPtr(p) + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyMarshalText: + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + p = ptrToPtr(p) + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + code = code.NextField + break + } + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpStructFieldMarshalTextPtr: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyMarshalTextPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + } + code = code.Next + case encoder.OpStructFieldArray: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptyArray: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldArrayPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptyArrayPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } else { + code = code.NextField + } + case encoder.OpStructFieldSlice: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptySlice: + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + slice := ptrToSlice(p) + if slice.Len == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructFieldSlicePtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptySlicePtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } else { + code = code.NextField + } + case encoder.OpStructFieldMap: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptyMap: + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) + if p == 0 || maplen(ptrToUnsafePtr(p)) == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructFieldMapPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) + if p != 0 { + p = ptrToNPtr(p, code.PtrNum) + } + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptyMapPtr: + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) + if p != 0 { + p = ptrToNPtr(p, code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } else { + code = code.NextField + } + case encoder.OpStructFieldStruct: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptyStruct: + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructEnd: + b = appendStructEndSkipLast(ctx, code, b) + code = code.Next + case encoder.OpStructEndInt: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyInt: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndIntString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyIntString: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndIntPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendInt(ctx, b, p, code) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyIntPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p, code) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndIntPtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyIntPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndUint: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyUint: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndUintString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyUintString: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndUintPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendUint(ctx, b, p, code) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyUintPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p, code) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndUintPtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendUint(ctx, b, p, code) + b = append(b, '"') + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyUintPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p, code) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat32: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat32: + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, v) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat32String: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat32String: + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, v) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat32Ptr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendFloat32(ctx, b, ptrToFloat32(p)) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat32Ptr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat32PtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = append(b, '"') + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat32PtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat64: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = appendFloat64(ctx, b, v) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat64: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if v != 0 { + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = appendFloat64(ctx, b, v) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat64String: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat64String: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if v != 0 { + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat64Ptr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + b = appendStructEnd(ctx, code, b) + code = code.Next + break + } + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat64Ptr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat64PtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = append(b, '"') + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat64PtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyString: + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, v) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndStringString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + s := ptrToString(p + uintptr(code.Offset)) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, s))) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyStringString: + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, v))) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndStringPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendString(ctx, b, ptrToString(p)) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyStringPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, ptrToString(p)) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndStringPtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyStringPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndBool: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyBool: + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) + if v { + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, v) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndBoolString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyBoolString: + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) + if v { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, v) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndBoolPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendBool(ctx, b, ptrToBool(p)) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyBoolPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, ptrToBool(p)) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndBoolPtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p)) + b = append(b, '"') + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyBoolPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p)) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndBytes: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyBytes: + p := load(ctxptr, code.Idx) + v := ptrToBytes(p + uintptr(code.Offset)) + if len(v) > 0 { + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, v) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndBytesPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendByteSlice(ctx, b, ptrToBytes(p)) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyBytesPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, ptrToBytes(p)) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndNumber: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) + if err != nil { + return nil, err + } + b = appendStructEnd(ctx, code, bb) + code = code.Next + case encoder.OpStructEndOmitEmptyNumber: + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, v) + if err != nil { + return nil, err + } + b = appendStructEnd(ctx, code, bb) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndNumberString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyNumberString: + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, v) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndNumberPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyNumberPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = appendStructEnd(ctx, code, bb) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndNumberPtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = append(bb, '"') + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyNumberPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpEnd: + goto END + } + } +END: + return b, nil +} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm_color/debug_vm.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_color/debug_vm.go new file mode 100644 index 000000000..925f61ed8 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/vm_color/debug_vm.go @@ -0,0 +1,35 @@ +package vm_color + +import ( + "fmt" + + "github.com/goccy/go-json/internal/encoder" +) + +func DebugRun(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) { + var code *encoder.Opcode + if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 { + code = codeSet.EscapeKeyCode + } else { + code = codeSet.NoescapeKeyCode + } + + defer func() { + if err := recover(); err != nil { + w := ctx.Option.DebugOut + fmt.Fprintln(w, "=============[DEBUG]===============") + fmt.Fprintln(w, "* [TYPE]") + fmt.Fprintln(w, codeSet.Type) + fmt.Fprintf(w, "\n") + fmt.Fprintln(w, "* [ALL OPCODE]") + fmt.Fprintln(w, code.Dump()) + fmt.Fprintf(w, "\n") + fmt.Fprintln(w, "* [CONTEXT]") + fmt.Fprintf(w, "%+v\n", ctx) + fmt.Fprintln(w, "===================================") + panic(err) + } + }() + + return Run(ctx, b, codeSet) +} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm_color/hack.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_color/hack.go new file mode 100644 index 000000000..12ec56c5b --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/vm_color/hack.go @@ -0,0 +1,9 @@ +package vm_color + +import ( + // HACK: compile order + // `vm`, `vm_indent`, `vm_color`, `vm_color_indent` packages uses a lot of memory to compile, + // so forcibly make dependencies and avoid compiling in concurrent. + // dependency order: vm => vm_indent => vm_color => vm_color_indent + _ "github.com/goccy/go-json/internal/encoder/vm_color_indent" +) diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm_color/util.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_color/util.go new file mode 100644 index 000000000..33f29aee4 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/vm_color/util.go @@ -0,0 +1,274 @@ +package vm_color + +import ( + "encoding/json" + "fmt" + "unsafe" + + "github.com/goccy/go-json/internal/encoder" + "github.com/goccy/go-json/internal/runtime" +) + +const uintptrSize = 4 << (^uintptr(0) >> 63) + +var ( + errUnsupportedValue = encoder.ErrUnsupportedValue + errUnsupportedFloat = encoder.ErrUnsupportedFloat + mapiterinit = encoder.MapIterInit + mapiterkey = encoder.MapIterKey + mapitervalue = encoder.MapIterValue + mapiternext = encoder.MapIterNext + maplen = encoder.MapLen +) + +type emptyInterface struct { + typ *runtime.Type + ptr unsafe.Pointer +} + +type nonEmptyInterface struct { + itab *struct { + ityp *runtime.Type // static interface type + typ *runtime.Type // dynamic concrete type + // unused fields... + } + ptr unsafe.Pointer +} + +func errUnimplementedOp(op encoder.OpType) error { + return fmt.Errorf("encoder: opcode %s has not been implemented", op) +} + +func load(base uintptr, idx uint32) uintptr { + addr := base + uintptr(idx) + return **(**uintptr)(unsafe.Pointer(&addr)) +} + +func store(base uintptr, idx uint32, p uintptr) { + addr := base + uintptr(idx) + **(**uintptr)(unsafe.Pointer(&addr)) = p +} + +func loadNPtr(base uintptr, idx uint32, ptrNum uint8) uintptr { + addr := base + uintptr(idx) + p := **(**uintptr)(unsafe.Pointer(&addr)) + for i := uint8(0); i < ptrNum; i++ { + if p == 0 { + return 0 + } + p = ptrToPtr(p) + } + return p +} + +func ptrToUint64(p uintptr, bitSize uint8) uint64 { + switch bitSize { + case 8: + return (uint64)(**(**uint8)(unsafe.Pointer(&p))) + case 16: + return (uint64)(**(**uint16)(unsafe.Pointer(&p))) + case 32: + return (uint64)(**(**uint32)(unsafe.Pointer(&p))) + case 64: + return **(**uint64)(unsafe.Pointer(&p)) + } + return 0 +} +func ptrToFloat32(p uintptr) float32 { return **(**float32)(unsafe.Pointer(&p)) } +func ptrToFloat64(p uintptr) float64 { return **(**float64)(unsafe.Pointer(&p)) } +func ptrToBool(p uintptr) bool { return **(**bool)(unsafe.Pointer(&p)) } +func ptrToBytes(p uintptr) []byte { return **(**[]byte)(unsafe.Pointer(&p)) } +func ptrToNumber(p uintptr) json.Number { return **(**json.Number)(unsafe.Pointer(&p)) } +func ptrToString(p uintptr) string { return **(**string)(unsafe.Pointer(&p)) } +func ptrToSlice(p uintptr) *runtime.SliceHeader { return *(**runtime.SliceHeader)(unsafe.Pointer(&p)) } +func ptrToPtr(p uintptr) uintptr { + return uintptr(**(**unsafe.Pointer)(unsafe.Pointer(&p))) +} +func ptrToNPtr(p uintptr, ptrNum uint8) uintptr { + for i := uint8(0); i < ptrNum; i++ { + if p == 0 { + return 0 + } + p = ptrToPtr(p) + } + return p +} + +func ptrToUnsafePtr(p uintptr) unsafe.Pointer { + return *(*unsafe.Pointer)(unsafe.Pointer(&p)) +} +func ptrToInterface(code *encoder.Opcode, p uintptr) interface{} { + return *(*interface{})(unsafe.Pointer(&emptyInterface{ + typ: code.Type, + ptr: *(*unsafe.Pointer)(unsafe.Pointer(&p)), + })) +} + +func appendInt(ctx *encoder.RuntimeContext, b []byte, p uintptr, code *encoder.Opcode) []byte { + format := ctx.Option.ColorScheme.Int + b = append(b, format.Header...) + b = encoder.AppendInt(ctx, b, p, code) + return append(b, format.Footer...) +} + +func appendUint(ctx *encoder.RuntimeContext, b []byte, p uintptr, code *encoder.Opcode) []byte { + format := ctx.Option.ColorScheme.Uint + b = append(b, format.Header...) + b = encoder.AppendUint(ctx, b, p, code) + return append(b, format.Footer...) +} + +func appendFloat32(ctx *encoder.RuntimeContext, b []byte, v float32) []byte { + format := ctx.Option.ColorScheme.Float + b = append(b, format.Header...) + b = encoder.AppendFloat32(ctx, b, v) + return append(b, format.Footer...) +} + +func appendFloat64(ctx *encoder.RuntimeContext, b []byte, v float64) []byte { + format := ctx.Option.ColorScheme.Float + b = append(b, format.Header...) + b = encoder.AppendFloat64(ctx, b, v) + return append(b, format.Footer...) +} + +func appendString(ctx *encoder.RuntimeContext, b []byte, v string) []byte { + format := ctx.Option.ColorScheme.String + b = append(b, format.Header...) + b = encoder.AppendString(ctx, b, v) + return append(b, format.Footer...) +} + +func appendByteSlice(ctx *encoder.RuntimeContext, b []byte, src []byte) []byte { + format := ctx.Option.ColorScheme.Binary + b = append(b, format.Header...) + b = encoder.AppendByteSlice(ctx, b, src) + return append(b, format.Footer...) +} + +func appendNumber(ctx *encoder.RuntimeContext, b []byte, n json.Number) ([]byte, error) { + format := ctx.Option.ColorScheme.Int + b = append(b, format.Header...) + bb, err := encoder.AppendNumber(ctx, b, n) + if err != nil { + return nil, err + } + return append(bb, format.Footer...), nil +} + +func appendBool(ctx *encoder.RuntimeContext, b []byte, v bool) []byte { + format := ctx.Option.ColorScheme.Bool + b = append(b, format.Header...) + if v { + b = append(b, "true"...) + } else { + b = append(b, "false"...) + } + return append(b, format.Footer...) +} + +func appendNull(ctx *encoder.RuntimeContext, b []byte) []byte { + format := ctx.Option.ColorScheme.Null + b = append(b, format.Header...) + b = append(b, "null"...) + return append(b, format.Footer...) +} + +func appendComma(_ *encoder.RuntimeContext, b []byte) []byte { + return append(b, ',') +} + +func appendNullComma(ctx *encoder.RuntimeContext, b []byte) []byte { + format := ctx.Option.ColorScheme.Null + b = append(b, format.Header...) + b = append(b, "null"...) + return append(append(b, format.Footer...), ',') +} + +func appendColon(_ *encoder.RuntimeContext, b []byte) []byte { + last := len(b) - 1 + b[last] = ':' + return b +} + +func appendMapKeyValue(_ *encoder.RuntimeContext, _ *encoder.Opcode, b, key, value []byte) []byte { + b = append(b, key[:len(key)-1]...) + b = append(b, ':') + return append(b, value...) +} + +func appendMapEnd(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { + last := len(b) - 1 + b[last] = '}' + b = append(b, ',') + return b +} + +func appendMarshalJSON(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) { + return encoder.AppendMarshalJSON(ctx, code, b, v) +} + +func appendMarshalText(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) { + format := ctx.Option.ColorScheme.String + b = append(b, format.Header...) + bb, err := encoder.AppendMarshalText(ctx, code, b, v) + if err != nil { + return nil, err + } + return append(bb, format.Footer...), nil +} + +func appendArrayHead(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { + return append(b, '[') +} + +func appendArrayEnd(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { + last := len(b) - 1 + b[last] = ']' + return append(b, ',') +} + +func appendEmptyArray(_ *encoder.RuntimeContext, b []byte) []byte { + return append(b, '[', ']', ',') +} + +func appendEmptyObject(_ *encoder.RuntimeContext, b []byte) []byte { + return append(b, '{', '}', ',') +} + +func appendObjectEnd(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { + last := len(b) - 1 + b[last] = '}' + return append(b, ',') +} + +func appendStructHead(_ *encoder.RuntimeContext, b []byte) []byte { + return append(b, '{') +} + +func appendStructKey(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { + format := ctx.Option.ColorScheme.ObjectKey + b = append(b, format.Header...) + b = append(b, code.Key[:len(code.Key)-1]...) + b = append(b, format.Footer...) + + return append(b, ':') +} + +func appendStructEnd(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { + return append(b, '}', ',') +} + +func appendStructEndSkipLast(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { + last := len(b) - 1 + if b[last] == ',' { + b[last] = '}' + return appendComma(ctx, b) + } + return appendStructEnd(ctx, code, b) +} + +func restoreIndent(_ *encoder.RuntimeContext, _ *encoder.Opcode, _ uintptr) {} +func storeIndent(_ uintptr, _ *encoder.Opcode, _ uintptr) {} +func appendMapKeyIndent(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { return b } +func appendArrayElemIndent(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { return b } diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm_color/vm.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_color/vm.go new file mode 100644 index 000000000..a63e83e55 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/vm_color/vm.go @@ -0,0 +1,4859 @@ +// Code generated by internal/cmd/generator. DO NOT EDIT! +package vm_color + +import ( + "math" + "reflect" + "sort" + "unsafe" + + "github.com/goccy/go-json/internal/encoder" + "github.com/goccy/go-json/internal/runtime" +) + +func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) { + recursiveLevel := 0 + ptrOffset := uintptr(0) + ctxptr := ctx.Ptr() + var code *encoder.Opcode + if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 { + code = codeSet.EscapeKeyCode + } else { + code = codeSet.NoescapeKeyCode + } + + for { + switch code.Op { + default: + return nil, errUnimplementedOp(code.Op) + case encoder.OpPtr: + p := load(ctxptr, code.Idx) + code = code.Next + store(ctxptr, code.Idx, ptrToPtr(p)) + case encoder.OpIntPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpInt: + b = appendInt(ctx, b, load(ctxptr, code.Idx), code) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpUintPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpUint: + b = appendUint(ctx, b, load(ctxptr, code.Idx), code) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpIntString: + b = append(b, '"') + b = appendInt(ctx, b, load(ctxptr, code.Idx), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpUintString: + b = append(b, '"') + b = appendUint(ctx, b, load(ctxptr, code.Idx), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpFloat32Ptr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpFloat32: + b = appendFloat32(ctx, b, ptrToFloat32(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpFloat64Ptr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpFloat64: + v := ptrToFloat64(load(ctxptr, code.Idx)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStringPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpString: + b = appendString(ctx, b, ptrToString(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpBoolPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpBool: + b = appendBool(ctx, b, ptrToBool(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpBytesPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpBytes: + b = appendByteSlice(ctx, b, ptrToBytes(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpNumberPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpNumber: + bb, err := appendNumber(ctx, b, ptrToNumber(load(ctxptr, code.Idx))) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpInterfacePtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpInterface: + p := load(ctxptr, code.Idx) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + if recursiveLevel > encoder.StartDetectingCyclesAfter { + for _, seen := range ctx.SeenPtr { + if p == seen { + return nil, errUnsupportedValue(code, p) + } + } + } + ctx.SeenPtr = append(ctx.SeenPtr, p) + var ( + typ *runtime.Type + ifacePtr unsafe.Pointer + ) + up := ptrToUnsafePtr(p) + if code.Flags&encoder.NonEmptyInterfaceFlags != 0 { + iface := (*nonEmptyInterface)(up) + ifacePtr = iface.ptr + if iface.itab != nil { + typ = iface.itab.typ + } + } else { + iface := (*emptyInterface)(up) + ifacePtr = iface.ptr + typ = iface.typ + } + if ifacePtr == nil { + isDirectedNil := typ != nil && typ.Kind() == reflect.Struct && !runtime.IfaceIndir(typ) + if !isDirectedNil { + b = appendNullComma(ctx, b) + code = code.Next + break + } + } + ctx.KeepRefs = append(ctx.KeepRefs, up) + ifaceCodeSet, err := encoder.CompileToGetCodeSet(ctx, uintptr(unsafe.Pointer(typ))) + if err != nil { + return nil, err + } + + totalLength := uintptr(code.Length) + 3 + nextTotalLength := uintptr(ifaceCodeSet.CodeLength) + 3 + + var c *encoder.Opcode + if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 { + c = ifaceCodeSet.InterfaceEscapeKeyCode + } else { + c = ifaceCodeSet.InterfaceNoescapeKeyCode + } + curlen := uintptr(len(ctx.Ptrs)) + offsetNum := ptrOffset / uintptrSize + oldOffset := ptrOffset + ptrOffset += totalLength * uintptrSize + oldBaseIndent := ctx.BaseIndent + ctx.BaseIndent += code.Indent + + newLen := offsetNum + totalLength + nextTotalLength + if curlen < newLen { + ctx.Ptrs = append(ctx.Ptrs, make([]uintptr, newLen-curlen)...) + } + ctxptr = ctx.Ptr() + ptrOffset // assign new ctxptr + + end := ifaceCodeSet.EndCode + store(ctxptr, c.Idx, uintptr(ifacePtr)) + store(ctxptr, end.Idx, oldOffset) + store(ctxptr, end.ElemIdx, uintptr(unsafe.Pointer(code.Next))) + storeIndent(ctxptr, end, uintptr(oldBaseIndent)) + code = c + recursiveLevel++ + case encoder.OpInterfaceEnd: + recursiveLevel-- + + // restore ctxptr + offset := load(ctxptr, code.Idx) + restoreIndent(ctx, code, ctxptr) + ctx.SeenPtr = ctx.SeenPtr[:len(ctx.SeenPtr)-1] + + codePtr := load(ctxptr, code.ElemIdx) + code = (*encoder.Opcode)(ptrToUnsafePtr(codePtr)) + ctxptr = ctx.Ptr() + offset + ptrOffset = offset + case encoder.OpMarshalJSONPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, ptrToPtr(p)) + fallthrough + case encoder.OpMarshalJSON: + p := load(ctxptr, code.Idx) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p) + } + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpMarshalTextPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, ptrToPtr(p)) + fallthrough + case encoder.OpMarshalText: + p := load(ctxptr, code.Idx) + if p == 0 { + b = append(b, `""`...) + b = appendComma(ctx, b) + code = code.Next + break + } + if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p) + } + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpSlicePtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.End.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpSlice: + p := load(ctxptr, code.Idx) + slice := ptrToSlice(p) + if p == 0 || slice.Data == nil { + b = appendNullComma(ctx, b) + code = code.End.Next + break + } + store(ctxptr, code.ElemIdx, 0) + store(ctxptr, code.Length, uintptr(slice.Len)) + store(ctxptr, code.Idx, uintptr(slice.Data)) + if slice.Len > 0 { + b = appendArrayHead(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, uintptr(slice.Data)) + } else { + b = appendEmptyArray(ctx, b) + code = code.End.Next + } + case encoder.OpSliceElem: + idx := load(ctxptr, code.ElemIdx) + length := load(ctxptr, code.Length) + idx++ + if idx < length { + b = appendArrayElemIndent(ctx, code, b) + store(ctxptr, code.ElemIdx, idx) + data := load(ctxptr, code.Idx) + size := uintptr(code.Size) + code = code.Next + store(ctxptr, code.Idx, data+idx*size) + } else { + b = appendArrayEnd(ctx, code, b) + code = code.End.Next + } + case encoder.OpArrayPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.End.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpArray: + p := load(ctxptr, code.Idx) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.End.Next + break + } + if code.Length > 0 { + b = appendArrayHead(ctx, code, b) + store(ctxptr, code.ElemIdx, 0) + code = code.Next + store(ctxptr, code.Idx, p) + } else { + b = appendEmptyArray(ctx, b) + code = code.End.Next + } + case encoder.OpArrayElem: + idx := load(ctxptr, code.ElemIdx) + idx++ + if idx < uintptr(code.Length) { + b = appendArrayElemIndent(ctx, code, b) + store(ctxptr, code.ElemIdx, idx) + p := load(ctxptr, code.Idx) + size := uintptr(code.Size) + code = code.Next + store(ctxptr, code.Idx, p+idx*size) + } else { + b = appendArrayEnd(ctx, code, b) + code = code.End.Next + } + case encoder.OpMapPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.End.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpMap: + p := load(ctxptr, code.Idx) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.End.Next + break + } + uptr := ptrToUnsafePtr(p) + mlen := maplen(uptr) + if mlen <= 0 { + b = appendEmptyObject(ctx, b) + code = code.End.Next + break + } + b = appendStructHead(ctx, b) + unorderedMap := (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 + mapCtx := encoder.NewMapContext(mlen, unorderedMap) + mapiterinit(code.Type, uptr, &mapCtx.Iter) + store(ctxptr, code.Idx, uintptr(unsafe.Pointer(mapCtx))) + ctx.KeepRefs = append(ctx.KeepRefs, unsafe.Pointer(mapCtx)) + if unorderedMap { + b = appendMapKeyIndent(ctx, code.Next, b) + } else { + mapCtx.Start = len(b) + mapCtx.First = len(b) + } + key := mapiterkey(&mapCtx.Iter) + store(ctxptr, code.Next.Idx, uintptr(key)) + code = code.Next + case encoder.OpMapKey: + mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx))) + idx := mapCtx.Idx + idx++ + if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 { + if idx < mapCtx.Len { + b = appendMapKeyIndent(ctx, code, b) + mapCtx.Idx = int(idx) + key := mapiterkey(&mapCtx.Iter) + store(ctxptr, code.Next.Idx, uintptr(key)) + code = code.Next + } else { + b = appendObjectEnd(ctx, code, b) + encoder.ReleaseMapContext(mapCtx) + code = code.End.Next + } + } else { + mapCtx.Slice.Items[mapCtx.Idx].Value = b[mapCtx.Start:len(b)] + if idx < mapCtx.Len { + mapCtx.Idx = int(idx) + mapCtx.Start = len(b) + key := mapiterkey(&mapCtx.Iter) + store(ctxptr, code.Next.Idx, uintptr(key)) + code = code.Next + } else { + code = code.End + } + } + case encoder.OpMapValue: + mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx))) + if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 { + b = appendColon(ctx, b) + } else { + mapCtx.Slice.Items[mapCtx.Idx].Key = b[mapCtx.Start:len(b)] + mapCtx.Start = len(b) + } + value := mapitervalue(&mapCtx.Iter) + store(ctxptr, code.Next.Idx, uintptr(value)) + mapiternext(&mapCtx.Iter) + code = code.Next + case encoder.OpMapEnd: + // this operation only used by sorted map. + mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx))) + sort.Sort(mapCtx.Slice) + buf := mapCtx.Buf + for _, item := range mapCtx.Slice.Items { + buf = appendMapKeyValue(ctx, code, buf, item.Key, item.Value) + } + buf = appendMapEnd(ctx, code, buf) + b = b[:mapCtx.First] + b = append(b, buf...) + mapCtx.Buf = buf + encoder.ReleaseMapContext(mapCtx) + code = code.Next + case encoder.OpRecursivePtr: + p := load(ctxptr, code.Idx) + if p == 0 { + code = code.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpRecursive: + ptr := load(ctxptr, code.Idx) + if ptr != 0 { + if recursiveLevel > encoder.StartDetectingCyclesAfter { + for _, seen := range ctx.SeenPtr { + if ptr == seen { + return nil, errUnsupportedValue(code, ptr) + } + } + } + } + ctx.SeenPtr = append(ctx.SeenPtr, ptr) + c := code.Jmp.Code + curlen := uintptr(len(ctx.Ptrs)) + offsetNum := ptrOffset / uintptrSize + oldOffset := ptrOffset + ptrOffset += code.Jmp.CurLen * uintptrSize + oldBaseIndent := ctx.BaseIndent + indentDiffFromTop := c.Indent - 1 + ctx.BaseIndent += code.Indent - indentDiffFromTop + + newLen := offsetNum + code.Jmp.CurLen + code.Jmp.NextLen + if curlen < newLen { + ctx.Ptrs = append(ctx.Ptrs, make([]uintptr, newLen-curlen)...) + } + ctxptr = ctx.Ptr() + ptrOffset // assign new ctxptr + + store(ctxptr, c.Idx, ptr) + store(ctxptr, c.End.Next.Idx, oldOffset) + store(ctxptr, c.End.Next.ElemIdx, uintptr(unsafe.Pointer(code.Next))) + storeIndent(ctxptr, c.End.Next, uintptr(oldBaseIndent)) + code = c + recursiveLevel++ + case encoder.OpRecursiveEnd: + recursiveLevel-- + + // restore ctxptr + restoreIndent(ctx, code, ctxptr) + offset := load(ctxptr, code.Idx) + ctx.SeenPtr = ctx.SeenPtr[:len(ctx.SeenPtr)-1] + + codePtr := load(ctxptr, code.ElemIdx) + code = (*encoder.Opcode)(ptrToUnsafePtr(codePtr)) + ctxptr = ctx.Ptr() + offset + ptrOffset = offset + case encoder.OpStructPtrHead: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHead: + p := load(ctxptr, code.Idx) + if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if len(code.Key) > 0 { + if (code.Flags&encoder.IsTaggedKeyFlags) != 0 || code.Flags&encoder.AnonymousKeyFlags == 0 { + b = appendStructKey(ctx, code, b) + } + } + p += uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructPtrHeadOmitEmpty: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmpty: + p := load(ctxptr, code.Idx) + if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + p += uintptr(code.Offset) + if p == 0 || (ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0) { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadInt: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadInt: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyInt: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyInt: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadIntString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadIntString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyIntString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyIntString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + p += uintptr(code.Offset) + u64 := ptrToUint64(p, code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadIntPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadIntPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendInt(ctx, b, p, code) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyIntPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyIntPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p, code) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadIntPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadIntPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyIntPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyIntPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadUint: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadUint: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyUint: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyUint: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadUintString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadUintString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyUintString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyUintString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadUintPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadUintPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendUint(ctx, b, p, code) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyUintPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyUintPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p, code) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadUintPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadUintPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendUint(ctx, b, p, code) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyUintPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyUintPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p, code) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadFloat32: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadFloat32: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat32: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyFloat32: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToFloat32(p + uintptr(code.Offset)) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadFloat32String: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadFloat32String: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat32String: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyFloat32String: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToFloat32(p + uintptr(code.Offset)) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadFloat32Ptr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadFloat32Ptr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendFloat32(ctx, b, ptrToFloat32(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat32Ptr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyFloat32Ptr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadFloat32PtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadFloat32PtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat32PtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyFloat32PtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadFloat64: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadFloat64: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + v := ptrToFloat64(p + uintptr(code.Offset)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat64: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyFloat64: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToFloat64(p + uintptr(code.Offset)) + if v == 0 { + code = code.NextField + } else { + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadFloat64String: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadFloat64String: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToFloat64(p + uintptr(code.Offset)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat64String: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyFloat64String: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToFloat64(p + uintptr(code.Offset)) + if v == 0 { + code = code.NextField + } else { + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadFloat64Ptr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadFloat64Ptr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat64Ptr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyFloat64Ptr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadFloat64PtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadFloat64PtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat64PtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyFloat64PtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToString(p + uintptr(code.Offset)) + if v == "" { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadStringString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadStringString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p+uintptr(code.Offset))))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyStringString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyStringString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToString(p + uintptr(code.Offset)) + if v == "" { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, v))) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadStringPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadStringPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendString(ctx, b, ptrToString(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyStringPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyStringPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, ptrToString(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadStringPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadStringPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyStringPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyStringPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadBool: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadBool: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyBool: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyBool: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToBool(p + uintptr(code.Offset)) + if v { + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + } else { + code = code.NextField + } + case encoder.OpStructPtrHeadBoolString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadBoolString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyBoolString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyBoolString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToBool(p + uintptr(code.Offset)) + if v { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + } else { + code = code.NextField + } + case encoder.OpStructPtrHeadBoolPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadBoolPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendBool(ctx, b, ptrToBool(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyBoolPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyBoolPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, ptrToBool(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadBoolPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadBoolPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p)) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyBoolPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyBoolPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p)) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadBytes: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadBytes: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyBytes: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyBytes: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToBytes(p + uintptr(code.Offset)) + if len(v) == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadBytesPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadBytesPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendByteSlice(ctx, b, ptrToBytes(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyBytesPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyBytesPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, ptrToBytes(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadNumber: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadNumber: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyNumber: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyNumber: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToNumber(p + uintptr(code.Offset)) + if v == "" { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, v) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + } + case encoder.OpStructPtrHeadNumberString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadNumberString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyNumberString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyNumberString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToNumber(p + uintptr(code.Offset)) + if v == "" { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, v) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadNumberPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadNumberPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyNumberPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyNumberPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + } + code = code.Next + case encoder.OpStructPtrHeadNumberPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadNumberPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = append(bb, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyNumberPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyNumberPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadArray, encoder.OpStructHeadSlice: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + p += uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructPtrHeadOmitEmptyArray: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyArray: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + p += uintptr(code.Offset) + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructPtrHeadOmitEmptySlice: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptySlice: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + p += uintptr(code.Offset) + slice := ptrToSlice(p) + if slice.Len == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadSlicePtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadSlicePtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNullComma(ctx, b) + code = code.NextField + } else { + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadOmitEmptyArrayPtr, encoder.OpStructPtrHeadOmitEmptySlicePtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyArrayPtr, encoder.OpStructHeadOmitEmptySlicePtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadMap: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadMap: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p + uintptr(code.Offset)) + } + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructPtrHeadOmitEmptyMap: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyMap: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p + uintptr(code.Offset)) + } + if maplen(ptrToUnsafePtr(p)) == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadMapPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadMapPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.NextField + break + } + p = ptrToPtr(p + uintptr(code.Offset)) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.NextField + } else { + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p, code.PtrNum) + } + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadOmitEmptyMapPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyMapPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if p == 0 { + code = code.NextField + break + } + p = ptrToPtr(p + uintptr(code.Offset)) + if p == 0 { + code = code.NextField + } else { + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p, code.PtrNum) + } + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadMarshalJSON: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if (code.Flags & encoder.IndirectFlags) != 0 { + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadMarshalJSON: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalJSON { + p = ptrToPtr(p) + } + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyMarshalJSON: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if (code.Flags & encoder.IndirectFlags) != 0 { + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyMarshalJSON: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { + p = ptrToPtr(p) + } + } + iface := ptrToInterface(code, p) + if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalJSON(ctx, code, b, iface) + if err != nil { + return nil, err + } + b = bb + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadMarshalJSONPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadMarshalJSONPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyMarshalJSONPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyMarshalJSONPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if p == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadMarshalText: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if (code.Flags & encoder.IndirectFlags) != 0 { + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadMarshalText: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalText { + p = ptrToPtr(p) + } + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyMarshalText: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if (code.Flags & encoder.IndirectFlags) != 0 { + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyMarshalText: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { + p = ptrToPtr(p) + } + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadMarshalTextPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadMarshalTextPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyMarshalTextPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyMarshalTextPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if p == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructField: + if code.Flags&encoder.IsTaggedKeyFlags != 0 || code.Flags&encoder.AnonymousKeyFlags == 0 { + b = appendStructKey(ctx, code, b) + } + p := load(ctxptr, code.Idx) + uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmpty: + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructFieldInt: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyInt: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldIntString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyIntString: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldIntPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendInt(ctx, b, p, code) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyIntPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p, code) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldIntPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyIntPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldUint: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyUint: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldUintString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyUintString: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldUintPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendUint(ctx, b, p, code) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyUintPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p, code) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldUintPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendUint(ctx, b, p, code) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyUintPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p, code) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat32: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat32: + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat32String: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat32String: + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat32Ptr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendFloat32(ctx, b, ptrToFloat32(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat32Ptr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat32PtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat32PtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat64: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + v := ptrToFloat64(p + uintptr(code.Offset)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat64: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if v != 0 { + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat64String: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat64String: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if v != 0 { + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat64Ptr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat64Ptr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat64PtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat64PtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyString: + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldStringString: + p := load(ctxptr, code.Idx) + s := ptrToString(p + uintptr(code.Offset)) + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, s))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyStringString: + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, v))) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldStringPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendString(ctx, b, ptrToString(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyStringPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, ptrToString(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldStringPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyStringPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldBool: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyBool: + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) + if v { + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldBoolString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyBoolString: + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) + if v { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldBoolPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendBool(ctx, b, ptrToBool(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyBoolPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, ptrToBool(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldBoolPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p)) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyBoolPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p)) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldBytes: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyBytes: + p := load(ctxptr, code.Idx) + v := ptrToBytes(p + uintptr(code.Offset)) + if len(v) > 0 { + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldBytesPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendByteSlice(ctx, b, ptrToBytes(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyBytesPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, ptrToBytes(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldNumber: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpStructFieldOmitEmptyNumber: + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, v) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + } + code = code.Next + case encoder.OpStructFieldNumberString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyNumberString: + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, v) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldNumberPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyNumberPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + } + code = code.Next + case encoder.OpStructFieldNumberPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = append(bb, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyNumberPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldMarshalJSON: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + p = ptrToPtr(p) + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyMarshalJSON: + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + p = ptrToPtr(p) + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + code = code.NextField + break + } + iface := ptrToInterface(code, p) + if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) { + code = code.NextField + break + } + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalJSON(ctx, code, b, iface) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpStructFieldMarshalJSONPtr: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyMarshalJSONPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + } + code = code.Next + case encoder.OpStructFieldMarshalText: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + p = ptrToPtr(p) + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyMarshalText: + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + p = ptrToPtr(p) + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + code = code.NextField + break + } + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpStructFieldMarshalTextPtr: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyMarshalTextPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + } + code = code.Next + case encoder.OpStructFieldArray: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptyArray: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldArrayPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptyArrayPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } else { + code = code.NextField + } + case encoder.OpStructFieldSlice: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptySlice: + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + slice := ptrToSlice(p) + if slice.Len == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructFieldSlicePtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptySlicePtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } else { + code = code.NextField + } + case encoder.OpStructFieldMap: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptyMap: + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) + if p == 0 || maplen(ptrToUnsafePtr(p)) == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructFieldMapPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) + if p != 0 { + p = ptrToNPtr(p, code.PtrNum) + } + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptyMapPtr: + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) + if p != 0 { + p = ptrToNPtr(p, code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } else { + code = code.NextField + } + case encoder.OpStructFieldStruct: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptyStruct: + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructEnd: + b = appendStructEndSkipLast(ctx, code, b) + code = code.Next + case encoder.OpStructEndInt: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyInt: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndIntString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyIntString: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndIntPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendInt(ctx, b, p, code) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyIntPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p, code) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndIntPtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyIntPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndUint: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyUint: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndUintString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyUintString: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndUintPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendUint(ctx, b, p, code) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyUintPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p, code) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndUintPtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendUint(ctx, b, p, code) + b = append(b, '"') + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyUintPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p, code) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat32: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat32: + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, v) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat32String: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat32String: + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, v) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat32Ptr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendFloat32(ctx, b, ptrToFloat32(p)) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat32Ptr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat32PtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = append(b, '"') + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat32PtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat64: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = appendFloat64(ctx, b, v) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat64: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if v != 0 { + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = appendFloat64(ctx, b, v) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat64String: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat64String: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if v != 0 { + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat64Ptr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + b = appendStructEnd(ctx, code, b) + code = code.Next + break + } + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat64Ptr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat64PtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = append(b, '"') + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat64PtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyString: + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, v) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndStringString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + s := ptrToString(p + uintptr(code.Offset)) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, s))) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyStringString: + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, v))) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndStringPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendString(ctx, b, ptrToString(p)) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyStringPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, ptrToString(p)) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndStringPtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyStringPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndBool: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyBool: + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) + if v { + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, v) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndBoolString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyBoolString: + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) + if v { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, v) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndBoolPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendBool(ctx, b, ptrToBool(p)) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyBoolPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, ptrToBool(p)) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndBoolPtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p)) + b = append(b, '"') + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyBoolPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p)) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndBytes: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyBytes: + p := load(ctxptr, code.Idx) + v := ptrToBytes(p + uintptr(code.Offset)) + if len(v) > 0 { + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, v) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndBytesPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendByteSlice(ctx, b, ptrToBytes(p)) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyBytesPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, ptrToBytes(p)) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndNumber: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) + if err != nil { + return nil, err + } + b = appendStructEnd(ctx, code, bb) + code = code.Next + case encoder.OpStructEndOmitEmptyNumber: + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, v) + if err != nil { + return nil, err + } + b = appendStructEnd(ctx, code, bb) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndNumberString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyNumberString: + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, v) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndNumberPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyNumberPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = appendStructEnd(ctx, code, bb) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndNumberPtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = append(bb, '"') + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyNumberPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpEnd: + goto END + } + } +END: + return b, nil +} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm_color_indent/debug_vm.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_color_indent/debug_vm.go new file mode 100644 index 000000000..dd4cd489e --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/vm_color_indent/debug_vm.go @@ -0,0 +1,35 @@ +package vm_color_indent + +import ( + "fmt" + + "github.com/goccy/go-json/internal/encoder" +) + +func DebugRun(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) { + var code *encoder.Opcode + if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 { + code = codeSet.EscapeKeyCode + } else { + code = codeSet.NoescapeKeyCode + } + + defer func() { + if err := recover(); err != nil { + w := ctx.Option.DebugOut + fmt.Fprintln(w, "=============[DEBUG]===============") + fmt.Fprintln(w, "* [TYPE]") + fmt.Fprintln(w, codeSet.Type) + fmt.Fprintf(w, "\n") + fmt.Fprintln(w, "* [ALL OPCODE]") + fmt.Fprintln(w, code.Dump()) + fmt.Fprintf(w, "\n") + fmt.Fprintln(w, "* [CONTEXT]") + fmt.Fprintf(w, "%+v\n", ctx) + fmt.Fprintln(w, "===================================") + panic(err) + } + }() + + return Run(ctx, b, codeSet) +} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm_color_indent/util.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_color_indent/util.go new file mode 100644 index 000000000..2395abec9 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/vm_color_indent/util.go @@ -0,0 +1,297 @@ +package vm_color_indent + +import ( + "encoding/json" + "fmt" + "unsafe" + + "github.com/goccy/go-json/internal/encoder" + "github.com/goccy/go-json/internal/runtime" +) + +const uintptrSize = 4 << (^uintptr(0) >> 63) + +var ( + appendIndent = encoder.AppendIndent + appendStructEnd = encoder.AppendStructEndIndent + errUnsupportedValue = encoder.ErrUnsupportedValue + errUnsupportedFloat = encoder.ErrUnsupportedFloat + mapiterinit = encoder.MapIterInit + mapiterkey = encoder.MapIterKey + mapitervalue = encoder.MapIterValue + mapiternext = encoder.MapIterNext + maplen = encoder.MapLen +) + +type emptyInterface struct { + typ *runtime.Type + ptr unsafe.Pointer +} + +type nonEmptyInterface struct { + itab *struct { + ityp *runtime.Type // static interface type + typ *runtime.Type // dynamic concrete type + // unused fields... + } + ptr unsafe.Pointer +} + +func errUnimplementedOp(op encoder.OpType) error { + return fmt.Errorf("encoder (indent): opcode %s has not been implemented", op) +} + +func load(base uintptr, idx uint32) uintptr { + addr := base + uintptr(idx) + return **(**uintptr)(unsafe.Pointer(&addr)) +} + +func store(base uintptr, idx uint32, p uintptr) { + addr := base + uintptr(idx) + **(**uintptr)(unsafe.Pointer(&addr)) = p +} + +func loadNPtr(base uintptr, idx uint32, ptrNum uint8) uintptr { + addr := base + uintptr(idx) + p := **(**uintptr)(unsafe.Pointer(&addr)) + for i := uint8(0); i < ptrNum; i++ { + if p == 0 { + return 0 + } + p = ptrToPtr(p) + } + return p +} + +func ptrToUint64(p uintptr, bitSize uint8) uint64 { + switch bitSize { + case 8: + return (uint64)(**(**uint8)(unsafe.Pointer(&p))) + case 16: + return (uint64)(**(**uint16)(unsafe.Pointer(&p))) + case 32: + return (uint64)(**(**uint32)(unsafe.Pointer(&p))) + case 64: + return **(**uint64)(unsafe.Pointer(&p)) + } + return 0 +} + +func ptrToFloat32(p uintptr) float32 { return **(**float32)(unsafe.Pointer(&p)) } +func ptrToFloat64(p uintptr) float64 { return **(**float64)(unsafe.Pointer(&p)) } +func ptrToBool(p uintptr) bool { return **(**bool)(unsafe.Pointer(&p)) } +func ptrToBytes(p uintptr) []byte { return **(**[]byte)(unsafe.Pointer(&p)) } +func ptrToNumber(p uintptr) json.Number { return **(**json.Number)(unsafe.Pointer(&p)) } +func ptrToString(p uintptr) string { return **(**string)(unsafe.Pointer(&p)) } +func ptrToSlice(p uintptr) *runtime.SliceHeader { return *(**runtime.SliceHeader)(unsafe.Pointer(&p)) } +func ptrToPtr(p uintptr) uintptr { + return uintptr(**(**unsafe.Pointer)(unsafe.Pointer(&p))) +} +func ptrToNPtr(p uintptr, ptrNum uint8) uintptr { + for i := uint8(0); i < ptrNum; i++ { + if p == 0 { + return 0 + } + p = ptrToPtr(p) + } + return p +} + +func ptrToUnsafePtr(p uintptr) unsafe.Pointer { + return *(*unsafe.Pointer)(unsafe.Pointer(&p)) +} +func ptrToInterface(code *encoder.Opcode, p uintptr) interface{} { + return *(*interface{})(unsafe.Pointer(&emptyInterface{ + typ: code.Type, + ptr: *(*unsafe.Pointer)(unsafe.Pointer(&p)), + })) +} + +func appendInt(ctx *encoder.RuntimeContext, b []byte, p uintptr, code *encoder.Opcode) []byte { + format := ctx.Option.ColorScheme.Int + b = append(b, format.Header...) + b = encoder.AppendInt(ctx, b, p, code) + return append(b, format.Footer...) +} + +func appendUint(ctx *encoder.RuntimeContext, b []byte, p uintptr, code *encoder.Opcode) []byte { + format := ctx.Option.ColorScheme.Uint + b = append(b, format.Header...) + b = encoder.AppendUint(ctx, b, p, code) + return append(b, format.Footer...) +} + +func appendFloat32(ctx *encoder.RuntimeContext, b []byte, v float32) []byte { + format := ctx.Option.ColorScheme.Float + b = append(b, format.Header...) + b = encoder.AppendFloat32(ctx, b, v) + return append(b, format.Footer...) +} + +func appendFloat64(ctx *encoder.RuntimeContext, b []byte, v float64) []byte { + format := ctx.Option.ColorScheme.Float + b = append(b, format.Header...) + b = encoder.AppendFloat64(ctx, b, v) + return append(b, format.Footer...) +} + +func appendString(ctx *encoder.RuntimeContext, b []byte, v string) []byte { + format := ctx.Option.ColorScheme.String + b = append(b, format.Header...) + b = encoder.AppendString(ctx, b, v) + return append(b, format.Footer...) +} + +func appendByteSlice(ctx *encoder.RuntimeContext, b []byte, src []byte) []byte { + format := ctx.Option.ColorScheme.Binary + b = append(b, format.Header...) + b = encoder.AppendByteSlice(ctx, b, src) + return append(b, format.Footer...) +} + +func appendNumber(ctx *encoder.RuntimeContext, b []byte, n json.Number) ([]byte, error) { + format := ctx.Option.ColorScheme.Int + b = append(b, format.Header...) + bb, err := encoder.AppendNumber(ctx, b, n) + if err != nil { + return nil, err + } + return append(bb, format.Footer...), nil +} + +func appendBool(ctx *encoder.RuntimeContext, b []byte, v bool) []byte { + format := ctx.Option.ColorScheme.Bool + b = append(b, format.Header...) + if v { + b = append(b, "true"...) + } else { + b = append(b, "false"...) + } + return append(b, format.Footer...) +} + +func appendNull(ctx *encoder.RuntimeContext, b []byte) []byte { + format := ctx.Option.ColorScheme.Null + b = append(b, format.Header...) + b = append(b, "null"...) + return append(b, format.Footer...) +} + +func appendComma(_ *encoder.RuntimeContext, b []byte) []byte { + return append(b, ',', '\n') +} + +func appendNullComma(ctx *encoder.RuntimeContext, b []byte) []byte { + format := ctx.Option.ColorScheme.Null + b = append(b, format.Header...) + b = append(b, "null"...) + return append(append(b, format.Footer...), ',', '\n') +} + +func appendColon(_ *encoder.RuntimeContext, b []byte) []byte { + return append(b[:len(b)-2], ':', ' ') +} + +func appendMapKeyValue(ctx *encoder.RuntimeContext, code *encoder.Opcode, b, key, value []byte) []byte { + b = appendIndent(ctx, b, code.Indent+1) + b = append(b, key...) + b[len(b)-2] = ':' + b[len(b)-1] = ' ' + return append(b, value...) +} + +func appendMapEnd(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { + b = b[:len(b)-2] + b = append(b, '\n') + b = appendIndent(ctx, b, code.Indent) + return append(b, '}', ',', '\n') +} + +func appendArrayHead(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { + b = append(b, '[', '\n') + return appendIndent(ctx, b, code.Indent+1) +} + +func appendArrayEnd(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { + b = b[:len(b)-2] + b = append(b, '\n') + b = appendIndent(ctx, b, code.Indent) + return append(b, ']', ',', '\n') +} + +func appendEmptyArray(_ *encoder.RuntimeContext, b []byte) []byte { + return append(b, '[', ']', ',', '\n') +} + +func appendEmptyObject(_ *encoder.RuntimeContext, b []byte) []byte { + return append(b, '{', '}', ',', '\n') +} + +func appendObjectEnd(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { + last := len(b) - 1 + // replace comma to newline + b[last-1] = '\n' + b = appendIndent(ctx, b[:last], code.Indent) + return append(b, '}', ',', '\n') +} + +func appendMarshalJSON(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) { + return encoder.AppendMarshalJSONIndent(ctx, code, b, v) +} + +func appendMarshalText(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) { + format := ctx.Option.ColorScheme.String + b = append(b, format.Header...) + bb, err := encoder.AppendMarshalTextIndent(ctx, code, b, v) + if err != nil { + return nil, err + } + return append(bb, format.Footer...), nil +} + +func appendStructHead(_ *encoder.RuntimeContext, b []byte) []byte { + return append(b, '{', '\n') +} + +func appendStructKey(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { + b = appendIndent(ctx, b, code.Indent) + + format := ctx.Option.ColorScheme.ObjectKey + b = append(b, format.Header...) + b = append(b, code.Key[:len(code.Key)-1]...) + b = append(b, format.Footer...) + + return append(b, ':', ' ') +} + +func appendStructEndSkipLast(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { + last := len(b) - 1 + if b[last-1] == '{' { + b[last] = '}' + } else { + if b[last] == '\n' { + // to remove ',' and '\n' characters + b = b[:len(b)-2] + } + b = append(b, '\n') + b = appendIndent(ctx, b, code.Indent-1) + b = append(b, '}') + } + return appendComma(ctx, b) +} + +func restoreIndent(ctx *encoder.RuntimeContext, code *encoder.Opcode, ctxptr uintptr) { + ctx.BaseIndent = uint32(load(ctxptr, code.Length)) +} + +func storeIndent(ctxptr uintptr, code *encoder.Opcode, indent uintptr) { + store(ctxptr, code.Length, indent) +} + +func appendArrayElemIndent(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { + return appendIndent(ctx, b, code.Indent+1) +} + +func appendMapKeyIndent(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { + return appendIndent(ctx, b, code.Indent) +} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm_color_indent/vm.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_color_indent/vm.go new file mode 100644 index 000000000..3b4e22e5d --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/vm_color_indent/vm.go @@ -0,0 +1,4859 @@ +// Code generated by internal/cmd/generator. DO NOT EDIT! +package vm_color_indent + +import ( + "math" + "reflect" + "sort" + "unsafe" + + "github.com/goccy/go-json/internal/encoder" + "github.com/goccy/go-json/internal/runtime" +) + +func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) { + recursiveLevel := 0 + ptrOffset := uintptr(0) + ctxptr := ctx.Ptr() + var code *encoder.Opcode + if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 { + code = codeSet.EscapeKeyCode + } else { + code = codeSet.NoescapeKeyCode + } + + for { + switch code.Op { + default: + return nil, errUnimplementedOp(code.Op) + case encoder.OpPtr: + p := load(ctxptr, code.Idx) + code = code.Next + store(ctxptr, code.Idx, ptrToPtr(p)) + case encoder.OpIntPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpInt: + b = appendInt(ctx, b, load(ctxptr, code.Idx), code) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpUintPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpUint: + b = appendUint(ctx, b, load(ctxptr, code.Idx), code) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpIntString: + b = append(b, '"') + b = appendInt(ctx, b, load(ctxptr, code.Idx), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpUintString: + b = append(b, '"') + b = appendUint(ctx, b, load(ctxptr, code.Idx), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpFloat32Ptr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpFloat32: + b = appendFloat32(ctx, b, ptrToFloat32(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpFloat64Ptr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpFloat64: + v := ptrToFloat64(load(ctxptr, code.Idx)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStringPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpString: + b = appendString(ctx, b, ptrToString(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpBoolPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpBool: + b = appendBool(ctx, b, ptrToBool(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpBytesPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpBytes: + b = appendByteSlice(ctx, b, ptrToBytes(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpNumberPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpNumber: + bb, err := appendNumber(ctx, b, ptrToNumber(load(ctxptr, code.Idx))) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpInterfacePtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpInterface: + p := load(ctxptr, code.Idx) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + if recursiveLevel > encoder.StartDetectingCyclesAfter { + for _, seen := range ctx.SeenPtr { + if p == seen { + return nil, errUnsupportedValue(code, p) + } + } + } + ctx.SeenPtr = append(ctx.SeenPtr, p) + var ( + typ *runtime.Type + ifacePtr unsafe.Pointer + ) + up := ptrToUnsafePtr(p) + if code.Flags&encoder.NonEmptyInterfaceFlags != 0 { + iface := (*nonEmptyInterface)(up) + ifacePtr = iface.ptr + if iface.itab != nil { + typ = iface.itab.typ + } + } else { + iface := (*emptyInterface)(up) + ifacePtr = iface.ptr + typ = iface.typ + } + if ifacePtr == nil { + isDirectedNil := typ != nil && typ.Kind() == reflect.Struct && !runtime.IfaceIndir(typ) + if !isDirectedNil { + b = appendNullComma(ctx, b) + code = code.Next + break + } + } + ctx.KeepRefs = append(ctx.KeepRefs, up) + ifaceCodeSet, err := encoder.CompileToGetCodeSet(ctx, uintptr(unsafe.Pointer(typ))) + if err != nil { + return nil, err + } + + totalLength := uintptr(code.Length) + 3 + nextTotalLength := uintptr(ifaceCodeSet.CodeLength) + 3 + + var c *encoder.Opcode + if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 { + c = ifaceCodeSet.InterfaceEscapeKeyCode + } else { + c = ifaceCodeSet.InterfaceNoescapeKeyCode + } + curlen := uintptr(len(ctx.Ptrs)) + offsetNum := ptrOffset / uintptrSize + oldOffset := ptrOffset + ptrOffset += totalLength * uintptrSize + oldBaseIndent := ctx.BaseIndent + ctx.BaseIndent += code.Indent + + newLen := offsetNum + totalLength + nextTotalLength + if curlen < newLen { + ctx.Ptrs = append(ctx.Ptrs, make([]uintptr, newLen-curlen)...) + } + ctxptr = ctx.Ptr() + ptrOffset // assign new ctxptr + + end := ifaceCodeSet.EndCode + store(ctxptr, c.Idx, uintptr(ifacePtr)) + store(ctxptr, end.Idx, oldOffset) + store(ctxptr, end.ElemIdx, uintptr(unsafe.Pointer(code.Next))) + storeIndent(ctxptr, end, uintptr(oldBaseIndent)) + code = c + recursiveLevel++ + case encoder.OpInterfaceEnd: + recursiveLevel-- + + // restore ctxptr + offset := load(ctxptr, code.Idx) + restoreIndent(ctx, code, ctxptr) + ctx.SeenPtr = ctx.SeenPtr[:len(ctx.SeenPtr)-1] + + codePtr := load(ctxptr, code.ElemIdx) + code = (*encoder.Opcode)(ptrToUnsafePtr(codePtr)) + ctxptr = ctx.Ptr() + offset + ptrOffset = offset + case encoder.OpMarshalJSONPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, ptrToPtr(p)) + fallthrough + case encoder.OpMarshalJSON: + p := load(ctxptr, code.Idx) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p) + } + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpMarshalTextPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, ptrToPtr(p)) + fallthrough + case encoder.OpMarshalText: + p := load(ctxptr, code.Idx) + if p == 0 { + b = append(b, `""`...) + b = appendComma(ctx, b) + code = code.Next + break + } + if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p) + } + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpSlicePtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.End.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpSlice: + p := load(ctxptr, code.Idx) + slice := ptrToSlice(p) + if p == 0 || slice.Data == nil { + b = appendNullComma(ctx, b) + code = code.End.Next + break + } + store(ctxptr, code.ElemIdx, 0) + store(ctxptr, code.Length, uintptr(slice.Len)) + store(ctxptr, code.Idx, uintptr(slice.Data)) + if slice.Len > 0 { + b = appendArrayHead(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, uintptr(slice.Data)) + } else { + b = appendEmptyArray(ctx, b) + code = code.End.Next + } + case encoder.OpSliceElem: + idx := load(ctxptr, code.ElemIdx) + length := load(ctxptr, code.Length) + idx++ + if idx < length { + b = appendArrayElemIndent(ctx, code, b) + store(ctxptr, code.ElemIdx, idx) + data := load(ctxptr, code.Idx) + size := uintptr(code.Size) + code = code.Next + store(ctxptr, code.Idx, data+idx*size) + } else { + b = appendArrayEnd(ctx, code, b) + code = code.End.Next + } + case encoder.OpArrayPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.End.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpArray: + p := load(ctxptr, code.Idx) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.End.Next + break + } + if code.Length > 0 { + b = appendArrayHead(ctx, code, b) + store(ctxptr, code.ElemIdx, 0) + code = code.Next + store(ctxptr, code.Idx, p) + } else { + b = appendEmptyArray(ctx, b) + code = code.End.Next + } + case encoder.OpArrayElem: + idx := load(ctxptr, code.ElemIdx) + idx++ + if idx < uintptr(code.Length) { + b = appendArrayElemIndent(ctx, code, b) + store(ctxptr, code.ElemIdx, idx) + p := load(ctxptr, code.Idx) + size := uintptr(code.Size) + code = code.Next + store(ctxptr, code.Idx, p+idx*size) + } else { + b = appendArrayEnd(ctx, code, b) + code = code.End.Next + } + case encoder.OpMapPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.End.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpMap: + p := load(ctxptr, code.Idx) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.End.Next + break + } + uptr := ptrToUnsafePtr(p) + mlen := maplen(uptr) + if mlen <= 0 { + b = appendEmptyObject(ctx, b) + code = code.End.Next + break + } + b = appendStructHead(ctx, b) + unorderedMap := (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 + mapCtx := encoder.NewMapContext(mlen, unorderedMap) + mapiterinit(code.Type, uptr, &mapCtx.Iter) + store(ctxptr, code.Idx, uintptr(unsafe.Pointer(mapCtx))) + ctx.KeepRefs = append(ctx.KeepRefs, unsafe.Pointer(mapCtx)) + if unorderedMap { + b = appendMapKeyIndent(ctx, code.Next, b) + } else { + mapCtx.Start = len(b) + mapCtx.First = len(b) + } + key := mapiterkey(&mapCtx.Iter) + store(ctxptr, code.Next.Idx, uintptr(key)) + code = code.Next + case encoder.OpMapKey: + mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx))) + idx := mapCtx.Idx + idx++ + if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 { + if idx < mapCtx.Len { + b = appendMapKeyIndent(ctx, code, b) + mapCtx.Idx = int(idx) + key := mapiterkey(&mapCtx.Iter) + store(ctxptr, code.Next.Idx, uintptr(key)) + code = code.Next + } else { + b = appendObjectEnd(ctx, code, b) + encoder.ReleaseMapContext(mapCtx) + code = code.End.Next + } + } else { + mapCtx.Slice.Items[mapCtx.Idx].Value = b[mapCtx.Start:len(b)] + if idx < mapCtx.Len { + mapCtx.Idx = int(idx) + mapCtx.Start = len(b) + key := mapiterkey(&mapCtx.Iter) + store(ctxptr, code.Next.Idx, uintptr(key)) + code = code.Next + } else { + code = code.End + } + } + case encoder.OpMapValue: + mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx))) + if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 { + b = appendColon(ctx, b) + } else { + mapCtx.Slice.Items[mapCtx.Idx].Key = b[mapCtx.Start:len(b)] + mapCtx.Start = len(b) + } + value := mapitervalue(&mapCtx.Iter) + store(ctxptr, code.Next.Idx, uintptr(value)) + mapiternext(&mapCtx.Iter) + code = code.Next + case encoder.OpMapEnd: + // this operation only used by sorted map. + mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx))) + sort.Sort(mapCtx.Slice) + buf := mapCtx.Buf + for _, item := range mapCtx.Slice.Items { + buf = appendMapKeyValue(ctx, code, buf, item.Key, item.Value) + } + buf = appendMapEnd(ctx, code, buf) + b = b[:mapCtx.First] + b = append(b, buf...) + mapCtx.Buf = buf + encoder.ReleaseMapContext(mapCtx) + code = code.Next + case encoder.OpRecursivePtr: + p := load(ctxptr, code.Idx) + if p == 0 { + code = code.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpRecursive: + ptr := load(ctxptr, code.Idx) + if ptr != 0 { + if recursiveLevel > encoder.StartDetectingCyclesAfter { + for _, seen := range ctx.SeenPtr { + if ptr == seen { + return nil, errUnsupportedValue(code, ptr) + } + } + } + } + ctx.SeenPtr = append(ctx.SeenPtr, ptr) + c := code.Jmp.Code + curlen := uintptr(len(ctx.Ptrs)) + offsetNum := ptrOffset / uintptrSize + oldOffset := ptrOffset + ptrOffset += code.Jmp.CurLen * uintptrSize + oldBaseIndent := ctx.BaseIndent + indentDiffFromTop := c.Indent - 1 + ctx.BaseIndent += code.Indent - indentDiffFromTop + + newLen := offsetNum + code.Jmp.CurLen + code.Jmp.NextLen + if curlen < newLen { + ctx.Ptrs = append(ctx.Ptrs, make([]uintptr, newLen-curlen)...) + } + ctxptr = ctx.Ptr() + ptrOffset // assign new ctxptr + + store(ctxptr, c.Idx, ptr) + store(ctxptr, c.End.Next.Idx, oldOffset) + store(ctxptr, c.End.Next.ElemIdx, uintptr(unsafe.Pointer(code.Next))) + storeIndent(ctxptr, c.End.Next, uintptr(oldBaseIndent)) + code = c + recursiveLevel++ + case encoder.OpRecursiveEnd: + recursiveLevel-- + + // restore ctxptr + restoreIndent(ctx, code, ctxptr) + offset := load(ctxptr, code.Idx) + ctx.SeenPtr = ctx.SeenPtr[:len(ctx.SeenPtr)-1] + + codePtr := load(ctxptr, code.ElemIdx) + code = (*encoder.Opcode)(ptrToUnsafePtr(codePtr)) + ctxptr = ctx.Ptr() + offset + ptrOffset = offset + case encoder.OpStructPtrHead: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHead: + p := load(ctxptr, code.Idx) + if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if len(code.Key) > 0 { + if (code.Flags&encoder.IsTaggedKeyFlags) != 0 || code.Flags&encoder.AnonymousKeyFlags == 0 { + b = appendStructKey(ctx, code, b) + } + } + p += uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructPtrHeadOmitEmpty: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmpty: + p := load(ctxptr, code.Idx) + if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + p += uintptr(code.Offset) + if p == 0 || (ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0) { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadInt: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadInt: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyInt: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyInt: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadIntString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadIntString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyIntString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyIntString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + p += uintptr(code.Offset) + u64 := ptrToUint64(p, code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadIntPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadIntPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendInt(ctx, b, p, code) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyIntPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyIntPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p, code) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadIntPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadIntPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyIntPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyIntPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadUint: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadUint: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyUint: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyUint: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadUintString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadUintString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyUintString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyUintString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadUintPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadUintPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendUint(ctx, b, p, code) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyUintPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyUintPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p, code) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadUintPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadUintPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendUint(ctx, b, p, code) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyUintPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyUintPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p, code) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadFloat32: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadFloat32: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat32: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyFloat32: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToFloat32(p + uintptr(code.Offset)) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadFloat32String: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadFloat32String: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat32String: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyFloat32String: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToFloat32(p + uintptr(code.Offset)) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadFloat32Ptr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadFloat32Ptr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendFloat32(ctx, b, ptrToFloat32(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat32Ptr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyFloat32Ptr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadFloat32PtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadFloat32PtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat32PtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyFloat32PtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadFloat64: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadFloat64: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + v := ptrToFloat64(p + uintptr(code.Offset)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat64: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyFloat64: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToFloat64(p + uintptr(code.Offset)) + if v == 0 { + code = code.NextField + } else { + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadFloat64String: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadFloat64String: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToFloat64(p + uintptr(code.Offset)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat64String: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyFloat64String: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToFloat64(p + uintptr(code.Offset)) + if v == 0 { + code = code.NextField + } else { + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadFloat64Ptr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadFloat64Ptr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat64Ptr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyFloat64Ptr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadFloat64PtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadFloat64PtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat64PtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyFloat64PtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToString(p + uintptr(code.Offset)) + if v == "" { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadStringString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadStringString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p+uintptr(code.Offset))))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyStringString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyStringString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToString(p + uintptr(code.Offset)) + if v == "" { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, v))) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadStringPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadStringPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendString(ctx, b, ptrToString(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyStringPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyStringPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, ptrToString(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadStringPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadStringPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyStringPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyStringPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadBool: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadBool: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyBool: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyBool: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToBool(p + uintptr(code.Offset)) + if v { + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + } else { + code = code.NextField + } + case encoder.OpStructPtrHeadBoolString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadBoolString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyBoolString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyBoolString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToBool(p + uintptr(code.Offset)) + if v { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + } else { + code = code.NextField + } + case encoder.OpStructPtrHeadBoolPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadBoolPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendBool(ctx, b, ptrToBool(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyBoolPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyBoolPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, ptrToBool(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadBoolPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadBoolPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p)) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyBoolPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyBoolPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p)) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadBytes: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadBytes: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyBytes: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyBytes: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToBytes(p + uintptr(code.Offset)) + if len(v) == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadBytesPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadBytesPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendByteSlice(ctx, b, ptrToBytes(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyBytesPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyBytesPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, ptrToBytes(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadNumber: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadNumber: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyNumber: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyNumber: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToNumber(p + uintptr(code.Offset)) + if v == "" { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, v) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + } + case encoder.OpStructPtrHeadNumberString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadNumberString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyNumberString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyNumberString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToNumber(p + uintptr(code.Offset)) + if v == "" { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, v) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadNumberPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadNumberPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyNumberPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyNumberPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + } + code = code.Next + case encoder.OpStructPtrHeadNumberPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadNumberPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = append(bb, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyNumberPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyNumberPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadArray, encoder.OpStructHeadSlice: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + p += uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructPtrHeadOmitEmptyArray: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyArray: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + p += uintptr(code.Offset) + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructPtrHeadOmitEmptySlice: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptySlice: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + p += uintptr(code.Offset) + slice := ptrToSlice(p) + if slice.Len == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadSlicePtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadSlicePtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNullComma(ctx, b) + code = code.NextField + } else { + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadOmitEmptyArrayPtr, encoder.OpStructPtrHeadOmitEmptySlicePtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyArrayPtr, encoder.OpStructHeadOmitEmptySlicePtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadMap: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadMap: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p + uintptr(code.Offset)) + } + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructPtrHeadOmitEmptyMap: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyMap: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p + uintptr(code.Offset)) + } + if maplen(ptrToUnsafePtr(p)) == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadMapPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadMapPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.NextField + break + } + p = ptrToPtr(p + uintptr(code.Offset)) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.NextField + } else { + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p, code.PtrNum) + } + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadOmitEmptyMapPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyMapPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if p == 0 { + code = code.NextField + break + } + p = ptrToPtr(p + uintptr(code.Offset)) + if p == 0 { + code = code.NextField + } else { + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p, code.PtrNum) + } + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadMarshalJSON: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if (code.Flags & encoder.IndirectFlags) != 0 { + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadMarshalJSON: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalJSON { + p = ptrToPtr(p) + } + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyMarshalJSON: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if (code.Flags & encoder.IndirectFlags) != 0 { + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyMarshalJSON: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { + p = ptrToPtr(p) + } + } + iface := ptrToInterface(code, p) + if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalJSON(ctx, code, b, iface) + if err != nil { + return nil, err + } + b = bb + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadMarshalJSONPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadMarshalJSONPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyMarshalJSONPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyMarshalJSONPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if p == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadMarshalText: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if (code.Flags & encoder.IndirectFlags) != 0 { + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadMarshalText: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalText { + p = ptrToPtr(p) + } + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyMarshalText: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if (code.Flags & encoder.IndirectFlags) != 0 { + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyMarshalText: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { + p = ptrToPtr(p) + } + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadMarshalTextPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadMarshalTextPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyMarshalTextPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyMarshalTextPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if p == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructField: + if code.Flags&encoder.IsTaggedKeyFlags != 0 || code.Flags&encoder.AnonymousKeyFlags == 0 { + b = appendStructKey(ctx, code, b) + } + p := load(ctxptr, code.Idx) + uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmpty: + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructFieldInt: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyInt: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldIntString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyIntString: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldIntPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendInt(ctx, b, p, code) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyIntPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p, code) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldIntPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyIntPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldUint: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyUint: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldUintString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyUintString: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldUintPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendUint(ctx, b, p, code) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyUintPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p, code) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldUintPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendUint(ctx, b, p, code) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyUintPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p, code) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat32: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat32: + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat32String: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat32String: + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat32Ptr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendFloat32(ctx, b, ptrToFloat32(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat32Ptr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat32PtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat32PtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat64: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + v := ptrToFloat64(p + uintptr(code.Offset)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat64: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if v != 0 { + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat64String: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat64String: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if v != 0 { + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat64Ptr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat64Ptr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat64PtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat64PtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyString: + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldStringString: + p := load(ctxptr, code.Idx) + s := ptrToString(p + uintptr(code.Offset)) + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, s))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyStringString: + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, v))) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldStringPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendString(ctx, b, ptrToString(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyStringPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, ptrToString(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldStringPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyStringPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldBool: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyBool: + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) + if v { + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldBoolString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyBoolString: + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) + if v { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldBoolPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendBool(ctx, b, ptrToBool(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyBoolPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, ptrToBool(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldBoolPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p)) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyBoolPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p)) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldBytes: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyBytes: + p := load(ctxptr, code.Idx) + v := ptrToBytes(p + uintptr(code.Offset)) + if len(v) > 0 { + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldBytesPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendByteSlice(ctx, b, ptrToBytes(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyBytesPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, ptrToBytes(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldNumber: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpStructFieldOmitEmptyNumber: + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, v) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + } + code = code.Next + case encoder.OpStructFieldNumberString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyNumberString: + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, v) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldNumberPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyNumberPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + } + code = code.Next + case encoder.OpStructFieldNumberPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = append(bb, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyNumberPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldMarshalJSON: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + p = ptrToPtr(p) + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyMarshalJSON: + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + p = ptrToPtr(p) + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + code = code.NextField + break + } + iface := ptrToInterface(code, p) + if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) { + code = code.NextField + break + } + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalJSON(ctx, code, b, iface) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpStructFieldMarshalJSONPtr: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyMarshalJSONPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + } + code = code.Next + case encoder.OpStructFieldMarshalText: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + p = ptrToPtr(p) + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyMarshalText: + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + p = ptrToPtr(p) + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + code = code.NextField + break + } + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpStructFieldMarshalTextPtr: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyMarshalTextPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + } + code = code.Next + case encoder.OpStructFieldArray: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptyArray: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldArrayPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptyArrayPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } else { + code = code.NextField + } + case encoder.OpStructFieldSlice: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptySlice: + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + slice := ptrToSlice(p) + if slice.Len == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructFieldSlicePtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptySlicePtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } else { + code = code.NextField + } + case encoder.OpStructFieldMap: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptyMap: + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) + if p == 0 || maplen(ptrToUnsafePtr(p)) == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructFieldMapPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) + if p != 0 { + p = ptrToNPtr(p, code.PtrNum) + } + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptyMapPtr: + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) + if p != 0 { + p = ptrToNPtr(p, code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } else { + code = code.NextField + } + case encoder.OpStructFieldStruct: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptyStruct: + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructEnd: + b = appendStructEndSkipLast(ctx, code, b) + code = code.Next + case encoder.OpStructEndInt: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyInt: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndIntString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyIntString: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndIntPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendInt(ctx, b, p, code) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyIntPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p, code) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndIntPtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyIntPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndUint: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyUint: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndUintString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyUintString: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndUintPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendUint(ctx, b, p, code) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyUintPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p, code) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndUintPtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendUint(ctx, b, p, code) + b = append(b, '"') + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyUintPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p, code) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat32: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat32: + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, v) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat32String: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat32String: + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, v) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat32Ptr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendFloat32(ctx, b, ptrToFloat32(p)) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat32Ptr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat32PtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = append(b, '"') + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat32PtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat64: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = appendFloat64(ctx, b, v) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat64: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if v != 0 { + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = appendFloat64(ctx, b, v) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat64String: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat64String: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if v != 0 { + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat64Ptr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + b = appendStructEnd(ctx, code, b) + code = code.Next + break + } + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat64Ptr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat64PtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = append(b, '"') + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat64PtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyString: + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, v) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndStringString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + s := ptrToString(p + uintptr(code.Offset)) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, s))) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyStringString: + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, v))) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndStringPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendString(ctx, b, ptrToString(p)) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyStringPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, ptrToString(p)) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndStringPtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyStringPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndBool: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyBool: + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) + if v { + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, v) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndBoolString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyBoolString: + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) + if v { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, v) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndBoolPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendBool(ctx, b, ptrToBool(p)) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyBoolPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, ptrToBool(p)) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndBoolPtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p)) + b = append(b, '"') + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyBoolPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p)) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndBytes: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyBytes: + p := load(ctxptr, code.Idx) + v := ptrToBytes(p + uintptr(code.Offset)) + if len(v) > 0 { + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, v) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndBytesPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendByteSlice(ctx, b, ptrToBytes(p)) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyBytesPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, ptrToBytes(p)) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndNumber: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) + if err != nil { + return nil, err + } + b = appendStructEnd(ctx, code, bb) + code = code.Next + case encoder.OpStructEndOmitEmptyNumber: + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, v) + if err != nil { + return nil, err + } + b = appendStructEnd(ctx, code, bb) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndNumberString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyNumberString: + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, v) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndNumberPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyNumberPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = appendStructEnd(ctx, code, bb) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndNumberPtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = append(bb, '"') + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyNumberPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpEnd: + goto END + } + } +END: + return b, nil +} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm_indent/debug_vm.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_indent/debug_vm.go new file mode 100644 index 000000000..99395388c --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/vm_indent/debug_vm.go @@ -0,0 +1,35 @@ +package vm_indent + +import ( + "fmt" + + "github.com/goccy/go-json/internal/encoder" +) + +func DebugRun(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) { + var code *encoder.Opcode + if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 { + code = codeSet.EscapeKeyCode + } else { + code = codeSet.NoescapeKeyCode + } + + defer func() { + if err := recover(); err != nil { + w := ctx.Option.DebugOut + fmt.Fprintln(w, "=============[DEBUG]===============") + fmt.Fprintln(w, "* [TYPE]") + fmt.Fprintln(w, codeSet.Type) + fmt.Fprintf(w, "\n") + fmt.Fprintln(w, "* [ALL OPCODE]") + fmt.Fprintln(w, code.Dump()) + fmt.Fprintf(w, "\n") + fmt.Fprintln(w, "* [CONTEXT]") + fmt.Fprintf(w, "%+v\n", ctx) + fmt.Fprintln(w, "===================================") + panic(err) + } + }() + + return Run(ctx, b, codeSet) +} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm_indent/hack.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_indent/hack.go new file mode 100644 index 000000000..9e245bfe5 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/vm_indent/hack.go @@ -0,0 +1,9 @@ +package vm_indent + +import ( + // HACK: compile order + // `vm`, `vm_indent`, `vm_color`, `vm_color_indent` packages uses a lot of memory to compile, + // so forcibly make dependencies and avoid compiling in concurrent. + // dependency order: vm => vm_indent => vm_color => vm_color_indent + _ "github.com/goccy/go-json/internal/encoder/vm_color" +) diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm_indent/util.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_indent/util.go new file mode 100644 index 000000000..6cb745e39 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/vm_indent/util.go @@ -0,0 +1,230 @@ +package vm_indent + +import ( + "encoding/json" + "fmt" + "unsafe" + + "github.com/goccy/go-json/internal/encoder" + "github.com/goccy/go-json/internal/runtime" +) + +const uintptrSize = 4 << (^uintptr(0) >> 63) + +var ( + appendInt = encoder.AppendInt + appendUint = encoder.AppendUint + appendFloat32 = encoder.AppendFloat32 + appendFloat64 = encoder.AppendFloat64 + appendString = encoder.AppendString + appendByteSlice = encoder.AppendByteSlice + appendNumber = encoder.AppendNumber + appendStructEnd = encoder.AppendStructEndIndent + appendIndent = encoder.AppendIndent + errUnsupportedValue = encoder.ErrUnsupportedValue + errUnsupportedFloat = encoder.ErrUnsupportedFloat + mapiterinit = encoder.MapIterInit + mapiterkey = encoder.MapIterKey + mapitervalue = encoder.MapIterValue + mapiternext = encoder.MapIterNext + maplen = encoder.MapLen +) + +type emptyInterface struct { + typ *runtime.Type + ptr unsafe.Pointer +} + +type nonEmptyInterface struct { + itab *struct { + ityp *runtime.Type // static interface type + typ *runtime.Type // dynamic concrete type + // unused fields... + } + ptr unsafe.Pointer +} + +func errUnimplementedOp(op encoder.OpType) error { + return fmt.Errorf("encoder (indent): opcode %s has not been implemented", op) +} + +func load(base uintptr, idx uint32) uintptr { + addr := base + uintptr(idx) + return **(**uintptr)(unsafe.Pointer(&addr)) +} + +func store(base uintptr, idx uint32, p uintptr) { + addr := base + uintptr(idx) + **(**uintptr)(unsafe.Pointer(&addr)) = p +} + +func loadNPtr(base uintptr, idx uint32, ptrNum uint8) uintptr { + addr := base + uintptr(idx) + p := **(**uintptr)(unsafe.Pointer(&addr)) + for i := uint8(0); i < ptrNum; i++ { + if p == 0 { + return 0 + } + p = ptrToPtr(p) + } + return p +} + +func ptrToUint64(p uintptr, bitSize uint8) uint64 { + switch bitSize { + case 8: + return (uint64)(**(**uint8)(unsafe.Pointer(&p))) + case 16: + return (uint64)(**(**uint16)(unsafe.Pointer(&p))) + case 32: + return (uint64)(**(**uint32)(unsafe.Pointer(&p))) + case 64: + return **(**uint64)(unsafe.Pointer(&p)) + } + return 0 +} +func ptrToFloat32(p uintptr) float32 { return **(**float32)(unsafe.Pointer(&p)) } +func ptrToFloat64(p uintptr) float64 { return **(**float64)(unsafe.Pointer(&p)) } +func ptrToBool(p uintptr) bool { return **(**bool)(unsafe.Pointer(&p)) } +func ptrToBytes(p uintptr) []byte { return **(**[]byte)(unsafe.Pointer(&p)) } +func ptrToNumber(p uintptr) json.Number { return **(**json.Number)(unsafe.Pointer(&p)) } +func ptrToString(p uintptr) string { return **(**string)(unsafe.Pointer(&p)) } +func ptrToSlice(p uintptr) *runtime.SliceHeader { return *(**runtime.SliceHeader)(unsafe.Pointer(&p)) } +func ptrToPtr(p uintptr) uintptr { + return uintptr(**(**unsafe.Pointer)(unsafe.Pointer(&p))) +} +func ptrToNPtr(p uintptr, ptrNum uint8) uintptr { + for i := uint8(0); i < ptrNum; i++ { + if p == 0 { + return 0 + } + p = ptrToPtr(p) + } + return p +} + +func ptrToUnsafePtr(p uintptr) unsafe.Pointer { + return *(*unsafe.Pointer)(unsafe.Pointer(&p)) +} +func ptrToInterface(code *encoder.Opcode, p uintptr) interface{} { + return *(*interface{})(unsafe.Pointer(&emptyInterface{ + typ: code.Type, + ptr: *(*unsafe.Pointer)(unsafe.Pointer(&p)), + })) +} + +func appendBool(_ *encoder.RuntimeContext, b []byte, v bool) []byte { + if v { + return append(b, "true"...) + } + return append(b, "false"...) +} + +func appendNull(_ *encoder.RuntimeContext, b []byte) []byte { + return append(b, "null"...) +} + +func appendComma(_ *encoder.RuntimeContext, b []byte) []byte { + return append(b, ',', '\n') +} + +func appendNullComma(_ *encoder.RuntimeContext, b []byte) []byte { + return append(b, "null,\n"...) +} + +func appendColon(_ *encoder.RuntimeContext, b []byte) []byte { + return append(b[:len(b)-2], ':', ' ') +} + +func appendMapKeyValue(ctx *encoder.RuntimeContext, code *encoder.Opcode, b, key, value []byte) []byte { + b = appendIndent(ctx, b, code.Indent+1) + b = append(b, key...) + b[len(b)-2] = ':' + b[len(b)-1] = ' ' + return append(b, value...) +} + +func appendMapEnd(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { + b = b[:len(b)-2] + b = append(b, '\n') + b = appendIndent(ctx, b, code.Indent) + return append(b, '}', ',', '\n') +} + +func appendArrayHead(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { + b = append(b, '[', '\n') + return appendIndent(ctx, b, code.Indent+1) +} + +func appendArrayEnd(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { + b = b[:len(b)-2] + b = append(b, '\n') + b = appendIndent(ctx, b, code.Indent) + return append(b, ']', ',', '\n') +} + +func appendEmptyArray(_ *encoder.RuntimeContext, b []byte) []byte { + return append(b, '[', ']', ',', '\n') +} + +func appendEmptyObject(_ *encoder.RuntimeContext, b []byte) []byte { + return append(b, '{', '}', ',', '\n') +} + +func appendObjectEnd(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { + last := len(b) - 1 + // replace comma to newline + b[last-1] = '\n' + b = appendIndent(ctx, b[:last], code.Indent) + return append(b, '}', ',', '\n') +} + +func appendMarshalJSON(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) { + return encoder.AppendMarshalJSONIndent(ctx, code, b, v) +} + +func appendMarshalText(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) { + return encoder.AppendMarshalTextIndent(ctx, code, b, v) +} + +func appendStructHead(_ *encoder.RuntimeContext, b []byte) []byte { + return append(b, '{', '\n') +} + +func appendStructKey(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { + b = appendIndent(ctx, b, code.Indent) + b = append(b, code.Key...) + return append(b, ' ') +} + +func appendStructEndSkipLast(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { + last := len(b) - 1 + if b[last-1] == '{' { + b[last] = '}' + } else { + if b[last] == '\n' { + // to remove ',' and '\n' characters + b = b[:len(b)-2] + } + b = append(b, '\n') + b = appendIndent(ctx, b, code.Indent-1) + b = append(b, '}') + } + return appendComma(ctx, b) +} + +func restoreIndent(ctx *encoder.RuntimeContext, code *encoder.Opcode, ctxptr uintptr) { + ctx.BaseIndent = uint32(load(ctxptr, code.Length)) +} + +func storeIndent(ctxptr uintptr, code *encoder.Opcode, indent uintptr) { + store(ctxptr, code.Length, indent) +} + +func appendArrayElemIndent(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { + return appendIndent(ctx, b, code.Indent+1) +} + +func appendMapKeyIndent(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { + return appendIndent(ctx, b, code.Indent) +} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm_indent/vm.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_indent/vm.go new file mode 100644 index 000000000..836c5c8a8 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/encoder/vm_indent/vm.go @@ -0,0 +1,4859 @@ +// Code generated by internal/cmd/generator. DO NOT EDIT! +package vm_indent + +import ( + "math" + "reflect" + "sort" + "unsafe" + + "github.com/goccy/go-json/internal/encoder" + "github.com/goccy/go-json/internal/runtime" +) + +func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) { + recursiveLevel := 0 + ptrOffset := uintptr(0) + ctxptr := ctx.Ptr() + var code *encoder.Opcode + if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 { + code = codeSet.EscapeKeyCode + } else { + code = codeSet.NoescapeKeyCode + } + + for { + switch code.Op { + default: + return nil, errUnimplementedOp(code.Op) + case encoder.OpPtr: + p := load(ctxptr, code.Idx) + code = code.Next + store(ctxptr, code.Idx, ptrToPtr(p)) + case encoder.OpIntPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpInt: + b = appendInt(ctx, b, load(ctxptr, code.Idx), code) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpUintPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpUint: + b = appendUint(ctx, b, load(ctxptr, code.Idx), code) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpIntString: + b = append(b, '"') + b = appendInt(ctx, b, load(ctxptr, code.Idx), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpUintString: + b = append(b, '"') + b = appendUint(ctx, b, load(ctxptr, code.Idx), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpFloat32Ptr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpFloat32: + b = appendFloat32(ctx, b, ptrToFloat32(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpFloat64Ptr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpFloat64: + v := ptrToFloat64(load(ctxptr, code.Idx)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStringPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpString: + b = appendString(ctx, b, ptrToString(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpBoolPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpBool: + b = appendBool(ctx, b, ptrToBool(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpBytesPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpBytes: + b = appendByteSlice(ctx, b, ptrToBytes(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpNumberPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpNumber: + bb, err := appendNumber(ctx, b, ptrToNumber(load(ctxptr, code.Idx))) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpInterfacePtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpInterface: + p := load(ctxptr, code.Idx) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + if recursiveLevel > encoder.StartDetectingCyclesAfter { + for _, seen := range ctx.SeenPtr { + if p == seen { + return nil, errUnsupportedValue(code, p) + } + } + } + ctx.SeenPtr = append(ctx.SeenPtr, p) + var ( + typ *runtime.Type + ifacePtr unsafe.Pointer + ) + up := ptrToUnsafePtr(p) + if code.Flags&encoder.NonEmptyInterfaceFlags != 0 { + iface := (*nonEmptyInterface)(up) + ifacePtr = iface.ptr + if iface.itab != nil { + typ = iface.itab.typ + } + } else { + iface := (*emptyInterface)(up) + ifacePtr = iface.ptr + typ = iface.typ + } + if ifacePtr == nil { + isDirectedNil := typ != nil && typ.Kind() == reflect.Struct && !runtime.IfaceIndir(typ) + if !isDirectedNil { + b = appendNullComma(ctx, b) + code = code.Next + break + } + } + ctx.KeepRefs = append(ctx.KeepRefs, up) + ifaceCodeSet, err := encoder.CompileToGetCodeSet(ctx, uintptr(unsafe.Pointer(typ))) + if err != nil { + return nil, err + } + + totalLength := uintptr(code.Length) + 3 + nextTotalLength := uintptr(ifaceCodeSet.CodeLength) + 3 + + var c *encoder.Opcode + if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 { + c = ifaceCodeSet.InterfaceEscapeKeyCode + } else { + c = ifaceCodeSet.InterfaceNoescapeKeyCode + } + curlen := uintptr(len(ctx.Ptrs)) + offsetNum := ptrOffset / uintptrSize + oldOffset := ptrOffset + ptrOffset += totalLength * uintptrSize + oldBaseIndent := ctx.BaseIndent + ctx.BaseIndent += code.Indent + + newLen := offsetNum + totalLength + nextTotalLength + if curlen < newLen { + ctx.Ptrs = append(ctx.Ptrs, make([]uintptr, newLen-curlen)...) + } + ctxptr = ctx.Ptr() + ptrOffset // assign new ctxptr + + end := ifaceCodeSet.EndCode + store(ctxptr, c.Idx, uintptr(ifacePtr)) + store(ctxptr, end.Idx, oldOffset) + store(ctxptr, end.ElemIdx, uintptr(unsafe.Pointer(code.Next))) + storeIndent(ctxptr, end, uintptr(oldBaseIndent)) + code = c + recursiveLevel++ + case encoder.OpInterfaceEnd: + recursiveLevel-- + + // restore ctxptr + offset := load(ctxptr, code.Idx) + restoreIndent(ctx, code, ctxptr) + ctx.SeenPtr = ctx.SeenPtr[:len(ctx.SeenPtr)-1] + + codePtr := load(ctxptr, code.ElemIdx) + code = (*encoder.Opcode)(ptrToUnsafePtr(codePtr)) + ctxptr = ctx.Ptr() + offset + ptrOffset = offset + case encoder.OpMarshalJSONPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, ptrToPtr(p)) + fallthrough + case encoder.OpMarshalJSON: + p := load(ctxptr, code.Idx) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p) + } + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpMarshalTextPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, ptrToPtr(p)) + fallthrough + case encoder.OpMarshalText: + p := load(ctxptr, code.Idx) + if p == 0 { + b = append(b, `""`...) + b = appendComma(ctx, b) + code = code.Next + break + } + if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p) + } + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpSlicePtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.End.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpSlice: + p := load(ctxptr, code.Idx) + slice := ptrToSlice(p) + if p == 0 || slice.Data == nil { + b = appendNullComma(ctx, b) + code = code.End.Next + break + } + store(ctxptr, code.ElemIdx, 0) + store(ctxptr, code.Length, uintptr(slice.Len)) + store(ctxptr, code.Idx, uintptr(slice.Data)) + if slice.Len > 0 { + b = appendArrayHead(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, uintptr(slice.Data)) + } else { + b = appendEmptyArray(ctx, b) + code = code.End.Next + } + case encoder.OpSliceElem: + idx := load(ctxptr, code.ElemIdx) + length := load(ctxptr, code.Length) + idx++ + if idx < length { + b = appendArrayElemIndent(ctx, code, b) + store(ctxptr, code.ElemIdx, idx) + data := load(ctxptr, code.Idx) + size := uintptr(code.Size) + code = code.Next + store(ctxptr, code.Idx, data+idx*size) + } else { + b = appendArrayEnd(ctx, code, b) + code = code.End.Next + } + case encoder.OpArrayPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.End.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpArray: + p := load(ctxptr, code.Idx) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.End.Next + break + } + if code.Length > 0 { + b = appendArrayHead(ctx, code, b) + store(ctxptr, code.ElemIdx, 0) + code = code.Next + store(ctxptr, code.Idx, p) + } else { + b = appendEmptyArray(ctx, b) + code = code.End.Next + } + case encoder.OpArrayElem: + idx := load(ctxptr, code.ElemIdx) + idx++ + if idx < uintptr(code.Length) { + b = appendArrayElemIndent(ctx, code, b) + store(ctxptr, code.ElemIdx, idx) + p := load(ctxptr, code.Idx) + size := uintptr(code.Size) + code = code.Next + store(ctxptr, code.Idx, p+idx*size) + } else { + b = appendArrayEnd(ctx, code, b) + code = code.End.Next + } + case encoder.OpMapPtr: + p := loadNPtr(ctxptr, code.Idx, code.PtrNum) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.End.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpMap: + p := load(ctxptr, code.Idx) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.End.Next + break + } + uptr := ptrToUnsafePtr(p) + mlen := maplen(uptr) + if mlen <= 0 { + b = appendEmptyObject(ctx, b) + code = code.End.Next + break + } + b = appendStructHead(ctx, b) + unorderedMap := (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 + mapCtx := encoder.NewMapContext(mlen, unorderedMap) + mapiterinit(code.Type, uptr, &mapCtx.Iter) + store(ctxptr, code.Idx, uintptr(unsafe.Pointer(mapCtx))) + ctx.KeepRefs = append(ctx.KeepRefs, unsafe.Pointer(mapCtx)) + if unorderedMap { + b = appendMapKeyIndent(ctx, code.Next, b) + } else { + mapCtx.Start = len(b) + mapCtx.First = len(b) + } + key := mapiterkey(&mapCtx.Iter) + store(ctxptr, code.Next.Idx, uintptr(key)) + code = code.Next + case encoder.OpMapKey: + mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx))) + idx := mapCtx.Idx + idx++ + if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 { + if idx < mapCtx.Len { + b = appendMapKeyIndent(ctx, code, b) + mapCtx.Idx = int(idx) + key := mapiterkey(&mapCtx.Iter) + store(ctxptr, code.Next.Idx, uintptr(key)) + code = code.Next + } else { + b = appendObjectEnd(ctx, code, b) + encoder.ReleaseMapContext(mapCtx) + code = code.End.Next + } + } else { + mapCtx.Slice.Items[mapCtx.Idx].Value = b[mapCtx.Start:len(b)] + if idx < mapCtx.Len { + mapCtx.Idx = int(idx) + mapCtx.Start = len(b) + key := mapiterkey(&mapCtx.Iter) + store(ctxptr, code.Next.Idx, uintptr(key)) + code = code.Next + } else { + code = code.End + } + } + case encoder.OpMapValue: + mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx))) + if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 { + b = appendColon(ctx, b) + } else { + mapCtx.Slice.Items[mapCtx.Idx].Key = b[mapCtx.Start:len(b)] + mapCtx.Start = len(b) + } + value := mapitervalue(&mapCtx.Iter) + store(ctxptr, code.Next.Idx, uintptr(value)) + mapiternext(&mapCtx.Iter) + code = code.Next + case encoder.OpMapEnd: + // this operation only used by sorted map. + mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx))) + sort.Sort(mapCtx.Slice) + buf := mapCtx.Buf + for _, item := range mapCtx.Slice.Items { + buf = appendMapKeyValue(ctx, code, buf, item.Key, item.Value) + } + buf = appendMapEnd(ctx, code, buf) + b = b[:mapCtx.First] + b = append(b, buf...) + mapCtx.Buf = buf + encoder.ReleaseMapContext(mapCtx) + code = code.Next + case encoder.OpRecursivePtr: + p := load(ctxptr, code.Idx) + if p == 0 { + code = code.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpRecursive: + ptr := load(ctxptr, code.Idx) + if ptr != 0 { + if recursiveLevel > encoder.StartDetectingCyclesAfter { + for _, seen := range ctx.SeenPtr { + if ptr == seen { + return nil, errUnsupportedValue(code, ptr) + } + } + } + } + ctx.SeenPtr = append(ctx.SeenPtr, ptr) + c := code.Jmp.Code + curlen := uintptr(len(ctx.Ptrs)) + offsetNum := ptrOffset / uintptrSize + oldOffset := ptrOffset + ptrOffset += code.Jmp.CurLen * uintptrSize + oldBaseIndent := ctx.BaseIndent + indentDiffFromTop := c.Indent - 1 + ctx.BaseIndent += code.Indent - indentDiffFromTop + + newLen := offsetNum + code.Jmp.CurLen + code.Jmp.NextLen + if curlen < newLen { + ctx.Ptrs = append(ctx.Ptrs, make([]uintptr, newLen-curlen)...) + } + ctxptr = ctx.Ptr() + ptrOffset // assign new ctxptr + + store(ctxptr, c.Idx, ptr) + store(ctxptr, c.End.Next.Idx, oldOffset) + store(ctxptr, c.End.Next.ElemIdx, uintptr(unsafe.Pointer(code.Next))) + storeIndent(ctxptr, c.End.Next, uintptr(oldBaseIndent)) + code = c + recursiveLevel++ + case encoder.OpRecursiveEnd: + recursiveLevel-- + + // restore ctxptr + restoreIndent(ctx, code, ctxptr) + offset := load(ctxptr, code.Idx) + ctx.SeenPtr = ctx.SeenPtr[:len(ctx.SeenPtr)-1] + + codePtr := load(ctxptr, code.ElemIdx) + code = (*encoder.Opcode)(ptrToUnsafePtr(codePtr)) + ctxptr = ctx.Ptr() + offset + ptrOffset = offset + case encoder.OpStructPtrHead: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHead: + p := load(ctxptr, code.Idx) + if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if len(code.Key) > 0 { + if (code.Flags&encoder.IsTaggedKeyFlags) != 0 || code.Flags&encoder.AnonymousKeyFlags == 0 { + b = appendStructKey(ctx, code, b) + } + } + p += uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructPtrHeadOmitEmpty: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmpty: + p := load(ctxptr, code.Idx) + if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + p += uintptr(code.Offset) + if p == 0 || (ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0) { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadInt: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadInt: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyInt: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyInt: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadIntString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadIntString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyIntString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyIntString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + p += uintptr(code.Offset) + u64 := ptrToUint64(p, code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadIntPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadIntPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendInt(ctx, b, p, code) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyIntPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyIntPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p, code) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadIntPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadIntPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyIntPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyIntPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadUint: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadUint: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyUint: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyUint: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadUintString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadUintString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyUintString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyUintString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadUintPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadUintPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendUint(ctx, b, p, code) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyUintPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyUintPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p, code) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadUintPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadUintPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendUint(ctx, b, p, code) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyUintPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyUintPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p, code) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadFloat32: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadFloat32: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat32: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyFloat32: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToFloat32(p + uintptr(code.Offset)) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadFloat32String: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadFloat32String: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat32String: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyFloat32String: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToFloat32(p + uintptr(code.Offset)) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadFloat32Ptr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadFloat32Ptr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendFloat32(ctx, b, ptrToFloat32(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat32Ptr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyFloat32Ptr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadFloat32PtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadFloat32PtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat32PtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyFloat32PtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadFloat64: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadFloat64: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + v := ptrToFloat64(p + uintptr(code.Offset)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat64: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyFloat64: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToFloat64(p + uintptr(code.Offset)) + if v == 0 { + code = code.NextField + } else { + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadFloat64String: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadFloat64String: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToFloat64(p + uintptr(code.Offset)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat64String: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyFloat64String: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToFloat64(p + uintptr(code.Offset)) + if v == 0 { + code = code.NextField + } else { + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadFloat64Ptr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadFloat64Ptr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat64Ptr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyFloat64Ptr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadFloat64PtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadFloat64PtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyFloat64PtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyFloat64PtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToString(p + uintptr(code.Offset)) + if v == "" { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadStringString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadStringString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p+uintptr(code.Offset))))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyStringString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyStringString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToString(p + uintptr(code.Offset)) + if v == "" { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, v))) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadStringPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadStringPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendString(ctx, b, ptrToString(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyStringPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyStringPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, ptrToString(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadStringPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadStringPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyStringPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyStringPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadBool: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadBool: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyBool: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyBool: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToBool(p + uintptr(code.Offset)) + if v { + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + } else { + code = code.NextField + } + case encoder.OpStructPtrHeadBoolString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadBoolString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyBoolString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyBoolString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToBool(p + uintptr(code.Offset)) + if v { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + } else { + code = code.NextField + } + case encoder.OpStructPtrHeadBoolPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadBoolPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendBool(ctx, b, ptrToBool(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyBoolPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyBoolPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, ptrToBool(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadBoolPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadBoolPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p)) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyBoolPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyBoolPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p)) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadBytes: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadBytes: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyBytes: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyBytes: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToBytes(p + uintptr(code.Offset)) + if len(v) == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadBytesPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadBytesPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendByteSlice(ctx, b, ptrToBytes(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyBytesPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyBytesPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, ptrToBytes(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadNumber: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadNumber: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyNumber: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyNumber: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToNumber(p + uintptr(code.Offset)) + if v == "" { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, v) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + } + case encoder.OpStructPtrHeadNumberString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadNumberString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyNumberString: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyNumberString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + v := ptrToNumber(p + uintptr(code.Offset)) + if v == "" { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, v) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadNumberPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadNumberPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyNumberPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyNumberPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + } + code = code.Next + case encoder.OpStructPtrHeadNumberPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadNumberPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = append(bb, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyNumberPtrString: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyNumberPtrString: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadArray, encoder.OpStructHeadSlice: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + p += uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructPtrHeadOmitEmptyArray: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyArray: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + p += uintptr(code.Offset) + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructPtrHeadOmitEmptySlice: + if (code.Flags & encoder.IndirectFlags) != 0 { + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptySlice: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + p += uintptr(code.Offset) + slice := ptrToSlice(p) + if slice.Len == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadSlicePtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadSlicePtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNullComma(ctx, b) + code = code.NextField + } else { + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadOmitEmptyArrayPtr, encoder.OpStructPtrHeadOmitEmptySlicePtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyArrayPtr, encoder.OpStructHeadOmitEmptySlicePtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadMap: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadMap: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p + uintptr(code.Offset)) + } + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructPtrHeadOmitEmptyMap: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyMap: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p + uintptr(code.Offset)) + } + if maplen(ptrToUnsafePtr(p)) == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadMapPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadMapPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.NextField + break + } + p = ptrToPtr(p + uintptr(code.Offset)) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.NextField + } else { + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p, code.PtrNum) + } + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadOmitEmptyMapPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyMapPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if p == 0 { + code = code.NextField + break + } + p = ptrToPtr(p + uintptr(code.Offset)) + if p == 0 { + code = code.NextField + } else { + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p, code.PtrNum) + } + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructPtrHeadMarshalJSON: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if (code.Flags & encoder.IndirectFlags) != 0 { + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadMarshalJSON: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalJSON { + p = ptrToPtr(p) + } + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyMarshalJSON: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if (code.Flags & encoder.IndirectFlags) != 0 { + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyMarshalJSON: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { + p = ptrToPtr(p) + } + } + iface := ptrToInterface(code, p) + if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalJSON(ctx, code, b, iface) + if err != nil { + return nil, err + } + b = bb + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadMarshalJSONPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadMarshalJSONPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyMarshalJSONPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyMarshalJSONPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if p == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadMarshalText: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if (code.Flags & encoder.IndirectFlags) != 0 { + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadMarshalText: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalText { + p = ptrToPtr(p) + } + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyMarshalText: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if (code.Flags & encoder.IndirectFlags) != 0 { + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + } + fallthrough + case encoder.OpStructHeadOmitEmptyMarshalText: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { + p = ptrToPtr(p) + } + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructPtrHeadMarshalTextPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadMarshalTextPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + b = appendStructKey(ctx, code, b) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructPtrHeadOmitEmptyMarshalTextPtr: + p := load(ctxptr, code.Idx) + if p == 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) + fallthrough + case encoder.OpStructHeadOmitEmptyMarshalTextPtr: + p := load(ctxptr, code.Idx) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNullComma(ctx, b) + } + code = code.End.Next + break + } + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if p == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + b = appendComma(ctx, b) + code = code.Next + } + case encoder.OpStructField: + if code.Flags&encoder.IsTaggedKeyFlags != 0 || code.Flags&encoder.AnonymousKeyFlags == 0 { + b = appendStructKey(ctx, code, b) + } + p := load(ctxptr, code.Idx) + uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmpty: + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructFieldInt: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyInt: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldIntString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyIntString: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldIntPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendInt(ctx, b, p, code) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyIntPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p, code) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldIntPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyIntPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldUint: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyUint: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldUintString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyUintString: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldUintPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendUint(ctx, b, p, code) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyUintPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p, code) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldUintPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendUint(ctx, b, p, code) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyUintPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p, code) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat32: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat32: + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat32String: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat32String: + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat32Ptr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendFloat32(ctx, b, ptrToFloat32(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat32Ptr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat32PtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat32PtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat64: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + v := ptrToFloat64(p + uintptr(code.Offset)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat64: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if v != 0 { + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat64String: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat64String: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if v != 0 { + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat64Ptr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNullComma(ctx, b) + code = code.Next + break + } + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat64Ptr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldFloat64PtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyFloat64PtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyString: + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldStringString: + p := load(ctxptr, code.Idx) + s := ptrToString(p + uintptr(code.Offset)) + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, s))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyStringString: + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, v))) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldStringPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendString(ctx, b, ptrToString(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyStringPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, ptrToString(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldStringPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyStringPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldBool: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyBool: + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) + if v { + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldBoolString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = append(b, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyBoolString: + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) + if v { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, v) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldBoolPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendBool(ctx, b, ptrToBool(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyBoolPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, ptrToBool(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldBoolPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p)) + b = append(b, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyBoolPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p)) + b = append(b, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldBytes: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyBytes: + p := load(ctxptr, code.Idx) + v := ptrToBytes(p + uintptr(code.Offset)) + if len(v) > 0 { + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, v) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldBytesPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendByteSlice(ctx, b, ptrToBytes(p)) + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyBytesPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, ptrToBytes(p)) + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldNumber: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpStructFieldOmitEmptyNumber: + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, v) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + } + code = code.Next + case encoder.OpStructFieldNumberString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyNumberString: + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, v) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldNumberPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyNumberPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + } + code = code.Next + case encoder.OpStructFieldNumberPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + b = appendStructKey(ctx, code, b) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = append(bb, '"') + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyNumberPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendComma(ctx, b) + } + code = code.Next + case encoder.OpStructFieldMarshalJSON: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + p = ptrToPtr(p) + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyMarshalJSON: + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + p = ptrToPtr(p) + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + code = code.NextField + break + } + iface := ptrToInterface(code, p) + if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) { + code = code.NextField + break + } + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalJSON(ctx, code, b, iface) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpStructFieldMarshalJSONPtr: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyMarshalJSONPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + } + code = code.Next + case encoder.OpStructFieldMarshalText: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + p = ptrToPtr(p) + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyMarshalText: + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + p = ptrToPtr(p) + } + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + code = code.NextField + break + } + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + code = code.Next + case encoder.OpStructFieldMarshalTextPtr: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendComma(ctx, b) + code = code.Next + case encoder.OpStructFieldOmitEmptyMarshalTextPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) + if err != nil { + return nil, err + } + b = appendComma(ctx, bb) + } + code = code.Next + case encoder.OpStructFieldArray: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptyArray: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldArrayPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptyArrayPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } else { + code = code.NextField + } + case encoder.OpStructFieldSlice: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptySlice: + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + slice := ptrToSlice(p) + if slice.Len == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructFieldSlicePtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptySlicePtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } else { + code = code.NextField + } + case encoder.OpStructFieldMap: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptyMap: + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) + if p == 0 || maplen(ptrToUnsafePtr(p)) == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructFieldMapPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) + if p != 0 { + p = ptrToNPtr(p, code.PtrNum) + } + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptyMapPtr: + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) + if p != 0 { + p = ptrToNPtr(p, code.PtrNum) + } + if p != 0 { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } else { + code = code.NextField + } + case encoder.OpStructFieldStruct: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + code = code.Next + store(ctxptr, code.Idx, p) + case encoder.OpStructFieldOmitEmptyStruct: + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + code = code.Next + store(ctxptr, code.Idx, p) + } + case encoder.OpStructEnd: + b = appendStructEndSkipLast(ctx, code, b) + code = code.Next + case encoder.OpStructEndInt: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyInt: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndIntString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyIntString: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndIntPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendInt(ctx, b, p, code) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyIntPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, p, code) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndIntPtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyIntPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, p, code) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndUint: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyUint: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndUintString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyUintString: + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p+uintptr(code.Offset), code) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndUintPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendUint(ctx, b, p, code) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyUintPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, p, code) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndUintPtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendUint(ctx, b, p, code) + b = append(b, '"') + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyUintPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, p, code) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat32: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat32: + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, v) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat32String: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat32String: + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, v) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat32Ptr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendFloat32(ctx, b, ptrToFloat32(p)) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat32Ptr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat32PtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = append(b, '"') + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat32PtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat64: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = appendFloat64(ctx, b, v) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat64: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if v != 0 { + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = appendFloat64(ctx, b, v) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat64String: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat64String: + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) + if v != 0 { + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat64Ptr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + b = appendStructEnd(ctx, code, b) + code = code.Next + break + } + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat64Ptr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndFloat64PtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = appendFloat64(ctx, b, v) + b = append(b, '"') + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyFloat64PtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = append(b, '"') + b = appendFloat64(ctx, b, v) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyString: + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, v) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndStringString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + s := ptrToString(p + uintptr(code.Offset)) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, s))) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyStringString: + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, v))) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndStringPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendString(ctx, b, ptrToString(p)) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyStringPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, ptrToString(p)) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndStringPtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyStringPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndBool: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyBool: + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) + if v { + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, v) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndBoolString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyBoolString: + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) + if v { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, v) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndBoolPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendBool(ctx, b, ptrToBool(p)) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyBoolPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendBool(ctx, b, ptrToBool(p)) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndBoolPtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p)) + b = append(b, '"') + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyBoolPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendBool(ctx, b, ptrToBool(p)) + b = append(b, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndBytes: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyBytes: + p := load(ctxptr, code.Idx) + v := ptrToBytes(p + uintptr(code.Offset)) + if len(v) > 0 { + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, v) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndBytesPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = appendByteSlice(ctx, b, ptrToBytes(p)) + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyBytesPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = appendByteSlice(ctx, b, ptrToBytes(p)) + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndNumber: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) + if err != nil { + return nil, err + } + b = appendStructEnd(ctx, code, bb) + code = code.Next + case encoder.OpStructEndOmitEmptyNumber: + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, v) + if err != nil { + return nil, err + } + b = appendStructEnd(ctx, code, bb) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndNumberString: + p := load(ctxptr, code.Idx) + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyNumberString: + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) + if v != "" { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, v) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndNumberPtr: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = bb + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyNumberPtr: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = appendStructEnd(ctx, code, bb) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpStructEndNumberPtrString: + b = appendStructKey(ctx, code, b) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p == 0 { + b = appendNull(ctx, b) + } else { + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = append(bb, '"') + } + b = appendStructEnd(ctx, code, b) + code = code.Next + case encoder.OpStructEndOmitEmptyNumberPtrString: + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + if p != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + bb, err := appendNumber(ctx, b, ptrToNumber(p)) + if err != nil { + return nil, err + } + b = append(bb, '"') + b = appendStructEnd(ctx, code, b) + } else { + b = appendStructEndSkipLast(ctx, code, b) + } + code = code.Next + case encoder.OpEnd: + goto END + } + } +END: + return b, nil +} diff --git a/vendor/github.com/goccy/go-json/internal/errors/error.go b/vendor/github.com/goccy/go-json/internal/errors/error.go new file mode 100644 index 000000000..9207d0ff2 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/errors/error.go @@ -0,0 +1,183 @@ +package errors + +import ( + "fmt" + "reflect" + "strconv" +) + +type InvalidUTF8Error struct { + S string // the whole string value that caused the error +} + +func (e *InvalidUTF8Error) Error() string { + return fmt.Sprintf("json: invalid UTF-8 in string: %s", strconv.Quote(e.S)) +} + +type InvalidUnmarshalError struct { + Type reflect.Type +} + +func (e *InvalidUnmarshalError) Error() string { + if e.Type == nil { + return "json: Unmarshal(nil)" + } + + if e.Type.Kind() != reflect.Ptr { + return fmt.Sprintf("json: Unmarshal(non-pointer %s)", e.Type) + } + return fmt.Sprintf("json: Unmarshal(nil %s)", e.Type) +} + +// A MarshalerError represents an error from calling a MarshalJSON or MarshalText method. +type MarshalerError struct { + Type reflect.Type + Err error + sourceFunc string +} + +func (e *MarshalerError) Error() string { + srcFunc := e.sourceFunc + if srcFunc == "" { + srcFunc = "MarshalJSON" + } + return fmt.Sprintf("json: error calling %s for type %s: %s", srcFunc, e.Type, e.Err.Error()) +} + +// Unwrap returns the underlying error. +func (e *MarshalerError) Unwrap() error { return e.Err } + +// A SyntaxError is a description of a JSON syntax error. +type SyntaxError struct { + msg string // description of error + Offset int64 // error occurred after reading Offset bytes +} + +func (e *SyntaxError) Error() string { return e.msg } + +// An UnmarshalFieldError describes a JSON object key that +// led to an unexported (and therefore unwritable) struct field. +// +// Deprecated: No longer used; kept for compatibility. +type UnmarshalFieldError struct { + Key string + Type reflect.Type + Field reflect.StructField +} + +func (e *UnmarshalFieldError) Error() string { + return fmt.Sprintf("json: cannot unmarshal object key %s into unexported field %s of type %s", + strconv.Quote(e.Key), e.Field.Name, e.Type.String(), + ) +} + +// An UnmarshalTypeError describes a JSON value that was +// not appropriate for a value of a specific Go type. +type UnmarshalTypeError struct { + Value string // description of JSON value - "bool", "array", "number -5" + Type reflect.Type // type of Go value it could not be assigned to + Offset int64 // error occurred after reading Offset bytes + Struct string // name of the struct type containing the field + Field string // the full path from root node to the field +} + +func (e *UnmarshalTypeError) Error() string { + if e.Struct != "" || e.Field != "" { + return fmt.Sprintf("json: cannot unmarshal %s into Go struct field %s.%s of type %s", + e.Value, e.Struct, e.Field, e.Type, + ) + } + return fmt.Sprintf("json: cannot unmarshal %s into Go value of type %s", e.Value, e.Type) +} + +// An UnsupportedTypeError is returned by Marshal when attempting +// to encode an unsupported value type. +type UnsupportedTypeError struct { + Type reflect.Type +} + +func (e *UnsupportedTypeError) Error() string { + return fmt.Sprintf("json: unsupported type: %s", e.Type) +} + +type UnsupportedValueError struct { + Value reflect.Value + Str string +} + +func (e *UnsupportedValueError) Error() string { + return fmt.Sprintf("json: unsupported value: %s", e.Str) +} + +func ErrSyntax(msg string, offset int64) *SyntaxError { + return &SyntaxError{msg: msg, Offset: offset} +} + +func ErrMarshaler(typ reflect.Type, err error, msg string) *MarshalerError { + return &MarshalerError{ + Type: typ, + Err: err, + sourceFunc: msg, + } +} + +func ErrExceededMaxDepth(c byte, cursor int64) *SyntaxError { + return &SyntaxError{ + msg: fmt.Sprintf(`invalid character "%c" exceeded max depth`, c), + Offset: cursor, + } +} + +func ErrNotAtBeginningOfValue(cursor int64) *SyntaxError { + return &SyntaxError{msg: "not at beginning of value", Offset: cursor} +} + +func ErrUnexpectedEndOfJSON(msg string, cursor int64) *SyntaxError { + return &SyntaxError{ + msg: fmt.Sprintf("json: %s unexpected end of JSON input", msg), + Offset: cursor, + } +} + +func ErrExpected(msg string, cursor int64) *SyntaxError { + return &SyntaxError{msg: fmt.Sprintf("expected %s", msg), Offset: cursor} +} + +func ErrInvalidCharacter(c byte, context string, cursor int64) *SyntaxError { + if c == 0 { + return &SyntaxError{ + msg: fmt.Sprintf("json: invalid character as %s", context), + Offset: cursor, + } + } + return &SyntaxError{ + msg: fmt.Sprintf("json: invalid character %c as %s", c, context), + Offset: cursor, + } +} + +func ErrInvalidBeginningOfValue(c byte, cursor int64) *SyntaxError { + return &SyntaxError{ + msg: fmt.Sprintf("invalid character '%c' looking for beginning of value", c), + Offset: cursor, + } +} + +type PathError struct { + msg string +} + +func (e *PathError) Error() string { + return fmt.Sprintf("json: invalid path format: %s", e.msg) +} + +func ErrInvalidPath(msg string, args ...interface{}) *PathError { + if len(args) != 0 { + return &PathError{msg: fmt.Sprintf(msg, args...)} + } + return &PathError{msg: msg} +} + +func ErrEmptyPath() *PathError { + return &PathError{msg: "path is empty"} +} diff --git a/vendor/github.com/goccy/go-json/internal/runtime/rtype.go b/vendor/github.com/goccy/go-json/internal/runtime/rtype.go new file mode 100644 index 000000000..4db10debe --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/runtime/rtype.go @@ -0,0 +1,263 @@ +package runtime + +import ( + "reflect" + "unsafe" +) + +// Type representing reflect.rtype for noescape trick +type Type struct{} + +//go:linkname rtype_Align reflect.(*rtype).Align +//go:noescape +func rtype_Align(*Type) int + +func (t *Type) Align() int { + return rtype_Align(t) +} + +//go:linkname rtype_FieldAlign reflect.(*rtype).FieldAlign +//go:noescape +func rtype_FieldAlign(*Type) int + +func (t *Type) FieldAlign() int { + return rtype_FieldAlign(t) +} + +//go:linkname rtype_Method reflect.(*rtype).Method +//go:noescape +func rtype_Method(*Type, int) reflect.Method + +func (t *Type) Method(a0 int) reflect.Method { + return rtype_Method(t, a0) +} + +//go:linkname rtype_MethodByName reflect.(*rtype).MethodByName +//go:noescape +func rtype_MethodByName(*Type, string) (reflect.Method, bool) + +func (t *Type) MethodByName(a0 string) (reflect.Method, bool) { + return rtype_MethodByName(t, a0) +} + +//go:linkname rtype_NumMethod reflect.(*rtype).NumMethod +//go:noescape +func rtype_NumMethod(*Type) int + +func (t *Type) NumMethod() int { + return rtype_NumMethod(t) +} + +//go:linkname rtype_Name reflect.(*rtype).Name +//go:noescape +func rtype_Name(*Type) string + +func (t *Type) Name() string { + return rtype_Name(t) +} + +//go:linkname rtype_PkgPath reflect.(*rtype).PkgPath +//go:noescape +func rtype_PkgPath(*Type) string + +func (t *Type) PkgPath() string { + return rtype_PkgPath(t) +} + +//go:linkname rtype_Size reflect.(*rtype).Size +//go:noescape +func rtype_Size(*Type) uintptr + +func (t *Type) Size() uintptr { + return rtype_Size(t) +} + +//go:linkname rtype_String reflect.(*rtype).String +//go:noescape +func rtype_String(*Type) string + +func (t *Type) String() string { + return rtype_String(t) +} + +//go:linkname rtype_Kind reflect.(*rtype).Kind +//go:noescape +func rtype_Kind(*Type) reflect.Kind + +func (t *Type) Kind() reflect.Kind { + return rtype_Kind(t) +} + +//go:linkname rtype_Implements reflect.(*rtype).Implements +//go:noescape +func rtype_Implements(*Type, reflect.Type) bool + +func (t *Type) Implements(u reflect.Type) bool { + return rtype_Implements(t, u) +} + +//go:linkname rtype_AssignableTo reflect.(*rtype).AssignableTo +//go:noescape +func rtype_AssignableTo(*Type, reflect.Type) bool + +func (t *Type) AssignableTo(u reflect.Type) bool { + return rtype_AssignableTo(t, u) +} + +//go:linkname rtype_ConvertibleTo reflect.(*rtype).ConvertibleTo +//go:noescape +func rtype_ConvertibleTo(*Type, reflect.Type) bool + +func (t *Type) ConvertibleTo(u reflect.Type) bool { + return rtype_ConvertibleTo(t, u) +} + +//go:linkname rtype_Comparable reflect.(*rtype).Comparable +//go:noescape +func rtype_Comparable(*Type) bool + +func (t *Type) Comparable() bool { + return rtype_Comparable(t) +} + +//go:linkname rtype_Bits reflect.(*rtype).Bits +//go:noescape +func rtype_Bits(*Type) int + +func (t *Type) Bits() int { + return rtype_Bits(t) +} + +//go:linkname rtype_ChanDir reflect.(*rtype).ChanDir +//go:noescape +func rtype_ChanDir(*Type) reflect.ChanDir + +func (t *Type) ChanDir() reflect.ChanDir { + return rtype_ChanDir(t) +} + +//go:linkname rtype_IsVariadic reflect.(*rtype).IsVariadic +//go:noescape +func rtype_IsVariadic(*Type) bool + +func (t *Type) IsVariadic() bool { + return rtype_IsVariadic(t) +} + +//go:linkname rtype_Elem reflect.(*rtype).Elem +//go:noescape +func rtype_Elem(*Type) reflect.Type + +func (t *Type) Elem() *Type { + return Type2RType(rtype_Elem(t)) +} + +//go:linkname rtype_Field reflect.(*rtype).Field +//go:noescape +func rtype_Field(*Type, int) reflect.StructField + +func (t *Type) Field(i int) reflect.StructField { + return rtype_Field(t, i) +} + +//go:linkname rtype_FieldByIndex reflect.(*rtype).FieldByIndex +//go:noescape +func rtype_FieldByIndex(*Type, []int) reflect.StructField + +func (t *Type) FieldByIndex(index []int) reflect.StructField { + return rtype_FieldByIndex(t, index) +} + +//go:linkname rtype_FieldByName reflect.(*rtype).FieldByName +//go:noescape +func rtype_FieldByName(*Type, string) (reflect.StructField, bool) + +func (t *Type) FieldByName(name string) (reflect.StructField, bool) { + return rtype_FieldByName(t, name) +} + +//go:linkname rtype_FieldByNameFunc reflect.(*rtype).FieldByNameFunc +//go:noescape +func rtype_FieldByNameFunc(*Type, func(string) bool) (reflect.StructField, bool) + +func (t *Type) FieldByNameFunc(match func(string) bool) (reflect.StructField, bool) { + return rtype_FieldByNameFunc(t, match) +} + +//go:linkname rtype_In reflect.(*rtype).In +//go:noescape +func rtype_In(*Type, int) reflect.Type + +func (t *Type) In(i int) reflect.Type { + return rtype_In(t, i) +} + +//go:linkname rtype_Key reflect.(*rtype).Key +//go:noescape +func rtype_Key(*Type) reflect.Type + +func (t *Type) Key() *Type { + return Type2RType(rtype_Key(t)) +} + +//go:linkname rtype_Len reflect.(*rtype).Len +//go:noescape +func rtype_Len(*Type) int + +func (t *Type) Len() int { + return rtype_Len(t) +} + +//go:linkname rtype_NumField reflect.(*rtype).NumField +//go:noescape +func rtype_NumField(*Type) int + +func (t *Type) NumField() int { + return rtype_NumField(t) +} + +//go:linkname rtype_NumIn reflect.(*rtype).NumIn +//go:noescape +func rtype_NumIn(*Type) int + +func (t *Type) NumIn() int { + return rtype_NumIn(t) +} + +//go:linkname rtype_NumOut reflect.(*rtype).NumOut +//go:noescape +func rtype_NumOut(*Type) int + +func (t *Type) NumOut() int { + return rtype_NumOut(t) +} + +//go:linkname rtype_Out reflect.(*rtype).Out +//go:noescape +func rtype_Out(*Type, int) reflect.Type + +//go:linkname PtrTo reflect.(*rtype).ptrTo +//go:noescape +func PtrTo(*Type) *Type + +func (t *Type) Out(i int) reflect.Type { + return rtype_Out(t, i) +} + +//go:linkname IfaceIndir reflect.ifaceIndir +//go:noescape +func IfaceIndir(*Type) bool + +//go:linkname RType2Type reflect.toType +//go:noescape +func RType2Type(t *Type) reflect.Type + +//go:nolint structcheck +type emptyInterface struct { + _ *Type + ptr unsafe.Pointer +} + +func Type2RType(t reflect.Type) *Type { + return (*Type)(((*emptyInterface)(unsafe.Pointer(&t))).ptr) +} diff --git a/vendor/github.com/goccy/go-json/internal/runtime/struct_field.go b/vendor/github.com/goccy/go-json/internal/runtime/struct_field.go new file mode 100644 index 000000000..baab0c597 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/runtime/struct_field.go @@ -0,0 +1,91 @@ +package runtime + +import ( + "reflect" + "strings" + "unicode" +) + +func getTag(field reflect.StructField) string { + return field.Tag.Get("json") +} + +func IsIgnoredStructField(field reflect.StructField) bool { + if field.PkgPath != "" { + if field.Anonymous { + t := field.Type + if t.Kind() == reflect.Ptr { + t = t.Elem() + } + if t.Kind() != reflect.Struct { + return true + } + } else { + // private field + return true + } + } + tag := getTag(field) + return tag == "-" +} + +type StructTag struct { + Key string + IsTaggedKey bool + IsOmitEmpty bool + IsString bool + Field reflect.StructField +} + +type StructTags []*StructTag + +func (t StructTags) ExistsKey(key string) bool { + for _, tt := range t { + if tt.Key == key { + return true + } + } + return false +} + +func isValidTag(s string) bool { + if s == "" { + return false + } + for _, c := range s { + switch { + case strings.ContainsRune("!#$%&()*+-./:<=>?@[]^_{|}~ ", c): + // Backslash and quote chars are reserved, but + // otherwise any punctuation chars are allowed + // in a tag name. + case !unicode.IsLetter(c) && !unicode.IsDigit(c): + return false + } + } + return true +} + +func StructTagFromField(field reflect.StructField) *StructTag { + keyName := field.Name + tag := getTag(field) + st := &StructTag{Field: field} + opts := strings.Split(tag, ",") + if len(opts) > 0 { + if opts[0] != "" && isValidTag(opts[0]) { + keyName = opts[0] + st.IsTaggedKey = true + } + } + st.Key = keyName + if len(opts) > 1 { + for _, opt := range opts[1:] { + switch opt { + case "omitempty": + st.IsOmitEmpty = true + case "string": + st.IsString = true + } + } + } + return st +} diff --git a/vendor/github.com/goccy/go-json/internal/runtime/type.go b/vendor/github.com/goccy/go-json/internal/runtime/type.go new file mode 100644 index 000000000..0167cd2c0 --- /dev/null +++ b/vendor/github.com/goccy/go-json/internal/runtime/type.go @@ -0,0 +1,100 @@ +package runtime + +import ( + "reflect" + "unsafe" +) + +type SliceHeader struct { + Data unsafe.Pointer + Len int + Cap int +} + +const ( + maxAcceptableTypeAddrRange = 1024 * 1024 * 2 // 2 Mib +) + +type TypeAddr struct { + BaseTypeAddr uintptr + MaxTypeAddr uintptr + AddrRange uintptr + AddrShift uintptr +} + +var ( + typeAddr *TypeAddr + alreadyAnalyzed bool +) + +//go:linkname typelinks reflect.typelinks +func typelinks() ([]unsafe.Pointer, [][]int32) + +//go:linkname rtypeOff reflect.rtypeOff +func rtypeOff(unsafe.Pointer, int32) unsafe.Pointer + +func AnalyzeTypeAddr() *TypeAddr { + defer func() { + alreadyAnalyzed = true + }() + if alreadyAnalyzed { + return typeAddr + } + sections, offsets := typelinks() + if len(sections) != 1 { + return nil + } + if len(offsets) != 1 { + return nil + } + section := sections[0] + offset := offsets[0] + var ( + min uintptr = uintptr(^uint(0)) + max uintptr = 0 + isAligned64 = true + isAligned32 = true + ) + for i := 0; i < len(offset); i++ { + typ := (*Type)(rtypeOff(section, offset[i])) + addr := uintptr(unsafe.Pointer(typ)) + if min > addr { + min = addr + } + if max < addr { + max = addr + } + if typ.Kind() == reflect.Ptr { + addr = uintptr(unsafe.Pointer(typ.Elem())) + if min > addr { + min = addr + } + if max < addr { + max = addr + } + } + isAligned64 = isAligned64 && (addr-min)&63 == 0 + isAligned32 = isAligned32 && (addr-min)&31 == 0 + } + addrRange := max - min + if addrRange == 0 { + return nil + } + var addrShift uintptr + if isAligned64 { + addrShift = 6 + } else if isAligned32 { + addrShift = 5 + } + cacheSize := addrRange >> addrShift + if cacheSize > maxAcceptableTypeAddrRange { + return nil + } + typeAddr = &TypeAddr{ + BaseTypeAddr: min, + MaxTypeAddr: max, + AddrRange: addrRange, + AddrShift: addrShift, + } + return typeAddr +} diff --git a/vendor/github.com/goccy/go-json/json.go b/vendor/github.com/goccy/go-json/json.go new file mode 100644 index 000000000..413cb20bf --- /dev/null +++ b/vendor/github.com/goccy/go-json/json.go @@ -0,0 +1,371 @@ +package json + +import ( + "bytes" + "context" + "encoding/json" + + "github.com/goccy/go-json/internal/encoder" +) + +// Marshaler is the interface implemented by types that +// can marshal themselves into valid JSON. +type Marshaler interface { + MarshalJSON() ([]byte, error) +} + +// MarshalerContext is the interface implemented by types that +// can marshal themselves into valid JSON with context.Context. +type MarshalerContext interface { + MarshalJSON(context.Context) ([]byte, error) +} + +// Unmarshaler is the interface implemented by types +// that can unmarshal a JSON description of themselves. +// The input can be assumed to be a valid encoding of +// a JSON value. UnmarshalJSON must copy the JSON data +// if it wishes to retain the data after returning. +// +// By convention, to approximate the behavior of Unmarshal itself, +// Unmarshalers implement UnmarshalJSON([]byte("null")) as a no-op. +type Unmarshaler interface { + UnmarshalJSON([]byte) error +} + +// UnmarshalerContext is the interface implemented by types +// that can unmarshal with context.Context a JSON description of themselves. +type UnmarshalerContext interface { + UnmarshalJSON(context.Context, []byte) error +} + +// Marshal returns the JSON encoding of v. +// +// Marshal traverses the value v recursively. +// If an encountered value implements the Marshaler interface +// and is not a nil pointer, Marshal calls its MarshalJSON method +// to produce JSON. If no MarshalJSON method is present but the +// value implements encoding.TextMarshaler instead, Marshal calls +// its MarshalText method and encodes the result as a JSON string. +// The nil pointer exception is not strictly necessary +// but mimics a similar, necessary exception in the behavior of +// UnmarshalJSON. +// +// Otherwise, Marshal uses the following type-dependent default encodings: +// +// Boolean values encode as JSON booleans. +// +// Floating point, integer, and Number values encode as JSON numbers. +// +// String values encode as JSON strings coerced to valid UTF-8, +// replacing invalid bytes with the Unicode replacement rune. +// The angle brackets "<" and ">" are escaped to "\u003c" and "\u003e" +// to keep some browsers from misinterpreting JSON output as HTML. +// Ampersand "&" is also escaped to "\u0026" for the same reason. +// This escaping can be disabled using an Encoder that had SetEscapeHTML(false) +// called on it. +// +// Array and slice values encode as JSON arrays, except that +// []byte encodes as a base64-encoded string, and a nil slice +// encodes as the null JSON value. +// +// Struct values encode as JSON objects. +// Each exported struct field becomes a member of the object, using the +// field name as the object key, unless the field is omitted for one of the +// reasons given below. +// +// The encoding of each struct field can be customized by the format string +// stored under the "json" key in the struct field's tag. +// The format string gives the name of the field, possibly followed by a +// comma-separated list of options. The name may be empty in order to +// specify options without overriding the default field name. +// +// The "omitempty" option specifies that the field should be omitted +// from the encoding if the field has an empty value, defined as +// false, 0, a nil pointer, a nil interface value, and any empty array, +// slice, map, or string. +// +// As a special case, if the field tag is "-", the field is always omitted. +// Note that a field with name "-" can still be generated using the tag "-,". +// +// Examples of struct field tags and their meanings: +// +// // Field appears in JSON as key "myName". +// Field int `json:"myName"` +// +// // Field appears in JSON as key "myName" and +// // the field is omitted from the object if its value is empty, +// // as defined above. +// Field int `json:"myName,omitempty"` +// +// // Field appears in JSON as key "Field" (the default), but +// // the field is skipped if empty. +// // Note the leading comma. +// Field int `json:",omitempty"` +// +// // Field is ignored by this package. +// Field int `json:"-"` +// +// // Field appears in JSON as key "-". +// Field int `json:"-,"` +// +// The "string" option signals that a field is stored as JSON inside a +// JSON-encoded string. It applies only to fields of string, floating point, +// integer, or boolean types. This extra level of encoding is sometimes used +// when communicating with JavaScript programs: +// +// Int64String int64 `json:",string"` +// +// The key name will be used if it's a non-empty string consisting of +// only Unicode letters, digits, and ASCII punctuation except quotation +// marks, backslash, and comma. +// +// Anonymous struct fields are usually marshaled as if their inner exported fields +// were fields in the outer struct, subject to the usual Go visibility rules amended +// as described in the next paragraph. +// An anonymous struct field with a name given in its JSON tag is treated as +// having that name, rather than being anonymous. +// An anonymous struct field of interface type is treated the same as having +// that type as its name, rather than being anonymous. +// +// The Go visibility rules for struct fields are amended for JSON when +// deciding which field to marshal or unmarshal. If there are +// multiple fields at the same level, and that level is the least +// nested (and would therefore be the nesting level selected by the +// usual Go rules), the following extra rules apply: +// +// 1) Of those fields, if any are JSON-tagged, only tagged fields are considered, +// even if there are multiple untagged fields that would otherwise conflict. +// +// 2) If there is exactly one field (tagged or not according to the first rule), that is selected. +// +// 3) Otherwise there are multiple fields, and all are ignored; no error occurs. +// +// Handling of anonymous struct fields is new in Go 1.1. +// Prior to Go 1.1, anonymous struct fields were ignored. To force ignoring of +// an anonymous struct field in both current and earlier versions, give the field +// a JSON tag of "-". +// +// Map values encode as JSON objects. The map's key type must either be a +// string, an integer type, or implement encoding.TextMarshaler. The map keys +// are sorted and used as JSON object keys by applying the following rules, +// subject to the UTF-8 coercion described for string values above: +// - string keys are used directly +// - encoding.TextMarshalers are marshaled +// - integer keys are converted to strings +// +// Pointer values encode as the value pointed to. +// A nil pointer encodes as the null JSON value. +// +// Interface values encode as the value contained in the interface. +// A nil interface value encodes as the null JSON value. +// +// Channel, complex, and function values cannot be encoded in JSON. +// Attempting to encode such a value causes Marshal to return +// an UnsupportedTypeError. +// +// JSON cannot represent cyclic data structures and Marshal does not +// handle them. Passing cyclic structures to Marshal will result in +// an infinite recursion. +// +func Marshal(v interface{}) ([]byte, error) { + return MarshalWithOption(v) +} + +// MarshalNoEscape returns the JSON encoding of v and doesn't escape v. +func MarshalNoEscape(v interface{}) ([]byte, error) { + return marshalNoEscape(v) +} + +// MarshalContext returns the JSON encoding of v with context.Context and EncodeOption. +func MarshalContext(ctx context.Context, v interface{}, optFuncs ...EncodeOptionFunc) ([]byte, error) { + return marshalContext(ctx, v, optFuncs...) +} + +// MarshalWithOption returns the JSON encoding of v with EncodeOption. +func MarshalWithOption(v interface{}, optFuncs ...EncodeOptionFunc) ([]byte, error) { + return marshal(v, optFuncs...) +} + +// MarshalIndent is like Marshal but applies Indent to format the output. +// Each JSON element in the output will begin on a new line beginning with prefix +// followed by one or more copies of indent according to the indentation nesting. +func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) { + return MarshalIndentWithOption(v, prefix, indent) +} + +// MarshalIndentWithOption is like Marshal but applies Indent to format the output with EncodeOption. +func MarshalIndentWithOption(v interface{}, prefix, indent string, optFuncs ...EncodeOptionFunc) ([]byte, error) { + return marshalIndent(v, prefix, indent, optFuncs...) +} + +// Unmarshal parses the JSON-encoded data and stores the result +// in the value pointed to by v. If v is nil or not a pointer, +// Unmarshal returns an InvalidUnmarshalError. +// +// Unmarshal uses the inverse of the encodings that +// Marshal uses, allocating maps, slices, and pointers as necessary, +// with the following additional rules: +// +// To unmarshal JSON into a pointer, Unmarshal first handles the case of +// the JSON being the JSON literal null. In that case, Unmarshal sets +// the pointer to nil. Otherwise, Unmarshal unmarshals the JSON into +// the value pointed at by the pointer. If the pointer is nil, Unmarshal +// allocates a new value for it to point to. +// +// To unmarshal JSON into a value implementing the Unmarshaler interface, +// Unmarshal calls that value's UnmarshalJSON method, including +// when the input is a JSON null. +// Otherwise, if the value implements encoding.TextUnmarshaler +// and the input is a JSON quoted string, Unmarshal calls that value's +// UnmarshalText method with the unquoted form of the string. +// +// To unmarshal JSON into a struct, Unmarshal matches incoming object +// keys to the keys used by Marshal (either the struct field name or its tag), +// preferring an exact match but also accepting a case-insensitive match. By +// default, object keys which don't have a corresponding struct field are +// ignored (see Decoder.DisallowUnknownFields for an alternative). +// +// To unmarshal JSON into an interface value, +// Unmarshal stores one of these in the interface value: +// +// bool, for JSON booleans +// float64, for JSON numbers +// string, for JSON strings +// []interface{}, for JSON arrays +// map[string]interface{}, for JSON objects +// nil for JSON null +// +// To unmarshal a JSON array into a slice, Unmarshal resets the slice length +// to zero and then appends each element to the slice. +// As a special case, to unmarshal an empty JSON array into a slice, +// Unmarshal replaces the slice with a new empty slice. +// +// To unmarshal a JSON array into a Go array, Unmarshal decodes +// JSON array elements into corresponding Go array elements. +// If the Go array is smaller than the JSON array, +// the additional JSON array elements are discarded. +// If the JSON array is smaller than the Go array, +// the additional Go array elements are set to zero values. +// +// To unmarshal a JSON object into a map, Unmarshal first establishes a map to +// use. If the map is nil, Unmarshal allocates a new map. Otherwise Unmarshal +// reuses the existing map, keeping existing entries. Unmarshal then stores +// key-value pairs from the JSON object into the map. The map's key type must +// either be any string type, an integer, implement json.Unmarshaler, or +// implement encoding.TextUnmarshaler. +// +// If a JSON value is not appropriate for a given target type, +// or if a JSON number overflows the target type, Unmarshal +// skips that field and completes the unmarshaling as best it can. +// If no more serious errors are encountered, Unmarshal returns +// an UnmarshalTypeError describing the earliest such error. In any +// case, it's not guaranteed that all the remaining fields following +// the problematic one will be unmarshaled into the target object. +// +// The JSON null value unmarshals into an interface, map, pointer, or slice +// by setting that Go value to nil. Because null is often used in JSON to mean +// ``not present,'' unmarshaling a JSON null into any other Go type has no effect +// on the value and produces no error. +// +// When unmarshaling quoted strings, invalid UTF-8 or +// invalid UTF-16 surrogate pairs are not treated as an error. +// Instead, they are replaced by the Unicode replacement +// character U+FFFD. +// +func Unmarshal(data []byte, v interface{}) error { + return unmarshal(data, v) +} + +// UnmarshalContext parses the JSON-encoded data and stores the result +// in the value pointed to by v. If you implement the UnmarshalerContext interface, +// call it with ctx as an argument. +func UnmarshalContext(ctx context.Context, data []byte, v interface{}, optFuncs ...DecodeOptionFunc) error { + return unmarshalContext(ctx, data, v) +} + +func UnmarshalWithOption(data []byte, v interface{}, optFuncs ...DecodeOptionFunc) error { + return unmarshal(data, v, optFuncs...) +} + +func UnmarshalNoEscape(data []byte, v interface{}, optFuncs ...DecodeOptionFunc) error { + return unmarshalNoEscape(data, v, optFuncs...) +} + +// A Token holds a value of one of these types: +// +// Delim, for the four JSON delimiters [ ] { } +// bool, for JSON booleans +// float64, for JSON numbers +// Number, for JSON numbers +// string, for JSON string literals +// nil, for JSON null +// +type Token = json.Token + +// A Number represents a JSON number literal. +type Number = json.Number + +// RawMessage is a raw encoded JSON value. +// It implements Marshaler and Unmarshaler and can +// be used to delay JSON decoding or precompute a JSON encoding. +type RawMessage = json.RawMessage + +// A Delim is a JSON array or object delimiter, one of [ ] { or }. +type Delim = json.Delim + +// Compact appends to dst the JSON-encoded src with +// insignificant space characters elided. +func Compact(dst *bytes.Buffer, src []byte) error { + return encoder.Compact(dst, src, false) +} + +// Indent appends to dst an indented form of the JSON-encoded src. +// Each element in a JSON object or array begins on a new, +// indented line beginning with prefix followed by one or more +// copies of indent according to the indentation nesting. +// The data appended to dst does not begin with the prefix nor +// any indentation, to make it easier to embed inside other formatted JSON data. +// Although leading space characters (space, tab, carriage return, newline) +// at the beginning of src are dropped, trailing space characters +// at the end of src are preserved and copied to dst. +// For example, if src has no trailing spaces, neither will dst; +// if src ends in a trailing newline, so will dst. +func Indent(dst *bytes.Buffer, src []byte, prefix, indent string) error { + return encoder.Indent(dst, src, prefix, indent) +} + +// HTMLEscape appends to dst the JSON-encoded src with <, >, &, U+2028 and U+2029 +// characters inside string literals changed to \u003c, \u003e, \u0026, \u2028, \u2029 +// so that the JSON will be safe to embed inside HTML