From 4cde3bae6a5645f99679330acd129e059bf776d7 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 29 Oct 2025 13:35:04 +0000 Subject: [PATCH] Regenerate client from commit aab7a0d of spec repo --- .generator/schemas/v2/openapi.yaml | 1378 +++++++++++++++++ api/datadog/configuration.go | 8 + api/datadogV2/api_cohort.go | 177 +++ api/datadogV2/api_funnel.go | 177 +++ api/datadogV2/api_segments.go | 237 +++ api/datadogV2/api_user_flow.go | 101 ++ api/datadogV2/doc.go | 8 + api/datadogV2/model_funnel_request.go | 111 ++ api/datadogV2/model_funnel_request_data.go | 186 +++ .../model_funnel_request_data_attributes.go | 254 +++ ...l_funnel_request_data_attributes_search.go | 207 +++ ...uest_data_attributes_search_steps_items.go | 172 ++ ...del_funnel_request_data_attributes_time.go | 137 ++ .../model_funnel_request_data_type.go | 64 + api/datadogV2/model_funnel_response.go | 111 ++ api/datadogV2/model_funnel_response_data.go | 186 +++ .../model_funnel_response_data_attributes.go | 216 +++ ...onse_data_attributes_funnel_steps_items.go | 181 +++ .../model_funnel_response_data_type.go | 64 + .../model_funnel_response_elapsed_time.go | 277 ++++ .../model_funnel_suggestion_request.go | 111 ++ .../model_funnel_suggestion_request_data.go | 186 +++ ...nnel_suggestion_request_data_attributes.go | 222 +++ ...ggestion_request_data_attributes_search.go | 207 +++ ...uest_data_attributes_search_steps_items.go | 172 ++ ...ion_request_data_attributes_term_search.go | 102 ++ ...suggestion_request_data_attributes_time.go | 137 ++ ...del_funnel_suggestion_request_data_type.go | 64 + .../model_funnel_suggestion_response.go | 111 ++ .../model_funnel_suggestion_response_data.go | 186 +++ ...nel_suggestion_response_data_attributes.go | 137 ++ ..._response_data_attributes_actions_items.go | 102 ++ ...on_response_data_attributes_views_items.go | 102 ++ ...el_funnel_suggestion_response_data_type.go | 64 + api/datadogV2/model_get_cohort_request.go | 111 ++ .../model_get_cohort_request_data.go | 186 +++ ...odel_get_cohort_request_data_attributes.go | 289 ++++ ...hort_request_data_attributes_definition.go | 216 +++ ..._attributes_definition_audience_filters.go | 207 +++ ...inition_audience_filters_accounts_items.go | 136 ++ ...inition_audience_filters_segments_items.go | 133 ++ ...definition_audience_filters_users_items.go | 136 ++ ...get_cohort_request_data_attributes_time.go | 137 ++ .../model_get_cohort_request_data_type.go | 64 + api/datadogV2/model_get_cohort_response.go | 111 ++ .../model_get_cohort_response_data.go | 186 +++ ...del_get_cohort_response_data_attributes.go | 102 ++ ..._response_data_attributes_cohorts_items.go | 207 +++ ...a_attributes_cohorts_items_values_items.go | 242 +++ .../model_get_cohort_response_data_type.go | 64 + .../model_get_cohort_users_request.go | 111 ++ .../model_get_cohort_users_request_data.go | 186 +++ ...et_cohort_users_request_data_attributes.go | 289 ++++ ...sers_request_data_attributes_definition.go | 286 ++++ ..._attributes_definition_audience_filters.go | 207 +++ ...inition_audience_filters_accounts_items.go | 136 ++ ...inition_audience_filters_segments_items.go | 133 ++ ...definition_audience_filters_users_items.go | 136 ++ ...hort_users_request_data_attributes_time.go | 137 ++ ...odel_get_cohort_users_request_data_type.go | 64 + .../model_get_cohort_users_response.go | 111 ++ .../model_get_cohort_users_response_data.go | 186 +++ ...t_cohort_users_response_data_attributes.go | 102 ++ ...rs_response_data_attributes_users_items.go | 172 ++ ...del_get_cohort_users_response_data_type.go | 64 + api/datadogV2/model_sankey_request.go | 111 ++ api/datadogV2/model_sankey_request_data.go | 186 +++ .../model_sankey_request_data_attributes.go | 330 ++++ ...nkey_request_data_attributes_definition.go | 207 +++ ...sankey_request_data_attributes_sampling.go | 102 ++ ...l_sankey_request_data_attributes_search.go | 219 +++ ...data_attributes_search_audience_filters.go | 207 +++ ..._search_audience_filters_accounts_items.go | 136 ++ ..._search_audience_filters_segments_items.go | 133 ++ ...tes_search_audience_filters_users_items.go | 136 ++ ...uest_data_attributes_search_occurrences.go | 168 ++ ...del_sankey_request_data_attributes_time.go | 137 ++ .../model_sankey_request_data_type.go | 64 + api/datadogV2/model_sankey_response.go | 111 ++ api/datadogV2/model_sankey_response_data.go | 186 +++ .../model_sankey_response_data_attributes.go | 137 ++ ...ey_response_data_attributes_links_items.go | 242 +++ ...ey_response_data_attributes_nodes_items.go | 347 +++++ ...utes_nodes_items_aggregated_nodes_items.go | 277 ++++ .../model_sankey_response_data_type.go | 64 + api/datadogV2/model_segment.go | 111 ++ api/datadogV2/model_segment_array.go | 101 ++ api/datadogV2/model_segment_data.go | 186 +++ .../model_segment_data_attributes.go | 619 ++++++++ ...odel_segment_data_attributes_data_query.go | 242 +++ ...ributes_data_query_event_platform_items.go | 241 +++ ...ibutes_data_query_reference_table_items.go | 247 +++ ...ery_reference_table_items_columns_items.go | 137 ++ ...ry_reference_table_items_join_condition.go | 136 ++ ...data_attributes_data_query_static_items.go | 172 ++ ..._attributes_data_query_user_store_items.go | 172 ++ api/datadogV2/model_segment_data_source.go | 235 +++ api/datadogV2/model_segment_data_type.go | 64 + examples/v2/cohort/GetRumCohort.go | 58 + examples/v2/cohort/GetRumCohortUsers.go | 58 + examples/v2/funnel/GetRumFunnel.go | 62 + .../v2/funnel/GetRumFunnelStepSuggestions.go | 58 + examples/v2/segments/CreateRumSegment.go | 72 + examples/v2/segments/InitializeRumSegments.go | 26 + examples/v2/segments/ListRumSegments.go | 30 + examples/v2/user-flow/GetRumSankey.go | 59 + tests/scenarios/api_mappings.go | 4 + tests/scenarios/features/v2/cohort.feature | 24 + tests/scenarios/features/v2/funnel.feature | 24 + tests/scenarios/features/v2/segments.feature | 30 + tests/scenarios/features/v2/undo.json | 48 + tests/scenarios/features/v2/user_flow.feature | 14 + 112 files changed, 17732 insertions(+) create mode 100644 api/datadogV2/api_cohort.go create mode 100644 api/datadogV2/api_funnel.go create mode 100644 api/datadogV2/api_segments.go create mode 100644 api/datadogV2/api_user_flow.go create mode 100644 api/datadogV2/model_funnel_request.go create mode 100644 api/datadogV2/model_funnel_request_data.go create mode 100644 api/datadogV2/model_funnel_request_data_attributes.go create mode 100644 api/datadogV2/model_funnel_request_data_attributes_search.go create mode 100644 api/datadogV2/model_funnel_request_data_attributes_search_steps_items.go create mode 100644 api/datadogV2/model_funnel_request_data_attributes_time.go create mode 100644 api/datadogV2/model_funnel_request_data_type.go create mode 100644 api/datadogV2/model_funnel_response.go create mode 100644 api/datadogV2/model_funnel_response_data.go create mode 100644 api/datadogV2/model_funnel_response_data_attributes.go create mode 100644 api/datadogV2/model_funnel_response_data_attributes_funnel_steps_items.go create mode 100644 api/datadogV2/model_funnel_response_data_type.go create mode 100644 api/datadogV2/model_funnel_response_elapsed_time.go create mode 100644 api/datadogV2/model_funnel_suggestion_request.go create mode 100644 api/datadogV2/model_funnel_suggestion_request_data.go create mode 100644 api/datadogV2/model_funnel_suggestion_request_data_attributes.go create mode 100644 api/datadogV2/model_funnel_suggestion_request_data_attributes_search.go create mode 100644 api/datadogV2/model_funnel_suggestion_request_data_attributes_search_steps_items.go create mode 100644 api/datadogV2/model_funnel_suggestion_request_data_attributes_term_search.go create mode 100644 api/datadogV2/model_funnel_suggestion_request_data_attributes_time.go create mode 100644 api/datadogV2/model_funnel_suggestion_request_data_type.go create mode 100644 api/datadogV2/model_funnel_suggestion_response.go create mode 100644 api/datadogV2/model_funnel_suggestion_response_data.go create mode 100644 api/datadogV2/model_funnel_suggestion_response_data_attributes.go create mode 100644 api/datadogV2/model_funnel_suggestion_response_data_attributes_actions_items.go create mode 100644 api/datadogV2/model_funnel_suggestion_response_data_attributes_views_items.go create mode 100644 api/datadogV2/model_funnel_suggestion_response_data_type.go create mode 100644 api/datadogV2/model_get_cohort_request.go create mode 100644 api/datadogV2/model_get_cohort_request_data.go create mode 100644 api/datadogV2/model_get_cohort_request_data_attributes.go create mode 100644 api/datadogV2/model_get_cohort_request_data_attributes_definition.go create mode 100644 api/datadogV2/model_get_cohort_request_data_attributes_definition_audience_filters.go create mode 100644 api/datadogV2/model_get_cohort_request_data_attributes_definition_audience_filters_accounts_items.go create mode 100644 api/datadogV2/model_get_cohort_request_data_attributes_definition_audience_filters_segments_items.go create mode 100644 api/datadogV2/model_get_cohort_request_data_attributes_definition_audience_filters_users_items.go create mode 100644 api/datadogV2/model_get_cohort_request_data_attributes_time.go create mode 100644 api/datadogV2/model_get_cohort_request_data_type.go create mode 100644 api/datadogV2/model_get_cohort_response.go create mode 100644 api/datadogV2/model_get_cohort_response_data.go create mode 100644 api/datadogV2/model_get_cohort_response_data_attributes.go create mode 100644 api/datadogV2/model_get_cohort_response_data_attributes_cohorts_items.go create mode 100644 api/datadogV2/model_get_cohort_response_data_attributes_cohorts_items_values_items.go create mode 100644 api/datadogV2/model_get_cohort_response_data_type.go create mode 100644 api/datadogV2/model_get_cohort_users_request.go create mode 100644 api/datadogV2/model_get_cohort_users_request_data.go create mode 100644 api/datadogV2/model_get_cohort_users_request_data_attributes.go create mode 100644 api/datadogV2/model_get_cohort_users_request_data_attributes_definition.go create mode 100644 api/datadogV2/model_get_cohort_users_request_data_attributes_definition_audience_filters.go create mode 100644 api/datadogV2/model_get_cohort_users_request_data_attributes_definition_audience_filters_accounts_items.go create mode 100644 api/datadogV2/model_get_cohort_users_request_data_attributes_definition_audience_filters_segments_items.go create mode 100644 api/datadogV2/model_get_cohort_users_request_data_attributes_definition_audience_filters_users_items.go create mode 100644 api/datadogV2/model_get_cohort_users_request_data_attributes_time.go create mode 100644 api/datadogV2/model_get_cohort_users_request_data_type.go create mode 100644 api/datadogV2/model_get_cohort_users_response.go create mode 100644 api/datadogV2/model_get_cohort_users_response_data.go create mode 100644 api/datadogV2/model_get_cohort_users_response_data_attributes.go create mode 100644 api/datadogV2/model_get_cohort_users_response_data_attributes_users_items.go create mode 100644 api/datadogV2/model_get_cohort_users_response_data_type.go create mode 100644 api/datadogV2/model_sankey_request.go create mode 100644 api/datadogV2/model_sankey_request_data.go create mode 100644 api/datadogV2/model_sankey_request_data_attributes.go create mode 100644 api/datadogV2/model_sankey_request_data_attributes_definition.go create mode 100644 api/datadogV2/model_sankey_request_data_attributes_sampling.go create mode 100644 api/datadogV2/model_sankey_request_data_attributes_search.go create mode 100644 api/datadogV2/model_sankey_request_data_attributes_search_audience_filters.go create mode 100644 api/datadogV2/model_sankey_request_data_attributes_search_audience_filters_accounts_items.go create mode 100644 api/datadogV2/model_sankey_request_data_attributes_search_audience_filters_segments_items.go create mode 100644 api/datadogV2/model_sankey_request_data_attributes_search_audience_filters_users_items.go create mode 100644 api/datadogV2/model_sankey_request_data_attributes_search_occurrences.go create mode 100644 api/datadogV2/model_sankey_request_data_attributes_time.go create mode 100644 api/datadogV2/model_sankey_request_data_type.go create mode 100644 api/datadogV2/model_sankey_response.go create mode 100644 api/datadogV2/model_sankey_response_data.go create mode 100644 api/datadogV2/model_sankey_response_data_attributes.go create mode 100644 api/datadogV2/model_sankey_response_data_attributes_links_items.go create mode 100644 api/datadogV2/model_sankey_response_data_attributes_nodes_items.go create mode 100644 api/datadogV2/model_sankey_response_data_attributes_nodes_items_aggregated_nodes_items.go create mode 100644 api/datadogV2/model_sankey_response_data_type.go create mode 100644 api/datadogV2/model_segment.go create mode 100644 api/datadogV2/model_segment_array.go create mode 100644 api/datadogV2/model_segment_data.go create mode 100644 api/datadogV2/model_segment_data_attributes.go create mode 100644 api/datadogV2/model_segment_data_attributes_data_query.go create mode 100644 api/datadogV2/model_segment_data_attributes_data_query_event_platform_items.go create mode 100644 api/datadogV2/model_segment_data_attributes_data_query_reference_table_items.go create mode 100644 api/datadogV2/model_segment_data_attributes_data_query_reference_table_items_columns_items.go create mode 100644 api/datadogV2/model_segment_data_attributes_data_query_reference_table_items_join_condition.go create mode 100644 api/datadogV2/model_segment_data_attributes_data_query_static_items.go create mode 100644 api/datadogV2/model_segment_data_attributes_data_query_user_store_items.go create mode 100644 api/datadogV2/model_segment_data_source.go create mode 100644 api/datadogV2/model_segment_data_type.go create mode 100644 examples/v2/cohort/GetRumCohort.go create mode 100644 examples/v2/cohort/GetRumCohortUsers.go create mode 100644 examples/v2/funnel/GetRumFunnel.go create mode 100644 examples/v2/funnel/GetRumFunnelStepSuggestions.go create mode 100644 examples/v2/segments/CreateRumSegment.go create mode 100644 examples/v2/segments/InitializeRumSegments.go create mode 100644 examples/v2/segments/ListRumSegments.go create mode 100644 examples/v2/user-flow/GetRumSankey.go create mode 100644 tests/scenarios/features/v2/cohort.feature create mode 100644 tests/scenarios/features/v2/funnel.feature create mode 100644 tests/scenarios/features/v2/segments.feature create mode 100644 tests/scenarios/features/v2/user_flow.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 93efc78e5a9..f95a76690c8 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -20823,6 +20823,326 @@ components: - name - requirements type: object + FunnelRequest: + example: + data: + attributes: + data_source: rum + enforced_execution_type: '' + request_id: '' + search: + cross_session_filter: '' + query_string: '@type:view' + steps: + - facet: '@view.name' + step_filter: '' + value: /apm/home + - facet: '@view.name' + step_filter: '' + value: /apm/traces + subquery_id: '' + time: + from: 1756425600000 + to: 1756857600000 + id: funnel_request + type: funnel_request + properties: + data: + $ref: '#/components/schemas/FunnelRequestData' + type: object + FunnelRequestData: + properties: + attributes: + $ref: '#/components/schemas/FunnelRequestDataAttributes' + id: + type: string + type: + $ref: '#/components/schemas/FunnelRequestDataType' + required: + - type + type: object + FunnelRequestDataAttributes: + properties: + data_source: + type: string + enforced_execution_type: + type: string + request_id: + type: string + search: + $ref: '#/components/schemas/FunnelRequestDataAttributesSearch' + time: + $ref: '#/components/schemas/FunnelRequestDataAttributesTime' + type: object + FunnelRequestDataAttributesSearch: + properties: + cross_session_filter: + type: string + query_string: + type: string + steps: + items: + $ref: '#/components/schemas/FunnelRequestDataAttributesSearchStepsItems' + type: array + subquery_id: + type: string + type: object + FunnelRequestDataAttributesSearchStepsItems: + properties: + facet: + type: string + step_filter: + type: string + value: + type: string + type: object + FunnelRequestDataAttributesTime: + properties: + from: + format: int64 + type: integer + to: + format: int64 + type: integer + type: object + FunnelRequestDataType: + default: funnel_request + enum: + - funnel_request + example: funnel_request + type: string + x-enum-varnames: + - FUNNEL_REQUEST + FunnelResponse: + example: + data: + attributes: + end_to_end_conversion_rate: 0.1161386890038228 + funnel_steps: + - label: '@type:view @view.name:/apm/home' + value: 284608 + - label: '@type:view @view.name:/apm/traces' + value: 33054 + initial_count: 3925047 + id: funnel_response + type: funnel_response + properties: + data: + $ref: '#/components/schemas/FunnelResponseData' + type: object + FunnelResponseData: + properties: + attributes: + $ref: '#/components/schemas/FunnelResponseDataAttributes' + id: + type: string + type: + $ref: '#/components/schemas/FunnelResponseDataType' + required: + - type + type: object + FunnelResponseDataAttributes: + properties: + end_to_end_conversion_rate: + format: double + type: number + end_to_end_elapsed_time: + $ref: '#/components/schemas/FunnelResponseElapsedTime' + funnel_steps: + items: + $ref: '#/components/schemas/FunnelResponseDataAttributesFunnelStepsItems' + type: array + initial_count: + format: int64 + type: integer + type: object + FunnelResponseDataAttributesFunnelStepsItems: + properties: + elapsed_time_to_next_step: + $ref: '#/components/schemas/FunnelResponseElapsedTime' + label: + type: string + value: + format: int64 + type: integer + type: object + FunnelResponseDataType: + default: funnel_response + enum: + - funnel_response + example: funnel_response + type: string + x-enum-varnames: + - FUNNEL_RESPONSE + FunnelResponseElapsedTime: + properties: + avg: + format: int64 + type: integer + max: + format: int64 + type: integer + min: + format: int64 + type: integer + p5: + format: int64 + type: integer + p50: + format: int64 + type: integer + p95: + format: int64 + type: integer + type: object + FunnelSuggestionRequest: + example: + data: + attributes: + data_source: '' + search: + cross_session_filter: '' + query_string: '@type:view' + steps: + - facet: '@view.name' + step_filter: '' + value: /apm/home + subquery_id: '' + term_search: + query: apm + time: + from: 1756425600000 + to: 1756857600000 + id: funnel_suggestion_request + type: funnel_suggestion_request + properties: + data: + $ref: '#/components/schemas/FunnelSuggestionRequestData' + type: object + FunnelSuggestionRequestData: + properties: + attributes: + $ref: '#/components/schemas/FunnelSuggestionRequestDataAttributes' + id: + type: string + type: + $ref: '#/components/schemas/FunnelSuggestionRequestDataType' + required: + - type + type: object + FunnelSuggestionRequestDataAttributes: + properties: + data_source: + type: string + search: + $ref: '#/components/schemas/FunnelSuggestionRequestDataAttributesSearch' + term_search: + $ref: '#/components/schemas/FunnelSuggestionRequestDataAttributesTermSearch' + time: + $ref: '#/components/schemas/FunnelSuggestionRequestDataAttributesTime' + type: object + FunnelSuggestionRequestDataAttributesSearch: + properties: + cross_session_filter: + type: string + query_string: + type: string + steps: + items: + $ref: '#/components/schemas/FunnelSuggestionRequestDataAttributesSearchStepsItems' + type: array + subquery_id: + type: string + type: object + FunnelSuggestionRequestDataAttributesSearchStepsItems: + properties: + facet: + type: string + step_filter: + type: string + value: + type: string + type: object + FunnelSuggestionRequestDataAttributesTermSearch: + properties: + query: + type: string + type: object + FunnelSuggestionRequestDataAttributesTime: + properties: + from: + format: int64 + type: integer + to: + format: int64 + type: integer + type: object + FunnelSuggestionRequestDataType: + default: funnel_suggestion_request + enum: + - funnel_suggestion_request + example: funnel_suggestion_request + type: string + x-enum-varnames: + - FUNNEL_SUGGESTION_REQUEST + FunnelSuggestionResponse: + example: + data: + attributes: + actions: + - name: view_trace_details + - name: filter_by_service + - name: analyze_performance + views: + - name: /apm/traces + - name: /apm/services + - name: /apm/service-map + id: funnel_suggestion_response + type: funnel_suggestion_response + properties: + data: + $ref: '#/components/schemas/FunnelSuggestionResponseData' + type: object + FunnelSuggestionResponseData: + properties: + attributes: + $ref: '#/components/schemas/FunnelSuggestionResponseDataAttributes' + id: + type: string + type: + $ref: '#/components/schemas/FunnelSuggestionResponseDataType' + required: + - type + type: object + FunnelSuggestionResponseDataAttributes: + properties: + actions: + items: + $ref: '#/components/schemas/FunnelSuggestionResponseDataAttributesActionsItems' + type: array + views: + items: + $ref: '#/components/schemas/FunnelSuggestionResponseDataAttributesViewsItems' + type: array + type: object + FunnelSuggestionResponseDataAttributesActionsItems: + properties: + name: + type: string + type: object + FunnelSuggestionResponseDataAttributesViewsItems: + properties: + name: + type: string + type: object + FunnelSuggestionResponseDataType: + default: funnel_suggestion_response + enum: + - funnel_suggestion_response + example: funnel_suggestion_response + type: string + x-enum-varnames: + - FUNNEL_SUGGESTION_RESPONSE GCPCredentials: description: The definition of the `GCPCredentials` object. oneOf: @@ -21735,6 +22055,369 @@ components: type: string type: array type: object + GetCohortRequest: + properties: + data: + $ref: '#/components/schemas/GetCohortRequestData' + type: object + GetCohortRequestData: + properties: + attributes: + $ref: '#/components/schemas/GetCohortRequestDataAttributes' + id: + type: string + type: + $ref: '#/components/schemas/GetCohortRequestDataType' + required: + - type + type: object + GetCohortRequestDataAttributes: + properties: + data_source: + type: string + definition: + $ref: '#/components/schemas/GetCohortRequestDataAttributesDefinition' + enforced_execution_type: + type: string + request_id: + type: string + time: + $ref: '#/components/schemas/GetCohortRequestDataAttributesTime' + window_size: + type: string + type: object + GetCohortRequestDataAttributesDefinition: + properties: + audience_filters: + $ref: '#/components/schemas/GetCohortRequestDataAttributesDefinitionAudienceFilters' + inclusion_search: + type: string + return_search: + type: string + segment_id: + type: string + type: object + GetCohortRequestDataAttributesDefinitionAudienceFilters: + properties: + accounts: + items: + $ref: '#/components/schemas/GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems' + type: array + formula: + type: string + segments: + items: + $ref: '#/components/schemas/GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems' + type: array + users: + items: + $ref: '#/components/schemas/GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems' + type: array + type: object + GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems: + properties: + name: + example: '' + type: string + query: + type: string + required: + - name + type: object + GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems: + properties: + name: + example: '' + type: string + segment_id: + example: '' + type: string + required: + - name + - segment_id + type: object + GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems: + properties: + name: + example: '' + type: string + query: + type: string + required: + - name + type: object + GetCohortRequestDataAttributesTime: + properties: + from: + format: int64 + type: integer + to: + format: int64 + type: integer + type: object + GetCohortRequestDataType: + default: cohort_request + enum: + - cohort_request + example: cohort_request + type: string + x-enum-varnames: + - COHORT_REQUEST + GetCohortResponse: + example: + data: + attributes: + cohorts: + - cohort: '2024-01-01' + cohort_size: 1000 + start_time: 1704067200000 + values: + - absolute_value: 1000 + end_time: 1704672000000 + relative_value: 100 + start_time: 1704067200000 + window: 0 + - absolute_value: 750 + end_time: 1705276800000 + relative_value: 75 + start_time: 1704672000000 + window: 1 + - absolute_value: 600 + end_time: 1705881600000 + relative_value: 60 + start_time: 1705276800000 + window: 2 + id: cohort_response + type: cohort_response + properties: + data: + $ref: '#/components/schemas/GetCohortResponseData' + type: object + GetCohortResponseData: + properties: + attributes: + $ref: '#/components/schemas/GetCohortResponseDataAttributes' + id: + type: string + type: + $ref: '#/components/schemas/GetCohortResponseDataType' + required: + - type + type: object + GetCohortResponseDataAttributes: + properties: + cohorts: + items: + $ref: '#/components/schemas/GetCohortResponseDataAttributesCohortsItems' + type: array + type: object + GetCohortResponseDataAttributesCohortsItems: + properties: + cohort: + type: string + cohort_size: + format: int64 + type: integer + start_time: + format: int64 + type: integer + values: + items: + $ref: '#/components/schemas/GetCohortResponseDataAttributesCohortsItemsValuesItems' + type: array + type: object + GetCohortResponseDataAttributesCohortsItemsValuesItems: + properties: + absolute_value: + format: int64 + type: integer + end_time: + format: int64 + type: integer + relative_value: + format: double + type: number + start_time: + format: int64 + type: integer + window: + format: int64 + type: integer + type: object + GetCohortResponseDataType: + default: cohort_response + enum: + - cohort_response + example: cohort_response + type: string + x-enum-varnames: + - COHORT_RESPONSE + GetCohortUsersRequest: + properties: + data: + $ref: '#/components/schemas/GetCohortUsersRequestData' + type: object + GetCohortUsersRequestData: + properties: + attributes: + $ref: '#/components/schemas/GetCohortUsersRequestDataAttributes' + id: + type: string + type: + $ref: '#/components/schemas/GetCohortUsersRequestDataType' + required: + - type + type: object + GetCohortUsersRequestDataAttributes: + properties: + data_source: + type: string + definition: + $ref: '#/components/schemas/GetCohortUsersRequestDataAttributesDefinition' + execution: + format: int64 + type: integer + time: + $ref: '#/components/schemas/GetCohortUsersRequestDataAttributesTime' + user_selection: + type: string + window_size: + type: string + type: object + GetCohortUsersRequestDataAttributesDefinition: + properties: + audience_filters: + $ref: '#/components/schemas/GetCohortUsersRequestDataAttributesDefinitionAudienceFilters' + cohort: + type: string + inclusion_search: + type: string + return_search: + type: string + segment_id: + type: string + window: + format: int64 + type: integer + type: object + GetCohortUsersRequestDataAttributesDefinitionAudienceFilters: + properties: + accounts: + items: + $ref: '#/components/schemas/GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems' + type: array + formula: + type: string + segments: + items: + $ref: '#/components/schemas/GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems' + type: array + users: + items: + $ref: '#/components/schemas/GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems' + type: array + type: object + GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems: + properties: + name: + example: '' + type: string + query: + type: string + required: + - name + type: object + GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems: + properties: + name: + example: '' + type: string + segment_id: + example: '' + type: string + required: + - name + - segment_id + type: object + GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems: + properties: + name: + example: '' + type: string + query: + type: string + required: + - name + type: object + GetCohortUsersRequestDataAttributesTime: + properties: + from: + format: int64 + type: integer + to: + format: int64 + type: integer + type: object + GetCohortUsersRequestDataType: + default: cohort_users_request + enum: + - cohort_users_request + example: cohort_users_request + type: string + x-enum-varnames: + - COHORT_USERS_REQUEST + GetCohortUsersResponse: + example: + data: + attributes: + users: + - email: user@example.com + id: user123 + name: John Doe + - email: jane@example.com + id: user456 + name: Jane Smith + id: cohort_users_response + type: cohort_users_response + properties: + data: + $ref: '#/components/schemas/GetCohortUsersResponseData' + type: object + GetCohortUsersResponseData: + properties: + attributes: + $ref: '#/components/schemas/GetCohortUsersResponseDataAttributes' + id: + type: string + type: + $ref: '#/components/schemas/GetCohortUsersResponseDataType' + required: + - type + type: object + GetCohortUsersResponseDataAttributes: + properties: + users: + items: + $ref: '#/components/schemas/GetCohortUsersResponseDataAttributesUsersItems' + type: array + type: object + GetCohortUsersResponseDataAttributesUsersItems: + properties: + email: + type: string + id: + type: string + name: + type: string + type: object + GetCohortUsersResponseDataType: + default: cohort_users_response + enum: + - cohort_users_response + example: cohort_users_response + type: string + x-enum-varnames: + - COHORT_USERS_RESPONSE GetCustomFrameworkResponse: description: Response object to get a custom framework. properties: @@ -42312,6 +42995,294 @@ components: example: report_id type: string type: object + SankeyRequest: + example: + data: + attributes: + data_source: '' + definition: + entries_per_step: 10 + number_of_steps: 5 + source: '@view.name' + target: '@view.name' + enforced_execution_type: '' + request_id: '' + sampling: + enabled: true + search: + audience_filters: {} + query: '@type:view @application.id:*' + subquery_id: '' + time: + from: 1756425600000 + to: 1756857600000 + id: sankey_request + type: sankey_request + properties: + data: + $ref: '#/components/schemas/SankeyRequestData' + type: object + SankeyRequestData: + properties: + attributes: + $ref: '#/components/schemas/SankeyRequestDataAttributes' + id: + type: string + type: + $ref: '#/components/schemas/SankeyRequestDataType' + required: + - type + type: object + SankeyRequestDataAttributes: + properties: + data_source: + type: string + definition: + $ref: '#/components/schemas/SankeyRequestDataAttributesDefinition' + enforced_execution_type: + type: string + request_id: + type: string + sampling: + $ref: '#/components/schemas/SankeyRequestDataAttributesSampling' + search: + $ref: '#/components/schemas/SankeyRequestDataAttributesSearch' + time: + $ref: '#/components/schemas/SankeyRequestDataAttributesTime' + type: object + SankeyRequestDataAttributesDefinition: + properties: + entries_per_step: + format: int64 + type: integer + number_of_steps: + format: int64 + type: integer + source: + type: string + target: + type: string + type: object + SankeyRequestDataAttributesSampling: + properties: + enabled: + description: The `sampling` `enabled`. + type: boolean + type: object + SankeyRequestDataAttributesSearch: + properties: + audience_filters: + $ref: '#/components/schemas/SankeyRequestDataAttributesSearchAudienceFilters' + occurrences: + $ref: '#/components/schemas/SankeyRequestDataAttributesSearchOccurrences' + query: + type: string + subquery_id: + type: string + type: object + SankeyRequestDataAttributesSearchAudienceFilters: + properties: + accounts: + items: + $ref: '#/components/schemas/SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems' + type: array + formula: + type: string + segments: + items: + $ref: '#/components/schemas/SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems' + type: array + users: + items: + $ref: '#/components/schemas/SankeyRequestDataAttributesSearchAudienceFiltersUsersItems' + type: array + type: object + SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems: + properties: + name: + example: '' + type: string + query: + type: string + required: + - name + type: object + SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems: + properties: + name: + example: '' + type: string + segment_id: + example: '' + type: string + required: + - name + - segment_id + type: object + SankeyRequestDataAttributesSearchAudienceFiltersUsersItems: + properties: + name: + example: '' + type: string + query: + type: string + required: + - name + type: object + SankeyRequestDataAttributesSearchOccurrences: + properties: + meta: + additionalProperties: + type: string + type: object + operator: + example: '' + type: string + value: + example: '' + type: string + required: + - operator + - value + type: object + SankeyRequestDataAttributesTime: + properties: + from: + format: int64 + type: integer + to: + format: int64 + type: integer + type: object + SankeyRequestDataType: + default: sankey_request + enum: + - sankey_request + example: sankey_request + type: string + x-enum-varnames: + - SANKEY_REQUEST + SankeyResponse: + example: + data: + attributes: + links: + - column: 0 + id: apm_home-to-apm_traces + source: apm_home + target: apm_traces + value: 33054 + nodes: + - aggregated_nodes: null + column: 0 + id: apm_home + incoming_value: 0 + name: /apm/home + outgoing_value: 33054 + type: regular + value: 284608 + - aggregated_nodes: null + column: 1 + id: apm_traces + incoming_value: 33054 + name: /apm/traces + outgoing_value: 15000 + type: regular + value: 33054 + id: sankey_response + type: sankey_response + properties: + data: + $ref: '#/components/schemas/SankeyResponseData' + type: object + SankeyResponseData: + properties: + attributes: + $ref: '#/components/schemas/SankeyResponseDataAttributes' + id: + type: string + type: + $ref: '#/components/schemas/SankeyResponseDataType' + required: + - type + type: object + SankeyResponseDataAttributes: + properties: + links: + items: + $ref: '#/components/schemas/SankeyResponseDataAttributesLinksItems' + type: array + nodes: + items: + $ref: '#/components/schemas/SankeyResponseDataAttributesNodesItems' + type: array + type: object + SankeyResponseDataAttributesLinksItems: + properties: + column: + format: int64 + type: integer + id: + type: string + source: + type: string + target: + type: string + value: + format: int64 + type: integer + type: object + SankeyResponseDataAttributesNodesItems: + properties: + aggregated_nodes: + items: + $ref: '#/components/schemas/SankeyResponseDataAttributesNodesItemsAggregatedNodesItems' + type: array + column: + format: int64 + type: integer + id: + type: string + incoming_value: + format: int64 + type: integer + name: + type: string + outgoing_value: + format: int64 + type: integer + type: + type: string + value: + format: int64 + type: integer + type: object + SankeyResponseDataAttributesNodesItemsAggregatedNodesItems: + properties: + id: + type: string + incoming_value: + format: int64 + type: integer + name: + type: string + outgoing_value: + format: int64 + type: integer + type: + type: string + value: + format: int64 + type: integer + type: object + SankeyResponseDataType: + default: sankey_response + enum: + - sankey_response + example: sankey_response + type: string + x-enum-varnames: + - SANKEY_RESPONSE ScaRequest: properties: data: @@ -45944,6 +46915,229 @@ components: required: - securityTrigger type: object + Segment: + example: + data: + attributes: + created_at: '0001-01-01T00:00:00Z' + created_by: + handle: '' + id: '' + uuid: '' + data_query: + event_platform: + - facet: '@usr.id' + from: '2025-08-01' + name: high_value_users + query: '@type:view @view.name:/logs @usr.session_duration:>300000' + to: '2025-09-01' + description: Users who frequently visit logs and have high session duration + modified_at: '0001-01-01T00:00:00Z' + modified_by: + handle: '' + id: '' + uuid: '' + name: High-Value Users + org_id: 123456 + source: 0 + tags: + - high-value + - logs + - active + version: 1 + id: segment-12345 + type: segment + properties: + data: + $ref: '#/components/schemas/SegmentData' + type: object + SegmentArray: + properties: + data: + items: + $ref: '#/components/schemas/SegmentData' + type: array + required: + - data + type: object + SegmentData: + properties: + attributes: + $ref: '#/components/schemas/SegmentDataAttributes' + id: + type: string + type: + $ref: '#/components/schemas/SegmentDataType' + required: + - type + type: object + SegmentDataAttributes: + properties: + created_at: + format: date-time + type: string + created_by: + $ref: '#/components/schemas/SegmentDataSource' + data_query: + $ref: '#/components/schemas/SegmentDataAttributesDataQuery' + description: + type: string + disabled_at: + format: date-time + type: string + disabled_by: + $ref: '#/components/schemas/SegmentDataSource' + materialization_row_count: + format: int64 + type: integer + materialized_at: + type: string + modified_at: + format: date-time + type: string + modified_by: + $ref: '#/components/schemas/SegmentDataSource' + name: + example: '' + type: string + org_id: + format: int64 + type: integer + source: + format: int64 + type: integer + tags: + items: + type: string + type: array + version: + format: int64 + type: integer + required: + - data_query + - name + type: object + SegmentDataAttributesDataQuery: + properties: + combination: + type: string + event_platform: + items: + $ref: '#/components/schemas/SegmentDataAttributesDataQueryEventPlatformItems' + type: array + reference_table: + items: + $ref: '#/components/schemas/SegmentDataAttributesDataQueryReferenceTableItems' + type: array + static: + items: + $ref: '#/components/schemas/SegmentDataAttributesDataQueryStaticItems' + type: array + user_store: + items: + $ref: '#/components/schemas/SegmentDataAttributesDataQueryUserStoreItems' + type: array + type: object + SegmentDataAttributesDataQueryEventPlatformItems: + properties: + facet: + example: '' + type: string + from: + type: string + name: + type: string + query: + type: string + to: + type: string + required: + - facet + type: object + SegmentDataAttributesDataQueryReferenceTableItems: + properties: + columns: + items: + $ref: '#/components/schemas/SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems' + type: array + filter_query: + type: string + join_condition: + $ref: '#/components/schemas/SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition' + name: + type: string + table_name: + example: '' + type: string + required: + - join_condition + - table_name + type: object + SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems: + properties: + alias: + type: string + name: + type: string + type: object + SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition: + properties: + column_name: + example: '' + type: string + facet: + type: string + required: + - column_name + type: object + SegmentDataAttributesDataQueryStaticItems: + properties: + id: + type: string + name: + type: string + user_count: + format: int64 + minimum: 0 + type: integer + type: object + SegmentDataAttributesDataQueryUserStoreItems: + properties: + facet: + type: string + name: + type: string + query: + type: string + type: object + SegmentDataSource: + properties: + handle: + example: '' + type: string + icon: + type: string + id: + example: '' + type: string + name: + type: string + uuid: + example: '' + type: string + required: + - handle + - id + - uuid + type: object + SegmentDataType: + default: segment + enum: + - segment + example: segment + type: string + x-enum-varnames: + - SEGMENT Selectors: description: 'Selectors are used to filter security issues for which notifications should be generated. @@ -73028,6 +74222,54 @@ paths: operator: OR permissions: - rum_apps_write + /api/v2/rum/cohort: + post: + description: Analyze user cohorts for retention and conversion analysis + operationId: GetRumCohort + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GetCohortRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/GetCohortResponse' + description: Successful response with cohort analysis data + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: [] + summary: Get rum cohort + tags: + - Cohort + x-unstable: '**Note**: This endpoint may be subject to changes.' + /api/v2/rum/cohort/users: + post: + description: Get users within a specific cohort for retention analysis + operationId: GetRumCohortUsers + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GetCohortUsersRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/GetCohortUsersResponse' + description: Successful response with cohort users + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: [] + summary: Get rum cohort users + tags: + - Cohort + x-unstable: '**Note**: This endpoint may be subject to changes.' /api/v2/rum/config/metrics: get: description: Get the list of configured rum-based metrics with their definitions. @@ -73282,6 +74524,134 @@ paths: operator: OR permissions: - rum_apps_read + /api/v2/rum/funnel: + post: + description: Analyze conversion funnels to understand user drop-off patterns + operationId: GetRumFunnel + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FunnelRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/FunnelResponse' + description: Successful response with funnel analysis data + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: [] + summary: Get rum funnel + tags: + - Funnel + x-unstable: '**Note**: This endpoint may be subject to changes.' + /api/v2/rum/funnel/new_step_suggestions: + post: + description: Get suggested steps for building conversion funnels + operationId: GetRumFunnelStepSuggestions + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FunnelSuggestionRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/FunnelSuggestionResponse' + description: Successful response with funnel step suggestions + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: [] + summary: Get rum funnel step suggestions + tags: + - Funnel + x-unstable: '**Note**: This endpoint may be subject to changes.' + /api/v2/rum/sankey: + post: + description: Generate Sankey diagrams to visualize user flow paths and drop-off + points + operationId: GetRumSankey + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SankeyRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SankeyResponse' + description: Successful response with Sankey diagram data + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: [] + summary: Get rum sankey + tags: + - User Flow + x-unstable: '**Note**: This endpoint may be subject to changes.' + /api/v2/rum/segment: + get: + description: List all available user segments for audience targeting + operationId: ListRumSegments + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SegmentArray' + description: Successful response with list of segments + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: [] + summary: List rum segments + tags: + - Segments + x-unstable: '**Note**: This endpoint may be subject to changes.' + post: + description: Create a new user segment for audience targeting + operationId: CreateRumSegment + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Segment' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/Segment' + description: Segment created successfully + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: [] + summary: Create rum segment + tags: + - Segments + x-unstable: '**Note**: This endpoint may be subject to changes.' + /api/v2/rum/segment/initialize: + post: + description: Initialize default segments for a new organization + operationId: InitializeRumSegments + responses: + '200': + description: Default segments created successfully + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: [] + summary: Initialize rum segments + tags: + - Segments + x-unstable: '**Note**: This endpoint may be subject to changes.' /api/v2/saml_configurations/idp_metadata: post: description: 'Endpoint for uploading IdP metadata for SAML setup. @@ -81252,6 +82622,8 @@ tags: API. See the [Cloudflare integration page](https://docs.datadoghq.com/integrations/cloudflare/) for more information. name: Cloudflare Integration +- description: API for Cohort. + name: Cohort - description: Manage your Datadog Confluent Cloud integration accounts and account resources directly through the Datadog API. See the [Confluent Cloud page](https://docs.datadoghq.com/integrations/confluent_cloud/) for more information. @@ -81335,6 +82707,8 @@ tags: that apply configuration changes to multiple hosts at once.' name: Fleet Automation +- description: API for funnel. + name: Funnel - description: 'Configure your Datadog-Google Cloud Platform (GCP) integration directly through the Datadog API. Read more about the [Datadog-Google Cloud Platform integration](https://docs.datadoghq.com/integrations/google_cloud_platform).' @@ -81556,6 +82930,8 @@ tags: See the [Datadog Security page](https://docs.datadoghq.com/security/) for more information. name: Security Monitoring +- description: API for segments. + name: Segments - description: Create, update, delete, and retrieve sensitive data scanner groups and rules. See the [Sensitive Data Scanner page](https://docs.datadoghq.com/sensitive_data_scanner/) for more information. @@ -81643,6 +83019,8 @@ tags: description: Find out more at url: https://docs.datadoghq.com/account_management/billing/usage_details/ name: Usage Metering +- description: API for user flow. + name: User Flow - description: Create, edit, and disable users. externalDocs: url: https://docs.datadoghq.com/account_management/users diff --git a/api/datadog/configuration.go b/api/datadog/configuration.go index 0fb98e36578..ccb0446007c 100644 --- a/api/datadog/configuration.go +++ b/api/datadog/configuration.go @@ -688,6 +688,14 @@ func NewConfiguration() *Configuration { "v2.ListPipelines": false, "v2.UpdatePipeline": false, "v2.ValidatePipeline": false, + "v2.GetRumCohort": false, + "v2.GetRumCohortUsers": false, + "v2.GetRumFunnel": false, + "v2.GetRumFunnelStepSuggestions": false, + "v2.GetRumSankey": false, + "v2.CreateRumSegment": false, + "v2.InitializeRumSegments": false, + "v2.ListRumSegments": false, "v2.CreateScorecardOutcomesBatch": false, "v2.CreateScorecardRule": false, "v2.DeleteScorecardRule": false, diff --git a/api/datadogV2/api_cohort.go b/api/datadogV2/api_cohort.go new file mode 100644 index 00000000000..06cefd09dad --- /dev/null +++ b/api/datadogV2/api_cohort.go @@ -0,0 +1,177 @@ +// Unless explicitly stated otherwise all files in this repository 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" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CohortApi service type +type CohortApi datadog.Service + +// GetRumCohort Get rum cohort. +// Analyze user cohorts for retention and conversion analysis +func (a *CohortApi) GetRumCohort(ctx _context.Context, body GetCohortRequest) (GetCohortResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue GetCohortResponse + ) + + operationId := "v2.GetRumCohort" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.CohortApi.GetRumCohort") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/rum/cohort" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + 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 == 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 +} + +// GetRumCohortUsers Get rum cohort users. +// Get users within a specific cohort for retention analysis +func (a *CohortApi) GetRumCohortUsers(ctx _context.Context, body GetCohortUsersRequest) (GetCohortUsersResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue GetCohortUsersResponse + ) + + operationId := "v2.GetRumCohortUsers" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.CohortApi.GetRumCohortUsers") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/rum/cohort/users" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + 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 == 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 +} + +// NewCohortApi Returns NewCohortApi. +func NewCohortApi(client *datadog.APIClient) *CohortApi { + return &CohortApi{ + Client: client, + } +} diff --git a/api/datadogV2/api_funnel.go b/api/datadogV2/api_funnel.go new file mode 100644 index 00000000000..cc8898727ad --- /dev/null +++ b/api/datadogV2/api_funnel.go @@ -0,0 +1,177 @@ +// Unless explicitly stated otherwise all files in this repository 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" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelApi service type +type FunnelApi datadog.Service + +// GetRumFunnel Get rum funnel. +// Analyze conversion funnels to understand user drop-off patterns +func (a *FunnelApi) GetRumFunnel(ctx _context.Context, body FunnelRequest) (FunnelResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue FunnelResponse + ) + + operationId := "v2.GetRumFunnel" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.FunnelApi.GetRumFunnel") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/rum/funnel" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + 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 == 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 +} + +// GetRumFunnelStepSuggestions Get rum funnel step suggestions. +// Get suggested steps for building conversion funnels +func (a *FunnelApi) GetRumFunnelStepSuggestions(ctx _context.Context, body FunnelSuggestionRequest) (FunnelSuggestionResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue FunnelSuggestionResponse + ) + + operationId := "v2.GetRumFunnelStepSuggestions" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.FunnelApi.GetRumFunnelStepSuggestions") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/rum/funnel/new_step_suggestions" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + 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 == 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 +} + +// NewFunnelApi Returns NewFunnelApi. +func NewFunnelApi(client *datadog.APIClient) *FunnelApi { + return &FunnelApi{ + Client: client, + } +} diff --git a/api/datadogV2/api_segments.go b/api/datadogV2/api_segments.go new file mode 100644 index 00000000000..1ec0ead10e8 --- /dev/null +++ b/api/datadogV2/api_segments.go @@ -0,0 +1,237 @@ +// Unless explicitly stated otherwise all files in this repository 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" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SegmentsApi service type +type SegmentsApi datadog.Service + +// CreateRumSegment Create rum segment. +// Create a new user segment for audience targeting +func (a *SegmentsApi) CreateRumSegment(ctx _context.Context, body Segment) (Segment, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue Segment + ) + + operationId := "v2.CreateRumSegment" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SegmentsApi.CreateRumSegment") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/rum/segment" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + 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 == 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 +} + +// InitializeRumSegments Initialize rum segments. +// Initialize default segments for a new organization +func (a *SegmentsApi) InitializeRumSegments(ctx _context.Context) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + ) + + operationId := "v2.InitializeRumSegments" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SegmentsApi.InitializeRumSegments") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/rum/segment/initialize" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + 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 == 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 +} + +// ListRumSegments List rum segments. +// List all available user segments for audience targeting +func (a *SegmentsApi) ListRumSegments(ctx _context.Context) (SegmentArray, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SegmentArray + ) + + operationId := "v2.ListRumSegments" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SegmentsApi.ListRumSegments") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/rum/segment" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + 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 == 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 +} + +// NewSegmentsApi Returns NewSegmentsApi. +func NewSegmentsApi(client *datadog.APIClient) *SegmentsApi { + return &SegmentsApi{ + Client: client, + } +} diff --git a/api/datadogV2/api_user_flow.go b/api/datadogV2/api_user_flow.go new file mode 100644 index 00000000000..fa239c59a06 --- /dev/null +++ b/api/datadogV2/api_user_flow.go @@ -0,0 +1,101 @@ +// Unless explicitly stated otherwise all files in this repository 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" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// UserFlowApi service type +type UserFlowApi datadog.Service + +// GetRumSankey Get rum sankey. +// Generate Sankey diagrams to visualize user flow paths and drop-off points +func (a *UserFlowApi) GetRumSankey(ctx _context.Context, body SankeyRequest) (SankeyResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue SankeyResponse + ) + + operationId := "v2.GetRumSankey" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.UserFlowApi.GetRumSankey") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/rum/sankey" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + 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 == 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 +} + +// NewUserFlowApi Returns NewUserFlowApi. +func NewUserFlowApi(client *datadog.APIClient) *UserFlowApi { + return &UserFlowApi{ + Client: client, + } +} diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index 4d31a1c74c4..6c7494f8190 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -188,6 +188,8 @@ // - [CloudflareIntegrationApi.GetCloudflareAccount] // - [CloudflareIntegrationApi.ListCloudflareAccounts] // - [CloudflareIntegrationApi.UpdateCloudflareAccount] +// - [CohortApi.GetRumCohort] +// - [CohortApi.GetRumCohortUsers] // - [ConfluentCloudApi.CreateConfluentAccount] // - [ConfluentCloudApi.CreateConfluentResource] // - [ConfluentCloudApi.DeleteConfluentAccount] @@ -252,6 +254,8 @@ // - [FleetAutomationApi.CreateFleetDeploymentConfigure] // - [FleetAutomationApi.GetFleetDeployment] // - [FleetAutomationApi.ListFleetDeployments] +// - [FunnelApi.GetRumFunnel] +// - [FunnelApi.GetRumFunnelStepSuggestions] // - [GCPIntegrationApi.CreateGCPSTSAccount] // - [GCPIntegrationApi.DeleteGCPSTSAccount] // - [GCPIntegrationApi.GetGCPSTSDelegate] @@ -548,6 +552,9 @@ // - [SecurityMonitoringApi.UpdateSecurityMonitoringSuppression] // - [SecurityMonitoringApi.ValidateSecurityMonitoringRule] // - [SecurityMonitoringApi.ValidateSecurityMonitoringSuppression] +// - [SegmentsApi.CreateRumSegment] +// - [SegmentsApi.InitializeRumSegments] +// - [SegmentsApi.ListRumSegments] // - [SensitiveDataScannerApi.CreateScanningGroup] // - [SensitiveDataScannerApi.CreateScanningRule] // - [SensitiveDataScannerApi.DeleteScanningGroup] @@ -630,6 +637,7 @@ // - [UsageMeteringApi.GetUsageApplicationSecurityMonitoring] // - [UsageMeteringApi.GetUsageLambdaTracedInvocations] // - [UsageMeteringApi.GetUsageObservabilityPipelines] +// - [UserFlowApi.GetRumSankey] // - [UsersApi.CreateUser] // - [UsersApi.DisableUser] // - [UsersApi.GetInvitation] diff --git a/api/datadogV2/model_funnel_request.go b/api/datadogV2/model_funnel_request.go new file mode 100644 index 00000000000..accd43cec88 --- /dev/null +++ b/api/datadogV2/model_funnel_request.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelRequest +type FunnelRequest struct { + // + Data *FunnelRequestData `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{} `json:"-"` +} + +// NewFunnelRequest instantiates a new FunnelRequest 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 NewFunnelRequest() *FunnelRequest { + this := FunnelRequest{} + return &this +} + +// NewFunnelRequestWithDefaults instantiates a new FunnelRequest 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 NewFunnelRequestWithDefaults() *FunnelRequest { + this := FunnelRequest{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *FunnelRequest) GetData() FunnelRequestData { + if o == nil || o.Data == nil { + var ret FunnelRequestData + 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 *FunnelRequest) GetDataOk() (*FunnelRequestData, 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 *FunnelRequest) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given FunnelRequestData and assigns it to the Data field. +func (o *FunnelRequest) SetData(v FunnelRequestData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *FunnelRequestData `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.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 datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_funnel_request_data.go b/api/datadogV2/model_funnel_request_data.go new file mode 100644 index 00000000000..7b66d0f4477 --- /dev/null +++ b/api/datadogV2/model_funnel_request_data.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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelRequestData +type FunnelRequestData struct { + // + Attributes *FunnelRequestDataAttributes `json:"attributes,omitempty"` + // + Id *string `json:"id,omitempty"` + // + Type FunnelRequestDataType `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{} `json:"-"` +} + +// NewFunnelRequestData instantiates a new FunnelRequestData 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 NewFunnelRequestData(typeVar FunnelRequestDataType) *FunnelRequestData { + this := FunnelRequestData{} + this.Type = typeVar + return &this +} + +// NewFunnelRequestDataWithDefaults instantiates a new FunnelRequestData 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 NewFunnelRequestDataWithDefaults() *FunnelRequestData { + this := FunnelRequestData{} + var typeVar FunnelRequestDataType = FUNNELREQUESTDATATYPE_FUNNEL_REQUEST + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *FunnelRequestData) GetAttributes() FunnelRequestDataAttributes { + if o == nil || o.Attributes == nil { + var ret FunnelRequestDataAttributes + 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 *FunnelRequestData) GetAttributesOk() (*FunnelRequestDataAttributes, 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 *FunnelRequestData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given FunnelRequestDataAttributes and assigns it to the Attributes field. +func (o *FunnelRequestData) SetAttributes(v FunnelRequestDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *FunnelRequestData) 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 *FunnelRequestData) 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 *FunnelRequestData) 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 *FunnelRequestData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *FunnelRequestData) GetType() FunnelRequestDataType { + if o == nil { + var ret FunnelRequestDataType + 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 *FunnelRequestData) GetTypeOk() (*FunnelRequestDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *FunnelRequestData) SetType(v FunnelRequestDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelRequestData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *FunnelRequestDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *FunnelRequestDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.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.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_funnel_request_data_attributes.go b/api/datadogV2/model_funnel_request_data_attributes.go new file mode 100644 index 00000000000..3b6b7fdbbef --- /dev/null +++ b/api/datadogV2/model_funnel_request_data_attributes.go @@ -0,0 +1,254 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelRequestDataAttributes +type FunnelRequestDataAttributes struct { + // + DataSource *string `json:"data_source,omitempty"` + // + EnforcedExecutionType *string `json:"enforced_execution_type,omitempty"` + // + RequestId *string `json:"request_id,omitempty"` + // + Search *FunnelRequestDataAttributesSearch `json:"search,omitempty"` + // + Time *FunnelRequestDataAttributesTime `json:"time,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{} `json:"-"` +} + +// NewFunnelRequestDataAttributes instantiates a new FunnelRequestDataAttributes 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 NewFunnelRequestDataAttributes() *FunnelRequestDataAttributes { + this := FunnelRequestDataAttributes{} + return &this +} + +// NewFunnelRequestDataAttributesWithDefaults instantiates a new FunnelRequestDataAttributes 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 NewFunnelRequestDataAttributesWithDefaults() *FunnelRequestDataAttributes { + this := FunnelRequestDataAttributes{} + return &this +} + +// GetDataSource returns the DataSource field value if set, zero value otherwise. +func (o *FunnelRequestDataAttributes) GetDataSource() string { + if o == nil || o.DataSource == nil { + var ret string + return ret + } + return *o.DataSource +} + +// GetDataSourceOk returns a tuple with the DataSource field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelRequestDataAttributes) GetDataSourceOk() (*string, bool) { + if o == nil || o.DataSource == nil { + return nil, false + } + return o.DataSource, true +} + +// HasDataSource returns a boolean if a field has been set. +func (o *FunnelRequestDataAttributes) HasDataSource() bool { + return o != nil && o.DataSource != nil +} + +// SetDataSource gets a reference to the given string and assigns it to the DataSource field. +func (o *FunnelRequestDataAttributes) SetDataSource(v string) { + o.DataSource = &v +} + +// GetEnforcedExecutionType returns the EnforcedExecutionType field value if set, zero value otherwise. +func (o *FunnelRequestDataAttributes) GetEnforcedExecutionType() string { + if o == nil || o.EnforcedExecutionType == nil { + var ret string + return ret + } + return *o.EnforcedExecutionType +} + +// GetEnforcedExecutionTypeOk returns a tuple with the EnforcedExecutionType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelRequestDataAttributes) GetEnforcedExecutionTypeOk() (*string, bool) { + if o == nil || o.EnforcedExecutionType == nil { + return nil, false + } + return o.EnforcedExecutionType, true +} + +// HasEnforcedExecutionType returns a boolean if a field has been set. +func (o *FunnelRequestDataAttributes) HasEnforcedExecutionType() bool { + return o != nil && o.EnforcedExecutionType != nil +} + +// SetEnforcedExecutionType gets a reference to the given string and assigns it to the EnforcedExecutionType field. +func (o *FunnelRequestDataAttributes) SetEnforcedExecutionType(v string) { + o.EnforcedExecutionType = &v +} + +// GetRequestId returns the RequestId field value if set, zero value otherwise. +func (o *FunnelRequestDataAttributes) 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 *FunnelRequestDataAttributes) 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 *FunnelRequestDataAttributes) 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 *FunnelRequestDataAttributes) SetRequestId(v string) { + o.RequestId = &v +} + +// GetSearch returns the Search field value if set, zero value otherwise. +func (o *FunnelRequestDataAttributes) GetSearch() FunnelRequestDataAttributesSearch { + if o == nil || o.Search == nil { + var ret FunnelRequestDataAttributesSearch + return ret + } + return *o.Search +} + +// GetSearchOk returns a tuple with the Search field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelRequestDataAttributes) GetSearchOk() (*FunnelRequestDataAttributesSearch, bool) { + if o == nil || o.Search == nil { + return nil, false + } + return o.Search, true +} + +// HasSearch returns a boolean if a field has been set. +func (o *FunnelRequestDataAttributes) HasSearch() bool { + return o != nil && o.Search != nil +} + +// SetSearch gets a reference to the given FunnelRequestDataAttributesSearch and assigns it to the Search field. +func (o *FunnelRequestDataAttributes) SetSearch(v FunnelRequestDataAttributesSearch) { + o.Search = &v +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *FunnelRequestDataAttributes) GetTime() FunnelRequestDataAttributesTime { + if o == nil || o.Time == nil { + var ret FunnelRequestDataAttributesTime + 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 *FunnelRequestDataAttributes) GetTimeOk() (*FunnelRequestDataAttributesTime, 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 *FunnelRequestDataAttributes) HasTime() bool { + return o != nil && o.Time != nil +} + +// SetTime gets a reference to the given FunnelRequestDataAttributesTime and assigns it to the Time field. +func (o *FunnelRequestDataAttributes) SetTime(v FunnelRequestDataAttributesTime) { + o.Time = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelRequestDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.DataSource != nil { + toSerialize["data_source"] = o.DataSource + } + if o.EnforcedExecutionType != nil { + toSerialize["enforced_execution_type"] = o.EnforcedExecutionType + } + if o.RequestId != nil { + toSerialize["request_id"] = o.RequestId + } + if o.Search != nil { + toSerialize["search"] = o.Search + } + if o.Time != nil { + toSerialize["time"] = o.Time + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelRequestDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + DataSource *string `json:"data_source,omitempty"` + EnforcedExecutionType *string `json:"enforced_execution_type,omitempty"` + RequestId *string `json:"request_id,omitempty"` + Search *FunnelRequestDataAttributesSearch `json:"search,omitempty"` + Time *FunnelRequestDataAttributesTime `json:"time,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data_source", "enforced_execution_type", "request_id", "search", "time"}) + } else { + return err + } + + hasInvalidField := false + o.DataSource = all.DataSource + o.EnforcedExecutionType = all.EnforcedExecutionType + o.RequestId = all.RequestId + if all.Search != nil && all.Search.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Search = all.Search + if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Time = all.Time + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_funnel_request_data_attributes_search.go b/api/datadogV2/model_funnel_request_data_attributes_search.go new file mode 100644 index 00000000000..769c1c4ed3d --- /dev/null +++ b/api/datadogV2/model_funnel_request_data_attributes_search.go @@ -0,0 +1,207 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelRequestDataAttributesSearch +type FunnelRequestDataAttributesSearch struct { + // + CrossSessionFilter *string `json:"cross_session_filter,omitempty"` + // + QueryString *string `json:"query_string,omitempty"` + // + Steps []FunnelRequestDataAttributesSearchStepsItems `json:"steps,omitempty"` + // + SubqueryId *string `json:"subquery_id,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{} `json:"-"` +} + +// NewFunnelRequestDataAttributesSearch instantiates a new FunnelRequestDataAttributesSearch 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 NewFunnelRequestDataAttributesSearch() *FunnelRequestDataAttributesSearch { + this := FunnelRequestDataAttributesSearch{} + return &this +} + +// NewFunnelRequestDataAttributesSearchWithDefaults instantiates a new FunnelRequestDataAttributesSearch 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 NewFunnelRequestDataAttributesSearchWithDefaults() *FunnelRequestDataAttributesSearch { + this := FunnelRequestDataAttributesSearch{} + return &this +} + +// GetCrossSessionFilter returns the CrossSessionFilter field value if set, zero value otherwise. +func (o *FunnelRequestDataAttributesSearch) GetCrossSessionFilter() string { + if o == nil || o.CrossSessionFilter == nil { + var ret string + return ret + } + return *o.CrossSessionFilter +} + +// GetCrossSessionFilterOk returns a tuple with the CrossSessionFilter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelRequestDataAttributesSearch) GetCrossSessionFilterOk() (*string, bool) { + if o == nil || o.CrossSessionFilter == nil { + return nil, false + } + return o.CrossSessionFilter, true +} + +// HasCrossSessionFilter returns a boolean if a field has been set. +func (o *FunnelRequestDataAttributesSearch) HasCrossSessionFilter() bool { + return o != nil && o.CrossSessionFilter != nil +} + +// SetCrossSessionFilter gets a reference to the given string and assigns it to the CrossSessionFilter field. +func (o *FunnelRequestDataAttributesSearch) SetCrossSessionFilter(v string) { + o.CrossSessionFilter = &v +} + +// GetQueryString returns the QueryString field value if set, zero value otherwise. +func (o *FunnelRequestDataAttributesSearch) GetQueryString() string { + if o == nil || o.QueryString == nil { + var ret string + return ret + } + return *o.QueryString +} + +// GetQueryStringOk returns a tuple with the QueryString field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelRequestDataAttributesSearch) GetQueryStringOk() (*string, bool) { + if o == nil || o.QueryString == nil { + return nil, false + } + return o.QueryString, true +} + +// HasQueryString returns a boolean if a field has been set. +func (o *FunnelRequestDataAttributesSearch) HasQueryString() bool { + return o != nil && o.QueryString != nil +} + +// SetQueryString gets a reference to the given string and assigns it to the QueryString field. +func (o *FunnelRequestDataAttributesSearch) SetQueryString(v string) { + o.QueryString = &v +} + +// GetSteps returns the Steps field value if set, zero value otherwise. +func (o *FunnelRequestDataAttributesSearch) GetSteps() []FunnelRequestDataAttributesSearchStepsItems { + if o == nil || o.Steps == nil { + var ret []FunnelRequestDataAttributesSearchStepsItems + return ret + } + return o.Steps +} + +// GetStepsOk returns a tuple with the Steps field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelRequestDataAttributesSearch) GetStepsOk() (*[]FunnelRequestDataAttributesSearchStepsItems, bool) { + if o == nil || o.Steps == nil { + return nil, false + } + return &o.Steps, true +} + +// HasSteps returns a boolean if a field has been set. +func (o *FunnelRequestDataAttributesSearch) HasSteps() bool { + return o != nil && o.Steps != nil +} + +// SetSteps gets a reference to the given []FunnelRequestDataAttributesSearchStepsItems and assigns it to the Steps field. +func (o *FunnelRequestDataAttributesSearch) SetSteps(v []FunnelRequestDataAttributesSearchStepsItems) { + o.Steps = v +} + +// GetSubqueryId returns the SubqueryId field value if set, zero value otherwise. +func (o *FunnelRequestDataAttributesSearch) GetSubqueryId() string { + if o == nil || o.SubqueryId == nil { + var ret string + return ret + } + return *o.SubqueryId +} + +// GetSubqueryIdOk returns a tuple with the SubqueryId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelRequestDataAttributesSearch) GetSubqueryIdOk() (*string, bool) { + if o == nil || o.SubqueryId == nil { + return nil, false + } + return o.SubqueryId, true +} + +// HasSubqueryId returns a boolean if a field has been set. +func (o *FunnelRequestDataAttributesSearch) HasSubqueryId() bool { + return o != nil && o.SubqueryId != nil +} + +// SetSubqueryId gets a reference to the given string and assigns it to the SubqueryId field. +func (o *FunnelRequestDataAttributesSearch) SetSubqueryId(v string) { + o.SubqueryId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelRequestDataAttributesSearch) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CrossSessionFilter != nil { + toSerialize["cross_session_filter"] = o.CrossSessionFilter + } + if o.QueryString != nil { + toSerialize["query_string"] = o.QueryString + } + if o.Steps != nil { + toSerialize["steps"] = o.Steps + } + if o.SubqueryId != nil { + toSerialize["subquery_id"] = o.SubqueryId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelRequestDataAttributesSearch) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CrossSessionFilter *string `json:"cross_session_filter,omitempty"` + QueryString *string `json:"query_string,omitempty"` + Steps []FunnelRequestDataAttributesSearchStepsItems `json:"steps,omitempty"` + SubqueryId *string `json:"subquery_id,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"cross_session_filter", "query_string", "steps", "subquery_id"}) + } else { + return err + } + o.CrossSessionFilter = all.CrossSessionFilter + o.QueryString = all.QueryString + o.Steps = all.Steps + o.SubqueryId = all.SubqueryId + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_funnel_request_data_attributes_search_steps_items.go b/api/datadogV2/model_funnel_request_data_attributes_search_steps_items.go new file mode 100644 index 00000000000..3a69348ef07 --- /dev/null +++ b/api/datadogV2/model_funnel_request_data_attributes_search_steps_items.go @@ -0,0 +1,172 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelRequestDataAttributesSearchStepsItems +type FunnelRequestDataAttributesSearchStepsItems struct { + // + Facet *string `json:"facet,omitempty"` + // + StepFilter *string `json:"step_filter,omitempty"` + // + Value *string `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{} `json:"-"` +} + +// NewFunnelRequestDataAttributesSearchStepsItems instantiates a new FunnelRequestDataAttributesSearchStepsItems 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 NewFunnelRequestDataAttributesSearchStepsItems() *FunnelRequestDataAttributesSearchStepsItems { + this := FunnelRequestDataAttributesSearchStepsItems{} + return &this +} + +// NewFunnelRequestDataAttributesSearchStepsItemsWithDefaults instantiates a new FunnelRequestDataAttributesSearchStepsItems 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 NewFunnelRequestDataAttributesSearchStepsItemsWithDefaults() *FunnelRequestDataAttributesSearchStepsItems { + this := FunnelRequestDataAttributesSearchStepsItems{} + return &this +} + +// GetFacet returns the Facet field value if set, zero value otherwise. +func (o *FunnelRequestDataAttributesSearchStepsItems) GetFacet() string { + if o == nil || o.Facet == nil { + var ret string + return ret + } + return *o.Facet +} + +// GetFacetOk returns a tuple with the Facet field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelRequestDataAttributesSearchStepsItems) GetFacetOk() (*string, bool) { + if o == nil || o.Facet == nil { + return nil, false + } + return o.Facet, true +} + +// HasFacet returns a boolean if a field has been set. +func (o *FunnelRequestDataAttributesSearchStepsItems) HasFacet() bool { + return o != nil && o.Facet != nil +} + +// SetFacet gets a reference to the given string and assigns it to the Facet field. +func (o *FunnelRequestDataAttributesSearchStepsItems) SetFacet(v string) { + o.Facet = &v +} + +// GetStepFilter returns the StepFilter field value if set, zero value otherwise. +func (o *FunnelRequestDataAttributesSearchStepsItems) GetStepFilter() string { + if o == nil || o.StepFilter == nil { + var ret string + return ret + } + return *o.StepFilter +} + +// GetStepFilterOk returns a tuple with the StepFilter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelRequestDataAttributesSearchStepsItems) GetStepFilterOk() (*string, bool) { + if o == nil || o.StepFilter == nil { + return nil, false + } + return o.StepFilter, true +} + +// HasStepFilter returns a boolean if a field has been set. +func (o *FunnelRequestDataAttributesSearchStepsItems) HasStepFilter() bool { + return o != nil && o.StepFilter != nil +} + +// SetStepFilter gets a reference to the given string and assigns it to the StepFilter field. +func (o *FunnelRequestDataAttributesSearchStepsItems) SetStepFilter(v string) { + o.StepFilter = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *FunnelRequestDataAttributesSearchStepsItems) GetValue() string { + if o == nil || o.Value == nil { + var ret string + 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 *FunnelRequestDataAttributesSearchStepsItems) GetValueOk() (*string, 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 *FunnelRequestDataAttributesSearchStepsItems) HasValue() bool { + return o != nil && o.Value != nil +} + +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *FunnelRequestDataAttributesSearchStepsItems) SetValue(v string) { + o.Value = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelRequestDataAttributesSearchStepsItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Facet != nil { + toSerialize["facet"] = o.Facet + } + if o.StepFilter != nil { + toSerialize["step_filter"] = o.StepFilter + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelRequestDataAttributesSearchStepsItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Facet *string `json:"facet,omitempty"` + StepFilter *string `json:"step_filter,omitempty"` + Value *string `json:"value,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"facet", "step_filter", "value"}) + } else { + return err + } + o.Facet = all.Facet + o.StepFilter = all.StepFilter + o.Value = all.Value + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_funnel_request_data_attributes_time.go b/api/datadogV2/model_funnel_request_data_attributes_time.go new file mode 100644 index 00000000000..7bb1bfb2b6a --- /dev/null +++ b/api/datadogV2/model_funnel_request_data_attributes_time.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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelRequestDataAttributesTime +type FunnelRequestDataAttributesTime struct { + // + From *int64 `json:"from,omitempty"` + // + To *int64 `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{} `json:"-"` +} + +// NewFunnelRequestDataAttributesTime instantiates a new FunnelRequestDataAttributesTime 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 NewFunnelRequestDataAttributesTime() *FunnelRequestDataAttributesTime { + this := FunnelRequestDataAttributesTime{} + return &this +} + +// NewFunnelRequestDataAttributesTimeWithDefaults instantiates a new FunnelRequestDataAttributesTime 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 NewFunnelRequestDataAttributesTimeWithDefaults() *FunnelRequestDataAttributesTime { + this := FunnelRequestDataAttributesTime{} + return &this +} + +// GetFrom returns the From field value if set, zero value otherwise. +func (o *FunnelRequestDataAttributesTime) GetFrom() int64 { + if o == nil || o.From == nil { + var ret int64 + 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 *FunnelRequestDataAttributesTime) GetFromOk() (*int64, 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 *FunnelRequestDataAttributesTime) HasFrom() bool { + return o != nil && o.From != nil +} + +// SetFrom gets a reference to the given int64 and assigns it to the From field. +func (o *FunnelRequestDataAttributesTime) SetFrom(v int64) { + o.From = &v +} + +// GetTo returns the To field value if set, zero value otherwise. +func (o *FunnelRequestDataAttributesTime) GetTo() int64 { + if o == nil || o.To == nil { + var ret int64 + 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 *FunnelRequestDataAttributesTime) GetToOk() (*int64, 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 *FunnelRequestDataAttributesTime) HasTo() bool { + return o != nil && o.To != nil +} + +// SetTo gets a reference to the given int64 and assigns it to the To field. +func (o *FunnelRequestDataAttributesTime) SetTo(v int64) { + o.To = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelRequestDataAttributesTime) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.From != nil { + toSerialize["from"] = o.From + } + if o.To != nil { + toSerialize["to"] = o.To + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelRequestDataAttributesTime) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + From *int64 `json:"from,omitempty"` + To *int64 `json:"to,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"from", "to"}) + } else { + return err + } + o.From = all.From + o.To = all.To + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_funnel_request_data_type.go b/api/datadogV2/model_funnel_request_data_type.go new file mode 100644 index 00000000000..2bfb26923f3 --- /dev/null +++ b/api/datadogV2/model_funnel_request_data_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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelRequestDataType +type FunnelRequestDataType string + +// List of FunnelRequestDataType. +const ( + FUNNELREQUESTDATATYPE_FUNNEL_REQUEST FunnelRequestDataType = "funnel_request" +) + +var allowedFunnelRequestDataTypeEnumValues = []FunnelRequestDataType{ + FUNNELREQUESTDATATYPE_FUNNEL_REQUEST, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *FunnelRequestDataType) GetAllowedValues() []FunnelRequestDataType { + return allowedFunnelRequestDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *FunnelRequestDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = FunnelRequestDataType(value) + return nil +} + +// NewFunnelRequestDataTypeFromValue returns a pointer to a valid FunnelRequestDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewFunnelRequestDataTypeFromValue(v string) (*FunnelRequestDataType, error) { + ev := FunnelRequestDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for FunnelRequestDataType: valid values are %v", v, allowedFunnelRequestDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v FunnelRequestDataType) IsValid() bool { + for _, existing := range allowedFunnelRequestDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FunnelRequestDataType value. +func (v FunnelRequestDataType) Ptr() *FunnelRequestDataType { + return &v +} diff --git a/api/datadogV2/model_funnel_response.go b/api/datadogV2/model_funnel_response.go new file mode 100644 index 00000000000..654636de987 --- /dev/null +++ b/api/datadogV2/model_funnel_response.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelResponse +type FunnelResponse struct { + // + Data *FunnelResponseData `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{} `json:"-"` +} + +// NewFunnelResponse instantiates a new FunnelResponse 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 NewFunnelResponse() *FunnelResponse { + this := FunnelResponse{} + return &this +} + +// NewFunnelResponseWithDefaults instantiates a new FunnelResponse 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 NewFunnelResponseWithDefaults() *FunnelResponse { + this := FunnelResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *FunnelResponse) GetData() FunnelResponseData { + if o == nil || o.Data == nil { + var ret FunnelResponseData + 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 *FunnelResponse) GetDataOk() (*FunnelResponseData, 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 *FunnelResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given FunnelResponseData and assigns it to the Data field. +func (o *FunnelResponse) SetData(v FunnelResponseData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *FunnelResponseData `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.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 datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_funnel_response_data.go b/api/datadogV2/model_funnel_response_data.go new file mode 100644 index 00000000000..94ab3bab7a2 --- /dev/null +++ b/api/datadogV2/model_funnel_response_data.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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelResponseData +type FunnelResponseData struct { + // + Attributes *FunnelResponseDataAttributes `json:"attributes,omitempty"` + // + Id *string `json:"id,omitempty"` + // + Type FunnelResponseDataType `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{} `json:"-"` +} + +// NewFunnelResponseData instantiates a new FunnelResponseData 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 NewFunnelResponseData(typeVar FunnelResponseDataType) *FunnelResponseData { + this := FunnelResponseData{} + this.Type = typeVar + return &this +} + +// NewFunnelResponseDataWithDefaults instantiates a new FunnelResponseData 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 NewFunnelResponseDataWithDefaults() *FunnelResponseData { + this := FunnelResponseData{} + var typeVar FunnelResponseDataType = FUNNELRESPONSEDATATYPE_FUNNEL_RESPONSE + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *FunnelResponseData) GetAttributes() FunnelResponseDataAttributes { + if o == nil || o.Attributes == nil { + var ret FunnelResponseDataAttributes + 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 *FunnelResponseData) GetAttributesOk() (*FunnelResponseDataAttributes, 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 *FunnelResponseData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given FunnelResponseDataAttributes and assigns it to the Attributes field. +func (o *FunnelResponseData) SetAttributes(v FunnelResponseDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *FunnelResponseData) 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 *FunnelResponseData) 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 *FunnelResponseData) 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 *FunnelResponseData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *FunnelResponseData) GetType() FunnelResponseDataType { + if o == nil { + var ret FunnelResponseDataType + 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 *FunnelResponseData) GetTypeOk() (*FunnelResponseDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *FunnelResponseData) SetType(v FunnelResponseDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *FunnelResponseDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *FunnelResponseDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.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.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_funnel_response_data_attributes.go b/api/datadogV2/model_funnel_response_data_attributes.go new file mode 100644 index 00000000000..c81c61f19ce --- /dev/null +++ b/api/datadogV2/model_funnel_response_data_attributes.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 datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelResponseDataAttributes +type FunnelResponseDataAttributes struct { + // + EndToEndConversionRate *float64 `json:"end_to_end_conversion_rate,omitempty"` + // + EndToEndElapsedTime *FunnelResponseElapsedTime `json:"end_to_end_elapsed_time,omitempty"` + // + FunnelSteps []FunnelResponseDataAttributesFunnelStepsItems `json:"funnel_steps,omitempty"` + // + InitialCount *int64 `json:"initial_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{} `json:"-"` +} + +// NewFunnelResponseDataAttributes instantiates a new FunnelResponseDataAttributes 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 NewFunnelResponseDataAttributes() *FunnelResponseDataAttributes { + this := FunnelResponseDataAttributes{} + return &this +} + +// NewFunnelResponseDataAttributesWithDefaults instantiates a new FunnelResponseDataAttributes 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 NewFunnelResponseDataAttributesWithDefaults() *FunnelResponseDataAttributes { + this := FunnelResponseDataAttributes{} + return &this +} + +// GetEndToEndConversionRate returns the EndToEndConversionRate field value if set, zero value otherwise. +func (o *FunnelResponseDataAttributes) GetEndToEndConversionRate() float64 { + if o == nil || o.EndToEndConversionRate == nil { + var ret float64 + return ret + } + return *o.EndToEndConversionRate +} + +// GetEndToEndConversionRateOk returns a tuple with the EndToEndConversionRate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelResponseDataAttributes) GetEndToEndConversionRateOk() (*float64, bool) { + if o == nil || o.EndToEndConversionRate == nil { + return nil, false + } + return o.EndToEndConversionRate, true +} + +// HasEndToEndConversionRate returns a boolean if a field has been set. +func (o *FunnelResponseDataAttributes) HasEndToEndConversionRate() bool { + return o != nil && o.EndToEndConversionRate != nil +} + +// SetEndToEndConversionRate gets a reference to the given float64 and assigns it to the EndToEndConversionRate field. +func (o *FunnelResponseDataAttributes) SetEndToEndConversionRate(v float64) { + o.EndToEndConversionRate = &v +} + +// GetEndToEndElapsedTime returns the EndToEndElapsedTime field value if set, zero value otherwise. +func (o *FunnelResponseDataAttributes) GetEndToEndElapsedTime() FunnelResponseElapsedTime { + if o == nil || o.EndToEndElapsedTime == nil { + var ret FunnelResponseElapsedTime + return ret + } + return *o.EndToEndElapsedTime +} + +// GetEndToEndElapsedTimeOk returns a tuple with the EndToEndElapsedTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelResponseDataAttributes) GetEndToEndElapsedTimeOk() (*FunnelResponseElapsedTime, bool) { + if o == nil || o.EndToEndElapsedTime == nil { + return nil, false + } + return o.EndToEndElapsedTime, true +} + +// HasEndToEndElapsedTime returns a boolean if a field has been set. +func (o *FunnelResponseDataAttributes) HasEndToEndElapsedTime() bool { + return o != nil && o.EndToEndElapsedTime != nil +} + +// SetEndToEndElapsedTime gets a reference to the given FunnelResponseElapsedTime and assigns it to the EndToEndElapsedTime field. +func (o *FunnelResponseDataAttributes) SetEndToEndElapsedTime(v FunnelResponseElapsedTime) { + o.EndToEndElapsedTime = &v +} + +// GetFunnelSteps returns the FunnelSteps field value if set, zero value otherwise. +func (o *FunnelResponseDataAttributes) GetFunnelSteps() []FunnelResponseDataAttributesFunnelStepsItems { + if o == nil || o.FunnelSteps == nil { + var ret []FunnelResponseDataAttributesFunnelStepsItems + return ret + } + return o.FunnelSteps +} + +// GetFunnelStepsOk returns a tuple with the FunnelSteps field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelResponseDataAttributes) GetFunnelStepsOk() (*[]FunnelResponseDataAttributesFunnelStepsItems, bool) { + if o == nil || o.FunnelSteps == nil { + return nil, false + } + return &o.FunnelSteps, true +} + +// HasFunnelSteps returns a boolean if a field has been set. +func (o *FunnelResponseDataAttributes) HasFunnelSteps() bool { + return o != nil && o.FunnelSteps != nil +} + +// SetFunnelSteps gets a reference to the given []FunnelResponseDataAttributesFunnelStepsItems and assigns it to the FunnelSteps field. +func (o *FunnelResponseDataAttributes) SetFunnelSteps(v []FunnelResponseDataAttributesFunnelStepsItems) { + o.FunnelSteps = v +} + +// GetInitialCount returns the InitialCount field value if set, zero value otherwise. +func (o *FunnelResponseDataAttributes) GetInitialCount() int64 { + if o == nil || o.InitialCount == nil { + var ret int64 + return ret + } + return *o.InitialCount +} + +// GetInitialCountOk returns a tuple with the InitialCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelResponseDataAttributes) GetInitialCountOk() (*int64, bool) { + if o == nil || o.InitialCount == nil { + return nil, false + } + return o.InitialCount, true +} + +// HasInitialCount returns a boolean if a field has been set. +func (o *FunnelResponseDataAttributes) HasInitialCount() bool { + return o != nil && o.InitialCount != nil +} + +// SetInitialCount gets a reference to the given int64 and assigns it to the InitialCount field. +func (o *FunnelResponseDataAttributes) SetInitialCount(v int64) { + o.InitialCount = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelResponseDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.EndToEndConversionRate != nil { + toSerialize["end_to_end_conversion_rate"] = o.EndToEndConversionRate + } + if o.EndToEndElapsedTime != nil { + toSerialize["end_to_end_elapsed_time"] = o.EndToEndElapsedTime + } + if o.FunnelSteps != nil { + toSerialize["funnel_steps"] = o.FunnelSteps + } + if o.InitialCount != nil { + toSerialize["initial_count"] = o.InitialCount + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + EndToEndConversionRate *float64 `json:"end_to_end_conversion_rate,omitempty"` + EndToEndElapsedTime *FunnelResponseElapsedTime `json:"end_to_end_elapsed_time,omitempty"` + FunnelSteps []FunnelResponseDataAttributesFunnelStepsItems `json:"funnel_steps,omitempty"` + InitialCount *int64 `json:"initial_count,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"end_to_end_conversion_rate", "end_to_end_elapsed_time", "funnel_steps", "initial_count"}) + } else { + return err + } + + hasInvalidField := false + o.EndToEndConversionRate = all.EndToEndConversionRate + if all.EndToEndElapsedTime != nil && all.EndToEndElapsedTime.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.EndToEndElapsedTime = all.EndToEndElapsedTime + o.FunnelSteps = all.FunnelSteps + o.InitialCount = all.InitialCount + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_funnel_response_data_attributes_funnel_steps_items.go b/api/datadogV2/model_funnel_response_data_attributes_funnel_steps_items.go new file mode 100644 index 00000000000..8dfe6ba5219 --- /dev/null +++ b/api/datadogV2/model_funnel_response_data_attributes_funnel_steps_items.go @@ -0,0 +1,181 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelResponseDataAttributesFunnelStepsItems +type FunnelResponseDataAttributesFunnelStepsItems struct { + // + ElapsedTimeToNextStep *FunnelResponseElapsedTime `json:"elapsed_time_to_next_step,omitempty"` + // + Label *string `json:"label,omitempty"` + // + Value *int64 `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{} `json:"-"` +} + +// NewFunnelResponseDataAttributesFunnelStepsItems instantiates a new FunnelResponseDataAttributesFunnelStepsItems 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 NewFunnelResponseDataAttributesFunnelStepsItems() *FunnelResponseDataAttributesFunnelStepsItems { + this := FunnelResponseDataAttributesFunnelStepsItems{} + return &this +} + +// NewFunnelResponseDataAttributesFunnelStepsItemsWithDefaults instantiates a new FunnelResponseDataAttributesFunnelStepsItems 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 NewFunnelResponseDataAttributesFunnelStepsItemsWithDefaults() *FunnelResponseDataAttributesFunnelStepsItems { + this := FunnelResponseDataAttributesFunnelStepsItems{} + return &this +} + +// GetElapsedTimeToNextStep returns the ElapsedTimeToNextStep field value if set, zero value otherwise. +func (o *FunnelResponseDataAttributesFunnelStepsItems) GetElapsedTimeToNextStep() FunnelResponseElapsedTime { + if o == nil || o.ElapsedTimeToNextStep == nil { + var ret FunnelResponseElapsedTime + return ret + } + return *o.ElapsedTimeToNextStep +} + +// GetElapsedTimeToNextStepOk returns a tuple with the ElapsedTimeToNextStep field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelResponseDataAttributesFunnelStepsItems) GetElapsedTimeToNextStepOk() (*FunnelResponseElapsedTime, bool) { + if o == nil || o.ElapsedTimeToNextStep == nil { + return nil, false + } + return o.ElapsedTimeToNextStep, true +} + +// HasElapsedTimeToNextStep returns a boolean if a field has been set. +func (o *FunnelResponseDataAttributesFunnelStepsItems) HasElapsedTimeToNextStep() bool { + return o != nil && o.ElapsedTimeToNextStep != nil +} + +// SetElapsedTimeToNextStep gets a reference to the given FunnelResponseElapsedTime and assigns it to the ElapsedTimeToNextStep field. +func (o *FunnelResponseDataAttributesFunnelStepsItems) SetElapsedTimeToNextStep(v FunnelResponseElapsedTime) { + o.ElapsedTimeToNextStep = &v +} + +// GetLabel returns the Label field value if set, zero value otherwise. +func (o *FunnelResponseDataAttributesFunnelStepsItems) GetLabel() string { + if o == nil || o.Label == nil { + var ret string + return ret + } + return *o.Label +} + +// GetLabelOk returns a tuple with the Label field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelResponseDataAttributesFunnelStepsItems) GetLabelOk() (*string, bool) { + if o == nil || o.Label == nil { + return nil, false + } + return o.Label, true +} + +// HasLabel returns a boolean if a field has been set. +func (o *FunnelResponseDataAttributesFunnelStepsItems) HasLabel() bool { + return o != nil && o.Label != nil +} + +// SetLabel gets a reference to the given string and assigns it to the Label field. +func (o *FunnelResponseDataAttributesFunnelStepsItems) SetLabel(v string) { + o.Label = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *FunnelResponseDataAttributesFunnelStepsItems) GetValue() int64 { + if o == nil || o.Value == nil { + var ret int64 + 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 *FunnelResponseDataAttributesFunnelStepsItems) GetValueOk() (*int64, 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 *FunnelResponseDataAttributesFunnelStepsItems) HasValue() bool { + return o != nil && o.Value != nil +} + +// SetValue gets a reference to the given int64 and assigns it to the Value field. +func (o *FunnelResponseDataAttributesFunnelStepsItems) SetValue(v int64) { + o.Value = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelResponseDataAttributesFunnelStepsItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.ElapsedTimeToNextStep != nil { + toSerialize["elapsed_time_to_next_step"] = o.ElapsedTimeToNextStep + } + if o.Label != nil { + toSerialize["label"] = o.Label + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelResponseDataAttributesFunnelStepsItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ElapsedTimeToNextStep *FunnelResponseElapsedTime `json:"elapsed_time_to_next_step,omitempty"` + Label *string `json:"label,omitempty"` + Value *int64 `json:"value,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"elapsed_time_to_next_step", "label", "value"}) + } else { + return err + } + + hasInvalidField := false + if all.ElapsedTimeToNextStep != nil && all.ElapsedTimeToNextStep.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ElapsedTimeToNextStep = all.ElapsedTimeToNextStep + o.Label = all.Label + o.Value = all.Value + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_funnel_response_data_type.go b/api/datadogV2/model_funnel_response_data_type.go new file mode 100644 index 00000000000..9f2cfc3bf9c --- /dev/null +++ b/api/datadogV2/model_funnel_response_data_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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelResponseDataType +type FunnelResponseDataType string + +// List of FunnelResponseDataType. +const ( + FUNNELRESPONSEDATATYPE_FUNNEL_RESPONSE FunnelResponseDataType = "funnel_response" +) + +var allowedFunnelResponseDataTypeEnumValues = []FunnelResponseDataType{ + FUNNELRESPONSEDATATYPE_FUNNEL_RESPONSE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *FunnelResponseDataType) GetAllowedValues() []FunnelResponseDataType { + return allowedFunnelResponseDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *FunnelResponseDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = FunnelResponseDataType(value) + return nil +} + +// NewFunnelResponseDataTypeFromValue returns a pointer to a valid FunnelResponseDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewFunnelResponseDataTypeFromValue(v string) (*FunnelResponseDataType, error) { + ev := FunnelResponseDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for FunnelResponseDataType: valid values are %v", v, allowedFunnelResponseDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v FunnelResponseDataType) IsValid() bool { + for _, existing := range allowedFunnelResponseDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FunnelResponseDataType value. +func (v FunnelResponseDataType) Ptr() *FunnelResponseDataType { + return &v +} diff --git a/api/datadogV2/model_funnel_response_elapsed_time.go b/api/datadogV2/model_funnel_response_elapsed_time.go new file mode 100644 index 00000000000..9fd41062180 --- /dev/null +++ b/api/datadogV2/model_funnel_response_elapsed_time.go @@ -0,0 +1,277 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelResponseElapsedTime +type FunnelResponseElapsedTime struct { + // + Avg *int64 `json:"avg,omitempty"` + // + Max *int64 `json:"max,omitempty"` + // + Min *int64 `json:"min,omitempty"` + // + P5 *int64 `json:"p5,omitempty"` + // + P50 *int64 `json:"p50,omitempty"` + // + P95 *int64 `json:"p95,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{} `json:"-"` +} + +// NewFunnelResponseElapsedTime instantiates a new FunnelResponseElapsedTime 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 NewFunnelResponseElapsedTime() *FunnelResponseElapsedTime { + this := FunnelResponseElapsedTime{} + return &this +} + +// NewFunnelResponseElapsedTimeWithDefaults instantiates a new FunnelResponseElapsedTime 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 NewFunnelResponseElapsedTimeWithDefaults() *FunnelResponseElapsedTime { + this := FunnelResponseElapsedTime{} + return &this +} + +// GetAvg returns the Avg field value if set, zero value otherwise. +func (o *FunnelResponseElapsedTime) GetAvg() int64 { + if o == nil || o.Avg == nil { + var ret int64 + return ret + } + return *o.Avg +} + +// GetAvgOk returns a tuple with the Avg field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelResponseElapsedTime) GetAvgOk() (*int64, bool) { + if o == nil || o.Avg == nil { + return nil, false + } + return o.Avg, true +} + +// HasAvg returns a boolean if a field has been set. +func (o *FunnelResponseElapsedTime) HasAvg() bool { + return o != nil && o.Avg != nil +} + +// SetAvg gets a reference to the given int64 and assigns it to the Avg field. +func (o *FunnelResponseElapsedTime) SetAvg(v int64) { + o.Avg = &v +} + +// GetMax returns the Max field value if set, zero value otherwise. +func (o *FunnelResponseElapsedTime) GetMax() int64 { + if o == nil || o.Max == nil { + var ret int64 + return ret + } + return *o.Max +} + +// GetMaxOk returns a tuple with the Max field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelResponseElapsedTime) GetMaxOk() (*int64, bool) { + if o == nil || o.Max == nil { + return nil, false + } + return o.Max, true +} + +// HasMax returns a boolean if a field has been set. +func (o *FunnelResponseElapsedTime) HasMax() bool { + return o != nil && o.Max != nil +} + +// SetMax gets a reference to the given int64 and assigns it to the Max field. +func (o *FunnelResponseElapsedTime) SetMax(v int64) { + o.Max = &v +} + +// GetMin returns the Min field value if set, zero value otherwise. +func (o *FunnelResponseElapsedTime) GetMin() int64 { + if o == nil || o.Min == nil { + var ret int64 + return ret + } + return *o.Min +} + +// GetMinOk returns a tuple with the Min field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelResponseElapsedTime) GetMinOk() (*int64, bool) { + if o == nil || o.Min == nil { + return nil, false + } + return o.Min, true +} + +// HasMin returns a boolean if a field has been set. +func (o *FunnelResponseElapsedTime) HasMin() bool { + return o != nil && o.Min != nil +} + +// SetMin gets a reference to the given int64 and assigns it to the Min field. +func (o *FunnelResponseElapsedTime) SetMin(v int64) { + o.Min = &v +} + +// GetP5 returns the P5 field value if set, zero value otherwise. +func (o *FunnelResponseElapsedTime) GetP5() int64 { + if o == nil || o.P5 == nil { + var ret int64 + return ret + } + return *o.P5 +} + +// GetP5Ok returns a tuple with the P5 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelResponseElapsedTime) GetP5Ok() (*int64, bool) { + if o == nil || o.P5 == nil { + return nil, false + } + return o.P5, true +} + +// HasP5 returns a boolean if a field has been set. +func (o *FunnelResponseElapsedTime) HasP5() bool { + return o != nil && o.P5 != nil +} + +// SetP5 gets a reference to the given int64 and assigns it to the P5 field. +func (o *FunnelResponseElapsedTime) SetP5(v int64) { + o.P5 = &v +} + +// GetP50 returns the P50 field value if set, zero value otherwise. +func (o *FunnelResponseElapsedTime) GetP50() int64 { + if o == nil || o.P50 == nil { + var ret int64 + return ret + } + return *o.P50 +} + +// GetP50Ok returns a tuple with the P50 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelResponseElapsedTime) GetP50Ok() (*int64, bool) { + if o == nil || o.P50 == nil { + return nil, false + } + return o.P50, true +} + +// HasP50 returns a boolean if a field has been set. +func (o *FunnelResponseElapsedTime) HasP50() bool { + return o != nil && o.P50 != nil +} + +// SetP50 gets a reference to the given int64 and assigns it to the P50 field. +func (o *FunnelResponseElapsedTime) SetP50(v int64) { + o.P50 = &v +} + +// GetP95 returns the P95 field value if set, zero value otherwise. +func (o *FunnelResponseElapsedTime) GetP95() int64 { + if o == nil || o.P95 == nil { + var ret int64 + return ret + } + return *o.P95 +} + +// GetP95Ok returns a tuple with the P95 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelResponseElapsedTime) GetP95Ok() (*int64, bool) { + if o == nil || o.P95 == nil { + return nil, false + } + return o.P95, true +} + +// HasP95 returns a boolean if a field has been set. +func (o *FunnelResponseElapsedTime) HasP95() bool { + return o != nil && o.P95 != nil +} + +// SetP95 gets a reference to the given int64 and assigns it to the P95 field. +func (o *FunnelResponseElapsedTime) SetP95(v int64) { + o.P95 = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelResponseElapsedTime) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Avg != nil { + toSerialize["avg"] = o.Avg + } + if o.Max != nil { + toSerialize["max"] = o.Max + } + if o.Min != nil { + toSerialize["min"] = o.Min + } + if o.P5 != nil { + toSerialize["p5"] = o.P5 + } + if o.P50 != nil { + toSerialize["p50"] = o.P50 + } + if o.P95 != nil { + toSerialize["p95"] = o.P95 + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelResponseElapsedTime) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Avg *int64 `json:"avg,omitempty"` + Max *int64 `json:"max,omitempty"` + Min *int64 `json:"min,omitempty"` + P5 *int64 `json:"p5,omitempty"` + P50 *int64 `json:"p50,omitempty"` + P95 *int64 `json:"p95,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"avg", "max", "min", "p5", "p50", "p95"}) + } else { + return err + } + o.Avg = all.Avg + o.Max = all.Max + o.Min = all.Min + o.P5 = all.P5 + o.P50 = all.P50 + o.P95 = all.P95 + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_funnel_suggestion_request.go b/api/datadogV2/model_funnel_suggestion_request.go new file mode 100644 index 00000000000..f0e940f0d6d --- /dev/null +++ b/api/datadogV2/model_funnel_suggestion_request.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelSuggestionRequest +type FunnelSuggestionRequest struct { + // + Data *FunnelSuggestionRequestData `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{} `json:"-"` +} + +// NewFunnelSuggestionRequest instantiates a new FunnelSuggestionRequest 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 NewFunnelSuggestionRequest() *FunnelSuggestionRequest { + this := FunnelSuggestionRequest{} + return &this +} + +// NewFunnelSuggestionRequestWithDefaults instantiates a new FunnelSuggestionRequest 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 NewFunnelSuggestionRequestWithDefaults() *FunnelSuggestionRequest { + this := FunnelSuggestionRequest{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *FunnelSuggestionRequest) GetData() FunnelSuggestionRequestData { + if o == nil || o.Data == nil { + var ret FunnelSuggestionRequestData + 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 *FunnelSuggestionRequest) GetDataOk() (*FunnelSuggestionRequestData, 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 *FunnelSuggestionRequest) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given FunnelSuggestionRequestData and assigns it to the Data field. +func (o *FunnelSuggestionRequest) SetData(v FunnelSuggestionRequestData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelSuggestionRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelSuggestionRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *FunnelSuggestionRequestData `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.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 datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_funnel_suggestion_request_data.go b/api/datadogV2/model_funnel_suggestion_request_data.go new file mode 100644 index 00000000000..1c3230cbcec --- /dev/null +++ b/api/datadogV2/model_funnel_suggestion_request_data.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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelSuggestionRequestData +type FunnelSuggestionRequestData struct { + // + Attributes *FunnelSuggestionRequestDataAttributes `json:"attributes,omitempty"` + // + Id *string `json:"id,omitempty"` + // + Type FunnelSuggestionRequestDataType `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{} `json:"-"` +} + +// NewFunnelSuggestionRequestData instantiates a new FunnelSuggestionRequestData 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 NewFunnelSuggestionRequestData(typeVar FunnelSuggestionRequestDataType) *FunnelSuggestionRequestData { + this := FunnelSuggestionRequestData{} + this.Type = typeVar + return &this +} + +// NewFunnelSuggestionRequestDataWithDefaults instantiates a new FunnelSuggestionRequestData 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 NewFunnelSuggestionRequestDataWithDefaults() *FunnelSuggestionRequestData { + this := FunnelSuggestionRequestData{} + var typeVar FunnelSuggestionRequestDataType = FUNNELSUGGESTIONREQUESTDATATYPE_FUNNEL_SUGGESTION_REQUEST + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *FunnelSuggestionRequestData) GetAttributes() FunnelSuggestionRequestDataAttributes { + if o == nil || o.Attributes == nil { + var ret FunnelSuggestionRequestDataAttributes + 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 *FunnelSuggestionRequestData) GetAttributesOk() (*FunnelSuggestionRequestDataAttributes, 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 *FunnelSuggestionRequestData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given FunnelSuggestionRequestDataAttributes and assigns it to the Attributes field. +func (o *FunnelSuggestionRequestData) SetAttributes(v FunnelSuggestionRequestDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *FunnelSuggestionRequestData) 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 *FunnelSuggestionRequestData) 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 *FunnelSuggestionRequestData) 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 *FunnelSuggestionRequestData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *FunnelSuggestionRequestData) GetType() FunnelSuggestionRequestDataType { + if o == nil { + var ret FunnelSuggestionRequestDataType + 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 *FunnelSuggestionRequestData) GetTypeOk() (*FunnelSuggestionRequestDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *FunnelSuggestionRequestData) SetType(v FunnelSuggestionRequestDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelSuggestionRequestData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelSuggestionRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *FunnelSuggestionRequestDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *FunnelSuggestionRequestDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.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.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_funnel_suggestion_request_data_attributes.go b/api/datadogV2/model_funnel_suggestion_request_data_attributes.go new file mode 100644 index 00000000000..42589b96195 --- /dev/null +++ b/api/datadogV2/model_funnel_suggestion_request_data_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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelSuggestionRequestDataAttributes +type FunnelSuggestionRequestDataAttributes struct { + // + DataSource *string `json:"data_source,omitempty"` + // + Search *FunnelSuggestionRequestDataAttributesSearch `json:"search,omitempty"` + // + TermSearch *FunnelSuggestionRequestDataAttributesTermSearch `json:"term_search,omitempty"` + // + Time *FunnelSuggestionRequestDataAttributesTime `json:"time,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{} `json:"-"` +} + +// NewFunnelSuggestionRequestDataAttributes instantiates a new FunnelSuggestionRequestDataAttributes 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 NewFunnelSuggestionRequestDataAttributes() *FunnelSuggestionRequestDataAttributes { + this := FunnelSuggestionRequestDataAttributes{} + return &this +} + +// NewFunnelSuggestionRequestDataAttributesWithDefaults instantiates a new FunnelSuggestionRequestDataAttributes 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 NewFunnelSuggestionRequestDataAttributesWithDefaults() *FunnelSuggestionRequestDataAttributes { + this := FunnelSuggestionRequestDataAttributes{} + return &this +} + +// GetDataSource returns the DataSource field value if set, zero value otherwise. +func (o *FunnelSuggestionRequestDataAttributes) GetDataSource() string { + if o == nil || o.DataSource == nil { + var ret string + return ret + } + return *o.DataSource +} + +// GetDataSourceOk returns a tuple with the DataSource field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelSuggestionRequestDataAttributes) GetDataSourceOk() (*string, bool) { + if o == nil || o.DataSource == nil { + return nil, false + } + return o.DataSource, true +} + +// HasDataSource returns a boolean if a field has been set. +func (o *FunnelSuggestionRequestDataAttributes) HasDataSource() bool { + return o != nil && o.DataSource != nil +} + +// SetDataSource gets a reference to the given string and assigns it to the DataSource field. +func (o *FunnelSuggestionRequestDataAttributes) SetDataSource(v string) { + o.DataSource = &v +} + +// GetSearch returns the Search field value if set, zero value otherwise. +func (o *FunnelSuggestionRequestDataAttributes) GetSearch() FunnelSuggestionRequestDataAttributesSearch { + if o == nil || o.Search == nil { + var ret FunnelSuggestionRequestDataAttributesSearch + return ret + } + return *o.Search +} + +// GetSearchOk returns a tuple with the Search field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelSuggestionRequestDataAttributes) GetSearchOk() (*FunnelSuggestionRequestDataAttributesSearch, bool) { + if o == nil || o.Search == nil { + return nil, false + } + return o.Search, true +} + +// HasSearch returns a boolean if a field has been set. +func (o *FunnelSuggestionRequestDataAttributes) HasSearch() bool { + return o != nil && o.Search != nil +} + +// SetSearch gets a reference to the given FunnelSuggestionRequestDataAttributesSearch and assigns it to the Search field. +func (o *FunnelSuggestionRequestDataAttributes) SetSearch(v FunnelSuggestionRequestDataAttributesSearch) { + o.Search = &v +} + +// GetTermSearch returns the TermSearch field value if set, zero value otherwise. +func (o *FunnelSuggestionRequestDataAttributes) GetTermSearch() FunnelSuggestionRequestDataAttributesTermSearch { + if o == nil || o.TermSearch == nil { + var ret FunnelSuggestionRequestDataAttributesTermSearch + return ret + } + return *o.TermSearch +} + +// GetTermSearchOk returns a tuple with the TermSearch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelSuggestionRequestDataAttributes) GetTermSearchOk() (*FunnelSuggestionRequestDataAttributesTermSearch, bool) { + if o == nil || o.TermSearch == nil { + return nil, false + } + return o.TermSearch, true +} + +// HasTermSearch returns a boolean if a field has been set. +func (o *FunnelSuggestionRequestDataAttributes) HasTermSearch() bool { + return o != nil && o.TermSearch != nil +} + +// SetTermSearch gets a reference to the given FunnelSuggestionRequestDataAttributesTermSearch and assigns it to the TermSearch field. +func (o *FunnelSuggestionRequestDataAttributes) SetTermSearch(v FunnelSuggestionRequestDataAttributesTermSearch) { + o.TermSearch = &v +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *FunnelSuggestionRequestDataAttributes) GetTime() FunnelSuggestionRequestDataAttributesTime { + if o == nil || o.Time == nil { + var ret FunnelSuggestionRequestDataAttributesTime + 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 *FunnelSuggestionRequestDataAttributes) GetTimeOk() (*FunnelSuggestionRequestDataAttributesTime, 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 *FunnelSuggestionRequestDataAttributes) HasTime() bool { + return o != nil && o.Time != nil +} + +// SetTime gets a reference to the given FunnelSuggestionRequestDataAttributesTime and assigns it to the Time field. +func (o *FunnelSuggestionRequestDataAttributes) SetTime(v FunnelSuggestionRequestDataAttributesTime) { + o.Time = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelSuggestionRequestDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.DataSource != nil { + toSerialize["data_source"] = o.DataSource + } + if o.Search != nil { + toSerialize["search"] = o.Search + } + if o.TermSearch != nil { + toSerialize["term_search"] = o.TermSearch + } + if o.Time != nil { + toSerialize["time"] = o.Time + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelSuggestionRequestDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + DataSource *string `json:"data_source,omitempty"` + Search *FunnelSuggestionRequestDataAttributesSearch `json:"search,omitempty"` + TermSearch *FunnelSuggestionRequestDataAttributesTermSearch `json:"term_search,omitempty"` + Time *FunnelSuggestionRequestDataAttributesTime `json:"time,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data_source", "search", "term_search", "time"}) + } else { + return err + } + + hasInvalidField := false + o.DataSource = all.DataSource + if all.Search != nil && all.Search.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Search = all.Search + if all.TermSearch != nil && all.TermSearch.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.TermSearch = all.TermSearch + if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Time = all.Time + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_funnel_suggestion_request_data_attributes_search.go b/api/datadogV2/model_funnel_suggestion_request_data_attributes_search.go new file mode 100644 index 00000000000..87e75b98657 --- /dev/null +++ b/api/datadogV2/model_funnel_suggestion_request_data_attributes_search.go @@ -0,0 +1,207 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelSuggestionRequestDataAttributesSearch +type FunnelSuggestionRequestDataAttributesSearch struct { + // + CrossSessionFilter *string `json:"cross_session_filter,omitempty"` + // + QueryString *string `json:"query_string,omitempty"` + // + Steps []FunnelSuggestionRequestDataAttributesSearchStepsItems `json:"steps,omitempty"` + // + SubqueryId *string `json:"subquery_id,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{} `json:"-"` +} + +// NewFunnelSuggestionRequestDataAttributesSearch instantiates a new FunnelSuggestionRequestDataAttributesSearch 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 NewFunnelSuggestionRequestDataAttributesSearch() *FunnelSuggestionRequestDataAttributesSearch { + this := FunnelSuggestionRequestDataAttributesSearch{} + return &this +} + +// NewFunnelSuggestionRequestDataAttributesSearchWithDefaults instantiates a new FunnelSuggestionRequestDataAttributesSearch 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 NewFunnelSuggestionRequestDataAttributesSearchWithDefaults() *FunnelSuggestionRequestDataAttributesSearch { + this := FunnelSuggestionRequestDataAttributesSearch{} + return &this +} + +// GetCrossSessionFilter returns the CrossSessionFilter field value if set, zero value otherwise. +func (o *FunnelSuggestionRequestDataAttributesSearch) GetCrossSessionFilter() string { + if o == nil || o.CrossSessionFilter == nil { + var ret string + return ret + } + return *o.CrossSessionFilter +} + +// GetCrossSessionFilterOk returns a tuple with the CrossSessionFilter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelSuggestionRequestDataAttributesSearch) GetCrossSessionFilterOk() (*string, bool) { + if o == nil || o.CrossSessionFilter == nil { + return nil, false + } + return o.CrossSessionFilter, true +} + +// HasCrossSessionFilter returns a boolean if a field has been set. +func (o *FunnelSuggestionRequestDataAttributesSearch) HasCrossSessionFilter() bool { + return o != nil && o.CrossSessionFilter != nil +} + +// SetCrossSessionFilter gets a reference to the given string and assigns it to the CrossSessionFilter field. +func (o *FunnelSuggestionRequestDataAttributesSearch) SetCrossSessionFilter(v string) { + o.CrossSessionFilter = &v +} + +// GetQueryString returns the QueryString field value if set, zero value otherwise. +func (o *FunnelSuggestionRequestDataAttributesSearch) GetQueryString() string { + if o == nil || o.QueryString == nil { + var ret string + return ret + } + return *o.QueryString +} + +// GetQueryStringOk returns a tuple with the QueryString field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelSuggestionRequestDataAttributesSearch) GetQueryStringOk() (*string, bool) { + if o == nil || o.QueryString == nil { + return nil, false + } + return o.QueryString, true +} + +// HasQueryString returns a boolean if a field has been set. +func (o *FunnelSuggestionRequestDataAttributesSearch) HasQueryString() bool { + return o != nil && o.QueryString != nil +} + +// SetQueryString gets a reference to the given string and assigns it to the QueryString field. +func (o *FunnelSuggestionRequestDataAttributesSearch) SetQueryString(v string) { + o.QueryString = &v +} + +// GetSteps returns the Steps field value if set, zero value otherwise. +func (o *FunnelSuggestionRequestDataAttributesSearch) GetSteps() []FunnelSuggestionRequestDataAttributesSearchStepsItems { + if o == nil || o.Steps == nil { + var ret []FunnelSuggestionRequestDataAttributesSearchStepsItems + return ret + } + return o.Steps +} + +// GetStepsOk returns a tuple with the Steps field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelSuggestionRequestDataAttributesSearch) GetStepsOk() (*[]FunnelSuggestionRequestDataAttributesSearchStepsItems, bool) { + if o == nil || o.Steps == nil { + return nil, false + } + return &o.Steps, true +} + +// HasSteps returns a boolean if a field has been set. +func (o *FunnelSuggestionRequestDataAttributesSearch) HasSteps() bool { + return o != nil && o.Steps != nil +} + +// SetSteps gets a reference to the given []FunnelSuggestionRequestDataAttributesSearchStepsItems and assigns it to the Steps field. +func (o *FunnelSuggestionRequestDataAttributesSearch) SetSteps(v []FunnelSuggestionRequestDataAttributesSearchStepsItems) { + o.Steps = v +} + +// GetSubqueryId returns the SubqueryId field value if set, zero value otherwise. +func (o *FunnelSuggestionRequestDataAttributesSearch) GetSubqueryId() string { + if o == nil || o.SubqueryId == nil { + var ret string + return ret + } + return *o.SubqueryId +} + +// GetSubqueryIdOk returns a tuple with the SubqueryId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelSuggestionRequestDataAttributesSearch) GetSubqueryIdOk() (*string, bool) { + if o == nil || o.SubqueryId == nil { + return nil, false + } + return o.SubqueryId, true +} + +// HasSubqueryId returns a boolean if a field has been set. +func (o *FunnelSuggestionRequestDataAttributesSearch) HasSubqueryId() bool { + return o != nil && o.SubqueryId != nil +} + +// SetSubqueryId gets a reference to the given string and assigns it to the SubqueryId field. +func (o *FunnelSuggestionRequestDataAttributesSearch) SetSubqueryId(v string) { + o.SubqueryId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelSuggestionRequestDataAttributesSearch) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CrossSessionFilter != nil { + toSerialize["cross_session_filter"] = o.CrossSessionFilter + } + if o.QueryString != nil { + toSerialize["query_string"] = o.QueryString + } + if o.Steps != nil { + toSerialize["steps"] = o.Steps + } + if o.SubqueryId != nil { + toSerialize["subquery_id"] = o.SubqueryId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelSuggestionRequestDataAttributesSearch) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CrossSessionFilter *string `json:"cross_session_filter,omitempty"` + QueryString *string `json:"query_string,omitempty"` + Steps []FunnelSuggestionRequestDataAttributesSearchStepsItems `json:"steps,omitempty"` + SubqueryId *string `json:"subquery_id,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"cross_session_filter", "query_string", "steps", "subquery_id"}) + } else { + return err + } + o.CrossSessionFilter = all.CrossSessionFilter + o.QueryString = all.QueryString + o.Steps = all.Steps + o.SubqueryId = all.SubqueryId + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_funnel_suggestion_request_data_attributes_search_steps_items.go b/api/datadogV2/model_funnel_suggestion_request_data_attributes_search_steps_items.go new file mode 100644 index 00000000000..00922563969 --- /dev/null +++ b/api/datadogV2/model_funnel_suggestion_request_data_attributes_search_steps_items.go @@ -0,0 +1,172 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelSuggestionRequestDataAttributesSearchStepsItems +type FunnelSuggestionRequestDataAttributesSearchStepsItems struct { + // + Facet *string `json:"facet,omitempty"` + // + StepFilter *string `json:"step_filter,omitempty"` + // + Value *string `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{} `json:"-"` +} + +// NewFunnelSuggestionRequestDataAttributesSearchStepsItems instantiates a new FunnelSuggestionRequestDataAttributesSearchStepsItems 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 NewFunnelSuggestionRequestDataAttributesSearchStepsItems() *FunnelSuggestionRequestDataAttributesSearchStepsItems { + this := FunnelSuggestionRequestDataAttributesSearchStepsItems{} + return &this +} + +// NewFunnelSuggestionRequestDataAttributesSearchStepsItemsWithDefaults instantiates a new FunnelSuggestionRequestDataAttributesSearchStepsItems 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 NewFunnelSuggestionRequestDataAttributesSearchStepsItemsWithDefaults() *FunnelSuggestionRequestDataAttributesSearchStepsItems { + this := FunnelSuggestionRequestDataAttributesSearchStepsItems{} + return &this +} + +// GetFacet returns the Facet field value if set, zero value otherwise. +func (o *FunnelSuggestionRequestDataAttributesSearchStepsItems) GetFacet() string { + if o == nil || o.Facet == nil { + var ret string + return ret + } + return *o.Facet +} + +// GetFacetOk returns a tuple with the Facet field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelSuggestionRequestDataAttributesSearchStepsItems) GetFacetOk() (*string, bool) { + if o == nil || o.Facet == nil { + return nil, false + } + return o.Facet, true +} + +// HasFacet returns a boolean if a field has been set. +func (o *FunnelSuggestionRequestDataAttributesSearchStepsItems) HasFacet() bool { + return o != nil && o.Facet != nil +} + +// SetFacet gets a reference to the given string and assigns it to the Facet field. +func (o *FunnelSuggestionRequestDataAttributesSearchStepsItems) SetFacet(v string) { + o.Facet = &v +} + +// GetStepFilter returns the StepFilter field value if set, zero value otherwise. +func (o *FunnelSuggestionRequestDataAttributesSearchStepsItems) GetStepFilter() string { + if o == nil || o.StepFilter == nil { + var ret string + return ret + } + return *o.StepFilter +} + +// GetStepFilterOk returns a tuple with the StepFilter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelSuggestionRequestDataAttributesSearchStepsItems) GetStepFilterOk() (*string, bool) { + if o == nil || o.StepFilter == nil { + return nil, false + } + return o.StepFilter, true +} + +// HasStepFilter returns a boolean if a field has been set. +func (o *FunnelSuggestionRequestDataAttributesSearchStepsItems) HasStepFilter() bool { + return o != nil && o.StepFilter != nil +} + +// SetStepFilter gets a reference to the given string and assigns it to the StepFilter field. +func (o *FunnelSuggestionRequestDataAttributesSearchStepsItems) SetStepFilter(v string) { + o.StepFilter = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *FunnelSuggestionRequestDataAttributesSearchStepsItems) GetValue() string { + if o == nil || o.Value == nil { + var ret string + 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 *FunnelSuggestionRequestDataAttributesSearchStepsItems) GetValueOk() (*string, 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 *FunnelSuggestionRequestDataAttributesSearchStepsItems) HasValue() bool { + return o != nil && o.Value != nil +} + +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *FunnelSuggestionRequestDataAttributesSearchStepsItems) SetValue(v string) { + o.Value = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelSuggestionRequestDataAttributesSearchStepsItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Facet != nil { + toSerialize["facet"] = o.Facet + } + if o.StepFilter != nil { + toSerialize["step_filter"] = o.StepFilter + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelSuggestionRequestDataAttributesSearchStepsItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Facet *string `json:"facet,omitempty"` + StepFilter *string `json:"step_filter,omitempty"` + Value *string `json:"value,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"facet", "step_filter", "value"}) + } else { + return err + } + o.Facet = all.Facet + o.StepFilter = all.StepFilter + o.Value = all.Value + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_funnel_suggestion_request_data_attributes_term_search.go b/api/datadogV2/model_funnel_suggestion_request_data_attributes_term_search.go new file mode 100644 index 00000000000..d4d4b912699 --- /dev/null +++ b/api/datadogV2/model_funnel_suggestion_request_data_attributes_term_search.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelSuggestionRequestDataAttributesTermSearch +type FunnelSuggestionRequestDataAttributesTermSearch struct { + // + 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{} `json:"-"` +} + +// NewFunnelSuggestionRequestDataAttributesTermSearch instantiates a new FunnelSuggestionRequestDataAttributesTermSearch 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 NewFunnelSuggestionRequestDataAttributesTermSearch() *FunnelSuggestionRequestDataAttributesTermSearch { + this := FunnelSuggestionRequestDataAttributesTermSearch{} + return &this +} + +// NewFunnelSuggestionRequestDataAttributesTermSearchWithDefaults instantiates a new FunnelSuggestionRequestDataAttributesTermSearch 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 NewFunnelSuggestionRequestDataAttributesTermSearchWithDefaults() *FunnelSuggestionRequestDataAttributesTermSearch { + this := FunnelSuggestionRequestDataAttributesTermSearch{} + return &this +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *FunnelSuggestionRequestDataAttributesTermSearch) 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 *FunnelSuggestionRequestDataAttributesTermSearch) 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 *FunnelSuggestionRequestDataAttributesTermSearch) 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 *FunnelSuggestionRequestDataAttributesTermSearch) SetQuery(v string) { + o.Query = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelSuggestionRequestDataAttributesTermSearch) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelSuggestionRequestDataAttributesTermSearch) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Query *string `json:"query,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"query"}) + } else { + return err + } + o.Query = all.Query + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_funnel_suggestion_request_data_attributes_time.go b/api/datadogV2/model_funnel_suggestion_request_data_attributes_time.go new file mode 100644 index 00000000000..ecb8fd19a32 --- /dev/null +++ b/api/datadogV2/model_funnel_suggestion_request_data_attributes_time.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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelSuggestionRequestDataAttributesTime +type FunnelSuggestionRequestDataAttributesTime struct { + // + From *int64 `json:"from,omitempty"` + // + To *int64 `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{} `json:"-"` +} + +// NewFunnelSuggestionRequestDataAttributesTime instantiates a new FunnelSuggestionRequestDataAttributesTime 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 NewFunnelSuggestionRequestDataAttributesTime() *FunnelSuggestionRequestDataAttributesTime { + this := FunnelSuggestionRequestDataAttributesTime{} + return &this +} + +// NewFunnelSuggestionRequestDataAttributesTimeWithDefaults instantiates a new FunnelSuggestionRequestDataAttributesTime 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 NewFunnelSuggestionRequestDataAttributesTimeWithDefaults() *FunnelSuggestionRequestDataAttributesTime { + this := FunnelSuggestionRequestDataAttributesTime{} + return &this +} + +// GetFrom returns the From field value if set, zero value otherwise. +func (o *FunnelSuggestionRequestDataAttributesTime) GetFrom() int64 { + if o == nil || o.From == nil { + var ret int64 + 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 *FunnelSuggestionRequestDataAttributesTime) GetFromOk() (*int64, 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 *FunnelSuggestionRequestDataAttributesTime) HasFrom() bool { + return o != nil && o.From != nil +} + +// SetFrom gets a reference to the given int64 and assigns it to the From field. +func (o *FunnelSuggestionRequestDataAttributesTime) SetFrom(v int64) { + o.From = &v +} + +// GetTo returns the To field value if set, zero value otherwise. +func (o *FunnelSuggestionRequestDataAttributesTime) GetTo() int64 { + if o == nil || o.To == nil { + var ret int64 + 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 *FunnelSuggestionRequestDataAttributesTime) GetToOk() (*int64, 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 *FunnelSuggestionRequestDataAttributesTime) HasTo() bool { + return o != nil && o.To != nil +} + +// SetTo gets a reference to the given int64 and assigns it to the To field. +func (o *FunnelSuggestionRequestDataAttributesTime) SetTo(v int64) { + o.To = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelSuggestionRequestDataAttributesTime) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.From != nil { + toSerialize["from"] = o.From + } + if o.To != nil { + toSerialize["to"] = o.To + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelSuggestionRequestDataAttributesTime) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + From *int64 `json:"from,omitempty"` + To *int64 `json:"to,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"from", "to"}) + } else { + return err + } + o.From = all.From + o.To = all.To + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_funnel_suggestion_request_data_type.go b/api/datadogV2/model_funnel_suggestion_request_data_type.go new file mode 100644 index 00000000000..85ecc81ea9f --- /dev/null +++ b/api/datadogV2/model_funnel_suggestion_request_data_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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelSuggestionRequestDataType +type FunnelSuggestionRequestDataType string + +// List of FunnelSuggestionRequestDataType. +const ( + FUNNELSUGGESTIONREQUESTDATATYPE_FUNNEL_SUGGESTION_REQUEST FunnelSuggestionRequestDataType = "funnel_suggestion_request" +) + +var allowedFunnelSuggestionRequestDataTypeEnumValues = []FunnelSuggestionRequestDataType{ + FUNNELSUGGESTIONREQUESTDATATYPE_FUNNEL_SUGGESTION_REQUEST, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *FunnelSuggestionRequestDataType) GetAllowedValues() []FunnelSuggestionRequestDataType { + return allowedFunnelSuggestionRequestDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *FunnelSuggestionRequestDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = FunnelSuggestionRequestDataType(value) + return nil +} + +// NewFunnelSuggestionRequestDataTypeFromValue returns a pointer to a valid FunnelSuggestionRequestDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewFunnelSuggestionRequestDataTypeFromValue(v string) (*FunnelSuggestionRequestDataType, error) { + ev := FunnelSuggestionRequestDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for FunnelSuggestionRequestDataType: valid values are %v", v, allowedFunnelSuggestionRequestDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v FunnelSuggestionRequestDataType) IsValid() bool { + for _, existing := range allowedFunnelSuggestionRequestDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FunnelSuggestionRequestDataType value. +func (v FunnelSuggestionRequestDataType) Ptr() *FunnelSuggestionRequestDataType { + return &v +} diff --git a/api/datadogV2/model_funnel_suggestion_response.go b/api/datadogV2/model_funnel_suggestion_response.go new file mode 100644 index 00000000000..aaa37d0df50 --- /dev/null +++ b/api/datadogV2/model_funnel_suggestion_response.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelSuggestionResponse +type FunnelSuggestionResponse struct { + // + Data *FunnelSuggestionResponseData `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{} `json:"-"` +} + +// NewFunnelSuggestionResponse instantiates a new FunnelSuggestionResponse 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 NewFunnelSuggestionResponse() *FunnelSuggestionResponse { + this := FunnelSuggestionResponse{} + return &this +} + +// NewFunnelSuggestionResponseWithDefaults instantiates a new FunnelSuggestionResponse 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 NewFunnelSuggestionResponseWithDefaults() *FunnelSuggestionResponse { + this := FunnelSuggestionResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *FunnelSuggestionResponse) GetData() FunnelSuggestionResponseData { + if o == nil || o.Data == nil { + var ret FunnelSuggestionResponseData + 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 *FunnelSuggestionResponse) GetDataOk() (*FunnelSuggestionResponseData, 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 *FunnelSuggestionResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given FunnelSuggestionResponseData and assigns it to the Data field. +func (o *FunnelSuggestionResponse) SetData(v FunnelSuggestionResponseData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelSuggestionResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelSuggestionResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *FunnelSuggestionResponseData `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.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 datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_funnel_suggestion_response_data.go b/api/datadogV2/model_funnel_suggestion_response_data.go new file mode 100644 index 00000000000..34468b6166d --- /dev/null +++ b/api/datadogV2/model_funnel_suggestion_response_data.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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelSuggestionResponseData +type FunnelSuggestionResponseData struct { + // + Attributes *FunnelSuggestionResponseDataAttributes `json:"attributes,omitempty"` + // + Id *string `json:"id,omitempty"` + // + Type FunnelSuggestionResponseDataType `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{} `json:"-"` +} + +// NewFunnelSuggestionResponseData instantiates a new FunnelSuggestionResponseData 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 NewFunnelSuggestionResponseData(typeVar FunnelSuggestionResponseDataType) *FunnelSuggestionResponseData { + this := FunnelSuggestionResponseData{} + this.Type = typeVar + return &this +} + +// NewFunnelSuggestionResponseDataWithDefaults instantiates a new FunnelSuggestionResponseData 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 NewFunnelSuggestionResponseDataWithDefaults() *FunnelSuggestionResponseData { + this := FunnelSuggestionResponseData{} + var typeVar FunnelSuggestionResponseDataType = FUNNELSUGGESTIONRESPONSEDATATYPE_FUNNEL_SUGGESTION_RESPONSE + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *FunnelSuggestionResponseData) GetAttributes() FunnelSuggestionResponseDataAttributes { + if o == nil || o.Attributes == nil { + var ret FunnelSuggestionResponseDataAttributes + 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 *FunnelSuggestionResponseData) GetAttributesOk() (*FunnelSuggestionResponseDataAttributes, 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 *FunnelSuggestionResponseData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given FunnelSuggestionResponseDataAttributes and assigns it to the Attributes field. +func (o *FunnelSuggestionResponseData) SetAttributes(v FunnelSuggestionResponseDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *FunnelSuggestionResponseData) 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 *FunnelSuggestionResponseData) 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 *FunnelSuggestionResponseData) 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 *FunnelSuggestionResponseData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *FunnelSuggestionResponseData) GetType() FunnelSuggestionResponseDataType { + if o == nil { + var ret FunnelSuggestionResponseDataType + 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 *FunnelSuggestionResponseData) GetTypeOk() (*FunnelSuggestionResponseDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *FunnelSuggestionResponseData) SetType(v FunnelSuggestionResponseDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelSuggestionResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelSuggestionResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *FunnelSuggestionResponseDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *FunnelSuggestionResponseDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.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.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_funnel_suggestion_response_data_attributes.go b/api/datadogV2/model_funnel_suggestion_response_data_attributes.go new file mode 100644 index 00000000000..cba862067cc --- /dev/null +++ b/api/datadogV2/model_funnel_suggestion_response_data_attributes.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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelSuggestionResponseDataAttributes +type FunnelSuggestionResponseDataAttributes struct { + // + Actions []FunnelSuggestionResponseDataAttributesActionsItems `json:"actions,omitempty"` + // + Views []FunnelSuggestionResponseDataAttributesViewsItems `json:"views,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{} `json:"-"` +} + +// NewFunnelSuggestionResponseDataAttributes instantiates a new FunnelSuggestionResponseDataAttributes 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 NewFunnelSuggestionResponseDataAttributes() *FunnelSuggestionResponseDataAttributes { + this := FunnelSuggestionResponseDataAttributes{} + return &this +} + +// NewFunnelSuggestionResponseDataAttributesWithDefaults instantiates a new FunnelSuggestionResponseDataAttributes 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 NewFunnelSuggestionResponseDataAttributesWithDefaults() *FunnelSuggestionResponseDataAttributes { + this := FunnelSuggestionResponseDataAttributes{} + return &this +} + +// GetActions returns the Actions field value if set, zero value otherwise. +func (o *FunnelSuggestionResponseDataAttributes) GetActions() []FunnelSuggestionResponseDataAttributesActionsItems { + if o == nil || o.Actions == nil { + var ret []FunnelSuggestionResponseDataAttributesActionsItems + return ret + } + return o.Actions +} + +// GetActionsOk returns a tuple with the Actions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelSuggestionResponseDataAttributes) GetActionsOk() (*[]FunnelSuggestionResponseDataAttributesActionsItems, bool) { + if o == nil || o.Actions == nil { + return nil, false + } + return &o.Actions, true +} + +// HasActions returns a boolean if a field has been set. +func (o *FunnelSuggestionResponseDataAttributes) HasActions() bool { + return o != nil && o.Actions != nil +} + +// SetActions gets a reference to the given []FunnelSuggestionResponseDataAttributesActionsItems and assigns it to the Actions field. +func (o *FunnelSuggestionResponseDataAttributes) SetActions(v []FunnelSuggestionResponseDataAttributesActionsItems) { + o.Actions = v +} + +// GetViews returns the Views field value if set, zero value otherwise. +func (o *FunnelSuggestionResponseDataAttributes) GetViews() []FunnelSuggestionResponseDataAttributesViewsItems { + if o == nil || o.Views == nil { + var ret []FunnelSuggestionResponseDataAttributesViewsItems + return ret + } + return o.Views +} + +// GetViewsOk returns a tuple with the Views field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelSuggestionResponseDataAttributes) GetViewsOk() (*[]FunnelSuggestionResponseDataAttributesViewsItems, bool) { + if o == nil || o.Views == nil { + return nil, false + } + return &o.Views, true +} + +// HasViews returns a boolean if a field has been set. +func (o *FunnelSuggestionResponseDataAttributes) HasViews() bool { + return o != nil && o.Views != nil +} + +// SetViews gets a reference to the given []FunnelSuggestionResponseDataAttributesViewsItems and assigns it to the Views field. +func (o *FunnelSuggestionResponseDataAttributes) SetViews(v []FunnelSuggestionResponseDataAttributesViewsItems) { + o.Views = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelSuggestionResponseDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Actions != nil { + toSerialize["actions"] = o.Actions + } + if o.Views != nil { + toSerialize["views"] = o.Views + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelSuggestionResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Actions []FunnelSuggestionResponseDataAttributesActionsItems `json:"actions,omitempty"` + Views []FunnelSuggestionResponseDataAttributesViewsItems `json:"views,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"actions", "views"}) + } else { + return err + } + o.Actions = all.Actions + o.Views = all.Views + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_funnel_suggestion_response_data_attributes_actions_items.go b/api/datadogV2/model_funnel_suggestion_response_data_attributes_actions_items.go new file mode 100644 index 00000000000..059ed9bdb24 --- /dev/null +++ b/api/datadogV2/model_funnel_suggestion_response_data_attributes_actions_items.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelSuggestionResponseDataAttributesActionsItems +type FunnelSuggestionResponseDataAttributesActionsItems struct { + // + 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{} `json:"-"` +} + +// NewFunnelSuggestionResponseDataAttributesActionsItems instantiates a new FunnelSuggestionResponseDataAttributesActionsItems 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 NewFunnelSuggestionResponseDataAttributesActionsItems() *FunnelSuggestionResponseDataAttributesActionsItems { + this := FunnelSuggestionResponseDataAttributesActionsItems{} + return &this +} + +// NewFunnelSuggestionResponseDataAttributesActionsItemsWithDefaults instantiates a new FunnelSuggestionResponseDataAttributesActionsItems 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 NewFunnelSuggestionResponseDataAttributesActionsItemsWithDefaults() *FunnelSuggestionResponseDataAttributesActionsItems { + this := FunnelSuggestionResponseDataAttributesActionsItems{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *FunnelSuggestionResponseDataAttributesActionsItems) 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 *FunnelSuggestionResponseDataAttributesActionsItems) 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 *FunnelSuggestionResponseDataAttributesActionsItems) 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 *FunnelSuggestionResponseDataAttributesActionsItems) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelSuggestionResponseDataAttributesActionsItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelSuggestionResponseDataAttributesActionsItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Name *string `json:"name,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.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/api/datadogV2/model_funnel_suggestion_response_data_attributes_views_items.go b/api/datadogV2/model_funnel_suggestion_response_data_attributes_views_items.go new file mode 100644 index 00000000000..340438647c2 --- /dev/null +++ b/api/datadogV2/model_funnel_suggestion_response_data_attributes_views_items.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelSuggestionResponseDataAttributesViewsItems +type FunnelSuggestionResponseDataAttributesViewsItems struct { + // + 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{} `json:"-"` +} + +// NewFunnelSuggestionResponseDataAttributesViewsItems instantiates a new FunnelSuggestionResponseDataAttributesViewsItems 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 NewFunnelSuggestionResponseDataAttributesViewsItems() *FunnelSuggestionResponseDataAttributesViewsItems { + this := FunnelSuggestionResponseDataAttributesViewsItems{} + return &this +} + +// NewFunnelSuggestionResponseDataAttributesViewsItemsWithDefaults instantiates a new FunnelSuggestionResponseDataAttributesViewsItems 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 NewFunnelSuggestionResponseDataAttributesViewsItemsWithDefaults() *FunnelSuggestionResponseDataAttributesViewsItems { + this := FunnelSuggestionResponseDataAttributesViewsItems{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *FunnelSuggestionResponseDataAttributesViewsItems) 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 *FunnelSuggestionResponseDataAttributesViewsItems) 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 *FunnelSuggestionResponseDataAttributesViewsItems) 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 *FunnelSuggestionResponseDataAttributesViewsItems) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelSuggestionResponseDataAttributesViewsItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelSuggestionResponseDataAttributesViewsItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Name *string `json:"name,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.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/api/datadogV2/model_funnel_suggestion_response_data_type.go b/api/datadogV2/model_funnel_suggestion_response_data_type.go new file mode 100644 index 00000000000..a415f43ea1a --- /dev/null +++ b/api/datadogV2/model_funnel_suggestion_response_data_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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FunnelSuggestionResponseDataType +type FunnelSuggestionResponseDataType string + +// List of FunnelSuggestionResponseDataType. +const ( + FUNNELSUGGESTIONRESPONSEDATATYPE_FUNNEL_SUGGESTION_RESPONSE FunnelSuggestionResponseDataType = "funnel_suggestion_response" +) + +var allowedFunnelSuggestionResponseDataTypeEnumValues = []FunnelSuggestionResponseDataType{ + FUNNELSUGGESTIONRESPONSEDATATYPE_FUNNEL_SUGGESTION_RESPONSE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *FunnelSuggestionResponseDataType) GetAllowedValues() []FunnelSuggestionResponseDataType { + return allowedFunnelSuggestionResponseDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *FunnelSuggestionResponseDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = FunnelSuggestionResponseDataType(value) + return nil +} + +// NewFunnelSuggestionResponseDataTypeFromValue returns a pointer to a valid FunnelSuggestionResponseDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewFunnelSuggestionResponseDataTypeFromValue(v string) (*FunnelSuggestionResponseDataType, error) { + ev := FunnelSuggestionResponseDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for FunnelSuggestionResponseDataType: valid values are %v", v, allowedFunnelSuggestionResponseDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v FunnelSuggestionResponseDataType) IsValid() bool { + for _, existing := range allowedFunnelSuggestionResponseDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FunnelSuggestionResponseDataType value. +func (v FunnelSuggestionResponseDataType) Ptr() *FunnelSuggestionResponseDataType { + return &v +} diff --git a/api/datadogV2/model_get_cohort_request.go b/api/datadogV2/model_get_cohort_request.go new file mode 100644 index 00000000000..39229b6e37b --- /dev/null +++ b/api/datadogV2/model_get_cohort_request.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortRequest +type GetCohortRequest struct { + // + Data *GetCohortRequestData `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{} `json:"-"` +} + +// NewGetCohortRequest instantiates a new GetCohortRequest 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 NewGetCohortRequest() *GetCohortRequest { + this := GetCohortRequest{} + return &this +} + +// NewGetCohortRequestWithDefaults instantiates a new GetCohortRequest 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 NewGetCohortRequestWithDefaults() *GetCohortRequest { + this := GetCohortRequest{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *GetCohortRequest) GetData() GetCohortRequestData { + if o == nil || o.Data == nil { + var ret GetCohortRequestData + 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 *GetCohortRequest) GetDataOk() (*GetCohortRequestData, 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 *GetCohortRequest) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given GetCohortRequestData and assigns it to the Data field. +func (o *GetCohortRequest) SetData(v GetCohortRequestData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *GetCohortRequestData `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.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 datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_request_data.go b/api/datadogV2/model_get_cohort_request_data.go new file mode 100644 index 00000000000..8295efbe409 --- /dev/null +++ b/api/datadogV2/model_get_cohort_request_data.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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortRequestData +type GetCohortRequestData struct { + // + Attributes *GetCohortRequestDataAttributes `json:"attributes,omitempty"` + // + Id *string `json:"id,omitempty"` + // + Type GetCohortRequestDataType `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{} `json:"-"` +} + +// NewGetCohortRequestData instantiates a new GetCohortRequestData 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 NewGetCohortRequestData(typeVar GetCohortRequestDataType) *GetCohortRequestData { + this := GetCohortRequestData{} + this.Type = typeVar + return &this +} + +// NewGetCohortRequestDataWithDefaults instantiates a new GetCohortRequestData 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 NewGetCohortRequestDataWithDefaults() *GetCohortRequestData { + this := GetCohortRequestData{} + var typeVar GetCohortRequestDataType = GETCOHORTREQUESTDATATYPE_COHORT_REQUEST + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *GetCohortRequestData) GetAttributes() GetCohortRequestDataAttributes { + if o == nil || o.Attributes == nil { + var ret GetCohortRequestDataAttributes + 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 *GetCohortRequestData) GetAttributesOk() (*GetCohortRequestDataAttributes, 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 *GetCohortRequestData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given GetCohortRequestDataAttributes and assigns it to the Attributes field. +func (o *GetCohortRequestData) SetAttributes(v GetCohortRequestDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *GetCohortRequestData) 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 *GetCohortRequestData) 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 *GetCohortRequestData) 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 *GetCohortRequestData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *GetCohortRequestData) GetType() GetCohortRequestDataType { + if o == nil { + var ret GetCohortRequestDataType + 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 *GetCohortRequestData) GetTypeOk() (*GetCohortRequestDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *GetCohortRequestData) SetType(v GetCohortRequestDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortRequestData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *GetCohortRequestDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *GetCohortRequestDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.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.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_request_data_attributes.go b/api/datadogV2/model_get_cohort_request_data_attributes.go new file mode 100644 index 00000000000..bdc5930faf1 --- /dev/null +++ b/api/datadogV2/model_get_cohort_request_data_attributes.go @@ -0,0 +1,289 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortRequestDataAttributes +type GetCohortRequestDataAttributes struct { + // + DataSource *string `json:"data_source,omitempty"` + // + Definition *GetCohortRequestDataAttributesDefinition `json:"definition,omitempty"` + // + EnforcedExecutionType *string `json:"enforced_execution_type,omitempty"` + // + RequestId *string `json:"request_id,omitempty"` + // + Time *GetCohortRequestDataAttributesTime `json:"time,omitempty"` + // + WindowSize *string `json:"window_size,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{} `json:"-"` +} + +// NewGetCohortRequestDataAttributes instantiates a new GetCohortRequestDataAttributes 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 NewGetCohortRequestDataAttributes() *GetCohortRequestDataAttributes { + this := GetCohortRequestDataAttributes{} + return &this +} + +// NewGetCohortRequestDataAttributesWithDefaults instantiates a new GetCohortRequestDataAttributes 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 NewGetCohortRequestDataAttributesWithDefaults() *GetCohortRequestDataAttributes { + this := GetCohortRequestDataAttributes{} + return &this +} + +// GetDataSource returns the DataSource field value if set, zero value otherwise. +func (o *GetCohortRequestDataAttributes) GetDataSource() string { + if o == nil || o.DataSource == nil { + var ret string + return ret + } + return *o.DataSource +} + +// GetDataSourceOk returns a tuple with the DataSource field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortRequestDataAttributes) GetDataSourceOk() (*string, bool) { + if o == nil || o.DataSource == nil { + return nil, false + } + return o.DataSource, true +} + +// HasDataSource returns a boolean if a field has been set. +func (o *GetCohortRequestDataAttributes) HasDataSource() bool { + return o != nil && o.DataSource != nil +} + +// SetDataSource gets a reference to the given string and assigns it to the DataSource field. +func (o *GetCohortRequestDataAttributes) SetDataSource(v string) { + o.DataSource = &v +} + +// GetDefinition returns the Definition field value if set, zero value otherwise. +func (o *GetCohortRequestDataAttributes) GetDefinition() GetCohortRequestDataAttributesDefinition { + if o == nil || o.Definition == nil { + var ret GetCohortRequestDataAttributesDefinition + return ret + } + return *o.Definition +} + +// GetDefinitionOk returns a tuple with the Definition field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortRequestDataAttributes) GetDefinitionOk() (*GetCohortRequestDataAttributesDefinition, bool) { + if o == nil || o.Definition == nil { + return nil, false + } + return o.Definition, true +} + +// HasDefinition returns a boolean if a field has been set. +func (o *GetCohortRequestDataAttributes) HasDefinition() bool { + return o != nil && o.Definition != nil +} + +// SetDefinition gets a reference to the given GetCohortRequestDataAttributesDefinition and assigns it to the Definition field. +func (o *GetCohortRequestDataAttributes) SetDefinition(v GetCohortRequestDataAttributesDefinition) { + o.Definition = &v +} + +// GetEnforcedExecutionType returns the EnforcedExecutionType field value if set, zero value otherwise. +func (o *GetCohortRequestDataAttributes) GetEnforcedExecutionType() string { + if o == nil || o.EnforcedExecutionType == nil { + var ret string + return ret + } + return *o.EnforcedExecutionType +} + +// GetEnforcedExecutionTypeOk returns a tuple with the EnforcedExecutionType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortRequestDataAttributes) GetEnforcedExecutionTypeOk() (*string, bool) { + if o == nil || o.EnforcedExecutionType == nil { + return nil, false + } + return o.EnforcedExecutionType, true +} + +// HasEnforcedExecutionType returns a boolean if a field has been set. +func (o *GetCohortRequestDataAttributes) HasEnforcedExecutionType() bool { + return o != nil && o.EnforcedExecutionType != nil +} + +// SetEnforcedExecutionType gets a reference to the given string and assigns it to the EnforcedExecutionType field. +func (o *GetCohortRequestDataAttributes) SetEnforcedExecutionType(v string) { + o.EnforcedExecutionType = &v +} + +// GetRequestId returns the RequestId field value if set, zero value otherwise. +func (o *GetCohortRequestDataAttributes) 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 *GetCohortRequestDataAttributes) 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 *GetCohortRequestDataAttributes) 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 *GetCohortRequestDataAttributes) SetRequestId(v string) { + o.RequestId = &v +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *GetCohortRequestDataAttributes) GetTime() GetCohortRequestDataAttributesTime { + if o == nil || o.Time == nil { + var ret GetCohortRequestDataAttributesTime + 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 *GetCohortRequestDataAttributes) GetTimeOk() (*GetCohortRequestDataAttributesTime, 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 *GetCohortRequestDataAttributes) HasTime() bool { + return o != nil && o.Time != nil +} + +// SetTime gets a reference to the given GetCohortRequestDataAttributesTime and assigns it to the Time field. +func (o *GetCohortRequestDataAttributes) SetTime(v GetCohortRequestDataAttributesTime) { + o.Time = &v +} + +// GetWindowSize returns the WindowSize field value if set, zero value otherwise. +func (o *GetCohortRequestDataAttributes) GetWindowSize() string { + if o == nil || o.WindowSize == nil { + var ret string + return ret + } + return *o.WindowSize +} + +// GetWindowSizeOk returns a tuple with the WindowSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortRequestDataAttributes) GetWindowSizeOk() (*string, bool) { + if o == nil || o.WindowSize == nil { + return nil, false + } + return o.WindowSize, true +} + +// HasWindowSize returns a boolean if a field has been set. +func (o *GetCohortRequestDataAttributes) HasWindowSize() bool { + return o != nil && o.WindowSize != nil +} + +// SetWindowSize gets a reference to the given string and assigns it to the WindowSize field. +func (o *GetCohortRequestDataAttributes) SetWindowSize(v string) { + o.WindowSize = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortRequestDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.DataSource != nil { + toSerialize["data_source"] = o.DataSource + } + if o.Definition != nil { + toSerialize["definition"] = o.Definition + } + if o.EnforcedExecutionType != nil { + toSerialize["enforced_execution_type"] = o.EnforcedExecutionType + } + if o.RequestId != nil { + toSerialize["request_id"] = o.RequestId + } + if o.Time != nil { + toSerialize["time"] = o.Time + } + if o.WindowSize != nil { + toSerialize["window_size"] = o.WindowSize + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortRequestDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + DataSource *string `json:"data_source,omitempty"` + Definition *GetCohortRequestDataAttributesDefinition `json:"definition,omitempty"` + EnforcedExecutionType *string `json:"enforced_execution_type,omitempty"` + RequestId *string `json:"request_id,omitempty"` + Time *GetCohortRequestDataAttributesTime `json:"time,omitempty"` + WindowSize *string `json:"window_size,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data_source", "definition", "enforced_execution_type", "request_id", "time", "window_size"}) + } else { + return err + } + + hasInvalidField := false + o.DataSource = all.DataSource + if all.Definition != nil && all.Definition.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Definition = all.Definition + o.EnforcedExecutionType = all.EnforcedExecutionType + o.RequestId = all.RequestId + if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Time = all.Time + o.WindowSize = all.WindowSize + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_request_data_attributes_definition.go b/api/datadogV2/model_get_cohort_request_data_attributes_definition.go new file mode 100644 index 00000000000..5bdfe234034 --- /dev/null +++ b/api/datadogV2/model_get_cohort_request_data_attributes_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 datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortRequestDataAttributesDefinition +type GetCohortRequestDataAttributesDefinition struct { + // + AudienceFilters *GetCohortRequestDataAttributesDefinitionAudienceFilters `json:"audience_filters,omitempty"` + // + InclusionSearch *string `json:"inclusion_search,omitempty"` + // + ReturnSearch *string `json:"return_search,omitempty"` + // + SegmentId *string `json:"segment_id,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{} `json:"-"` +} + +// NewGetCohortRequestDataAttributesDefinition instantiates a new GetCohortRequestDataAttributesDefinition 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 NewGetCohortRequestDataAttributesDefinition() *GetCohortRequestDataAttributesDefinition { + this := GetCohortRequestDataAttributesDefinition{} + return &this +} + +// NewGetCohortRequestDataAttributesDefinitionWithDefaults instantiates a new GetCohortRequestDataAttributesDefinition 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 NewGetCohortRequestDataAttributesDefinitionWithDefaults() *GetCohortRequestDataAttributesDefinition { + this := GetCohortRequestDataAttributesDefinition{} + return &this +} + +// GetAudienceFilters returns the AudienceFilters field value if set, zero value otherwise. +func (o *GetCohortRequestDataAttributesDefinition) GetAudienceFilters() GetCohortRequestDataAttributesDefinitionAudienceFilters { + if o == nil || o.AudienceFilters == nil { + var ret GetCohortRequestDataAttributesDefinitionAudienceFilters + return ret + } + return *o.AudienceFilters +} + +// GetAudienceFiltersOk returns a tuple with the AudienceFilters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortRequestDataAttributesDefinition) GetAudienceFiltersOk() (*GetCohortRequestDataAttributesDefinitionAudienceFilters, bool) { + if o == nil || o.AudienceFilters == nil { + return nil, false + } + return o.AudienceFilters, true +} + +// HasAudienceFilters returns a boolean if a field has been set. +func (o *GetCohortRequestDataAttributesDefinition) HasAudienceFilters() bool { + return o != nil && o.AudienceFilters != nil +} + +// SetAudienceFilters gets a reference to the given GetCohortRequestDataAttributesDefinitionAudienceFilters and assigns it to the AudienceFilters field. +func (o *GetCohortRequestDataAttributesDefinition) SetAudienceFilters(v GetCohortRequestDataAttributesDefinitionAudienceFilters) { + o.AudienceFilters = &v +} + +// GetInclusionSearch returns the InclusionSearch field value if set, zero value otherwise. +func (o *GetCohortRequestDataAttributesDefinition) GetInclusionSearch() string { + if o == nil || o.InclusionSearch == nil { + var ret string + return ret + } + return *o.InclusionSearch +} + +// GetInclusionSearchOk returns a tuple with the InclusionSearch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortRequestDataAttributesDefinition) GetInclusionSearchOk() (*string, bool) { + if o == nil || o.InclusionSearch == nil { + return nil, false + } + return o.InclusionSearch, true +} + +// HasInclusionSearch returns a boolean if a field has been set. +func (o *GetCohortRequestDataAttributesDefinition) HasInclusionSearch() bool { + return o != nil && o.InclusionSearch != nil +} + +// SetInclusionSearch gets a reference to the given string and assigns it to the InclusionSearch field. +func (o *GetCohortRequestDataAttributesDefinition) SetInclusionSearch(v string) { + o.InclusionSearch = &v +} + +// GetReturnSearch returns the ReturnSearch field value if set, zero value otherwise. +func (o *GetCohortRequestDataAttributesDefinition) GetReturnSearch() string { + if o == nil || o.ReturnSearch == nil { + var ret string + return ret + } + return *o.ReturnSearch +} + +// GetReturnSearchOk returns a tuple with the ReturnSearch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortRequestDataAttributesDefinition) GetReturnSearchOk() (*string, bool) { + if o == nil || o.ReturnSearch == nil { + return nil, false + } + return o.ReturnSearch, true +} + +// HasReturnSearch returns a boolean if a field has been set. +func (o *GetCohortRequestDataAttributesDefinition) HasReturnSearch() bool { + return o != nil && o.ReturnSearch != nil +} + +// SetReturnSearch gets a reference to the given string and assigns it to the ReturnSearch field. +func (o *GetCohortRequestDataAttributesDefinition) SetReturnSearch(v string) { + o.ReturnSearch = &v +} + +// GetSegmentId returns the SegmentId field value if set, zero value otherwise. +func (o *GetCohortRequestDataAttributesDefinition) GetSegmentId() string { + if o == nil || o.SegmentId == nil { + var ret string + return ret + } + return *o.SegmentId +} + +// GetSegmentIdOk returns a tuple with the SegmentId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortRequestDataAttributesDefinition) GetSegmentIdOk() (*string, bool) { + if o == nil || o.SegmentId == nil { + return nil, false + } + return o.SegmentId, true +} + +// HasSegmentId returns a boolean if a field has been set. +func (o *GetCohortRequestDataAttributesDefinition) HasSegmentId() bool { + return o != nil && o.SegmentId != nil +} + +// SetSegmentId gets a reference to the given string and assigns it to the SegmentId field. +func (o *GetCohortRequestDataAttributesDefinition) SetSegmentId(v string) { + o.SegmentId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortRequestDataAttributesDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AudienceFilters != nil { + toSerialize["audience_filters"] = o.AudienceFilters + } + if o.InclusionSearch != nil { + toSerialize["inclusion_search"] = o.InclusionSearch + } + if o.ReturnSearch != nil { + toSerialize["return_search"] = o.ReturnSearch + } + if o.SegmentId != nil { + toSerialize["segment_id"] = o.SegmentId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortRequestDataAttributesDefinition) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AudienceFilters *GetCohortRequestDataAttributesDefinitionAudienceFilters `json:"audience_filters,omitempty"` + InclusionSearch *string `json:"inclusion_search,omitempty"` + ReturnSearch *string `json:"return_search,omitempty"` + SegmentId *string `json:"segment_id,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"audience_filters", "inclusion_search", "return_search", "segment_id"}) + } else { + return err + } + + hasInvalidField := false + if all.AudienceFilters != nil && all.AudienceFilters.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.AudienceFilters = all.AudienceFilters + o.InclusionSearch = all.InclusionSearch + o.ReturnSearch = all.ReturnSearch + o.SegmentId = all.SegmentId + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_request_data_attributes_definition_audience_filters.go b/api/datadogV2/model_get_cohort_request_data_attributes_definition_audience_filters.go new file mode 100644 index 00000000000..7096aa64086 --- /dev/null +++ b/api/datadogV2/model_get_cohort_request_data_attributes_definition_audience_filters.go @@ -0,0 +1,207 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortRequestDataAttributesDefinitionAudienceFilters +type GetCohortRequestDataAttributesDefinitionAudienceFilters struct { + // + Accounts []GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems `json:"accounts,omitempty"` + // + Formula *string `json:"formula,omitempty"` + // + Segments []GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems `json:"segments,omitempty"` + // + Users []GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems `json:"users,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{} `json:"-"` +} + +// NewGetCohortRequestDataAttributesDefinitionAudienceFilters instantiates a new GetCohortRequestDataAttributesDefinitionAudienceFilters 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 NewGetCohortRequestDataAttributesDefinitionAudienceFilters() *GetCohortRequestDataAttributesDefinitionAudienceFilters { + this := GetCohortRequestDataAttributesDefinitionAudienceFilters{} + return &this +} + +// NewGetCohortRequestDataAttributesDefinitionAudienceFiltersWithDefaults instantiates a new GetCohortRequestDataAttributesDefinitionAudienceFilters 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 NewGetCohortRequestDataAttributesDefinitionAudienceFiltersWithDefaults() *GetCohortRequestDataAttributesDefinitionAudienceFilters { + this := GetCohortRequestDataAttributesDefinitionAudienceFilters{} + return &this +} + +// GetAccounts returns the Accounts field value if set, zero value otherwise. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFilters) GetAccounts() []GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems { + if o == nil || o.Accounts == nil { + var ret []GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems + return ret + } + return o.Accounts +} + +// GetAccountsOk returns a tuple with the Accounts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFilters) GetAccountsOk() (*[]GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems, bool) { + if o == nil || o.Accounts == nil { + return nil, false + } + return &o.Accounts, true +} + +// HasAccounts returns a boolean if a field has been set. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFilters) HasAccounts() bool { + return o != nil && o.Accounts != nil +} + +// SetAccounts gets a reference to the given []GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems and assigns it to the Accounts field. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFilters) SetAccounts(v []GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems) { + o.Accounts = v +} + +// GetFormula returns the Formula field value if set, zero value otherwise. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFilters) GetFormula() string { + if o == nil || o.Formula == nil { + var ret string + return ret + } + return *o.Formula +} + +// GetFormulaOk returns a tuple with the Formula field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFilters) GetFormulaOk() (*string, bool) { + if o == nil || o.Formula == nil { + return nil, false + } + return o.Formula, true +} + +// HasFormula returns a boolean if a field has been set. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFilters) HasFormula() bool { + return o != nil && o.Formula != nil +} + +// SetFormula gets a reference to the given string and assigns it to the Formula field. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFilters) SetFormula(v string) { + o.Formula = &v +} + +// GetSegments returns the Segments field value if set, zero value otherwise. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFilters) GetSegments() []GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems { + if o == nil || o.Segments == nil { + var ret []GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems + return ret + } + return o.Segments +} + +// GetSegmentsOk returns a tuple with the Segments field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFilters) GetSegmentsOk() (*[]GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems, bool) { + if o == nil || o.Segments == nil { + return nil, false + } + return &o.Segments, true +} + +// HasSegments returns a boolean if a field has been set. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFilters) HasSegments() bool { + return o != nil && o.Segments != nil +} + +// SetSegments gets a reference to the given []GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems and assigns it to the Segments field. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFilters) SetSegments(v []GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems) { + o.Segments = v +} + +// GetUsers returns the Users field value if set, zero value otherwise. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFilters) GetUsers() []GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems { + if o == nil || o.Users == nil { + var ret []GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems + return ret + } + return o.Users +} + +// GetUsersOk returns a tuple with the Users field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFilters) GetUsersOk() (*[]GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems, bool) { + if o == nil || o.Users == nil { + return nil, false + } + return &o.Users, true +} + +// HasUsers returns a boolean if a field has been set. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFilters) HasUsers() bool { + return o != nil && o.Users != nil +} + +// SetUsers gets a reference to the given []GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems and assigns it to the Users field. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFilters) SetUsers(v []GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems) { + o.Users = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortRequestDataAttributesDefinitionAudienceFilters) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Accounts != nil { + toSerialize["accounts"] = o.Accounts + } + if o.Formula != nil { + toSerialize["formula"] = o.Formula + } + if o.Segments != nil { + toSerialize["segments"] = o.Segments + } + if o.Users != nil { + toSerialize["users"] = o.Users + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFilters) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Accounts []GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems `json:"accounts,omitempty"` + Formula *string `json:"formula,omitempty"` + Segments []GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems `json:"segments,omitempty"` + Users []GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems `json:"users,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"accounts", "formula", "segments", "users"}) + } else { + return err + } + o.Accounts = all.Accounts + o.Formula = all.Formula + o.Segments = all.Segments + o.Users = all.Users + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_request_data_attributes_definition_audience_filters_accounts_items.go b/api/datadogV2/model_get_cohort_request_data_attributes_definition_audience_filters_accounts_items.go new file mode 100644 index 00000000000..547d2cd9e12 --- /dev/null +++ b/api/datadogV2/model_get_cohort_request_data_attributes_definition_audience_filters_accounts_items.go @@ -0,0 +1,136 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems +type GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems struct { + // + Name string `json:"name"` + // + 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{} `json:"-"` +} + +// NewGetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems instantiates a new GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems 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 NewGetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems(name string) *GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems { + this := GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems{} + this.Name = name + return &this +} + +// NewGetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItemsWithDefaults instantiates a new GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems 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 NewGetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItemsWithDefaults() *GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems { + this := GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems{} + return &this +} + +// GetName returns the Name field value. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems) 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 *GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems) SetName(v string) { + o.Name = v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems) 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 *GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems) 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 *GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems) 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 *GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems) SetQuery(v string) { + o.Query = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + if o.Query != nil { + toSerialize["query"] = o.Query + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Name *string `json:"name"` + Query *string `json:"query,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"name", "query"}) + } else { + return err + } + o.Name = *all.Name + o.Query = all.Query + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_request_data_attributes_definition_audience_filters_segments_items.go b/api/datadogV2/model_get_cohort_request_data_attributes_definition_audience_filters_segments_items.go new file mode 100644 index 00000000000..7bece8028f9 --- /dev/null +++ b/api/datadogV2/model_get_cohort_request_data_attributes_definition_audience_filters_segments_items.go @@ -0,0 +1,133 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems +type GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems struct { + // + Name string `json:"name"` + // + SegmentId string `json:"segment_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{} `json:"-"` +} + +// NewGetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems instantiates a new GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems 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 NewGetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems(name string, segmentId string) *GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems { + this := GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems{} + this.Name = name + this.SegmentId = segmentId + return &this +} + +// NewGetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItemsWithDefaults instantiates a new GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems 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 NewGetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItemsWithDefaults() *GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems { + this := GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems{} + return &this +} + +// GetName returns the Name field value. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems) 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 *GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems) SetName(v string) { + o.Name = v +} + +// GetSegmentId returns the SegmentId field value. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems) GetSegmentId() string { + if o == nil { + var ret string + return ret + } + return o.SegmentId +} + +// GetSegmentIdOk returns a tuple with the SegmentId field value +// and a boolean to check if the value has been set. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems) GetSegmentIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SegmentId, true +} + +// SetSegmentId sets field value. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems) SetSegmentId(v string) { + o.SegmentId = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + toSerialize["segment_id"] = o.SegmentId + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Name *string `json:"name"` + SegmentId *string `json:"segment_id"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.SegmentId == nil { + return fmt.Errorf("required field segment_id missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"name", "segment_id"}) + } else { + return err + } + o.Name = *all.Name + o.SegmentId = *all.SegmentId + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_request_data_attributes_definition_audience_filters_users_items.go b/api/datadogV2/model_get_cohort_request_data_attributes_definition_audience_filters_users_items.go new file mode 100644 index 00000000000..1cff57652bc --- /dev/null +++ b/api/datadogV2/model_get_cohort_request_data_attributes_definition_audience_filters_users_items.go @@ -0,0 +1,136 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems +type GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems struct { + // + Name string `json:"name"` + // + 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{} `json:"-"` +} + +// NewGetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems instantiates a new GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems 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 NewGetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems(name string) *GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems { + this := GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems{} + this.Name = name + return &this +} + +// NewGetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItemsWithDefaults instantiates a new GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems 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 NewGetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItemsWithDefaults() *GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems { + this := GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems{} + return &this +} + +// GetName returns the Name field value. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems) 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 *GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems) SetName(v string) { + o.Name = v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems) 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 *GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems) 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 *GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems) 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 *GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems) SetQuery(v string) { + o.Query = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + if o.Query != nil { + toSerialize["query"] = o.Query + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Name *string `json:"name"` + Query *string `json:"query,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"name", "query"}) + } else { + return err + } + o.Name = *all.Name + o.Query = all.Query + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_request_data_attributes_time.go b/api/datadogV2/model_get_cohort_request_data_attributes_time.go new file mode 100644 index 00000000000..ae5e08db995 --- /dev/null +++ b/api/datadogV2/model_get_cohort_request_data_attributes_time.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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortRequestDataAttributesTime +type GetCohortRequestDataAttributesTime struct { + // + From *int64 `json:"from,omitempty"` + // + To *int64 `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{} `json:"-"` +} + +// NewGetCohortRequestDataAttributesTime instantiates a new GetCohortRequestDataAttributesTime 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 NewGetCohortRequestDataAttributesTime() *GetCohortRequestDataAttributesTime { + this := GetCohortRequestDataAttributesTime{} + return &this +} + +// NewGetCohortRequestDataAttributesTimeWithDefaults instantiates a new GetCohortRequestDataAttributesTime 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 NewGetCohortRequestDataAttributesTimeWithDefaults() *GetCohortRequestDataAttributesTime { + this := GetCohortRequestDataAttributesTime{} + return &this +} + +// GetFrom returns the From field value if set, zero value otherwise. +func (o *GetCohortRequestDataAttributesTime) GetFrom() int64 { + if o == nil || o.From == nil { + var ret int64 + 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 *GetCohortRequestDataAttributesTime) GetFromOk() (*int64, 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 *GetCohortRequestDataAttributesTime) HasFrom() bool { + return o != nil && o.From != nil +} + +// SetFrom gets a reference to the given int64 and assigns it to the From field. +func (o *GetCohortRequestDataAttributesTime) SetFrom(v int64) { + o.From = &v +} + +// GetTo returns the To field value if set, zero value otherwise. +func (o *GetCohortRequestDataAttributesTime) GetTo() int64 { + if o == nil || o.To == nil { + var ret int64 + 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 *GetCohortRequestDataAttributesTime) GetToOk() (*int64, 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 *GetCohortRequestDataAttributesTime) HasTo() bool { + return o != nil && o.To != nil +} + +// SetTo gets a reference to the given int64 and assigns it to the To field. +func (o *GetCohortRequestDataAttributesTime) SetTo(v int64) { + o.To = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortRequestDataAttributesTime) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.From != nil { + toSerialize["from"] = o.From + } + if o.To != nil { + toSerialize["to"] = o.To + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortRequestDataAttributesTime) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + From *int64 `json:"from,omitempty"` + To *int64 `json:"to,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"from", "to"}) + } else { + return err + } + o.From = all.From + o.To = all.To + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_request_data_type.go b/api/datadogV2/model_get_cohort_request_data_type.go new file mode 100644 index 00000000000..d02cd1faf15 --- /dev/null +++ b/api/datadogV2/model_get_cohort_request_data_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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortRequestDataType +type GetCohortRequestDataType string + +// List of GetCohortRequestDataType. +const ( + GETCOHORTREQUESTDATATYPE_COHORT_REQUEST GetCohortRequestDataType = "cohort_request" +) + +var allowedGetCohortRequestDataTypeEnumValues = []GetCohortRequestDataType{ + GETCOHORTREQUESTDATATYPE_COHORT_REQUEST, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *GetCohortRequestDataType) GetAllowedValues() []GetCohortRequestDataType { + return allowedGetCohortRequestDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *GetCohortRequestDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = GetCohortRequestDataType(value) + return nil +} + +// NewGetCohortRequestDataTypeFromValue returns a pointer to a valid GetCohortRequestDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewGetCohortRequestDataTypeFromValue(v string) (*GetCohortRequestDataType, error) { + ev := GetCohortRequestDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for GetCohortRequestDataType: valid values are %v", v, allowedGetCohortRequestDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v GetCohortRequestDataType) IsValid() bool { + for _, existing := range allowedGetCohortRequestDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to GetCohortRequestDataType value. +func (v GetCohortRequestDataType) Ptr() *GetCohortRequestDataType { + return &v +} diff --git a/api/datadogV2/model_get_cohort_response.go b/api/datadogV2/model_get_cohort_response.go new file mode 100644 index 00000000000..367ec17c689 --- /dev/null +++ b/api/datadogV2/model_get_cohort_response.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortResponse +type GetCohortResponse struct { + // + Data *GetCohortResponseData `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{} `json:"-"` +} + +// NewGetCohortResponse instantiates a new GetCohortResponse 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 NewGetCohortResponse() *GetCohortResponse { + this := GetCohortResponse{} + return &this +} + +// NewGetCohortResponseWithDefaults instantiates a new GetCohortResponse 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 NewGetCohortResponseWithDefaults() *GetCohortResponse { + this := GetCohortResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *GetCohortResponse) GetData() GetCohortResponseData { + if o == nil || o.Data == nil { + var ret GetCohortResponseData + 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 *GetCohortResponse) GetDataOk() (*GetCohortResponseData, 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 *GetCohortResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given GetCohortResponseData and assigns it to the Data field. +func (o *GetCohortResponse) SetData(v GetCohortResponseData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *GetCohortResponseData `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.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 datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_response_data.go b/api/datadogV2/model_get_cohort_response_data.go new file mode 100644 index 00000000000..b584c355282 --- /dev/null +++ b/api/datadogV2/model_get_cohort_response_data.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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortResponseData +type GetCohortResponseData struct { + // + Attributes *GetCohortResponseDataAttributes `json:"attributes,omitempty"` + // + Id *string `json:"id,omitempty"` + // + Type GetCohortResponseDataType `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{} `json:"-"` +} + +// NewGetCohortResponseData instantiates a new GetCohortResponseData 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 NewGetCohortResponseData(typeVar GetCohortResponseDataType) *GetCohortResponseData { + this := GetCohortResponseData{} + this.Type = typeVar + return &this +} + +// NewGetCohortResponseDataWithDefaults instantiates a new GetCohortResponseData 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 NewGetCohortResponseDataWithDefaults() *GetCohortResponseData { + this := GetCohortResponseData{} + var typeVar GetCohortResponseDataType = GETCOHORTRESPONSEDATATYPE_COHORT_RESPONSE + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *GetCohortResponseData) GetAttributes() GetCohortResponseDataAttributes { + if o == nil || o.Attributes == nil { + var ret GetCohortResponseDataAttributes + 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 *GetCohortResponseData) GetAttributesOk() (*GetCohortResponseDataAttributes, 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 *GetCohortResponseData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given GetCohortResponseDataAttributes and assigns it to the Attributes field. +func (o *GetCohortResponseData) SetAttributes(v GetCohortResponseDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *GetCohortResponseData) 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 *GetCohortResponseData) 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 *GetCohortResponseData) 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 *GetCohortResponseData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *GetCohortResponseData) GetType() GetCohortResponseDataType { + if o == nil { + var ret GetCohortResponseDataType + 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 *GetCohortResponseData) GetTypeOk() (*GetCohortResponseDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *GetCohortResponseData) SetType(v GetCohortResponseDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *GetCohortResponseDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *GetCohortResponseDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.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.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_response_data_attributes.go b/api/datadogV2/model_get_cohort_response_data_attributes.go new file mode 100644 index 00000000000..343005b0022 --- /dev/null +++ b/api/datadogV2/model_get_cohort_response_data_attributes.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortResponseDataAttributes +type GetCohortResponseDataAttributes struct { + // + Cohorts []GetCohortResponseDataAttributesCohortsItems `json:"cohorts,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{} `json:"-"` +} + +// NewGetCohortResponseDataAttributes instantiates a new GetCohortResponseDataAttributes 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 NewGetCohortResponseDataAttributes() *GetCohortResponseDataAttributes { + this := GetCohortResponseDataAttributes{} + return &this +} + +// NewGetCohortResponseDataAttributesWithDefaults instantiates a new GetCohortResponseDataAttributes 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 NewGetCohortResponseDataAttributesWithDefaults() *GetCohortResponseDataAttributes { + this := GetCohortResponseDataAttributes{} + return &this +} + +// GetCohorts returns the Cohorts field value if set, zero value otherwise. +func (o *GetCohortResponseDataAttributes) GetCohorts() []GetCohortResponseDataAttributesCohortsItems { + if o == nil || o.Cohorts == nil { + var ret []GetCohortResponseDataAttributesCohortsItems + return ret + } + return o.Cohorts +} + +// GetCohortsOk returns a tuple with the Cohorts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortResponseDataAttributes) GetCohortsOk() (*[]GetCohortResponseDataAttributesCohortsItems, bool) { + if o == nil || o.Cohorts == nil { + return nil, false + } + return &o.Cohorts, true +} + +// HasCohorts returns a boolean if a field has been set. +func (o *GetCohortResponseDataAttributes) HasCohorts() bool { + return o != nil && o.Cohorts != nil +} + +// SetCohorts gets a reference to the given []GetCohortResponseDataAttributesCohortsItems and assigns it to the Cohorts field. +func (o *GetCohortResponseDataAttributes) SetCohorts(v []GetCohortResponseDataAttributesCohortsItems) { + o.Cohorts = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortResponseDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Cohorts != nil { + toSerialize["cohorts"] = o.Cohorts + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Cohorts []GetCohortResponseDataAttributesCohortsItems `json:"cohorts,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"cohorts"}) + } else { + return err + } + o.Cohorts = all.Cohorts + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_response_data_attributes_cohorts_items.go b/api/datadogV2/model_get_cohort_response_data_attributes_cohorts_items.go new file mode 100644 index 00000000000..37777cbd020 --- /dev/null +++ b/api/datadogV2/model_get_cohort_response_data_attributes_cohorts_items.go @@ -0,0 +1,207 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortResponseDataAttributesCohortsItems +type GetCohortResponseDataAttributesCohortsItems struct { + // + Cohort *string `json:"cohort,omitempty"` + // + CohortSize *int64 `json:"cohort_size,omitempty"` + // + StartTime *int64 `json:"start_time,omitempty"` + // + Values []GetCohortResponseDataAttributesCohortsItemsValuesItems `json:"values,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{} `json:"-"` +} + +// NewGetCohortResponseDataAttributesCohortsItems instantiates a new GetCohortResponseDataAttributesCohortsItems 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 NewGetCohortResponseDataAttributesCohortsItems() *GetCohortResponseDataAttributesCohortsItems { + this := GetCohortResponseDataAttributesCohortsItems{} + return &this +} + +// NewGetCohortResponseDataAttributesCohortsItemsWithDefaults instantiates a new GetCohortResponseDataAttributesCohortsItems 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 NewGetCohortResponseDataAttributesCohortsItemsWithDefaults() *GetCohortResponseDataAttributesCohortsItems { + this := GetCohortResponseDataAttributesCohortsItems{} + return &this +} + +// GetCohort returns the Cohort field value if set, zero value otherwise. +func (o *GetCohortResponseDataAttributesCohortsItems) GetCohort() string { + if o == nil || o.Cohort == nil { + var ret string + return ret + } + return *o.Cohort +} + +// GetCohortOk returns a tuple with the Cohort field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortResponseDataAttributesCohortsItems) GetCohortOk() (*string, bool) { + if o == nil || o.Cohort == nil { + return nil, false + } + return o.Cohort, true +} + +// HasCohort returns a boolean if a field has been set. +func (o *GetCohortResponseDataAttributesCohortsItems) HasCohort() bool { + return o != nil && o.Cohort != nil +} + +// SetCohort gets a reference to the given string and assigns it to the Cohort field. +func (o *GetCohortResponseDataAttributesCohortsItems) SetCohort(v string) { + o.Cohort = &v +} + +// GetCohortSize returns the CohortSize field value if set, zero value otherwise. +func (o *GetCohortResponseDataAttributesCohortsItems) GetCohortSize() int64 { + if o == nil || o.CohortSize == nil { + var ret int64 + return ret + } + return *o.CohortSize +} + +// GetCohortSizeOk returns a tuple with the CohortSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortResponseDataAttributesCohortsItems) GetCohortSizeOk() (*int64, bool) { + if o == nil || o.CohortSize == nil { + return nil, false + } + return o.CohortSize, true +} + +// HasCohortSize returns a boolean if a field has been set. +func (o *GetCohortResponseDataAttributesCohortsItems) HasCohortSize() bool { + return o != nil && o.CohortSize != nil +} + +// SetCohortSize gets a reference to the given int64 and assigns it to the CohortSize field. +func (o *GetCohortResponseDataAttributesCohortsItems) SetCohortSize(v int64) { + o.CohortSize = &v +} + +// GetStartTime returns the StartTime field value if set, zero value otherwise. +func (o *GetCohortResponseDataAttributesCohortsItems) GetStartTime() int64 { + if o == nil || o.StartTime == nil { + var ret int64 + return ret + } + return *o.StartTime +} + +// GetStartTimeOk returns a tuple with the StartTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortResponseDataAttributesCohortsItems) GetStartTimeOk() (*int64, bool) { + if o == nil || o.StartTime == nil { + return nil, false + } + return o.StartTime, true +} + +// HasStartTime returns a boolean if a field has been set. +func (o *GetCohortResponseDataAttributesCohortsItems) HasStartTime() bool { + return o != nil && o.StartTime != nil +} + +// SetStartTime gets a reference to the given int64 and assigns it to the StartTime field. +func (o *GetCohortResponseDataAttributesCohortsItems) SetStartTime(v int64) { + o.StartTime = &v +} + +// GetValues returns the Values field value if set, zero value otherwise. +func (o *GetCohortResponseDataAttributesCohortsItems) GetValues() []GetCohortResponseDataAttributesCohortsItemsValuesItems { + if o == nil || o.Values == nil { + var ret []GetCohortResponseDataAttributesCohortsItemsValuesItems + return ret + } + return o.Values +} + +// GetValuesOk returns a tuple with the Values field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortResponseDataAttributesCohortsItems) GetValuesOk() (*[]GetCohortResponseDataAttributesCohortsItemsValuesItems, bool) { + if o == nil || o.Values == nil { + return nil, false + } + return &o.Values, true +} + +// HasValues returns a boolean if a field has been set. +func (o *GetCohortResponseDataAttributesCohortsItems) HasValues() bool { + return o != nil && o.Values != nil +} + +// SetValues gets a reference to the given []GetCohortResponseDataAttributesCohortsItemsValuesItems and assigns it to the Values field. +func (o *GetCohortResponseDataAttributesCohortsItems) SetValues(v []GetCohortResponseDataAttributesCohortsItemsValuesItems) { + o.Values = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortResponseDataAttributesCohortsItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Cohort != nil { + toSerialize["cohort"] = o.Cohort + } + if o.CohortSize != nil { + toSerialize["cohort_size"] = o.CohortSize + } + if o.StartTime != nil { + toSerialize["start_time"] = o.StartTime + } + if o.Values != nil { + toSerialize["values"] = o.Values + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortResponseDataAttributesCohortsItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Cohort *string `json:"cohort,omitempty"` + CohortSize *int64 `json:"cohort_size,omitempty"` + StartTime *int64 `json:"start_time,omitempty"` + Values []GetCohortResponseDataAttributesCohortsItemsValuesItems `json:"values,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"cohort", "cohort_size", "start_time", "values"}) + } else { + return err + } + o.Cohort = all.Cohort + o.CohortSize = all.CohortSize + o.StartTime = all.StartTime + o.Values = all.Values + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_response_data_attributes_cohorts_items_values_items.go b/api/datadogV2/model_get_cohort_response_data_attributes_cohorts_items_values_items.go new file mode 100644 index 00000000000..02e7b75635c --- /dev/null +++ b/api/datadogV2/model_get_cohort_response_data_attributes_cohorts_items_values_items.go @@ -0,0 +1,242 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortResponseDataAttributesCohortsItemsValuesItems +type GetCohortResponseDataAttributesCohortsItemsValuesItems struct { + // + AbsoluteValue *int64 `json:"absolute_value,omitempty"` + // + EndTime *int64 `json:"end_time,omitempty"` + // + RelativeValue *float64 `json:"relative_value,omitempty"` + // + StartTime *int64 `json:"start_time,omitempty"` + // + Window *int64 `json:"window,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{} `json:"-"` +} + +// NewGetCohortResponseDataAttributesCohortsItemsValuesItems instantiates a new GetCohortResponseDataAttributesCohortsItemsValuesItems 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 NewGetCohortResponseDataAttributesCohortsItemsValuesItems() *GetCohortResponseDataAttributesCohortsItemsValuesItems { + this := GetCohortResponseDataAttributesCohortsItemsValuesItems{} + return &this +} + +// NewGetCohortResponseDataAttributesCohortsItemsValuesItemsWithDefaults instantiates a new GetCohortResponseDataAttributesCohortsItemsValuesItems 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 NewGetCohortResponseDataAttributesCohortsItemsValuesItemsWithDefaults() *GetCohortResponseDataAttributesCohortsItemsValuesItems { + this := GetCohortResponseDataAttributesCohortsItemsValuesItems{} + return &this +} + +// GetAbsoluteValue returns the AbsoluteValue field value if set, zero value otherwise. +func (o *GetCohortResponseDataAttributesCohortsItemsValuesItems) GetAbsoluteValue() int64 { + if o == nil || o.AbsoluteValue == nil { + var ret int64 + return ret + } + return *o.AbsoluteValue +} + +// GetAbsoluteValueOk returns a tuple with the AbsoluteValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortResponseDataAttributesCohortsItemsValuesItems) GetAbsoluteValueOk() (*int64, bool) { + if o == nil || o.AbsoluteValue == nil { + return nil, false + } + return o.AbsoluteValue, true +} + +// HasAbsoluteValue returns a boolean if a field has been set. +func (o *GetCohortResponseDataAttributesCohortsItemsValuesItems) HasAbsoluteValue() bool { + return o != nil && o.AbsoluteValue != nil +} + +// SetAbsoluteValue gets a reference to the given int64 and assigns it to the AbsoluteValue field. +func (o *GetCohortResponseDataAttributesCohortsItemsValuesItems) SetAbsoluteValue(v int64) { + o.AbsoluteValue = &v +} + +// GetEndTime returns the EndTime field value if set, zero value otherwise. +func (o *GetCohortResponseDataAttributesCohortsItemsValuesItems) GetEndTime() int64 { + if o == nil || o.EndTime == nil { + var ret int64 + return ret + } + return *o.EndTime +} + +// GetEndTimeOk returns a tuple with the EndTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortResponseDataAttributesCohortsItemsValuesItems) GetEndTimeOk() (*int64, bool) { + if o == nil || o.EndTime == nil { + return nil, false + } + return o.EndTime, true +} + +// HasEndTime returns a boolean if a field has been set. +func (o *GetCohortResponseDataAttributesCohortsItemsValuesItems) HasEndTime() bool { + return o != nil && o.EndTime != nil +} + +// SetEndTime gets a reference to the given int64 and assigns it to the EndTime field. +func (o *GetCohortResponseDataAttributesCohortsItemsValuesItems) SetEndTime(v int64) { + o.EndTime = &v +} + +// GetRelativeValue returns the RelativeValue field value if set, zero value otherwise. +func (o *GetCohortResponseDataAttributesCohortsItemsValuesItems) GetRelativeValue() float64 { + if o == nil || o.RelativeValue == nil { + var ret float64 + return ret + } + return *o.RelativeValue +} + +// GetRelativeValueOk returns a tuple with the RelativeValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortResponseDataAttributesCohortsItemsValuesItems) GetRelativeValueOk() (*float64, bool) { + if o == nil || o.RelativeValue == nil { + return nil, false + } + return o.RelativeValue, true +} + +// HasRelativeValue returns a boolean if a field has been set. +func (o *GetCohortResponseDataAttributesCohortsItemsValuesItems) HasRelativeValue() bool { + return o != nil && o.RelativeValue != nil +} + +// SetRelativeValue gets a reference to the given float64 and assigns it to the RelativeValue field. +func (o *GetCohortResponseDataAttributesCohortsItemsValuesItems) SetRelativeValue(v float64) { + o.RelativeValue = &v +} + +// GetStartTime returns the StartTime field value if set, zero value otherwise. +func (o *GetCohortResponseDataAttributesCohortsItemsValuesItems) GetStartTime() int64 { + if o == nil || o.StartTime == nil { + var ret int64 + return ret + } + return *o.StartTime +} + +// GetStartTimeOk returns a tuple with the StartTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortResponseDataAttributesCohortsItemsValuesItems) GetStartTimeOk() (*int64, bool) { + if o == nil || o.StartTime == nil { + return nil, false + } + return o.StartTime, true +} + +// HasStartTime returns a boolean if a field has been set. +func (o *GetCohortResponseDataAttributesCohortsItemsValuesItems) HasStartTime() bool { + return o != nil && o.StartTime != nil +} + +// SetStartTime gets a reference to the given int64 and assigns it to the StartTime field. +func (o *GetCohortResponseDataAttributesCohortsItemsValuesItems) SetStartTime(v int64) { + o.StartTime = &v +} + +// GetWindow returns the Window field value if set, zero value otherwise. +func (o *GetCohortResponseDataAttributesCohortsItemsValuesItems) GetWindow() int64 { + if o == nil || o.Window == nil { + var ret int64 + return ret + } + return *o.Window +} + +// GetWindowOk returns a tuple with the Window field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortResponseDataAttributesCohortsItemsValuesItems) GetWindowOk() (*int64, bool) { + if o == nil || o.Window == nil { + return nil, false + } + return o.Window, true +} + +// HasWindow returns a boolean if a field has been set. +func (o *GetCohortResponseDataAttributesCohortsItemsValuesItems) HasWindow() bool { + return o != nil && o.Window != nil +} + +// SetWindow gets a reference to the given int64 and assigns it to the Window field. +func (o *GetCohortResponseDataAttributesCohortsItemsValuesItems) SetWindow(v int64) { + o.Window = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortResponseDataAttributesCohortsItemsValuesItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AbsoluteValue != nil { + toSerialize["absolute_value"] = o.AbsoluteValue + } + if o.EndTime != nil { + toSerialize["end_time"] = o.EndTime + } + if o.RelativeValue != nil { + toSerialize["relative_value"] = o.RelativeValue + } + if o.StartTime != nil { + toSerialize["start_time"] = o.StartTime + } + if o.Window != nil { + toSerialize["window"] = o.Window + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortResponseDataAttributesCohortsItemsValuesItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AbsoluteValue *int64 `json:"absolute_value,omitempty"` + EndTime *int64 `json:"end_time,omitempty"` + RelativeValue *float64 `json:"relative_value,omitempty"` + StartTime *int64 `json:"start_time,omitempty"` + Window *int64 `json:"window,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"absolute_value", "end_time", "relative_value", "start_time", "window"}) + } else { + return err + } + o.AbsoluteValue = all.AbsoluteValue + o.EndTime = all.EndTime + o.RelativeValue = all.RelativeValue + o.StartTime = all.StartTime + o.Window = all.Window + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_response_data_type.go b/api/datadogV2/model_get_cohort_response_data_type.go new file mode 100644 index 00000000000..9fdbea41201 --- /dev/null +++ b/api/datadogV2/model_get_cohort_response_data_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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortResponseDataType +type GetCohortResponseDataType string + +// List of GetCohortResponseDataType. +const ( + GETCOHORTRESPONSEDATATYPE_COHORT_RESPONSE GetCohortResponseDataType = "cohort_response" +) + +var allowedGetCohortResponseDataTypeEnumValues = []GetCohortResponseDataType{ + GETCOHORTRESPONSEDATATYPE_COHORT_RESPONSE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *GetCohortResponseDataType) GetAllowedValues() []GetCohortResponseDataType { + return allowedGetCohortResponseDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *GetCohortResponseDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = GetCohortResponseDataType(value) + return nil +} + +// NewGetCohortResponseDataTypeFromValue returns a pointer to a valid GetCohortResponseDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewGetCohortResponseDataTypeFromValue(v string) (*GetCohortResponseDataType, error) { + ev := GetCohortResponseDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for GetCohortResponseDataType: valid values are %v", v, allowedGetCohortResponseDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v GetCohortResponseDataType) IsValid() bool { + for _, existing := range allowedGetCohortResponseDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to GetCohortResponseDataType value. +func (v GetCohortResponseDataType) Ptr() *GetCohortResponseDataType { + return &v +} diff --git a/api/datadogV2/model_get_cohort_users_request.go b/api/datadogV2/model_get_cohort_users_request.go new file mode 100644 index 00000000000..e4dd8520fbe --- /dev/null +++ b/api/datadogV2/model_get_cohort_users_request.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortUsersRequest +type GetCohortUsersRequest struct { + // + Data *GetCohortUsersRequestData `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{} `json:"-"` +} + +// NewGetCohortUsersRequest instantiates a new GetCohortUsersRequest 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 NewGetCohortUsersRequest() *GetCohortUsersRequest { + this := GetCohortUsersRequest{} + return &this +} + +// NewGetCohortUsersRequestWithDefaults instantiates a new GetCohortUsersRequest 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 NewGetCohortUsersRequestWithDefaults() *GetCohortUsersRequest { + this := GetCohortUsersRequest{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *GetCohortUsersRequest) GetData() GetCohortUsersRequestData { + if o == nil || o.Data == nil { + var ret GetCohortUsersRequestData + 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 *GetCohortUsersRequest) GetDataOk() (*GetCohortUsersRequestData, 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 *GetCohortUsersRequest) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given GetCohortUsersRequestData and assigns it to the Data field. +func (o *GetCohortUsersRequest) SetData(v GetCohortUsersRequestData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortUsersRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortUsersRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *GetCohortUsersRequestData `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.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 datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_users_request_data.go b/api/datadogV2/model_get_cohort_users_request_data.go new file mode 100644 index 00000000000..a02251a22ff --- /dev/null +++ b/api/datadogV2/model_get_cohort_users_request_data.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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortUsersRequestData +type GetCohortUsersRequestData struct { + // + Attributes *GetCohortUsersRequestDataAttributes `json:"attributes,omitempty"` + // + Id *string `json:"id,omitempty"` + // + Type GetCohortUsersRequestDataType `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{} `json:"-"` +} + +// NewGetCohortUsersRequestData instantiates a new GetCohortUsersRequestData 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 NewGetCohortUsersRequestData(typeVar GetCohortUsersRequestDataType) *GetCohortUsersRequestData { + this := GetCohortUsersRequestData{} + this.Type = typeVar + return &this +} + +// NewGetCohortUsersRequestDataWithDefaults instantiates a new GetCohortUsersRequestData 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 NewGetCohortUsersRequestDataWithDefaults() *GetCohortUsersRequestData { + this := GetCohortUsersRequestData{} + var typeVar GetCohortUsersRequestDataType = GETCOHORTUSERSREQUESTDATATYPE_COHORT_USERS_REQUEST + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *GetCohortUsersRequestData) GetAttributes() GetCohortUsersRequestDataAttributes { + if o == nil || o.Attributes == nil { + var ret GetCohortUsersRequestDataAttributes + 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 *GetCohortUsersRequestData) GetAttributesOk() (*GetCohortUsersRequestDataAttributes, 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 *GetCohortUsersRequestData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given GetCohortUsersRequestDataAttributes and assigns it to the Attributes field. +func (o *GetCohortUsersRequestData) SetAttributes(v GetCohortUsersRequestDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *GetCohortUsersRequestData) 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 *GetCohortUsersRequestData) 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 *GetCohortUsersRequestData) 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 *GetCohortUsersRequestData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *GetCohortUsersRequestData) GetType() GetCohortUsersRequestDataType { + if o == nil { + var ret GetCohortUsersRequestDataType + 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 *GetCohortUsersRequestData) GetTypeOk() (*GetCohortUsersRequestDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *GetCohortUsersRequestData) SetType(v GetCohortUsersRequestDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortUsersRequestData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortUsersRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *GetCohortUsersRequestDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *GetCohortUsersRequestDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.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.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_users_request_data_attributes.go b/api/datadogV2/model_get_cohort_users_request_data_attributes.go new file mode 100644 index 00000000000..2edf76b5e99 --- /dev/null +++ b/api/datadogV2/model_get_cohort_users_request_data_attributes.go @@ -0,0 +1,289 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortUsersRequestDataAttributes +type GetCohortUsersRequestDataAttributes struct { + // + DataSource *string `json:"data_source,omitempty"` + // + Definition *GetCohortUsersRequestDataAttributesDefinition `json:"definition,omitempty"` + // + Execution *int64 `json:"execution,omitempty"` + // + Time *GetCohortUsersRequestDataAttributesTime `json:"time,omitempty"` + // + UserSelection *string `json:"user_selection,omitempty"` + // + WindowSize *string `json:"window_size,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{} `json:"-"` +} + +// NewGetCohortUsersRequestDataAttributes instantiates a new GetCohortUsersRequestDataAttributes 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 NewGetCohortUsersRequestDataAttributes() *GetCohortUsersRequestDataAttributes { + this := GetCohortUsersRequestDataAttributes{} + return &this +} + +// NewGetCohortUsersRequestDataAttributesWithDefaults instantiates a new GetCohortUsersRequestDataAttributes 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 NewGetCohortUsersRequestDataAttributesWithDefaults() *GetCohortUsersRequestDataAttributes { + this := GetCohortUsersRequestDataAttributes{} + return &this +} + +// GetDataSource returns the DataSource field value if set, zero value otherwise. +func (o *GetCohortUsersRequestDataAttributes) GetDataSource() string { + if o == nil || o.DataSource == nil { + var ret string + return ret + } + return *o.DataSource +} + +// GetDataSourceOk returns a tuple with the DataSource field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortUsersRequestDataAttributes) GetDataSourceOk() (*string, bool) { + if o == nil || o.DataSource == nil { + return nil, false + } + return o.DataSource, true +} + +// HasDataSource returns a boolean if a field has been set. +func (o *GetCohortUsersRequestDataAttributes) HasDataSource() bool { + return o != nil && o.DataSource != nil +} + +// SetDataSource gets a reference to the given string and assigns it to the DataSource field. +func (o *GetCohortUsersRequestDataAttributes) SetDataSource(v string) { + o.DataSource = &v +} + +// GetDefinition returns the Definition field value if set, zero value otherwise. +func (o *GetCohortUsersRequestDataAttributes) GetDefinition() GetCohortUsersRequestDataAttributesDefinition { + if o == nil || o.Definition == nil { + var ret GetCohortUsersRequestDataAttributesDefinition + return ret + } + return *o.Definition +} + +// GetDefinitionOk returns a tuple with the Definition field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortUsersRequestDataAttributes) GetDefinitionOk() (*GetCohortUsersRequestDataAttributesDefinition, bool) { + if o == nil || o.Definition == nil { + return nil, false + } + return o.Definition, true +} + +// HasDefinition returns a boolean if a field has been set. +func (o *GetCohortUsersRequestDataAttributes) HasDefinition() bool { + return o != nil && o.Definition != nil +} + +// SetDefinition gets a reference to the given GetCohortUsersRequestDataAttributesDefinition and assigns it to the Definition field. +func (o *GetCohortUsersRequestDataAttributes) SetDefinition(v GetCohortUsersRequestDataAttributesDefinition) { + o.Definition = &v +} + +// GetExecution returns the Execution field value if set, zero value otherwise. +func (o *GetCohortUsersRequestDataAttributes) GetExecution() int64 { + if o == nil || o.Execution == nil { + var ret int64 + return ret + } + return *o.Execution +} + +// GetExecutionOk returns a tuple with the Execution field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortUsersRequestDataAttributes) GetExecutionOk() (*int64, bool) { + if o == nil || o.Execution == nil { + return nil, false + } + return o.Execution, true +} + +// HasExecution returns a boolean if a field has been set. +func (o *GetCohortUsersRequestDataAttributes) HasExecution() bool { + return o != nil && o.Execution != nil +} + +// SetExecution gets a reference to the given int64 and assigns it to the Execution field. +func (o *GetCohortUsersRequestDataAttributes) SetExecution(v int64) { + o.Execution = &v +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *GetCohortUsersRequestDataAttributes) GetTime() GetCohortUsersRequestDataAttributesTime { + if o == nil || o.Time == nil { + var ret GetCohortUsersRequestDataAttributesTime + 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 *GetCohortUsersRequestDataAttributes) GetTimeOk() (*GetCohortUsersRequestDataAttributesTime, 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 *GetCohortUsersRequestDataAttributes) HasTime() bool { + return o != nil && o.Time != nil +} + +// SetTime gets a reference to the given GetCohortUsersRequestDataAttributesTime and assigns it to the Time field. +func (o *GetCohortUsersRequestDataAttributes) SetTime(v GetCohortUsersRequestDataAttributesTime) { + o.Time = &v +} + +// GetUserSelection returns the UserSelection field value if set, zero value otherwise. +func (o *GetCohortUsersRequestDataAttributes) GetUserSelection() string { + if o == nil || o.UserSelection == nil { + var ret string + return ret + } + return *o.UserSelection +} + +// GetUserSelectionOk returns a tuple with the UserSelection field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortUsersRequestDataAttributes) GetUserSelectionOk() (*string, bool) { + if o == nil || o.UserSelection == nil { + return nil, false + } + return o.UserSelection, true +} + +// HasUserSelection returns a boolean if a field has been set. +func (o *GetCohortUsersRequestDataAttributes) HasUserSelection() bool { + return o != nil && o.UserSelection != nil +} + +// SetUserSelection gets a reference to the given string and assigns it to the UserSelection field. +func (o *GetCohortUsersRequestDataAttributes) SetUserSelection(v string) { + o.UserSelection = &v +} + +// GetWindowSize returns the WindowSize field value if set, zero value otherwise. +func (o *GetCohortUsersRequestDataAttributes) GetWindowSize() string { + if o == nil || o.WindowSize == nil { + var ret string + return ret + } + return *o.WindowSize +} + +// GetWindowSizeOk returns a tuple with the WindowSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortUsersRequestDataAttributes) GetWindowSizeOk() (*string, bool) { + if o == nil || o.WindowSize == nil { + return nil, false + } + return o.WindowSize, true +} + +// HasWindowSize returns a boolean if a field has been set. +func (o *GetCohortUsersRequestDataAttributes) HasWindowSize() bool { + return o != nil && o.WindowSize != nil +} + +// SetWindowSize gets a reference to the given string and assigns it to the WindowSize field. +func (o *GetCohortUsersRequestDataAttributes) SetWindowSize(v string) { + o.WindowSize = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortUsersRequestDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.DataSource != nil { + toSerialize["data_source"] = o.DataSource + } + if o.Definition != nil { + toSerialize["definition"] = o.Definition + } + if o.Execution != nil { + toSerialize["execution"] = o.Execution + } + if o.Time != nil { + toSerialize["time"] = o.Time + } + if o.UserSelection != nil { + toSerialize["user_selection"] = o.UserSelection + } + if o.WindowSize != nil { + toSerialize["window_size"] = o.WindowSize + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortUsersRequestDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + DataSource *string `json:"data_source,omitempty"` + Definition *GetCohortUsersRequestDataAttributesDefinition `json:"definition,omitempty"` + Execution *int64 `json:"execution,omitempty"` + Time *GetCohortUsersRequestDataAttributesTime `json:"time,omitempty"` + UserSelection *string `json:"user_selection,omitempty"` + WindowSize *string `json:"window_size,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data_source", "definition", "execution", "time", "user_selection", "window_size"}) + } else { + return err + } + + hasInvalidField := false + o.DataSource = all.DataSource + if all.Definition != nil && all.Definition.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Definition = all.Definition + o.Execution = all.Execution + if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Time = all.Time + o.UserSelection = all.UserSelection + o.WindowSize = all.WindowSize + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_users_request_data_attributes_definition.go b/api/datadogV2/model_get_cohort_users_request_data_attributes_definition.go new file mode 100644 index 00000000000..cab5f9776c6 --- /dev/null +++ b/api/datadogV2/model_get_cohort_users_request_data_attributes_definition.go @@ -0,0 +1,286 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortUsersRequestDataAttributesDefinition +type GetCohortUsersRequestDataAttributesDefinition struct { + // + AudienceFilters *GetCohortUsersRequestDataAttributesDefinitionAudienceFilters `json:"audience_filters,omitempty"` + // + Cohort *string `json:"cohort,omitempty"` + // + InclusionSearch *string `json:"inclusion_search,omitempty"` + // + ReturnSearch *string `json:"return_search,omitempty"` + // + SegmentId *string `json:"segment_id,omitempty"` + // + Window *int64 `json:"window,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{} `json:"-"` +} + +// NewGetCohortUsersRequestDataAttributesDefinition instantiates a new GetCohortUsersRequestDataAttributesDefinition 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 NewGetCohortUsersRequestDataAttributesDefinition() *GetCohortUsersRequestDataAttributesDefinition { + this := GetCohortUsersRequestDataAttributesDefinition{} + return &this +} + +// NewGetCohortUsersRequestDataAttributesDefinitionWithDefaults instantiates a new GetCohortUsersRequestDataAttributesDefinition 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 NewGetCohortUsersRequestDataAttributesDefinitionWithDefaults() *GetCohortUsersRequestDataAttributesDefinition { + this := GetCohortUsersRequestDataAttributesDefinition{} + return &this +} + +// GetAudienceFilters returns the AudienceFilters field value if set, zero value otherwise. +func (o *GetCohortUsersRequestDataAttributesDefinition) GetAudienceFilters() GetCohortUsersRequestDataAttributesDefinitionAudienceFilters { + if o == nil || o.AudienceFilters == nil { + var ret GetCohortUsersRequestDataAttributesDefinitionAudienceFilters + return ret + } + return *o.AudienceFilters +} + +// GetAudienceFiltersOk returns a tuple with the AudienceFilters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortUsersRequestDataAttributesDefinition) GetAudienceFiltersOk() (*GetCohortUsersRequestDataAttributesDefinitionAudienceFilters, bool) { + if o == nil || o.AudienceFilters == nil { + return nil, false + } + return o.AudienceFilters, true +} + +// HasAudienceFilters returns a boolean if a field has been set. +func (o *GetCohortUsersRequestDataAttributesDefinition) HasAudienceFilters() bool { + return o != nil && o.AudienceFilters != nil +} + +// SetAudienceFilters gets a reference to the given GetCohortUsersRequestDataAttributesDefinitionAudienceFilters and assigns it to the AudienceFilters field. +func (o *GetCohortUsersRequestDataAttributesDefinition) SetAudienceFilters(v GetCohortUsersRequestDataAttributesDefinitionAudienceFilters) { + o.AudienceFilters = &v +} + +// GetCohort returns the Cohort field value if set, zero value otherwise. +func (o *GetCohortUsersRequestDataAttributesDefinition) GetCohort() string { + if o == nil || o.Cohort == nil { + var ret string + return ret + } + return *o.Cohort +} + +// GetCohortOk returns a tuple with the Cohort field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortUsersRequestDataAttributesDefinition) GetCohortOk() (*string, bool) { + if o == nil || o.Cohort == nil { + return nil, false + } + return o.Cohort, true +} + +// HasCohort returns a boolean if a field has been set. +func (o *GetCohortUsersRequestDataAttributesDefinition) HasCohort() bool { + return o != nil && o.Cohort != nil +} + +// SetCohort gets a reference to the given string and assigns it to the Cohort field. +func (o *GetCohortUsersRequestDataAttributesDefinition) SetCohort(v string) { + o.Cohort = &v +} + +// GetInclusionSearch returns the InclusionSearch field value if set, zero value otherwise. +func (o *GetCohortUsersRequestDataAttributesDefinition) GetInclusionSearch() string { + if o == nil || o.InclusionSearch == nil { + var ret string + return ret + } + return *o.InclusionSearch +} + +// GetInclusionSearchOk returns a tuple with the InclusionSearch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortUsersRequestDataAttributesDefinition) GetInclusionSearchOk() (*string, bool) { + if o == nil || o.InclusionSearch == nil { + return nil, false + } + return o.InclusionSearch, true +} + +// HasInclusionSearch returns a boolean if a field has been set. +func (o *GetCohortUsersRequestDataAttributesDefinition) HasInclusionSearch() bool { + return o != nil && o.InclusionSearch != nil +} + +// SetInclusionSearch gets a reference to the given string and assigns it to the InclusionSearch field. +func (o *GetCohortUsersRequestDataAttributesDefinition) SetInclusionSearch(v string) { + o.InclusionSearch = &v +} + +// GetReturnSearch returns the ReturnSearch field value if set, zero value otherwise. +func (o *GetCohortUsersRequestDataAttributesDefinition) GetReturnSearch() string { + if o == nil || o.ReturnSearch == nil { + var ret string + return ret + } + return *o.ReturnSearch +} + +// GetReturnSearchOk returns a tuple with the ReturnSearch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortUsersRequestDataAttributesDefinition) GetReturnSearchOk() (*string, bool) { + if o == nil || o.ReturnSearch == nil { + return nil, false + } + return o.ReturnSearch, true +} + +// HasReturnSearch returns a boolean if a field has been set. +func (o *GetCohortUsersRequestDataAttributesDefinition) HasReturnSearch() bool { + return o != nil && o.ReturnSearch != nil +} + +// SetReturnSearch gets a reference to the given string and assigns it to the ReturnSearch field. +func (o *GetCohortUsersRequestDataAttributesDefinition) SetReturnSearch(v string) { + o.ReturnSearch = &v +} + +// GetSegmentId returns the SegmentId field value if set, zero value otherwise. +func (o *GetCohortUsersRequestDataAttributesDefinition) GetSegmentId() string { + if o == nil || o.SegmentId == nil { + var ret string + return ret + } + return *o.SegmentId +} + +// GetSegmentIdOk returns a tuple with the SegmentId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortUsersRequestDataAttributesDefinition) GetSegmentIdOk() (*string, bool) { + if o == nil || o.SegmentId == nil { + return nil, false + } + return o.SegmentId, true +} + +// HasSegmentId returns a boolean if a field has been set. +func (o *GetCohortUsersRequestDataAttributesDefinition) HasSegmentId() bool { + return o != nil && o.SegmentId != nil +} + +// SetSegmentId gets a reference to the given string and assigns it to the SegmentId field. +func (o *GetCohortUsersRequestDataAttributesDefinition) SetSegmentId(v string) { + o.SegmentId = &v +} + +// GetWindow returns the Window field value if set, zero value otherwise. +func (o *GetCohortUsersRequestDataAttributesDefinition) GetWindow() int64 { + if o == nil || o.Window == nil { + var ret int64 + return ret + } + return *o.Window +} + +// GetWindowOk returns a tuple with the Window field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortUsersRequestDataAttributesDefinition) GetWindowOk() (*int64, bool) { + if o == nil || o.Window == nil { + return nil, false + } + return o.Window, true +} + +// HasWindow returns a boolean if a field has been set. +func (o *GetCohortUsersRequestDataAttributesDefinition) HasWindow() bool { + return o != nil && o.Window != nil +} + +// SetWindow gets a reference to the given int64 and assigns it to the Window field. +func (o *GetCohortUsersRequestDataAttributesDefinition) SetWindow(v int64) { + o.Window = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortUsersRequestDataAttributesDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AudienceFilters != nil { + toSerialize["audience_filters"] = o.AudienceFilters + } + if o.Cohort != nil { + toSerialize["cohort"] = o.Cohort + } + if o.InclusionSearch != nil { + toSerialize["inclusion_search"] = o.InclusionSearch + } + if o.ReturnSearch != nil { + toSerialize["return_search"] = o.ReturnSearch + } + if o.SegmentId != nil { + toSerialize["segment_id"] = o.SegmentId + } + if o.Window != nil { + toSerialize["window"] = o.Window + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortUsersRequestDataAttributesDefinition) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AudienceFilters *GetCohortUsersRequestDataAttributesDefinitionAudienceFilters `json:"audience_filters,omitempty"` + Cohort *string `json:"cohort,omitempty"` + InclusionSearch *string `json:"inclusion_search,omitempty"` + ReturnSearch *string `json:"return_search,omitempty"` + SegmentId *string `json:"segment_id,omitempty"` + Window *int64 `json:"window,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"audience_filters", "cohort", "inclusion_search", "return_search", "segment_id", "window"}) + } else { + return err + } + + hasInvalidField := false + if all.AudienceFilters != nil && all.AudienceFilters.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.AudienceFilters = all.AudienceFilters + o.Cohort = all.Cohort + o.InclusionSearch = all.InclusionSearch + o.ReturnSearch = all.ReturnSearch + o.SegmentId = all.SegmentId + o.Window = all.Window + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_users_request_data_attributes_definition_audience_filters.go b/api/datadogV2/model_get_cohort_users_request_data_attributes_definition_audience_filters.go new file mode 100644 index 00000000000..45c3b586c23 --- /dev/null +++ b/api/datadogV2/model_get_cohort_users_request_data_attributes_definition_audience_filters.go @@ -0,0 +1,207 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortUsersRequestDataAttributesDefinitionAudienceFilters +type GetCohortUsersRequestDataAttributesDefinitionAudienceFilters struct { + // + Accounts []GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems `json:"accounts,omitempty"` + // + Formula *string `json:"formula,omitempty"` + // + Segments []GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems `json:"segments,omitempty"` + // + Users []GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems `json:"users,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{} `json:"-"` +} + +// NewGetCohortUsersRequestDataAttributesDefinitionAudienceFilters instantiates a new GetCohortUsersRequestDataAttributesDefinitionAudienceFilters 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 NewGetCohortUsersRequestDataAttributesDefinitionAudienceFilters() *GetCohortUsersRequestDataAttributesDefinitionAudienceFilters { + this := GetCohortUsersRequestDataAttributesDefinitionAudienceFilters{} + return &this +} + +// NewGetCohortUsersRequestDataAttributesDefinitionAudienceFiltersWithDefaults instantiates a new GetCohortUsersRequestDataAttributesDefinitionAudienceFilters 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 NewGetCohortUsersRequestDataAttributesDefinitionAudienceFiltersWithDefaults() *GetCohortUsersRequestDataAttributesDefinitionAudienceFilters { + this := GetCohortUsersRequestDataAttributesDefinitionAudienceFilters{} + return &this +} + +// GetAccounts returns the Accounts field value if set, zero value otherwise. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFilters) GetAccounts() []GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems { + if o == nil || o.Accounts == nil { + var ret []GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems + return ret + } + return o.Accounts +} + +// GetAccountsOk returns a tuple with the Accounts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFilters) GetAccountsOk() (*[]GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems, bool) { + if o == nil || o.Accounts == nil { + return nil, false + } + return &o.Accounts, true +} + +// HasAccounts returns a boolean if a field has been set. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFilters) HasAccounts() bool { + return o != nil && o.Accounts != nil +} + +// SetAccounts gets a reference to the given []GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems and assigns it to the Accounts field. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFilters) SetAccounts(v []GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems) { + o.Accounts = v +} + +// GetFormula returns the Formula field value if set, zero value otherwise. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFilters) GetFormula() string { + if o == nil || o.Formula == nil { + var ret string + return ret + } + return *o.Formula +} + +// GetFormulaOk returns a tuple with the Formula field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFilters) GetFormulaOk() (*string, bool) { + if o == nil || o.Formula == nil { + return nil, false + } + return o.Formula, true +} + +// HasFormula returns a boolean if a field has been set. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFilters) HasFormula() bool { + return o != nil && o.Formula != nil +} + +// SetFormula gets a reference to the given string and assigns it to the Formula field. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFilters) SetFormula(v string) { + o.Formula = &v +} + +// GetSegments returns the Segments field value if set, zero value otherwise. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFilters) GetSegments() []GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems { + if o == nil || o.Segments == nil { + var ret []GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems + return ret + } + return o.Segments +} + +// GetSegmentsOk returns a tuple with the Segments field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFilters) GetSegmentsOk() (*[]GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems, bool) { + if o == nil || o.Segments == nil { + return nil, false + } + return &o.Segments, true +} + +// HasSegments returns a boolean if a field has been set. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFilters) HasSegments() bool { + return o != nil && o.Segments != nil +} + +// SetSegments gets a reference to the given []GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems and assigns it to the Segments field. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFilters) SetSegments(v []GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems) { + o.Segments = v +} + +// GetUsers returns the Users field value if set, zero value otherwise. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFilters) GetUsers() []GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems { + if o == nil || o.Users == nil { + var ret []GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems + return ret + } + return o.Users +} + +// GetUsersOk returns a tuple with the Users field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFilters) GetUsersOk() (*[]GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems, bool) { + if o == nil || o.Users == nil { + return nil, false + } + return &o.Users, true +} + +// HasUsers returns a boolean if a field has been set. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFilters) HasUsers() bool { + return o != nil && o.Users != nil +} + +// SetUsers gets a reference to the given []GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems and assigns it to the Users field. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFilters) SetUsers(v []GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems) { + o.Users = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortUsersRequestDataAttributesDefinitionAudienceFilters) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Accounts != nil { + toSerialize["accounts"] = o.Accounts + } + if o.Formula != nil { + toSerialize["formula"] = o.Formula + } + if o.Segments != nil { + toSerialize["segments"] = o.Segments + } + if o.Users != nil { + toSerialize["users"] = o.Users + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFilters) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Accounts []GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems `json:"accounts,omitempty"` + Formula *string `json:"formula,omitempty"` + Segments []GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems `json:"segments,omitempty"` + Users []GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems `json:"users,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"accounts", "formula", "segments", "users"}) + } else { + return err + } + o.Accounts = all.Accounts + o.Formula = all.Formula + o.Segments = all.Segments + o.Users = all.Users + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_users_request_data_attributes_definition_audience_filters_accounts_items.go b/api/datadogV2/model_get_cohort_users_request_data_attributes_definition_audience_filters_accounts_items.go new file mode 100644 index 00000000000..e4bfa8e54ff --- /dev/null +++ b/api/datadogV2/model_get_cohort_users_request_data_attributes_definition_audience_filters_accounts_items.go @@ -0,0 +1,136 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems +type GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems struct { + // + Name string `json:"name"` + // + 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{} `json:"-"` +} + +// NewGetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems instantiates a new GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems 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 NewGetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems(name string) *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems { + this := GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems{} + this.Name = name + return &this +} + +// NewGetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItemsWithDefaults instantiates a new GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems 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 NewGetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItemsWithDefaults() *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems { + this := GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems{} + return &this +} + +// GetName returns the Name field value. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems) 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 *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems) SetName(v string) { + o.Name = v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems) 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 *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems) 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 *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems) 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 *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems) SetQuery(v string) { + o.Query = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + if o.Query != nil { + toSerialize["query"] = o.Query + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Name *string `json:"name"` + Query *string `json:"query,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"name", "query"}) + } else { + return err + } + o.Name = *all.Name + o.Query = all.Query + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_users_request_data_attributes_definition_audience_filters_segments_items.go b/api/datadogV2/model_get_cohort_users_request_data_attributes_definition_audience_filters_segments_items.go new file mode 100644 index 00000000000..9341c9a5a72 --- /dev/null +++ b/api/datadogV2/model_get_cohort_users_request_data_attributes_definition_audience_filters_segments_items.go @@ -0,0 +1,133 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems +type GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems struct { + // + Name string `json:"name"` + // + SegmentId string `json:"segment_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{} `json:"-"` +} + +// NewGetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems instantiates a new GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems 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 NewGetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems(name string, segmentId string) *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems { + this := GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems{} + this.Name = name + this.SegmentId = segmentId + return &this +} + +// NewGetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItemsWithDefaults instantiates a new GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems 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 NewGetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItemsWithDefaults() *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems { + this := GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems{} + return &this +} + +// GetName returns the Name field value. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems) 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 *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems) SetName(v string) { + o.Name = v +} + +// GetSegmentId returns the SegmentId field value. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems) GetSegmentId() string { + if o == nil { + var ret string + return ret + } + return o.SegmentId +} + +// GetSegmentIdOk returns a tuple with the SegmentId field value +// and a boolean to check if the value has been set. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems) GetSegmentIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SegmentId, true +} + +// SetSegmentId sets field value. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems) SetSegmentId(v string) { + o.SegmentId = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + toSerialize["segment_id"] = o.SegmentId + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Name *string `json:"name"` + SegmentId *string `json:"segment_id"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.SegmentId == nil { + return fmt.Errorf("required field segment_id missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"name", "segment_id"}) + } else { + return err + } + o.Name = *all.Name + o.SegmentId = *all.SegmentId + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_users_request_data_attributes_definition_audience_filters_users_items.go b/api/datadogV2/model_get_cohort_users_request_data_attributes_definition_audience_filters_users_items.go new file mode 100644 index 00000000000..c031c3d8673 --- /dev/null +++ b/api/datadogV2/model_get_cohort_users_request_data_attributes_definition_audience_filters_users_items.go @@ -0,0 +1,136 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems +type GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems struct { + // + Name string `json:"name"` + // + 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{} `json:"-"` +} + +// NewGetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems instantiates a new GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems 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 NewGetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems(name string) *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems { + this := GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems{} + this.Name = name + return &this +} + +// NewGetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItemsWithDefaults instantiates a new GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems 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 NewGetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItemsWithDefaults() *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems { + this := GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems{} + return &this +} + +// GetName returns the Name field value. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems) 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 *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems) SetName(v string) { + o.Name = v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems) 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 *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems) 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 *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems) 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 *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems) SetQuery(v string) { + o.Query = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + if o.Query != nil { + toSerialize["query"] = o.Query + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Name *string `json:"name"` + Query *string `json:"query,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"name", "query"}) + } else { + return err + } + o.Name = *all.Name + o.Query = all.Query + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_users_request_data_attributes_time.go b/api/datadogV2/model_get_cohort_users_request_data_attributes_time.go new file mode 100644 index 00000000000..cc675088e99 --- /dev/null +++ b/api/datadogV2/model_get_cohort_users_request_data_attributes_time.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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortUsersRequestDataAttributesTime +type GetCohortUsersRequestDataAttributesTime struct { + // + From *int64 `json:"from,omitempty"` + // + To *int64 `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{} `json:"-"` +} + +// NewGetCohortUsersRequestDataAttributesTime instantiates a new GetCohortUsersRequestDataAttributesTime 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 NewGetCohortUsersRequestDataAttributesTime() *GetCohortUsersRequestDataAttributesTime { + this := GetCohortUsersRequestDataAttributesTime{} + return &this +} + +// NewGetCohortUsersRequestDataAttributesTimeWithDefaults instantiates a new GetCohortUsersRequestDataAttributesTime 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 NewGetCohortUsersRequestDataAttributesTimeWithDefaults() *GetCohortUsersRequestDataAttributesTime { + this := GetCohortUsersRequestDataAttributesTime{} + return &this +} + +// GetFrom returns the From field value if set, zero value otherwise. +func (o *GetCohortUsersRequestDataAttributesTime) GetFrom() int64 { + if o == nil || o.From == nil { + var ret int64 + 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 *GetCohortUsersRequestDataAttributesTime) GetFromOk() (*int64, 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 *GetCohortUsersRequestDataAttributesTime) HasFrom() bool { + return o != nil && o.From != nil +} + +// SetFrom gets a reference to the given int64 and assigns it to the From field. +func (o *GetCohortUsersRequestDataAttributesTime) SetFrom(v int64) { + o.From = &v +} + +// GetTo returns the To field value if set, zero value otherwise. +func (o *GetCohortUsersRequestDataAttributesTime) GetTo() int64 { + if o == nil || o.To == nil { + var ret int64 + 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 *GetCohortUsersRequestDataAttributesTime) GetToOk() (*int64, 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 *GetCohortUsersRequestDataAttributesTime) HasTo() bool { + return o != nil && o.To != nil +} + +// SetTo gets a reference to the given int64 and assigns it to the To field. +func (o *GetCohortUsersRequestDataAttributesTime) SetTo(v int64) { + o.To = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortUsersRequestDataAttributesTime) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.From != nil { + toSerialize["from"] = o.From + } + if o.To != nil { + toSerialize["to"] = o.To + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortUsersRequestDataAttributesTime) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + From *int64 `json:"from,omitempty"` + To *int64 `json:"to,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"from", "to"}) + } else { + return err + } + o.From = all.From + o.To = all.To + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_users_request_data_type.go b/api/datadogV2/model_get_cohort_users_request_data_type.go new file mode 100644 index 00000000000..b42fcdbc5fd --- /dev/null +++ b/api/datadogV2/model_get_cohort_users_request_data_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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortUsersRequestDataType +type GetCohortUsersRequestDataType string + +// List of GetCohortUsersRequestDataType. +const ( + GETCOHORTUSERSREQUESTDATATYPE_COHORT_USERS_REQUEST GetCohortUsersRequestDataType = "cohort_users_request" +) + +var allowedGetCohortUsersRequestDataTypeEnumValues = []GetCohortUsersRequestDataType{ + GETCOHORTUSERSREQUESTDATATYPE_COHORT_USERS_REQUEST, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *GetCohortUsersRequestDataType) GetAllowedValues() []GetCohortUsersRequestDataType { + return allowedGetCohortUsersRequestDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *GetCohortUsersRequestDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = GetCohortUsersRequestDataType(value) + return nil +} + +// NewGetCohortUsersRequestDataTypeFromValue returns a pointer to a valid GetCohortUsersRequestDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewGetCohortUsersRequestDataTypeFromValue(v string) (*GetCohortUsersRequestDataType, error) { + ev := GetCohortUsersRequestDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for GetCohortUsersRequestDataType: valid values are %v", v, allowedGetCohortUsersRequestDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v GetCohortUsersRequestDataType) IsValid() bool { + for _, existing := range allowedGetCohortUsersRequestDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to GetCohortUsersRequestDataType value. +func (v GetCohortUsersRequestDataType) Ptr() *GetCohortUsersRequestDataType { + return &v +} diff --git a/api/datadogV2/model_get_cohort_users_response.go b/api/datadogV2/model_get_cohort_users_response.go new file mode 100644 index 00000000000..119340bc026 --- /dev/null +++ b/api/datadogV2/model_get_cohort_users_response.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortUsersResponse +type GetCohortUsersResponse struct { + // + Data *GetCohortUsersResponseData `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{} `json:"-"` +} + +// NewGetCohortUsersResponse instantiates a new GetCohortUsersResponse 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 NewGetCohortUsersResponse() *GetCohortUsersResponse { + this := GetCohortUsersResponse{} + return &this +} + +// NewGetCohortUsersResponseWithDefaults instantiates a new GetCohortUsersResponse 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 NewGetCohortUsersResponseWithDefaults() *GetCohortUsersResponse { + this := GetCohortUsersResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *GetCohortUsersResponse) GetData() GetCohortUsersResponseData { + if o == nil || o.Data == nil { + var ret GetCohortUsersResponseData + 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 *GetCohortUsersResponse) GetDataOk() (*GetCohortUsersResponseData, 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 *GetCohortUsersResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given GetCohortUsersResponseData and assigns it to the Data field. +func (o *GetCohortUsersResponse) SetData(v GetCohortUsersResponseData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortUsersResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortUsersResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *GetCohortUsersResponseData `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.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 datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_users_response_data.go b/api/datadogV2/model_get_cohort_users_response_data.go new file mode 100644 index 00000000000..eab50515283 --- /dev/null +++ b/api/datadogV2/model_get_cohort_users_response_data.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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortUsersResponseData +type GetCohortUsersResponseData struct { + // + Attributes *GetCohortUsersResponseDataAttributes `json:"attributes,omitempty"` + // + Id *string `json:"id,omitempty"` + // + Type GetCohortUsersResponseDataType `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{} `json:"-"` +} + +// NewGetCohortUsersResponseData instantiates a new GetCohortUsersResponseData 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 NewGetCohortUsersResponseData(typeVar GetCohortUsersResponseDataType) *GetCohortUsersResponseData { + this := GetCohortUsersResponseData{} + this.Type = typeVar + return &this +} + +// NewGetCohortUsersResponseDataWithDefaults instantiates a new GetCohortUsersResponseData 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 NewGetCohortUsersResponseDataWithDefaults() *GetCohortUsersResponseData { + this := GetCohortUsersResponseData{} + var typeVar GetCohortUsersResponseDataType = GETCOHORTUSERSRESPONSEDATATYPE_COHORT_USERS_RESPONSE + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *GetCohortUsersResponseData) GetAttributes() GetCohortUsersResponseDataAttributes { + if o == nil || o.Attributes == nil { + var ret GetCohortUsersResponseDataAttributes + 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 *GetCohortUsersResponseData) GetAttributesOk() (*GetCohortUsersResponseDataAttributes, 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 *GetCohortUsersResponseData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given GetCohortUsersResponseDataAttributes and assigns it to the Attributes field. +func (o *GetCohortUsersResponseData) SetAttributes(v GetCohortUsersResponseDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *GetCohortUsersResponseData) 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 *GetCohortUsersResponseData) 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 *GetCohortUsersResponseData) 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 *GetCohortUsersResponseData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *GetCohortUsersResponseData) GetType() GetCohortUsersResponseDataType { + if o == nil { + var ret GetCohortUsersResponseDataType + 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 *GetCohortUsersResponseData) GetTypeOk() (*GetCohortUsersResponseDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *GetCohortUsersResponseData) SetType(v GetCohortUsersResponseDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortUsersResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortUsersResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *GetCohortUsersResponseDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *GetCohortUsersResponseDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.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.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_users_response_data_attributes.go b/api/datadogV2/model_get_cohort_users_response_data_attributes.go new file mode 100644 index 00000000000..729d295d672 --- /dev/null +++ b/api/datadogV2/model_get_cohort_users_response_data_attributes.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortUsersResponseDataAttributes +type GetCohortUsersResponseDataAttributes struct { + // + Users []GetCohortUsersResponseDataAttributesUsersItems `json:"users,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{} `json:"-"` +} + +// NewGetCohortUsersResponseDataAttributes instantiates a new GetCohortUsersResponseDataAttributes 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 NewGetCohortUsersResponseDataAttributes() *GetCohortUsersResponseDataAttributes { + this := GetCohortUsersResponseDataAttributes{} + return &this +} + +// NewGetCohortUsersResponseDataAttributesWithDefaults instantiates a new GetCohortUsersResponseDataAttributes 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 NewGetCohortUsersResponseDataAttributesWithDefaults() *GetCohortUsersResponseDataAttributes { + this := GetCohortUsersResponseDataAttributes{} + return &this +} + +// GetUsers returns the Users field value if set, zero value otherwise. +func (o *GetCohortUsersResponseDataAttributes) GetUsers() []GetCohortUsersResponseDataAttributesUsersItems { + if o == nil || o.Users == nil { + var ret []GetCohortUsersResponseDataAttributesUsersItems + return ret + } + return o.Users +} + +// GetUsersOk returns a tuple with the Users field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortUsersResponseDataAttributes) GetUsersOk() (*[]GetCohortUsersResponseDataAttributesUsersItems, bool) { + if o == nil || o.Users == nil { + return nil, false + } + return &o.Users, true +} + +// HasUsers returns a boolean if a field has been set. +func (o *GetCohortUsersResponseDataAttributes) HasUsers() bool { + return o != nil && o.Users != nil +} + +// SetUsers gets a reference to the given []GetCohortUsersResponseDataAttributesUsersItems and assigns it to the Users field. +func (o *GetCohortUsersResponseDataAttributes) SetUsers(v []GetCohortUsersResponseDataAttributesUsersItems) { + o.Users = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortUsersResponseDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Users != nil { + toSerialize["users"] = o.Users + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortUsersResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Users []GetCohortUsersResponseDataAttributesUsersItems `json:"users,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"users"}) + } else { + return err + } + o.Users = all.Users + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_users_response_data_attributes_users_items.go b/api/datadogV2/model_get_cohort_users_response_data_attributes_users_items.go new file mode 100644 index 00000000000..92ce16243a6 --- /dev/null +++ b/api/datadogV2/model_get_cohort_users_response_data_attributes_users_items.go @@ -0,0 +1,172 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortUsersResponseDataAttributesUsersItems +type GetCohortUsersResponseDataAttributesUsersItems struct { + // + Email *string `json:"email,omitempty"` + // + Id *string `json:"id,omitempty"` + // + 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{} `json:"-"` +} + +// NewGetCohortUsersResponseDataAttributesUsersItems instantiates a new GetCohortUsersResponseDataAttributesUsersItems 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 NewGetCohortUsersResponseDataAttributesUsersItems() *GetCohortUsersResponseDataAttributesUsersItems { + this := GetCohortUsersResponseDataAttributesUsersItems{} + return &this +} + +// NewGetCohortUsersResponseDataAttributesUsersItemsWithDefaults instantiates a new GetCohortUsersResponseDataAttributesUsersItems 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 NewGetCohortUsersResponseDataAttributesUsersItemsWithDefaults() *GetCohortUsersResponseDataAttributesUsersItems { + this := GetCohortUsersResponseDataAttributesUsersItems{} + return &this +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *GetCohortUsersResponseDataAttributesUsersItems) GetEmail() string { + if o == nil || o.Email == nil { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCohortUsersResponseDataAttributesUsersItems) GetEmailOk() (*string, bool) { + if o == nil || o.Email == nil { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *GetCohortUsersResponseDataAttributesUsersItems) HasEmail() bool { + return o != nil && o.Email != nil +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *GetCohortUsersResponseDataAttributesUsersItems) SetEmail(v string) { + o.Email = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *GetCohortUsersResponseDataAttributesUsersItems) 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 *GetCohortUsersResponseDataAttributesUsersItems) 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 *GetCohortUsersResponseDataAttributesUsersItems) 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 *GetCohortUsersResponseDataAttributesUsersItems) SetId(v string) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *GetCohortUsersResponseDataAttributesUsersItems) 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 *GetCohortUsersResponseDataAttributesUsersItems) 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 *GetCohortUsersResponseDataAttributesUsersItems) 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 *GetCohortUsersResponseDataAttributesUsersItems) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetCohortUsersResponseDataAttributesUsersItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Email != nil { + toSerialize["email"] = o.Email + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetCohortUsersResponseDataAttributesUsersItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Email *string `json:"email,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"email", "id", "name"}) + } else { + return err + } + o.Email = all.Email + o.Id = all.Id + o.Name = all.Name + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_get_cohort_users_response_data_type.go b/api/datadogV2/model_get_cohort_users_response_data_type.go new file mode 100644 index 00000000000..58d76204f19 --- /dev/null +++ b/api/datadogV2/model_get_cohort_users_response_data_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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetCohortUsersResponseDataType +type GetCohortUsersResponseDataType string + +// List of GetCohortUsersResponseDataType. +const ( + GETCOHORTUSERSRESPONSEDATATYPE_COHORT_USERS_RESPONSE GetCohortUsersResponseDataType = "cohort_users_response" +) + +var allowedGetCohortUsersResponseDataTypeEnumValues = []GetCohortUsersResponseDataType{ + GETCOHORTUSERSRESPONSEDATATYPE_COHORT_USERS_RESPONSE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *GetCohortUsersResponseDataType) GetAllowedValues() []GetCohortUsersResponseDataType { + return allowedGetCohortUsersResponseDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *GetCohortUsersResponseDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = GetCohortUsersResponseDataType(value) + return nil +} + +// NewGetCohortUsersResponseDataTypeFromValue returns a pointer to a valid GetCohortUsersResponseDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewGetCohortUsersResponseDataTypeFromValue(v string) (*GetCohortUsersResponseDataType, error) { + ev := GetCohortUsersResponseDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for GetCohortUsersResponseDataType: valid values are %v", v, allowedGetCohortUsersResponseDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v GetCohortUsersResponseDataType) IsValid() bool { + for _, existing := range allowedGetCohortUsersResponseDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to GetCohortUsersResponseDataType value. +func (v GetCohortUsersResponseDataType) Ptr() *GetCohortUsersResponseDataType { + return &v +} diff --git a/api/datadogV2/model_sankey_request.go b/api/datadogV2/model_sankey_request.go new file mode 100644 index 00000000000..e278402a288 --- /dev/null +++ b/api/datadogV2/model_sankey_request.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SankeyRequest +type SankeyRequest struct { + // + Data *SankeyRequestData `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{} `json:"-"` +} + +// NewSankeyRequest instantiates a new SankeyRequest 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 NewSankeyRequest() *SankeyRequest { + this := SankeyRequest{} + return &this +} + +// NewSankeyRequestWithDefaults instantiates a new SankeyRequest 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 NewSankeyRequestWithDefaults() *SankeyRequest { + this := SankeyRequest{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *SankeyRequest) GetData() SankeyRequestData { + if o == nil || o.Data == nil { + var ret SankeyRequestData + 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 *SankeyRequest) GetDataOk() (*SankeyRequestData, 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 *SankeyRequest) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given SankeyRequestData and assigns it to the Data field. +func (o *SankeyRequest) SetData(v SankeyRequestData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SankeyRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SankeyRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *SankeyRequestData `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.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 datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_sankey_request_data.go b/api/datadogV2/model_sankey_request_data.go new file mode 100644 index 00000000000..926835671c4 --- /dev/null +++ b/api/datadogV2/model_sankey_request_data.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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SankeyRequestData +type SankeyRequestData struct { + // + Attributes *SankeyRequestDataAttributes `json:"attributes,omitempty"` + // + Id *string `json:"id,omitempty"` + // + Type SankeyRequestDataType `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{} `json:"-"` +} + +// NewSankeyRequestData instantiates a new SankeyRequestData 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 NewSankeyRequestData(typeVar SankeyRequestDataType) *SankeyRequestData { + this := SankeyRequestData{} + this.Type = typeVar + return &this +} + +// NewSankeyRequestDataWithDefaults instantiates a new SankeyRequestData 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 NewSankeyRequestDataWithDefaults() *SankeyRequestData { + this := SankeyRequestData{} + var typeVar SankeyRequestDataType = SANKEYREQUESTDATATYPE_SANKEY_REQUEST + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *SankeyRequestData) GetAttributes() SankeyRequestDataAttributes { + if o == nil || o.Attributes == nil { + var ret SankeyRequestDataAttributes + 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 *SankeyRequestData) GetAttributesOk() (*SankeyRequestDataAttributes, 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 *SankeyRequestData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given SankeyRequestDataAttributes and assigns it to the Attributes field. +func (o *SankeyRequestData) SetAttributes(v SankeyRequestDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SankeyRequestData) 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 *SankeyRequestData) 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 *SankeyRequestData) 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 *SankeyRequestData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *SankeyRequestData) GetType() SankeyRequestDataType { + if o == nil { + var ret SankeyRequestDataType + 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 *SankeyRequestData) GetTypeOk() (*SankeyRequestDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SankeyRequestData) SetType(v SankeyRequestDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SankeyRequestData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SankeyRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *SankeyRequestDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *SankeyRequestDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.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.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_sankey_request_data_attributes.go b/api/datadogV2/model_sankey_request_data_attributes.go new file mode 100644 index 00000000000..5dd7355eb1c --- /dev/null +++ b/api/datadogV2/model_sankey_request_data_attributes.go @@ -0,0 +1,330 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SankeyRequestDataAttributes +type SankeyRequestDataAttributes struct { + // + DataSource *string `json:"data_source,omitempty"` + // + Definition *SankeyRequestDataAttributesDefinition `json:"definition,omitempty"` + // + EnforcedExecutionType *string `json:"enforced_execution_type,omitempty"` + // + RequestId *string `json:"request_id,omitempty"` + // + Sampling *SankeyRequestDataAttributesSampling `json:"sampling,omitempty"` + // + Search *SankeyRequestDataAttributesSearch `json:"search,omitempty"` + // + Time *SankeyRequestDataAttributesTime `json:"time,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{} `json:"-"` +} + +// NewSankeyRequestDataAttributes instantiates a new SankeyRequestDataAttributes 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 NewSankeyRequestDataAttributes() *SankeyRequestDataAttributes { + this := SankeyRequestDataAttributes{} + return &this +} + +// NewSankeyRequestDataAttributesWithDefaults instantiates a new SankeyRequestDataAttributes 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 NewSankeyRequestDataAttributesWithDefaults() *SankeyRequestDataAttributes { + this := SankeyRequestDataAttributes{} + return &this +} + +// GetDataSource returns the DataSource field value if set, zero value otherwise. +func (o *SankeyRequestDataAttributes) GetDataSource() string { + if o == nil || o.DataSource == nil { + var ret string + return ret + } + return *o.DataSource +} + +// GetDataSourceOk returns a tuple with the DataSource field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyRequestDataAttributes) GetDataSourceOk() (*string, bool) { + if o == nil || o.DataSource == nil { + return nil, false + } + return o.DataSource, true +} + +// HasDataSource returns a boolean if a field has been set. +func (o *SankeyRequestDataAttributes) HasDataSource() bool { + return o != nil && o.DataSource != nil +} + +// SetDataSource gets a reference to the given string and assigns it to the DataSource field. +func (o *SankeyRequestDataAttributes) SetDataSource(v string) { + o.DataSource = &v +} + +// GetDefinition returns the Definition field value if set, zero value otherwise. +func (o *SankeyRequestDataAttributes) GetDefinition() SankeyRequestDataAttributesDefinition { + if o == nil || o.Definition == nil { + var ret SankeyRequestDataAttributesDefinition + return ret + } + return *o.Definition +} + +// GetDefinitionOk returns a tuple with the Definition field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyRequestDataAttributes) GetDefinitionOk() (*SankeyRequestDataAttributesDefinition, bool) { + if o == nil || o.Definition == nil { + return nil, false + } + return o.Definition, true +} + +// HasDefinition returns a boolean if a field has been set. +func (o *SankeyRequestDataAttributes) HasDefinition() bool { + return o != nil && o.Definition != nil +} + +// SetDefinition gets a reference to the given SankeyRequestDataAttributesDefinition and assigns it to the Definition field. +func (o *SankeyRequestDataAttributes) SetDefinition(v SankeyRequestDataAttributesDefinition) { + o.Definition = &v +} + +// GetEnforcedExecutionType returns the EnforcedExecutionType field value if set, zero value otherwise. +func (o *SankeyRequestDataAttributes) GetEnforcedExecutionType() string { + if o == nil || o.EnforcedExecutionType == nil { + var ret string + return ret + } + return *o.EnforcedExecutionType +} + +// GetEnforcedExecutionTypeOk returns a tuple with the EnforcedExecutionType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyRequestDataAttributes) GetEnforcedExecutionTypeOk() (*string, bool) { + if o == nil || o.EnforcedExecutionType == nil { + return nil, false + } + return o.EnforcedExecutionType, true +} + +// HasEnforcedExecutionType returns a boolean if a field has been set. +func (o *SankeyRequestDataAttributes) HasEnforcedExecutionType() bool { + return o != nil && o.EnforcedExecutionType != nil +} + +// SetEnforcedExecutionType gets a reference to the given string and assigns it to the EnforcedExecutionType field. +func (o *SankeyRequestDataAttributes) SetEnforcedExecutionType(v string) { + o.EnforcedExecutionType = &v +} + +// GetRequestId returns the RequestId field value if set, zero value otherwise. +func (o *SankeyRequestDataAttributes) 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 *SankeyRequestDataAttributes) 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 *SankeyRequestDataAttributes) 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 *SankeyRequestDataAttributes) SetRequestId(v string) { + o.RequestId = &v +} + +// GetSampling returns the Sampling field value if set, zero value otherwise. +func (o *SankeyRequestDataAttributes) GetSampling() SankeyRequestDataAttributesSampling { + if o == nil || o.Sampling == nil { + var ret SankeyRequestDataAttributesSampling + return ret + } + return *o.Sampling +} + +// GetSamplingOk returns a tuple with the Sampling field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyRequestDataAttributes) GetSamplingOk() (*SankeyRequestDataAttributesSampling, bool) { + if o == nil || o.Sampling == nil { + return nil, false + } + return o.Sampling, true +} + +// HasSampling returns a boolean if a field has been set. +func (o *SankeyRequestDataAttributes) HasSampling() bool { + return o != nil && o.Sampling != nil +} + +// SetSampling gets a reference to the given SankeyRequestDataAttributesSampling and assigns it to the Sampling field. +func (o *SankeyRequestDataAttributes) SetSampling(v SankeyRequestDataAttributesSampling) { + o.Sampling = &v +} + +// GetSearch returns the Search field value if set, zero value otherwise. +func (o *SankeyRequestDataAttributes) GetSearch() SankeyRequestDataAttributesSearch { + if o == nil || o.Search == nil { + var ret SankeyRequestDataAttributesSearch + return ret + } + return *o.Search +} + +// GetSearchOk returns a tuple with the Search field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyRequestDataAttributes) GetSearchOk() (*SankeyRequestDataAttributesSearch, bool) { + if o == nil || o.Search == nil { + return nil, false + } + return o.Search, true +} + +// HasSearch returns a boolean if a field has been set. +func (o *SankeyRequestDataAttributes) HasSearch() bool { + return o != nil && o.Search != nil +} + +// SetSearch gets a reference to the given SankeyRequestDataAttributesSearch and assigns it to the Search field. +func (o *SankeyRequestDataAttributes) SetSearch(v SankeyRequestDataAttributesSearch) { + o.Search = &v +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *SankeyRequestDataAttributes) GetTime() SankeyRequestDataAttributesTime { + if o == nil || o.Time == nil { + var ret SankeyRequestDataAttributesTime + 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 *SankeyRequestDataAttributes) GetTimeOk() (*SankeyRequestDataAttributesTime, 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 *SankeyRequestDataAttributes) HasTime() bool { + return o != nil && o.Time != nil +} + +// SetTime gets a reference to the given SankeyRequestDataAttributesTime and assigns it to the Time field. +func (o *SankeyRequestDataAttributes) SetTime(v SankeyRequestDataAttributesTime) { + o.Time = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SankeyRequestDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.DataSource != nil { + toSerialize["data_source"] = o.DataSource + } + if o.Definition != nil { + toSerialize["definition"] = o.Definition + } + if o.EnforcedExecutionType != nil { + toSerialize["enforced_execution_type"] = o.EnforcedExecutionType + } + if o.RequestId != nil { + toSerialize["request_id"] = o.RequestId + } + if o.Sampling != nil { + toSerialize["sampling"] = o.Sampling + } + if o.Search != nil { + toSerialize["search"] = o.Search + } + if o.Time != nil { + toSerialize["time"] = o.Time + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SankeyRequestDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + DataSource *string `json:"data_source,omitempty"` + Definition *SankeyRequestDataAttributesDefinition `json:"definition,omitempty"` + EnforcedExecutionType *string `json:"enforced_execution_type,omitempty"` + RequestId *string `json:"request_id,omitempty"` + Sampling *SankeyRequestDataAttributesSampling `json:"sampling,omitempty"` + Search *SankeyRequestDataAttributesSearch `json:"search,omitempty"` + Time *SankeyRequestDataAttributesTime `json:"time,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data_source", "definition", "enforced_execution_type", "request_id", "sampling", "search", "time"}) + } else { + return err + } + + hasInvalidField := false + o.DataSource = all.DataSource + if all.Definition != nil && all.Definition.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Definition = all.Definition + o.EnforcedExecutionType = all.EnforcedExecutionType + o.RequestId = all.RequestId + if all.Sampling != nil && all.Sampling.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Sampling = all.Sampling + if all.Search != nil && all.Search.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Search = all.Search + if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Time = all.Time + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_sankey_request_data_attributes_definition.go b/api/datadogV2/model_sankey_request_data_attributes_definition.go new file mode 100644 index 00000000000..5d83a72306e --- /dev/null +++ b/api/datadogV2/model_sankey_request_data_attributes_definition.go @@ -0,0 +1,207 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SankeyRequestDataAttributesDefinition +type SankeyRequestDataAttributesDefinition struct { + // + EntriesPerStep *int64 `json:"entries_per_step,omitempty"` + // + NumberOfSteps *int64 `json:"number_of_steps,omitempty"` + // + Source *string `json:"source,omitempty"` + // + Target *string `json:"target,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{} `json:"-"` +} + +// NewSankeyRequestDataAttributesDefinition instantiates a new SankeyRequestDataAttributesDefinition 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 NewSankeyRequestDataAttributesDefinition() *SankeyRequestDataAttributesDefinition { + this := SankeyRequestDataAttributesDefinition{} + return &this +} + +// NewSankeyRequestDataAttributesDefinitionWithDefaults instantiates a new SankeyRequestDataAttributesDefinition 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 NewSankeyRequestDataAttributesDefinitionWithDefaults() *SankeyRequestDataAttributesDefinition { + this := SankeyRequestDataAttributesDefinition{} + return &this +} + +// GetEntriesPerStep returns the EntriesPerStep field value if set, zero value otherwise. +func (o *SankeyRequestDataAttributesDefinition) GetEntriesPerStep() int64 { + if o == nil || o.EntriesPerStep == nil { + var ret int64 + return ret + } + return *o.EntriesPerStep +} + +// GetEntriesPerStepOk returns a tuple with the EntriesPerStep field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyRequestDataAttributesDefinition) GetEntriesPerStepOk() (*int64, bool) { + if o == nil || o.EntriesPerStep == nil { + return nil, false + } + return o.EntriesPerStep, true +} + +// HasEntriesPerStep returns a boolean if a field has been set. +func (o *SankeyRequestDataAttributesDefinition) HasEntriesPerStep() bool { + return o != nil && o.EntriesPerStep != nil +} + +// SetEntriesPerStep gets a reference to the given int64 and assigns it to the EntriesPerStep field. +func (o *SankeyRequestDataAttributesDefinition) SetEntriesPerStep(v int64) { + o.EntriesPerStep = &v +} + +// GetNumberOfSteps returns the NumberOfSteps field value if set, zero value otherwise. +func (o *SankeyRequestDataAttributesDefinition) GetNumberOfSteps() int64 { + if o == nil || o.NumberOfSteps == nil { + var ret int64 + return ret + } + return *o.NumberOfSteps +} + +// GetNumberOfStepsOk returns a tuple with the NumberOfSteps field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyRequestDataAttributesDefinition) GetNumberOfStepsOk() (*int64, bool) { + if o == nil || o.NumberOfSteps == nil { + return nil, false + } + return o.NumberOfSteps, true +} + +// HasNumberOfSteps returns a boolean if a field has been set. +func (o *SankeyRequestDataAttributesDefinition) HasNumberOfSteps() bool { + return o != nil && o.NumberOfSteps != nil +} + +// SetNumberOfSteps gets a reference to the given int64 and assigns it to the NumberOfSteps field. +func (o *SankeyRequestDataAttributesDefinition) SetNumberOfSteps(v int64) { + o.NumberOfSteps = &v +} + +// GetSource returns the Source field value if set, zero value otherwise. +func (o *SankeyRequestDataAttributesDefinition) GetSource() string { + if o == nil || o.Source == nil { + var ret string + return ret + } + return *o.Source +} + +// GetSourceOk returns a tuple with the Source field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyRequestDataAttributesDefinition) GetSourceOk() (*string, bool) { + if o == nil || o.Source == nil { + return nil, false + } + return o.Source, true +} + +// HasSource returns a boolean if a field has been set. +func (o *SankeyRequestDataAttributesDefinition) HasSource() bool { + return o != nil && o.Source != nil +} + +// SetSource gets a reference to the given string and assigns it to the Source field. +func (o *SankeyRequestDataAttributesDefinition) SetSource(v string) { + o.Source = &v +} + +// GetTarget returns the Target field value if set, zero value otherwise. +func (o *SankeyRequestDataAttributesDefinition) GetTarget() string { + if o == nil || o.Target == nil { + var ret string + return ret + } + return *o.Target +} + +// GetTargetOk returns a tuple with the Target field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyRequestDataAttributesDefinition) GetTargetOk() (*string, bool) { + if o == nil || o.Target == nil { + return nil, false + } + return o.Target, true +} + +// HasTarget returns a boolean if a field has been set. +func (o *SankeyRequestDataAttributesDefinition) HasTarget() bool { + return o != nil && o.Target != nil +} + +// SetTarget gets a reference to the given string and assigns it to the Target field. +func (o *SankeyRequestDataAttributesDefinition) SetTarget(v string) { + o.Target = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SankeyRequestDataAttributesDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.EntriesPerStep != nil { + toSerialize["entries_per_step"] = o.EntriesPerStep + } + if o.NumberOfSteps != nil { + toSerialize["number_of_steps"] = o.NumberOfSteps + } + if o.Source != nil { + toSerialize["source"] = o.Source + } + if o.Target != nil { + toSerialize["target"] = o.Target + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SankeyRequestDataAttributesDefinition) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + EntriesPerStep *int64 `json:"entries_per_step,omitempty"` + NumberOfSteps *int64 `json:"number_of_steps,omitempty"` + Source *string `json:"source,omitempty"` + Target *string `json:"target,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"entries_per_step", "number_of_steps", "source", "target"}) + } else { + return err + } + o.EntriesPerStep = all.EntriesPerStep + o.NumberOfSteps = all.NumberOfSteps + o.Source = all.Source + o.Target = all.Target + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_sankey_request_data_attributes_sampling.go b/api/datadogV2/model_sankey_request_data_attributes_sampling.go new file mode 100644 index 00000000000..9851d10da4d --- /dev/null +++ b/api/datadogV2/model_sankey_request_data_attributes_sampling.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SankeyRequestDataAttributesSampling +type SankeyRequestDataAttributesSampling struct { + // The `sampling` `enabled`. + Enabled *bool `json:"enabled,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{} `json:"-"` +} + +// NewSankeyRequestDataAttributesSampling instantiates a new SankeyRequestDataAttributesSampling 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 NewSankeyRequestDataAttributesSampling() *SankeyRequestDataAttributesSampling { + this := SankeyRequestDataAttributesSampling{} + return &this +} + +// NewSankeyRequestDataAttributesSamplingWithDefaults instantiates a new SankeyRequestDataAttributesSampling 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 NewSankeyRequestDataAttributesSamplingWithDefaults() *SankeyRequestDataAttributesSampling { + this := SankeyRequestDataAttributesSampling{} + return &this +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *SankeyRequestDataAttributesSampling) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyRequestDataAttributesSampling) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *SankeyRequestDataAttributesSampling) HasEnabled() bool { + return o != nil && o.Enabled != nil +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *SankeyRequestDataAttributesSampling) SetEnabled(v bool) { + o.Enabled = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SankeyRequestDataAttributesSampling) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SankeyRequestDataAttributesSampling) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Enabled *bool `json:"enabled,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"enabled"}) + } else { + return err + } + o.Enabled = all.Enabled + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_sankey_request_data_attributes_search.go b/api/datadogV2/model_sankey_request_data_attributes_search.go new file mode 100644 index 00000000000..7ee2e113b77 --- /dev/null +++ b/api/datadogV2/model_sankey_request_data_attributes_search.go @@ -0,0 +1,219 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SankeyRequestDataAttributesSearch +type SankeyRequestDataAttributesSearch struct { + // + AudienceFilters *SankeyRequestDataAttributesSearchAudienceFilters `json:"audience_filters,omitempty"` + // + Occurrences *SankeyRequestDataAttributesSearchOccurrences `json:"occurrences,omitempty"` + // + Query *string `json:"query,omitempty"` + // + SubqueryId *string `json:"subquery_id,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{} `json:"-"` +} + +// NewSankeyRequestDataAttributesSearch instantiates a new SankeyRequestDataAttributesSearch 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 NewSankeyRequestDataAttributesSearch() *SankeyRequestDataAttributesSearch { + this := SankeyRequestDataAttributesSearch{} + return &this +} + +// NewSankeyRequestDataAttributesSearchWithDefaults instantiates a new SankeyRequestDataAttributesSearch 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 NewSankeyRequestDataAttributesSearchWithDefaults() *SankeyRequestDataAttributesSearch { + this := SankeyRequestDataAttributesSearch{} + return &this +} + +// GetAudienceFilters returns the AudienceFilters field value if set, zero value otherwise. +func (o *SankeyRequestDataAttributesSearch) GetAudienceFilters() SankeyRequestDataAttributesSearchAudienceFilters { + if o == nil || o.AudienceFilters == nil { + var ret SankeyRequestDataAttributesSearchAudienceFilters + return ret + } + return *o.AudienceFilters +} + +// GetAudienceFiltersOk returns a tuple with the AudienceFilters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyRequestDataAttributesSearch) GetAudienceFiltersOk() (*SankeyRequestDataAttributesSearchAudienceFilters, bool) { + if o == nil || o.AudienceFilters == nil { + return nil, false + } + return o.AudienceFilters, true +} + +// HasAudienceFilters returns a boolean if a field has been set. +func (o *SankeyRequestDataAttributesSearch) HasAudienceFilters() bool { + return o != nil && o.AudienceFilters != nil +} + +// SetAudienceFilters gets a reference to the given SankeyRequestDataAttributesSearchAudienceFilters and assigns it to the AudienceFilters field. +func (o *SankeyRequestDataAttributesSearch) SetAudienceFilters(v SankeyRequestDataAttributesSearchAudienceFilters) { + o.AudienceFilters = &v +} + +// GetOccurrences returns the Occurrences field value if set, zero value otherwise. +func (o *SankeyRequestDataAttributesSearch) GetOccurrences() SankeyRequestDataAttributesSearchOccurrences { + if o == nil || o.Occurrences == nil { + var ret SankeyRequestDataAttributesSearchOccurrences + return ret + } + return *o.Occurrences +} + +// GetOccurrencesOk returns a tuple with the Occurrences field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyRequestDataAttributesSearch) GetOccurrencesOk() (*SankeyRequestDataAttributesSearchOccurrences, bool) { + if o == nil || o.Occurrences == nil { + return nil, false + } + return o.Occurrences, true +} + +// HasOccurrences returns a boolean if a field has been set. +func (o *SankeyRequestDataAttributesSearch) HasOccurrences() bool { + return o != nil && o.Occurrences != nil +} + +// SetOccurrences gets a reference to the given SankeyRequestDataAttributesSearchOccurrences and assigns it to the Occurrences field. +func (o *SankeyRequestDataAttributesSearch) SetOccurrences(v SankeyRequestDataAttributesSearchOccurrences) { + o.Occurrences = &v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *SankeyRequestDataAttributesSearch) 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 *SankeyRequestDataAttributesSearch) 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 *SankeyRequestDataAttributesSearch) 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 *SankeyRequestDataAttributesSearch) SetQuery(v string) { + o.Query = &v +} + +// GetSubqueryId returns the SubqueryId field value if set, zero value otherwise. +func (o *SankeyRequestDataAttributesSearch) GetSubqueryId() string { + if o == nil || o.SubqueryId == nil { + var ret string + return ret + } + return *o.SubqueryId +} + +// GetSubqueryIdOk returns a tuple with the SubqueryId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyRequestDataAttributesSearch) GetSubqueryIdOk() (*string, bool) { + if o == nil || o.SubqueryId == nil { + return nil, false + } + return o.SubqueryId, true +} + +// HasSubqueryId returns a boolean if a field has been set. +func (o *SankeyRequestDataAttributesSearch) HasSubqueryId() bool { + return o != nil && o.SubqueryId != nil +} + +// SetSubqueryId gets a reference to the given string and assigns it to the SubqueryId field. +func (o *SankeyRequestDataAttributesSearch) SetSubqueryId(v string) { + o.SubqueryId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SankeyRequestDataAttributesSearch) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AudienceFilters != nil { + toSerialize["audience_filters"] = o.AudienceFilters + } + if o.Occurrences != nil { + toSerialize["occurrences"] = o.Occurrences + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + if o.SubqueryId != nil { + toSerialize["subquery_id"] = o.SubqueryId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SankeyRequestDataAttributesSearch) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AudienceFilters *SankeyRequestDataAttributesSearchAudienceFilters `json:"audience_filters,omitempty"` + Occurrences *SankeyRequestDataAttributesSearchOccurrences `json:"occurrences,omitempty"` + Query *string `json:"query,omitempty"` + SubqueryId *string `json:"subquery_id,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"audience_filters", "occurrences", "query", "subquery_id"}) + } else { + return err + } + + hasInvalidField := false + if all.AudienceFilters != nil && all.AudienceFilters.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.AudienceFilters = all.AudienceFilters + if all.Occurrences != nil && all.Occurrences.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Occurrences = all.Occurrences + o.Query = all.Query + o.SubqueryId = all.SubqueryId + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_sankey_request_data_attributes_search_audience_filters.go b/api/datadogV2/model_sankey_request_data_attributes_search_audience_filters.go new file mode 100644 index 00000000000..a017e310637 --- /dev/null +++ b/api/datadogV2/model_sankey_request_data_attributes_search_audience_filters.go @@ -0,0 +1,207 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SankeyRequestDataAttributesSearchAudienceFilters +type SankeyRequestDataAttributesSearchAudienceFilters struct { + // + Accounts []SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems `json:"accounts,omitempty"` + // + Formula *string `json:"formula,omitempty"` + // + Segments []SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems `json:"segments,omitempty"` + // + Users []SankeyRequestDataAttributesSearchAudienceFiltersUsersItems `json:"users,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{} `json:"-"` +} + +// NewSankeyRequestDataAttributesSearchAudienceFilters instantiates a new SankeyRequestDataAttributesSearchAudienceFilters 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 NewSankeyRequestDataAttributesSearchAudienceFilters() *SankeyRequestDataAttributesSearchAudienceFilters { + this := SankeyRequestDataAttributesSearchAudienceFilters{} + return &this +} + +// NewSankeyRequestDataAttributesSearchAudienceFiltersWithDefaults instantiates a new SankeyRequestDataAttributesSearchAudienceFilters 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 NewSankeyRequestDataAttributesSearchAudienceFiltersWithDefaults() *SankeyRequestDataAttributesSearchAudienceFilters { + this := SankeyRequestDataAttributesSearchAudienceFilters{} + return &this +} + +// GetAccounts returns the Accounts field value if set, zero value otherwise. +func (o *SankeyRequestDataAttributesSearchAudienceFilters) GetAccounts() []SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems { + if o == nil || o.Accounts == nil { + var ret []SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems + return ret + } + return o.Accounts +} + +// GetAccountsOk returns a tuple with the Accounts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyRequestDataAttributesSearchAudienceFilters) GetAccountsOk() (*[]SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems, bool) { + if o == nil || o.Accounts == nil { + return nil, false + } + return &o.Accounts, true +} + +// HasAccounts returns a boolean if a field has been set. +func (o *SankeyRequestDataAttributesSearchAudienceFilters) HasAccounts() bool { + return o != nil && o.Accounts != nil +} + +// SetAccounts gets a reference to the given []SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems and assigns it to the Accounts field. +func (o *SankeyRequestDataAttributesSearchAudienceFilters) SetAccounts(v []SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems) { + o.Accounts = v +} + +// GetFormula returns the Formula field value if set, zero value otherwise. +func (o *SankeyRequestDataAttributesSearchAudienceFilters) GetFormula() string { + if o == nil || o.Formula == nil { + var ret string + return ret + } + return *o.Formula +} + +// GetFormulaOk returns a tuple with the Formula field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyRequestDataAttributesSearchAudienceFilters) GetFormulaOk() (*string, bool) { + if o == nil || o.Formula == nil { + return nil, false + } + return o.Formula, true +} + +// HasFormula returns a boolean if a field has been set. +func (o *SankeyRequestDataAttributesSearchAudienceFilters) HasFormula() bool { + return o != nil && o.Formula != nil +} + +// SetFormula gets a reference to the given string and assigns it to the Formula field. +func (o *SankeyRequestDataAttributesSearchAudienceFilters) SetFormula(v string) { + o.Formula = &v +} + +// GetSegments returns the Segments field value if set, zero value otherwise. +func (o *SankeyRequestDataAttributesSearchAudienceFilters) GetSegments() []SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems { + if o == nil || o.Segments == nil { + var ret []SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems + return ret + } + return o.Segments +} + +// GetSegmentsOk returns a tuple with the Segments field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyRequestDataAttributesSearchAudienceFilters) GetSegmentsOk() (*[]SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems, bool) { + if o == nil || o.Segments == nil { + return nil, false + } + return &o.Segments, true +} + +// HasSegments returns a boolean if a field has been set. +func (o *SankeyRequestDataAttributesSearchAudienceFilters) HasSegments() bool { + return o != nil && o.Segments != nil +} + +// SetSegments gets a reference to the given []SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems and assigns it to the Segments field. +func (o *SankeyRequestDataAttributesSearchAudienceFilters) SetSegments(v []SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems) { + o.Segments = v +} + +// GetUsers returns the Users field value if set, zero value otherwise. +func (o *SankeyRequestDataAttributesSearchAudienceFilters) GetUsers() []SankeyRequestDataAttributesSearchAudienceFiltersUsersItems { + if o == nil || o.Users == nil { + var ret []SankeyRequestDataAttributesSearchAudienceFiltersUsersItems + return ret + } + return o.Users +} + +// GetUsersOk returns a tuple with the Users field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyRequestDataAttributesSearchAudienceFilters) GetUsersOk() (*[]SankeyRequestDataAttributesSearchAudienceFiltersUsersItems, bool) { + if o == nil || o.Users == nil { + return nil, false + } + return &o.Users, true +} + +// HasUsers returns a boolean if a field has been set. +func (o *SankeyRequestDataAttributesSearchAudienceFilters) HasUsers() bool { + return o != nil && o.Users != nil +} + +// SetUsers gets a reference to the given []SankeyRequestDataAttributesSearchAudienceFiltersUsersItems and assigns it to the Users field. +func (o *SankeyRequestDataAttributesSearchAudienceFilters) SetUsers(v []SankeyRequestDataAttributesSearchAudienceFiltersUsersItems) { + o.Users = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SankeyRequestDataAttributesSearchAudienceFilters) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Accounts != nil { + toSerialize["accounts"] = o.Accounts + } + if o.Formula != nil { + toSerialize["formula"] = o.Formula + } + if o.Segments != nil { + toSerialize["segments"] = o.Segments + } + if o.Users != nil { + toSerialize["users"] = o.Users + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SankeyRequestDataAttributesSearchAudienceFilters) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Accounts []SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems `json:"accounts,omitempty"` + Formula *string `json:"formula,omitempty"` + Segments []SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems `json:"segments,omitempty"` + Users []SankeyRequestDataAttributesSearchAudienceFiltersUsersItems `json:"users,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"accounts", "formula", "segments", "users"}) + } else { + return err + } + o.Accounts = all.Accounts + o.Formula = all.Formula + o.Segments = all.Segments + o.Users = all.Users + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_sankey_request_data_attributes_search_audience_filters_accounts_items.go b/api/datadogV2/model_sankey_request_data_attributes_search_audience_filters_accounts_items.go new file mode 100644 index 00000000000..63ac7a3ce4d --- /dev/null +++ b/api/datadogV2/model_sankey_request_data_attributes_search_audience_filters_accounts_items.go @@ -0,0 +1,136 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems +type SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems struct { + // + Name string `json:"name"` + // + 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{} `json:"-"` +} + +// NewSankeyRequestDataAttributesSearchAudienceFiltersAccountsItems instantiates a new SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems 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 NewSankeyRequestDataAttributesSearchAudienceFiltersAccountsItems(name string) *SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems { + this := SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems{} + this.Name = name + return &this +} + +// NewSankeyRequestDataAttributesSearchAudienceFiltersAccountsItemsWithDefaults instantiates a new SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems 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 NewSankeyRequestDataAttributesSearchAudienceFiltersAccountsItemsWithDefaults() *SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems { + this := SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems{} + return &this +} + +// GetName returns the Name field value. +func (o *SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems) 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 *SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems) SetName(v string) { + o.Name = v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems) 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 *SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems) 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 *SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems) 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 *SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems) SetQuery(v string) { + o.Query = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + if o.Query != nil { + toSerialize["query"] = o.Query + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Name *string `json:"name"` + Query *string `json:"query,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"name", "query"}) + } else { + return err + } + o.Name = *all.Name + o.Query = all.Query + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_sankey_request_data_attributes_search_audience_filters_segments_items.go b/api/datadogV2/model_sankey_request_data_attributes_search_audience_filters_segments_items.go new file mode 100644 index 00000000000..38458f7733f --- /dev/null +++ b/api/datadogV2/model_sankey_request_data_attributes_search_audience_filters_segments_items.go @@ -0,0 +1,133 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems +type SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems struct { + // + Name string `json:"name"` + // + SegmentId string `json:"segment_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{} `json:"-"` +} + +// NewSankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems instantiates a new SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems 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 NewSankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems(name string, segmentId string) *SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems { + this := SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems{} + this.Name = name + this.SegmentId = segmentId + return &this +} + +// NewSankeyRequestDataAttributesSearchAudienceFiltersSegmentsItemsWithDefaults instantiates a new SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems 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 NewSankeyRequestDataAttributesSearchAudienceFiltersSegmentsItemsWithDefaults() *SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems { + this := SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems{} + return &this +} + +// GetName returns the Name field value. +func (o *SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems) 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 *SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems) SetName(v string) { + o.Name = v +} + +// GetSegmentId returns the SegmentId field value. +func (o *SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems) GetSegmentId() string { + if o == nil { + var ret string + return ret + } + return o.SegmentId +} + +// GetSegmentIdOk returns a tuple with the SegmentId field value +// and a boolean to check if the value has been set. +func (o *SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems) GetSegmentIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SegmentId, true +} + +// SetSegmentId sets field value. +func (o *SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems) SetSegmentId(v string) { + o.SegmentId = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + toSerialize["segment_id"] = o.SegmentId + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Name *string `json:"name"` + SegmentId *string `json:"segment_id"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.SegmentId == nil { + return fmt.Errorf("required field segment_id missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"name", "segment_id"}) + } else { + return err + } + o.Name = *all.Name + o.SegmentId = *all.SegmentId + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_sankey_request_data_attributes_search_audience_filters_users_items.go b/api/datadogV2/model_sankey_request_data_attributes_search_audience_filters_users_items.go new file mode 100644 index 00000000000..e090457c578 --- /dev/null +++ b/api/datadogV2/model_sankey_request_data_attributes_search_audience_filters_users_items.go @@ -0,0 +1,136 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SankeyRequestDataAttributesSearchAudienceFiltersUsersItems +type SankeyRequestDataAttributesSearchAudienceFiltersUsersItems struct { + // + Name string `json:"name"` + // + 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{} `json:"-"` +} + +// NewSankeyRequestDataAttributesSearchAudienceFiltersUsersItems instantiates a new SankeyRequestDataAttributesSearchAudienceFiltersUsersItems 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 NewSankeyRequestDataAttributesSearchAudienceFiltersUsersItems(name string) *SankeyRequestDataAttributesSearchAudienceFiltersUsersItems { + this := SankeyRequestDataAttributesSearchAudienceFiltersUsersItems{} + this.Name = name + return &this +} + +// NewSankeyRequestDataAttributesSearchAudienceFiltersUsersItemsWithDefaults instantiates a new SankeyRequestDataAttributesSearchAudienceFiltersUsersItems 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 NewSankeyRequestDataAttributesSearchAudienceFiltersUsersItemsWithDefaults() *SankeyRequestDataAttributesSearchAudienceFiltersUsersItems { + this := SankeyRequestDataAttributesSearchAudienceFiltersUsersItems{} + return &this +} + +// GetName returns the Name field value. +func (o *SankeyRequestDataAttributesSearchAudienceFiltersUsersItems) 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 *SankeyRequestDataAttributesSearchAudienceFiltersUsersItems) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *SankeyRequestDataAttributesSearchAudienceFiltersUsersItems) SetName(v string) { + o.Name = v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *SankeyRequestDataAttributesSearchAudienceFiltersUsersItems) 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 *SankeyRequestDataAttributesSearchAudienceFiltersUsersItems) 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 *SankeyRequestDataAttributesSearchAudienceFiltersUsersItems) 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 *SankeyRequestDataAttributesSearchAudienceFiltersUsersItems) SetQuery(v string) { + o.Query = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SankeyRequestDataAttributesSearchAudienceFiltersUsersItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + if o.Query != nil { + toSerialize["query"] = o.Query + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SankeyRequestDataAttributesSearchAudienceFiltersUsersItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Name *string `json:"name"` + Query *string `json:"query,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"name", "query"}) + } else { + return err + } + o.Name = *all.Name + o.Query = all.Query + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_sankey_request_data_attributes_search_occurrences.go b/api/datadogV2/model_sankey_request_data_attributes_search_occurrences.go new file mode 100644 index 00000000000..8d516236151 --- /dev/null +++ b/api/datadogV2/model_sankey_request_data_attributes_search_occurrences.go @@ -0,0 +1,168 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SankeyRequestDataAttributesSearchOccurrences +type SankeyRequestDataAttributesSearchOccurrences struct { + // + Meta map[string]string `json:"meta,omitempty"` + // + Operator string `json:"operator"` + // + Value string `json:"value"` + // 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{} `json:"-"` +} + +// NewSankeyRequestDataAttributesSearchOccurrences instantiates a new SankeyRequestDataAttributesSearchOccurrences 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 NewSankeyRequestDataAttributesSearchOccurrences(operator string, value string) *SankeyRequestDataAttributesSearchOccurrences { + this := SankeyRequestDataAttributesSearchOccurrences{} + this.Operator = operator + this.Value = value + return &this +} + +// NewSankeyRequestDataAttributesSearchOccurrencesWithDefaults instantiates a new SankeyRequestDataAttributesSearchOccurrences 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 NewSankeyRequestDataAttributesSearchOccurrencesWithDefaults() *SankeyRequestDataAttributesSearchOccurrences { + this := SankeyRequestDataAttributesSearchOccurrences{} + return &this +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *SankeyRequestDataAttributesSearchOccurrences) GetMeta() map[string]string { + if o == nil || o.Meta == nil { + var ret map[string]string + 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 *SankeyRequestDataAttributesSearchOccurrences) GetMetaOk() (*map[string]string, 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 *SankeyRequestDataAttributesSearchOccurrences) HasMeta() bool { + return o != nil && o.Meta != nil +} + +// SetMeta gets a reference to the given map[string]string and assigns it to the Meta field. +func (o *SankeyRequestDataAttributesSearchOccurrences) SetMeta(v map[string]string) { + o.Meta = v +} + +// GetOperator returns the Operator field value. +func (o *SankeyRequestDataAttributesSearchOccurrences) GetOperator() string { + if o == nil { + var ret string + return ret + } + return o.Operator +} + +// GetOperatorOk returns a tuple with the Operator field value +// and a boolean to check if the value has been set. +func (o *SankeyRequestDataAttributesSearchOccurrences) GetOperatorOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Operator, true +} + +// SetOperator sets field value. +func (o *SankeyRequestDataAttributesSearchOccurrences) SetOperator(v string) { + o.Operator = v +} + +// GetValue returns the Value field value. +func (o *SankeyRequestDataAttributesSearchOccurrences) GetValue() string { + if o == nil { + var ret string + return ret + } + return o.Value +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *SankeyRequestDataAttributesSearchOccurrences) GetValueOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Value, true +} + +// SetValue sets field value. +func (o *SankeyRequestDataAttributesSearchOccurrences) SetValue(v string) { + o.Value = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SankeyRequestDataAttributesSearchOccurrences) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + toSerialize["operator"] = o.Operator + toSerialize["value"] = o.Value + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SankeyRequestDataAttributesSearchOccurrences) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Meta map[string]string `json:"meta,omitempty"` + Operator *string `json:"operator"` + Value *string `json:"value"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Operator == nil { + return fmt.Errorf("required field operator missing") + } + if all.Value == nil { + return fmt.Errorf("required field value missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"meta", "operator", "value"}) + } else { + return err + } + o.Meta = all.Meta + o.Operator = *all.Operator + o.Value = *all.Value + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_sankey_request_data_attributes_time.go b/api/datadogV2/model_sankey_request_data_attributes_time.go new file mode 100644 index 00000000000..a3f636e5165 --- /dev/null +++ b/api/datadogV2/model_sankey_request_data_attributes_time.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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SankeyRequestDataAttributesTime +type SankeyRequestDataAttributesTime struct { + // + From *int64 `json:"from,omitempty"` + // + To *int64 `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{} `json:"-"` +} + +// NewSankeyRequestDataAttributesTime instantiates a new SankeyRequestDataAttributesTime 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 NewSankeyRequestDataAttributesTime() *SankeyRequestDataAttributesTime { + this := SankeyRequestDataAttributesTime{} + return &this +} + +// NewSankeyRequestDataAttributesTimeWithDefaults instantiates a new SankeyRequestDataAttributesTime 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 NewSankeyRequestDataAttributesTimeWithDefaults() *SankeyRequestDataAttributesTime { + this := SankeyRequestDataAttributesTime{} + return &this +} + +// GetFrom returns the From field value if set, zero value otherwise. +func (o *SankeyRequestDataAttributesTime) GetFrom() int64 { + if o == nil || o.From == nil { + var ret int64 + 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 *SankeyRequestDataAttributesTime) GetFromOk() (*int64, 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 *SankeyRequestDataAttributesTime) HasFrom() bool { + return o != nil && o.From != nil +} + +// SetFrom gets a reference to the given int64 and assigns it to the From field. +func (o *SankeyRequestDataAttributesTime) SetFrom(v int64) { + o.From = &v +} + +// GetTo returns the To field value if set, zero value otherwise. +func (o *SankeyRequestDataAttributesTime) GetTo() int64 { + if o == nil || o.To == nil { + var ret int64 + 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 *SankeyRequestDataAttributesTime) GetToOk() (*int64, 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 *SankeyRequestDataAttributesTime) HasTo() bool { + return o != nil && o.To != nil +} + +// SetTo gets a reference to the given int64 and assigns it to the To field. +func (o *SankeyRequestDataAttributesTime) SetTo(v int64) { + o.To = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SankeyRequestDataAttributesTime) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.From != nil { + toSerialize["from"] = o.From + } + if o.To != nil { + toSerialize["to"] = o.To + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SankeyRequestDataAttributesTime) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + From *int64 `json:"from,omitempty"` + To *int64 `json:"to,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"from", "to"}) + } else { + return err + } + o.From = all.From + o.To = all.To + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_sankey_request_data_type.go b/api/datadogV2/model_sankey_request_data_type.go new file mode 100644 index 00000000000..52051a0f6a5 --- /dev/null +++ b/api/datadogV2/model_sankey_request_data_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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SankeyRequestDataType +type SankeyRequestDataType string + +// List of SankeyRequestDataType. +const ( + SANKEYREQUESTDATATYPE_SANKEY_REQUEST SankeyRequestDataType = "sankey_request" +) + +var allowedSankeyRequestDataTypeEnumValues = []SankeyRequestDataType{ + SANKEYREQUESTDATATYPE_SANKEY_REQUEST, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SankeyRequestDataType) GetAllowedValues() []SankeyRequestDataType { + return allowedSankeyRequestDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SankeyRequestDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SankeyRequestDataType(value) + return nil +} + +// NewSankeyRequestDataTypeFromValue returns a pointer to a valid SankeyRequestDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSankeyRequestDataTypeFromValue(v string) (*SankeyRequestDataType, error) { + ev := SankeyRequestDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SankeyRequestDataType: valid values are %v", v, allowedSankeyRequestDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SankeyRequestDataType) IsValid() bool { + for _, existing := range allowedSankeyRequestDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SankeyRequestDataType value. +func (v SankeyRequestDataType) Ptr() *SankeyRequestDataType { + return &v +} diff --git a/api/datadogV2/model_sankey_response.go b/api/datadogV2/model_sankey_response.go new file mode 100644 index 00000000000..037ad568413 --- /dev/null +++ b/api/datadogV2/model_sankey_response.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SankeyResponse +type SankeyResponse struct { + // + Data *SankeyResponseData `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{} `json:"-"` +} + +// NewSankeyResponse instantiates a new SankeyResponse 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 NewSankeyResponse() *SankeyResponse { + this := SankeyResponse{} + return &this +} + +// NewSankeyResponseWithDefaults instantiates a new SankeyResponse 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 NewSankeyResponseWithDefaults() *SankeyResponse { + this := SankeyResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *SankeyResponse) GetData() SankeyResponseData { + if o == nil || o.Data == nil { + var ret SankeyResponseData + 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 *SankeyResponse) GetDataOk() (*SankeyResponseData, 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 *SankeyResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given SankeyResponseData and assigns it to the Data field. +func (o *SankeyResponse) SetData(v SankeyResponseData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SankeyResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SankeyResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *SankeyResponseData `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.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 datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_sankey_response_data.go b/api/datadogV2/model_sankey_response_data.go new file mode 100644 index 00000000000..d381b8bcae0 --- /dev/null +++ b/api/datadogV2/model_sankey_response_data.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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SankeyResponseData +type SankeyResponseData struct { + // + Attributes *SankeyResponseDataAttributes `json:"attributes,omitempty"` + // + Id *string `json:"id,omitempty"` + // + Type SankeyResponseDataType `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{} `json:"-"` +} + +// NewSankeyResponseData instantiates a new SankeyResponseData 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 NewSankeyResponseData(typeVar SankeyResponseDataType) *SankeyResponseData { + this := SankeyResponseData{} + this.Type = typeVar + return &this +} + +// NewSankeyResponseDataWithDefaults instantiates a new SankeyResponseData 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 NewSankeyResponseDataWithDefaults() *SankeyResponseData { + this := SankeyResponseData{} + var typeVar SankeyResponseDataType = SANKEYRESPONSEDATATYPE_SANKEY_RESPONSE + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *SankeyResponseData) GetAttributes() SankeyResponseDataAttributes { + if o == nil || o.Attributes == nil { + var ret SankeyResponseDataAttributes + 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 *SankeyResponseData) GetAttributesOk() (*SankeyResponseDataAttributes, 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 *SankeyResponseData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given SankeyResponseDataAttributes and assigns it to the Attributes field. +func (o *SankeyResponseData) SetAttributes(v SankeyResponseDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SankeyResponseData) 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 *SankeyResponseData) 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 *SankeyResponseData) 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 *SankeyResponseData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *SankeyResponseData) GetType() SankeyResponseDataType { + if o == nil { + var ret SankeyResponseDataType + 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 *SankeyResponseData) GetTypeOk() (*SankeyResponseDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SankeyResponseData) SetType(v SankeyResponseDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SankeyResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SankeyResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *SankeyResponseDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *SankeyResponseDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.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.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_sankey_response_data_attributes.go b/api/datadogV2/model_sankey_response_data_attributes.go new file mode 100644 index 00000000000..97083b0831d --- /dev/null +++ b/api/datadogV2/model_sankey_response_data_attributes.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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SankeyResponseDataAttributes +type SankeyResponseDataAttributes struct { + // + Links []SankeyResponseDataAttributesLinksItems `json:"links,omitempty"` + // + Nodes []SankeyResponseDataAttributesNodesItems `json:"nodes,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{} `json:"-"` +} + +// NewSankeyResponseDataAttributes instantiates a new SankeyResponseDataAttributes 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 NewSankeyResponseDataAttributes() *SankeyResponseDataAttributes { + this := SankeyResponseDataAttributes{} + return &this +} + +// NewSankeyResponseDataAttributesWithDefaults instantiates a new SankeyResponseDataAttributes 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 NewSankeyResponseDataAttributesWithDefaults() *SankeyResponseDataAttributes { + this := SankeyResponseDataAttributes{} + return &this +} + +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *SankeyResponseDataAttributes) GetLinks() []SankeyResponseDataAttributesLinksItems { + if o == nil || o.Links == nil { + var ret []SankeyResponseDataAttributesLinksItems + 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 *SankeyResponseDataAttributes) GetLinksOk() (*[]SankeyResponseDataAttributesLinksItems, 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 *SankeyResponseDataAttributes) HasLinks() bool { + return o != nil && o.Links != nil +} + +// SetLinks gets a reference to the given []SankeyResponseDataAttributesLinksItems and assigns it to the Links field. +func (o *SankeyResponseDataAttributes) SetLinks(v []SankeyResponseDataAttributesLinksItems) { + o.Links = v +} + +// GetNodes returns the Nodes field value if set, zero value otherwise. +func (o *SankeyResponseDataAttributes) GetNodes() []SankeyResponseDataAttributesNodesItems { + if o == nil || o.Nodes == nil { + var ret []SankeyResponseDataAttributesNodesItems + return ret + } + return o.Nodes +} + +// GetNodesOk returns a tuple with the Nodes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyResponseDataAttributes) GetNodesOk() (*[]SankeyResponseDataAttributesNodesItems, bool) { + if o == nil || o.Nodes == nil { + return nil, false + } + return &o.Nodes, true +} + +// HasNodes returns a boolean if a field has been set. +func (o *SankeyResponseDataAttributes) HasNodes() bool { + return o != nil && o.Nodes != nil +} + +// SetNodes gets a reference to the given []SankeyResponseDataAttributesNodesItems and assigns it to the Nodes field. +func (o *SankeyResponseDataAttributes) SetNodes(v []SankeyResponseDataAttributesNodesItems) { + o.Nodes = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SankeyResponseDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Links != nil { + toSerialize["links"] = o.Links + } + if o.Nodes != nil { + toSerialize["nodes"] = o.Nodes + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SankeyResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Links []SankeyResponseDataAttributesLinksItems `json:"links,omitempty"` + Nodes []SankeyResponseDataAttributesNodesItems `json:"nodes,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"links", "nodes"}) + } else { + return err + } + o.Links = all.Links + o.Nodes = all.Nodes + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_sankey_response_data_attributes_links_items.go b/api/datadogV2/model_sankey_response_data_attributes_links_items.go new file mode 100644 index 00000000000..0e413d9d518 --- /dev/null +++ b/api/datadogV2/model_sankey_response_data_attributes_links_items.go @@ -0,0 +1,242 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SankeyResponseDataAttributesLinksItems +type SankeyResponseDataAttributesLinksItems struct { + // + Column *int64 `json:"column,omitempty"` + // + Id *string `json:"id,omitempty"` + // + Source *string `json:"source,omitempty"` + // + Target *string `json:"target,omitempty"` + // + Value *int64 `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{} `json:"-"` +} + +// NewSankeyResponseDataAttributesLinksItems instantiates a new SankeyResponseDataAttributesLinksItems 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 NewSankeyResponseDataAttributesLinksItems() *SankeyResponseDataAttributesLinksItems { + this := SankeyResponseDataAttributesLinksItems{} + return &this +} + +// NewSankeyResponseDataAttributesLinksItemsWithDefaults instantiates a new SankeyResponseDataAttributesLinksItems 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 NewSankeyResponseDataAttributesLinksItemsWithDefaults() *SankeyResponseDataAttributesLinksItems { + this := SankeyResponseDataAttributesLinksItems{} + return &this +} + +// GetColumn returns the Column field value if set, zero value otherwise. +func (o *SankeyResponseDataAttributesLinksItems) GetColumn() int64 { + if o == nil || o.Column == nil { + var ret int64 + return ret + } + return *o.Column +} + +// GetColumnOk returns a tuple with the Column field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyResponseDataAttributesLinksItems) GetColumnOk() (*int64, bool) { + if o == nil || o.Column == nil { + return nil, false + } + return o.Column, true +} + +// HasColumn returns a boolean if a field has been set. +func (o *SankeyResponseDataAttributesLinksItems) HasColumn() bool { + return o != nil && o.Column != nil +} + +// SetColumn gets a reference to the given int64 and assigns it to the Column field. +func (o *SankeyResponseDataAttributesLinksItems) SetColumn(v int64) { + o.Column = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SankeyResponseDataAttributesLinksItems) 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 *SankeyResponseDataAttributesLinksItems) 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 *SankeyResponseDataAttributesLinksItems) 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 *SankeyResponseDataAttributesLinksItems) SetId(v string) { + o.Id = &v +} + +// GetSource returns the Source field value if set, zero value otherwise. +func (o *SankeyResponseDataAttributesLinksItems) GetSource() string { + if o == nil || o.Source == nil { + var ret string + return ret + } + return *o.Source +} + +// GetSourceOk returns a tuple with the Source field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyResponseDataAttributesLinksItems) GetSourceOk() (*string, bool) { + if o == nil || o.Source == nil { + return nil, false + } + return o.Source, true +} + +// HasSource returns a boolean if a field has been set. +func (o *SankeyResponseDataAttributesLinksItems) HasSource() bool { + return o != nil && o.Source != nil +} + +// SetSource gets a reference to the given string and assigns it to the Source field. +func (o *SankeyResponseDataAttributesLinksItems) SetSource(v string) { + o.Source = &v +} + +// GetTarget returns the Target field value if set, zero value otherwise. +func (o *SankeyResponseDataAttributesLinksItems) GetTarget() string { + if o == nil || o.Target == nil { + var ret string + return ret + } + return *o.Target +} + +// GetTargetOk returns a tuple with the Target field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyResponseDataAttributesLinksItems) GetTargetOk() (*string, bool) { + if o == nil || o.Target == nil { + return nil, false + } + return o.Target, true +} + +// HasTarget returns a boolean if a field has been set. +func (o *SankeyResponseDataAttributesLinksItems) HasTarget() bool { + return o != nil && o.Target != nil +} + +// SetTarget gets a reference to the given string and assigns it to the Target field. +func (o *SankeyResponseDataAttributesLinksItems) SetTarget(v string) { + o.Target = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *SankeyResponseDataAttributesLinksItems) GetValue() int64 { + if o == nil || o.Value == nil { + var ret int64 + 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 *SankeyResponseDataAttributesLinksItems) GetValueOk() (*int64, 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 *SankeyResponseDataAttributesLinksItems) HasValue() bool { + return o != nil && o.Value != nil +} + +// SetValue gets a reference to the given int64 and assigns it to the Value field. +func (o *SankeyResponseDataAttributesLinksItems) SetValue(v int64) { + o.Value = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SankeyResponseDataAttributesLinksItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Column != nil { + toSerialize["column"] = o.Column + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Source != nil { + toSerialize["source"] = o.Source + } + if o.Target != nil { + toSerialize["target"] = o.Target + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SankeyResponseDataAttributesLinksItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Column *int64 `json:"column,omitempty"` + Id *string `json:"id,omitempty"` + Source *string `json:"source,omitempty"` + Target *string `json:"target,omitempty"` + Value *int64 `json:"value,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"column", "id", "source", "target", "value"}) + } else { + return err + } + o.Column = all.Column + o.Id = all.Id + o.Source = all.Source + o.Target = all.Target + o.Value = all.Value + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_sankey_response_data_attributes_nodes_items.go b/api/datadogV2/model_sankey_response_data_attributes_nodes_items.go new file mode 100644 index 00000000000..e4cb6745b76 --- /dev/null +++ b/api/datadogV2/model_sankey_response_data_attributes_nodes_items.go @@ -0,0 +1,347 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SankeyResponseDataAttributesNodesItems +type SankeyResponseDataAttributesNodesItems struct { + // + AggregatedNodes []SankeyResponseDataAttributesNodesItemsAggregatedNodesItems `json:"aggregated_nodes,omitempty"` + // + Column *int64 `json:"column,omitempty"` + // + Id *string `json:"id,omitempty"` + // + IncomingValue *int64 `json:"incoming_value,omitempty"` + // + Name *string `json:"name,omitempty"` + // + OutgoingValue *int64 `json:"outgoing_value,omitempty"` + // + Type *string `json:"type,omitempty"` + // + Value *int64 `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{} `json:"-"` +} + +// NewSankeyResponseDataAttributesNodesItems instantiates a new SankeyResponseDataAttributesNodesItems 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 NewSankeyResponseDataAttributesNodesItems() *SankeyResponseDataAttributesNodesItems { + this := SankeyResponseDataAttributesNodesItems{} + return &this +} + +// NewSankeyResponseDataAttributesNodesItemsWithDefaults instantiates a new SankeyResponseDataAttributesNodesItems 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 NewSankeyResponseDataAttributesNodesItemsWithDefaults() *SankeyResponseDataAttributesNodesItems { + this := SankeyResponseDataAttributesNodesItems{} + return &this +} + +// GetAggregatedNodes returns the AggregatedNodes field value if set, zero value otherwise. +func (o *SankeyResponseDataAttributesNodesItems) GetAggregatedNodes() []SankeyResponseDataAttributesNodesItemsAggregatedNodesItems { + if o == nil || o.AggregatedNodes == nil { + var ret []SankeyResponseDataAttributesNodesItemsAggregatedNodesItems + return ret + } + return o.AggregatedNodes +} + +// GetAggregatedNodesOk returns a tuple with the AggregatedNodes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyResponseDataAttributesNodesItems) GetAggregatedNodesOk() (*[]SankeyResponseDataAttributesNodesItemsAggregatedNodesItems, bool) { + if o == nil || o.AggregatedNodes == nil { + return nil, false + } + return &o.AggregatedNodes, true +} + +// HasAggregatedNodes returns a boolean if a field has been set. +func (o *SankeyResponseDataAttributesNodesItems) HasAggregatedNodes() bool { + return o != nil && o.AggregatedNodes != nil +} + +// SetAggregatedNodes gets a reference to the given []SankeyResponseDataAttributesNodesItemsAggregatedNodesItems and assigns it to the AggregatedNodes field. +func (o *SankeyResponseDataAttributesNodesItems) SetAggregatedNodes(v []SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) { + o.AggregatedNodes = v +} + +// GetColumn returns the Column field value if set, zero value otherwise. +func (o *SankeyResponseDataAttributesNodesItems) GetColumn() int64 { + if o == nil || o.Column == nil { + var ret int64 + return ret + } + return *o.Column +} + +// GetColumnOk returns a tuple with the Column field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyResponseDataAttributesNodesItems) GetColumnOk() (*int64, bool) { + if o == nil || o.Column == nil { + return nil, false + } + return o.Column, true +} + +// HasColumn returns a boolean if a field has been set. +func (o *SankeyResponseDataAttributesNodesItems) HasColumn() bool { + return o != nil && o.Column != nil +} + +// SetColumn gets a reference to the given int64 and assigns it to the Column field. +func (o *SankeyResponseDataAttributesNodesItems) SetColumn(v int64) { + o.Column = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SankeyResponseDataAttributesNodesItems) 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 *SankeyResponseDataAttributesNodesItems) 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 *SankeyResponseDataAttributesNodesItems) 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 *SankeyResponseDataAttributesNodesItems) SetId(v string) { + o.Id = &v +} + +// GetIncomingValue returns the IncomingValue field value if set, zero value otherwise. +func (o *SankeyResponseDataAttributesNodesItems) GetIncomingValue() int64 { + if o == nil || o.IncomingValue == nil { + var ret int64 + return ret + } + return *o.IncomingValue +} + +// GetIncomingValueOk returns a tuple with the IncomingValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyResponseDataAttributesNodesItems) GetIncomingValueOk() (*int64, bool) { + if o == nil || o.IncomingValue == nil { + return nil, false + } + return o.IncomingValue, true +} + +// HasIncomingValue returns a boolean if a field has been set. +func (o *SankeyResponseDataAttributesNodesItems) HasIncomingValue() bool { + return o != nil && o.IncomingValue != nil +} + +// SetIncomingValue gets a reference to the given int64 and assigns it to the IncomingValue field. +func (o *SankeyResponseDataAttributesNodesItems) SetIncomingValue(v int64) { + o.IncomingValue = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SankeyResponseDataAttributesNodesItems) 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 *SankeyResponseDataAttributesNodesItems) 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 *SankeyResponseDataAttributesNodesItems) 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 *SankeyResponseDataAttributesNodesItems) SetName(v string) { + o.Name = &v +} + +// GetOutgoingValue returns the OutgoingValue field value if set, zero value otherwise. +func (o *SankeyResponseDataAttributesNodesItems) GetOutgoingValue() int64 { + if o == nil || o.OutgoingValue == nil { + var ret int64 + return ret + } + return *o.OutgoingValue +} + +// GetOutgoingValueOk returns a tuple with the OutgoingValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyResponseDataAttributesNodesItems) GetOutgoingValueOk() (*int64, bool) { + if o == nil || o.OutgoingValue == nil { + return nil, false + } + return o.OutgoingValue, true +} + +// HasOutgoingValue returns a boolean if a field has been set. +func (o *SankeyResponseDataAttributesNodesItems) HasOutgoingValue() bool { + return o != nil && o.OutgoingValue != nil +} + +// SetOutgoingValue gets a reference to the given int64 and assigns it to the OutgoingValue field. +func (o *SankeyResponseDataAttributesNodesItems) SetOutgoingValue(v int64) { + o.OutgoingValue = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SankeyResponseDataAttributesNodesItems) 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 *SankeyResponseDataAttributesNodesItems) 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 *SankeyResponseDataAttributesNodesItems) 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 *SankeyResponseDataAttributesNodesItems) SetType(v string) { + o.Type = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *SankeyResponseDataAttributesNodesItems) GetValue() int64 { + if o == nil || o.Value == nil { + var ret int64 + 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 *SankeyResponseDataAttributesNodesItems) GetValueOk() (*int64, 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 *SankeyResponseDataAttributesNodesItems) HasValue() bool { + return o != nil && o.Value != nil +} + +// SetValue gets a reference to the given int64 and assigns it to the Value field. +func (o *SankeyResponseDataAttributesNodesItems) SetValue(v int64) { + o.Value = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SankeyResponseDataAttributesNodesItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AggregatedNodes != nil { + toSerialize["aggregated_nodes"] = o.AggregatedNodes + } + if o.Column != nil { + toSerialize["column"] = o.Column + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.IncomingValue != nil { + toSerialize["incoming_value"] = o.IncomingValue + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.OutgoingValue != nil { + toSerialize["outgoing_value"] = o.OutgoingValue + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SankeyResponseDataAttributesNodesItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AggregatedNodes []SankeyResponseDataAttributesNodesItemsAggregatedNodesItems `json:"aggregated_nodes,omitempty"` + Column *int64 `json:"column,omitempty"` + Id *string `json:"id,omitempty"` + IncomingValue *int64 `json:"incoming_value,omitempty"` + Name *string `json:"name,omitempty"` + OutgoingValue *int64 `json:"outgoing_value,omitempty"` + Type *string `json:"type,omitempty"` + Value *int64 `json:"value,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"aggregated_nodes", "column", "id", "incoming_value", "name", "outgoing_value", "type", "value"}) + } else { + return err + } + o.AggregatedNodes = all.AggregatedNodes + o.Column = all.Column + o.Id = all.Id + o.IncomingValue = all.IncomingValue + o.Name = all.Name + o.OutgoingValue = all.OutgoingValue + o.Type = all.Type + o.Value = all.Value + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_sankey_response_data_attributes_nodes_items_aggregated_nodes_items.go b/api/datadogV2/model_sankey_response_data_attributes_nodes_items_aggregated_nodes_items.go new file mode 100644 index 00000000000..4a9c3eaf0e2 --- /dev/null +++ b/api/datadogV2/model_sankey_response_data_attributes_nodes_items_aggregated_nodes_items.go @@ -0,0 +1,277 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SankeyResponseDataAttributesNodesItemsAggregatedNodesItems +type SankeyResponseDataAttributesNodesItemsAggregatedNodesItems struct { + // + Id *string `json:"id,omitempty"` + // + IncomingValue *int64 `json:"incoming_value,omitempty"` + // + Name *string `json:"name,omitempty"` + // + OutgoingValue *int64 `json:"outgoing_value,omitempty"` + // + Type *string `json:"type,omitempty"` + // + Value *int64 `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{} `json:"-"` +} + +// NewSankeyResponseDataAttributesNodesItemsAggregatedNodesItems instantiates a new SankeyResponseDataAttributesNodesItemsAggregatedNodesItems 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 NewSankeyResponseDataAttributesNodesItemsAggregatedNodesItems() *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems { + this := SankeyResponseDataAttributesNodesItemsAggregatedNodesItems{} + return &this +} + +// NewSankeyResponseDataAttributesNodesItemsAggregatedNodesItemsWithDefaults instantiates a new SankeyResponseDataAttributesNodesItemsAggregatedNodesItems 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 NewSankeyResponseDataAttributesNodesItemsAggregatedNodesItemsWithDefaults() *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems { + this := SankeyResponseDataAttributesNodesItemsAggregatedNodesItems{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) 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 *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) 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 *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) 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 *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) SetId(v string) { + o.Id = &v +} + +// GetIncomingValue returns the IncomingValue field value if set, zero value otherwise. +func (o *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) GetIncomingValue() int64 { + if o == nil || o.IncomingValue == nil { + var ret int64 + return ret + } + return *o.IncomingValue +} + +// GetIncomingValueOk returns a tuple with the IncomingValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) GetIncomingValueOk() (*int64, bool) { + if o == nil || o.IncomingValue == nil { + return nil, false + } + return o.IncomingValue, true +} + +// HasIncomingValue returns a boolean if a field has been set. +func (o *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) HasIncomingValue() bool { + return o != nil && o.IncomingValue != nil +} + +// SetIncomingValue gets a reference to the given int64 and assigns it to the IncomingValue field. +func (o *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) SetIncomingValue(v int64) { + o.IncomingValue = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) 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 *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) 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 *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) 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 *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) SetName(v string) { + o.Name = &v +} + +// GetOutgoingValue returns the OutgoingValue field value if set, zero value otherwise. +func (o *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) GetOutgoingValue() int64 { + if o == nil || o.OutgoingValue == nil { + var ret int64 + return ret + } + return *o.OutgoingValue +} + +// GetOutgoingValueOk returns a tuple with the OutgoingValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) GetOutgoingValueOk() (*int64, bool) { + if o == nil || o.OutgoingValue == nil { + return nil, false + } + return o.OutgoingValue, true +} + +// HasOutgoingValue returns a boolean if a field has been set. +func (o *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) HasOutgoingValue() bool { + return o != nil && o.OutgoingValue != nil +} + +// SetOutgoingValue gets a reference to the given int64 and assigns it to the OutgoingValue field. +func (o *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) SetOutgoingValue(v int64) { + o.OutgoingValue = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) 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 *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) 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 *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) 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 *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) SetType(v string) { + o.Type = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) GetValue() int64 { + if o == nil || o.Value == nil { + var ret int64 + 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 *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) GetValueOk() (*int64, 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 *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) HasValue() bool { + return o != nil && o.Value != nil +} + +// SetValue gets a reference to the given int64 and assigns it to the Value field. +func (o *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) SetValue(v int64) { + o.Value = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.IncomingValue != nil { + toSerialize["incoming_value"] = o.IncomingValue + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.OutgoingValue != nil { + toSerialize["outgoing_value"] = o.OutgoingValue + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SankeyResponseDataAttributesNodesItemsAggregatedNodesItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *string `json:"id,omitempty"` + IncomingValue *int64 `json:"incoming_value,omitempty"` + Name *string `json:"name,omitempty"` + OutgoingValue *int64 `json:"outgoing_value,omitempty"` + Type *string `json:"type,omitempty"` + Value *int64 `json:"value,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"id", "incoming_value", "name", "outgoing_value", "type", "value"}) + } else { + return err + } + o.Id = all.Id + o.IncomingValue = all.IncomingValue + o.Name = all.Name + o.OutgoingValue = all.OutgoingValue + o.Type = all.Type + o.Value = all.Value + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_sankey_response_data_type.go b/api/datadogV2/model_sankey_response_data_type.go new file mode 100644 index 00000000000..752b31a8832 --- /dev/null +++ b/api/datadogV2/model_sankey_response_data_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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SankeyResponseDataType +type SankeyResponseDataType string + +// List of SankeyResponseDataType. +const ( + SANKEYRESPONSEDATATYPE_SANKEY_RESPONSE SankeyResponseDataType = "sankey_response" +) + +var allowedSankeyResponseDataTypeEnumValues = []SankeyResponseDataType{ + SANKEYRESPONSEDATATYPE_SANKEY_RESPONSE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SankeyResponseDataType) GetAllowedValues() []SankeyResponseDataType { + return allowedSankeyResponseDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SankeyResponseDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SankeyResponseDataType(value) + return nil +} + +// NewSankeyResponseDataTypeFromValue returns a pointer to a valid SankeyResponseDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSankeyResponseDataTypeFromValue(v string) (*SankeyResponseDataType, error) { + ev := SankeyResponseDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SankeyResponseDataType: valid values are %v", v, allowedSankeyResponseDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SankeyResponseDataType) IsValid() bool { + for _, existing := range allowedSankeyResponseDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SankeyResponseDataType value. +func (v SankeyResponseDataType) Ptr() *SankeyResponseDataType { + return &v +} diff --git a/api/datadogV2/model_segment.go b/api/datadogV2/model_segment.go new file mode 100644 index 00000000000..7092e36189c --- /dev/null +++ b/api/datadogV2/model_segment.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// Segment +type Segment struct { + // + Data *SegmentData `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{} `json:"-"` +} + +// NewSegment instantiates a new Segment 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 NewSegment() *Segment { + this := Segment{} + return &this +} + +// NewSegmentWithDefaults instantiates a new Segment 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 NewSegmentWithDefaults() *Segment { + this := Segment{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *Segment) GetData() SegmentData { + if o == nil || o.Data == nil { + var ret SegmentData + 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 *Segment) GetDataOk() (*SegmentData, 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 *Segment) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given SegmentData and assigns it to the Data field. +func (o *Segment) SetData(v SegmentData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o Segment) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *Segment) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *SegmentData `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.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 datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_segment_array.go b/api/datadogV2/model_segment_array.go new file mode 100644 index 00000000000..b104f0c6ce4 --- /dev/null +++ b/api/datadogV2/model_segment_array.go @@ -0,0 +1,101 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SegmentArray +type SegmentArray struct { + // + Data []SegmentData `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{} `json:"-"` +} + +// NewSegmentArray instantiates a new SegmentArray 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 NewSegmentArray(data []SegmentData) *SegmentArray { + this := SegmentArray{} + this.Data = data + return &this +} + +// NewSegmentArrayWithDefaults instantiates a new SegmentArray 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 NewSegmentArrayWithDefaults() *SegmentArray { + this := SegmentArray{} + return &this +} + +// GetData returns the Data field value. +func (o *SegmentArray) GetData() []SegmentData { + if o == nil { + var ret []SegmentData + 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 *SegmentArray) GetDataOk() (*[]SegmentData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *SegmentArray) SetData(v []SegmentData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SegmentArray) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SegmentArray) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]SegmentData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.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/api/datadogV2/model_segment_data.go b/api/datadogV2/model_segment_data.go new file mode 100644 index 00000000000..a4c7511facb --- /dev/null +++ b/api/datadogV2/model_segment_data.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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SegmentData +type SegmentData struct { + // + Attributes *SegmentDataAttributes `json:"attributes,omitempty"` + // + Id *string `json:"id,omitempty"` + // + Type SegmentDataType `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{} `json:"-"` +} + +// NewSegmentData instantiates a new SegmentData 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 NewSegmentData(typeVar SegmentDataType) *SegmentData { + this := SegmentData{} + this.Type = typeVar + return &this +} + +// NewSegmentDataWithDefaults instantiates a new SegmentData 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 NewSegmentDataWithDefaults() *SegmentData { + this := SegmentData{} + var typeVar SegmentDataType = SEGMENTDATATYPE_SEGMENT + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *SegmentData) GetAttributes() SegmentDataAttributes { + if o == nil || o.Attributes == nil { + var ret SegmentDataAttributes + 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 *SegmentData) GetAttributesOk() (*SegmentDataAttributes, 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 *SegmentData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given SegmentDataAttributes and assigns it to the Attributes field. +func (o *SegmentData) SetAttributes(v SegmentDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SegmentData) 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 *SegmentData) 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 *SegmentData) 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 *SegmentData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *SegmentData) GetType() SegmentDataType { + if o == nil { + var ret SegmentDataType + 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 *SegmentData) GetTypeOk() (*SegmentDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SegmentData) SetType(v SegmentDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SegmentData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SegmentData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *SegmentDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *SegmentDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.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.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_segment_data_attributes.go b/api/datadogV2/model_segment_data_attributes.go new file mode 100644 index 00000000000..bc305b5c1b4 --- /dev/null +++ b/api/datadogV2/model_segment_data_attributes.go @@ -0,0 +1,619 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SegmentDataAttributes +type SegmentDataAttributes struct { + // + CreatedAt *time.Time `json:"created_at,omitempty"` + // + CreatedBy *SegmentDataSource `json:"created_by,omitempty"` + // + DataQuery SegmentDataAttributesDataQuery `json:"data_query"` + // + Description *string `json:"description,omitempty"` + // + DisabledAt *time.Time `json:"disabled_at,omitempty"` + // + DisabledBy *SegmentDataSource `json:"disabled_by,omitempty"` + // + MaterializationRowCount *int64 `json:"materialization_row_count,omitempty"` + // + MaterializedAt *string `json:"materialized_at,omitempty"` + // + ModifiedAt *time.Time `json:"modified_at,omitempty"` + // + ModifiedBy *SegmentDataSource `json:"modified_by,omitempty"` + // + Name string `json:"name"` + // + OrgId *int64 `json:"org_id,omitempty"` + // + Source *int64 `json:"source,omitempty"` + // + Tags []string `json:"tags,omitempty"` + // + Version *int64 `json:"version,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{} `json:"-"` +} + +// NewSegmentDataAttributes instantiates a new SegmentDataAttributes 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 NewSegmentDataAttributes(dataQuery SegmentDataAttributesDataQuery, name string) *SegmentDataAttributes { + this := SegmentDataAttributes{} + this.DataQuery = dataQuery + this.Name = name + return &this +} + +// NewSegmentDataAttributesWithDefaults instantiates a new SegmentDataAttributes 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 NewSegmentDataAttributesWithDefaults() *SegmentDataAttributes { + this := SegmentDataAttributes{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *SegmentDataAttributes) GetCreatedAt() time.Time { + if o == nil || o.CreatedAt == nil { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SegmentDataAttributes) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *SegmentDataAttributes) HasCreatedAt() bool { + return o != nil && o.CreatedAt != nil +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *SegmentDataAttributes) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. +func (o *SegmentDataAttributes) GetCreatedBy() SegmentDataSource { + if o == nil || o.CreatedBy == nil { + var ret SegmentDataSource + 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 *SegmentDataAttributes) GetCreatedByOk() (*SegmentDataSource, 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 *SegmentDataAttributes) HasCreatedBy() bool { + return o != nil && o.CreatedBy != nil +} + +// SetCreatedBy gets a reference to the given SegmentDataSource and assigns it to the CreatedBy field. +func (o *SegmentDataAttributes) SetCreatedBy(v SegmentDataSource) { + o.CreatedBy = &v +} + +// GetDataQuery returns the DataQuery field value. +func (o *SegmentDataAttributes) GetDataQuery() SegmentDataAttributesDataQuery { + if o == nil { + var ret SegmentDataAttributesDataQuery + return ret + } + return o.DataQuery +} + +// GetDataQueryOk returns a tuple with the DataQuery field value +// and a boolean to check if the value has been set. +func (o *SegmentDataAttributes) GetDataQueryOk() (*SegmentDataAttributesDataQuery, bool) { + if o == nil { + return nil, false + } + return &o.DataQuery, true +} + +// SetDataQuery sets field value. +func (o *SegmentDataAttributes) SetDataQuery(v SegmentDataAttributesDataQuery) { + o.DataQuery = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *SegmentDataAttributes) 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 *SegmentDataAttributes) 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 *SegmentDataAttributes) 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 *SegmentDataAttributes) SetDescription(v string) { + o.Description = &v +} + +// GetDisabledAt returns the DisabledAt field value if set, zero value otherwise. +func (o *SegmentDataAttributes) GetDisabledAt() time.Time { + if o == nil || o.DisabledAt == nil { + var ret time.Time + return ret + } + return *o.DisabledAt +} + +// GetDisabledAtOk returns a tuple with the DisabledAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SegmentDataAttributes) GetDisabledAtOk() (*time.Time, bool) { + if o == nil || o.DisabledAt == nil { + return nil, false + } + return o.DisabledAt, true +} + +// HasDisabledAt returns a boolean if a field has been set. +func (o *SegmentDataAttributes) HasDisabledAt() bool { + return o != nil && o.DisabledAt != nil +} + +// SetDisabledAt gets a reference to the given time.Time and assigns it to the DisabledAt field. +func (o *SegmentDataAttributes) SetDisabledAt(v time.Time) { + o.DisabledAt = &v +} + +// GetDisabledBy returns the DisabledBy field value if set, zero value otherwise. +func (o *SegmentDataAttributes) GetDisabledBy() SegmentDataSource { + if o == nil || o.DisabledBy == nil { + var ret SegmentDataSource + return ret + } + return *o.DisabledBy +} + +// GetDisabledByOk returns a tuple with the DisabledBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SegmentDataAttributes) GetDisabledByOk() (*SegmentDataSource, bool) { + if o == nil || o.DisabledBy == nil { + return nil, false + } + return o.DisabledBy, true +} + +// HasDisabledBy returns a boolean if a field has been set. +func (o *SegmentDataAttributes) HasDisabledBy() bool { + return o != nil && o.DisabledBy != nil +} + +// SetDisabledBy gets a reference to the given SegmentDataSource and assigns it to the DisabledBy field. +func (o *SegmentDataAttributes) SetDisabledBy(v SegmentDataSource) { + o.DisabledBy = &v +} + +// GetMaterializationRowCount returns the MaterializationRowCount field value if set, zero value otherwise. +func (o *SegmentDataAttributes) GetMaterializationRowCount() int64 { + if o == nil || o.MaterializationRowCount == nil { + var ret int64 + return ret + } + return *o.MaterializationRowCount +} + +// GetMaterializationRowCountOk returns a tuple with the MaterializationRowCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SegmentDataAttributes) GetMaterializationRowCountOk() (*int64, bool) { + if o == nil || o.MaterializationRowCount == nil { + return nil, false + } + return o.MaterializationRowCount, true +} + +// HasMaterializationRowCount returns a boolean if a field has been set. +func (o *SegmentDataAttributes) HasMaterializationRowCount() bool { + return o != nil && o.MaterializationRowCount != nil +} + +// SetMaterializationRowCount gets a reference to the given int64 and assigns it to the MaterializationRowCount field. +func (o *SegmentDataAttributes) SetMaterializationRowCount(v int64) { + o.MaterializationRowCount = &v +} + +// GetMaterializedAt returns the MaterializedAt field value if set, zero value otherwise. +func (o *SegmentDataAttributes) GetMaterializedAt() string { + if o == nil || o.MaterializedAt == nil { + var ret string + return ret + } + return *o.MaterializedAt +} + +// GetMaterializedAtOk returns a tuple with the MaterializedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SegmentDataAttributes) GetMaterializedAtOk() (*string, bool) { + if o == nil || o.MaterializedAt == nil { + return nil, false + } + return o.MaterializedAt, true +} + +// HasMaterializedAt returns a boolean if a field has been set. +func (o *SegmentDataAttributes) HasMaterializedAt() bool { + return o != nil && o.MaterializedAt != nil +} + +// SetMaterializedAt gets a reference to the given string and assigns it to the MaterializedAt field. +func (o *SegmentDataAttributes) SetMaterializedAt(v string) { + o.MaterializedAt = &v +} + +// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. +func (o *SegmentDataAttributes) GetModifiedAt() time.Time { + if o == nil || o.ModifiedAt == nil { + var ret time.Time + return ret + } + return *o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SegmentDataAttributes) GetModifiedAtOk() (*time.Time, bool) { + if o == nil || o.ModifiedAt == nil { + return nil, false + } + return o.ModifiedAt, true +} + +// HasModifiedAt returns a boolean if a field has been set. +func (o *SegmentDataAttributes) HasModifiedAt() bool { + return o != nil && o.ModifiedAt != nil +} + +// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. +func (o *SegmentDataAttributes) SetModifiedAt(v time.Time) { + o.ModifiedAt = &v +} + +// GetModifiedBy returns the ModifiedBy field value if set, zero value otherwise. +func (o *SegmentDataAttributes) GetModifiedBy() SegmentDataSource { + if o == nil || o.ModifiedBy == nil { + var ret SegmentDataSource + return ret + } + return *o.ModifiedBy +} + +// GetModifiedByOk returns a tuple with the ModifiedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SegmentDataAttributes) GetModifiedByOk() (*SegmentDataSource, bool) { + if o == nil || o.ModifiedBy == nil { + return nil, false + } + return o.ModifiedBy, true +} + +// HasModifiedBy returns a boolean if a field has been set. +func (o *SegmentDataAttributes) HasModifiedBy() bool { + return o != nil && o.ModifiedBy != nil +} + +// SetModifiedBy gets a reference to the given SegmentDataSource and assigns it to the ModifiedBy field. +func (o *SegmentDataAttributes) SetModifiedBy(v SegmentDataSource) { + o.ModifiedBy = &v +} + +// GetName returns the Name field value. +func (o *SegmentDataAttributes) 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 *SegmentDataAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *SegmentDataAttributes) SetName(v string) { + o.Name = v +} + +// GetOrgId returns the OrgId field value if set, zero value otherwise. +func (o *SegmentDataAttributes) GetOrgId() int64 { + if o == nil || o.OrgId == nil { + var ret int64 + return ret + } + return *o.OrgId +} + +// GetOrgIdOk returns a tuple with the OrgId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SegmentDataAttributes) GetOrgIdOk() (*int64, bool) { + if o == nil || o.OrgId == nil { + return nil, false + } + return o.OrgId, true +} + +// HasOrgId returns a boolean if a field has been set. +func (o *SegmentDataAttributes) HasOrgId() bool { + return o != nil && o.OrgId != nil +} + +// SetOrgId gets a reference to the given int64 and assigns it to the OrgId field. +func (o *SegmentDataAttributes) SetOrgId(v int64) { + o.OrgId = &v +} + +// GetSource returns the Source field value if set, zero value otherwise. +func (o *SegmentDataAttributes) GetSource() int64 { + if o == nil || o.Source == nil { + var ret int64 + return ret + } + return *o.Source +} + +// GetSourceOk returns a tuple with the Source field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SegmentDataAttributes) GetSourceOk() (*int64, bool) { + if o == nil || o.Source == nil { + return nil, false + } + return o.Source, true +} + +// HasSource returns a boolean if a field has been set. +func (o *SegmentDataAttributes) HasSource() bool { + return o != nil && o.Source != nil +} + +// SetSource gets a reference to the given int64 and assigns it to the Source field. +func (o *SegmentDataAttributes) SetSource(v int64) { + o.Source = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *SegmentDataAttributes) 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 *SegmentDataAttributes) 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 *SegmentDataAttributes) 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 *SegmentDataAttributes) SetTags(v []string) { + o.Tags = v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *SegmentDataAttributes) GetVersion() int64 { + if o == nil || o.Version == nil { + var ret int64 + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SegmentDataAttributes) GetVersionOk() (*int64, bool) { + if o == nil || o.Version == nil { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *SegmentDataAttributes) HasVersion() bool { + return o != nil && o.Version != nil +} + +// SetVersion gets a reference to the given int64 and assigns it to the Version field. +func (o *SegmentDataAttributes) SetVersion(v int64) { + o.Version = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SegmentDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CreatedAt != nil { + if o.CreatedAt.Nanosecond() == 0 { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.CreatedBy != nil { + toSerialize["created_by"] = o.CreatedBy + } + toSerialize["data_query"] = o.DataQuery + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.DisabledAt != nil { + if o.DisabledAt.Nanosecond() == 0 { + toSerialize["disabled_at"] = o.DisabledAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["disabled_at"] = o.DisabledAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.DisabledBy != nil { + toSerialize["disabled_by"] = o.DisabledBy + } + if o.MaterializationRowCount != nil { + toSerialize["materialization_row_count"] = o.MaterializationRowCount + } + if o.MaterializedAt != nil { + toSerialize["materialized_at"] = o.MaterializedAt + } + if o.ModifiedAt != nil { + if o.ModifiedAt.Nanosecond() == 0 { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.ModifiedBy != nil { + toSerialize["modified_by"] = o.ModifiedBy + } + toSerialize["name"] = o.Name + if o.OrgId != nil { + toSerialize["org_id"] = o.OrgId + } + if o.Source != nil { + toSerialize["source"] = o.Source + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Version != nil { + toSerialize["version"] = o.Version + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SegmentDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CreatedAt *time.Time `json:"created_at,omitempty"` + CreatedBy *SegmentDataSource `json:"created_by,omitempty"` + DataQuery *SegmentDataAttributesDataQuery `json:"data_query"` + Description *string `json:"description,omitempty"` + DisabledAt *time.Time `json:"disabled_at,omitempty"` + DisabledBy *SegmentDataSource `json:"disabled_by,omitempty"` + MaterializationRowCount *int64 `json:"materialization_row_count,omitempty"` + MaterializedAt *string `json:"materialized_at,omitempty"` + ModifiedAt *time.Time `json:"modified_at,omitempty"` + ModifiedBy *SegmentDataSource `json:"modified_by,omitempty"` + Name *string `json:"name"` + OrgId *int64 `json:"org_id,omitempty"` + Source *int64 `json:"source,omitempty"` + Tags []string `json:"tags,omitempty"` + Version *int64 `json:"version,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.DataQuery == nil { + return fmt.Errorf("required field data_query missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "created_by", "data_query", "description", "disabled_at", "disabled_by", "materialization_row_count", "materialized_at", "modified_at", "modified_by", "name", "org_id", "source", "tags", "version"}) + } else { + return err + } + + hasInvalidField := false + o.CreatedAt = all.CreatedAt + if all.CreatedBy != nil && all.CreatedBy.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.CreatedBy = all.CreatedBy + if all.DataQuery.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.DataQuery = *all.DataQuery + o.Description = all.Description + o.DisabledAt = all.DisabledAt + if all.DisabledBy != nil && all.DisabledBy.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.DisabledBy = all.DisabledBy + o.MaterializationRowCount = all.MaterializationRowCount + o.MaterializedAt = all.MaterializedAt + o.ModifiedAt = all.ModifiedAt + if all.ModifiedBy != nil && all.ModifiedBy.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ModifiedBy = all.ModifiedBy + o.Name = *all.Name + o.OrgId = all.OrgId + o.Source = all.Source + o.Tags = all.Tags + o.Version = all.Version + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_segment_data_attributes_data_query.go b/api/datadogV2/model_segment_data_attributes_data_query.go new file mode 100644 index 00000000000..dfe02feb7f3 --- /dev/null +++ b/api/datadogV2/model_segment_data_attributes_data_query.go @@ -0,0 +1,242 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SegmentDataAttributesDataQuery +type SegmentDataAttributesDataQuery struct { + // + Combination *string `json:"combination,omitempty"` + // + EventPlatform []SegmentDataAttributesDataQueryEventPlatformItems `json:"event_platform,omitempty"` + // + ReferenceTable []SegmentDataAttributesDataQueryReferenceTableItems `json:"reference_table,omitempty"` + // + Static []SegmentDataAttributesDataQueryStaticItems `json:"static,omitempty"` + // + UserStore []SegmentDataAttributesDataQueryUserStoreItems `json:"user_store,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{} `json:"-"` +} + +// NewSegmentDataAttributesDataQuery instantiates a new SegmentDataAttributesDataQuery 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 NewSegmentDataAttributesDataQuery() *SegmentDataAttributesDataQuery { + this := SegmentDataAttributesDataQuery{} + return &this +} + +// NewSegmentDataAttributesDataQueryWithDefaults instantiates a new SegmentDataAttributesDataQuery 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 NewSegmentDataAttributesDataQueryWithDefaults() *SegmentDataAttributesDataQuery { + this := SegmentDataAttributesDataQuery{} + return &this +} + +// GetCombination returns the Combination field value if set, zero value otherwise. +func (o *SegmentDataAttributesDataQuery) GetCombination() string { + if o == nil || o.Combination == nil { + var ret string + return ret + } + return *o.Combination +} + +// GetCombinationOk returns a tuple with the Combination field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SegmentDataAttributesDataQuery) GetCombinationOk() (*string, bool) { + if o == nil || o.Combination == nil { + return nil, false + } + return o.Combination, true +} + +// HasCombination returns a boolean if a field has been set. +func (o *SegmentDataAttributesDataQuery) HasCombination() bool { + return o != nil && o.Combination != nil +} + +// SetCombination gets a reference to the given string and assigns it to the Combination field. +func (o *SegmentDataAttributesDataQuery) SetCombination(v string) { + o.Combination = &v +} + +// GetEventPlatform returns the EventPlatform field value if set, zero value otherwise. +func (o *SegmentDataAttributesDataQuery) GetEventPlatform() []SegmentDataAttributesDataQueryEventPlatformItems { + if o == nil || o.EventPlatform == nil { + var ret []SegmentDataAttributesDataQueryEventPlatformItems + return ret + } + return o.EventPlatform +} + +// GetEventPlatformOk returns a tuple with the EventPlatform field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SegmentDataAttributesDataQuery) GetEventPlatformOk() (*[]SegmentDataAttributesDataQueryEventPlatformItems, bool) { + if o == nil || o.EventPlatform == nil { + return nil, false + } + return &o.EventPlatform, true +} + +// HasEventPlatform returns a boolean if a field has been set. +func (o *SegmentDataAttributesDataQuery) HasEventPlatform() bool { + return o != nil && o.EventPlatform != nil +} + +// SetEventPlatform gets a reference to the given []SegmentDataAttributesDataQueryEventPlatformItems and assigns it to the EventPlatform field. +func (o *SegmentDataAttributesDataQuery) SetEventPlatform(v []SegmentDataAttributesDataQueryEventPlatformItems) { + o.EventPlatform = v +} + +// GetReferenceTable returns the ReferenceTable field value if set, zero value otherwise. +func (o *SegmentDataAttributesDataQuery) GetReferenceTable() []SegmentDataAttributesDataQueryReferenceTableItems { + if o == nil || o.ReferenceTable == nil { + var ret []SegmentDataAttributesDataQueryReferenceTableItems + return ret + } + return o.ReferenceTable +} + +// GetReferenceTableOk returns a tuple with the ReferenceTable field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SegmentDataAttributesDataQuery) GetReferenceTableOk() (*[]SegmentDataAttributesDataQueryReferenceTableItems, bool) { + if o == nil || o.ReferenceTable == nil { + return nil, false + } + return &o.ReferenceTable, true +} + +// HasReferenceTable returns a boolean if a field has been set. +func (o *SegmentDataAttributesDataQuery) HasReferenceTable() bool { + return o != nil && o.ReferenceTable != nil +} + +// SetReferenceTable gets a reference to the given []SegmentDataAttributesDataQueryReferenceTableItems and assigns it to the ReferenceTable field. +func (o *SegmentDataAttributesDataQuery) SetReferenceTable(v []SegmentDataAttributesDataQueryReferenceTableItems) { + o.ReferenceTable = v +} + +// GetStatic returns the Static field value if set, zero value otherwise. +func (o *SegmentDataAttributesDataQuery) GetStatic() []SegmentDataAttributesDataQueryStaticItems { + if o == nil || o.Static == nil { + var ret []SegmentDataAttributesDataQueryStaticItems + return ret + } + return o.Static +} + +// GetStaticOk returns a tuple with the Static field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SegmentDataAttributesDataQuery) GetStaticOk() (*[]SegmentDataAttributesDataQueryStaticItems, bool) { + if o == nil || o.Static == nil { + return nil, false + } + return &o.Static, true +} + +// HasStatic returns a boolean if a field has been set. +func (o *SegmentDataAttributesDataQuery) HasStatic() bool { + return o != nil && o.Static != nil +} + +// SetStatic gets a reference to the given []SegmentDataAttributesDataQueryStaticItems and assigns it to the Static field. +func (o *SegmentDataAttributesDataQuery) SetStatic(v []SegmentDataAttributesDataQueryStaticItems) { + o.Static = v +} + +// GetUserStore returns the UserStore field value if set, zero value otherwise. +func (o *SegmentDataAttributesDataQuery) GetUserStore() []SegmentDataAttributesDataQueryUserStoreItems { + if o == nil || o.UserStore == nil { + var ret []SegmentDataAttributesDataQueryUserStoreItems + return ret + } + return o.UserStore +} + +// GetUserStoreOk returns a tuple with the UserStore field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SegmentDataAttributesDataQuery) GetUserStoreOk() (*[]SegmentDataAttributesDataQueryUserStoreItems, bool) { + if o == nil || o.UserStore == nil { + return nil, false + } + return &o.UserStore, true +} + +// HasUserStore returns a boolean if a field has been set. +func (o *SegmentDataAttributesDataQuery) HasUserStore() bool { + return o != nil && o.UserStore != nil +} + +// SetUserStore gets a reference to the given []SegmentDataAttributesDataQueryUserStoreItems and assigns it to the UserStore field. +func (o *SegmentDataAttributesDataQuery) SetUserStore(v []SegmentDataAttributesDataQueryUserStoreItems) { + o.UserStore = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SegmentDataAttributesDataQuery) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Combination != nil { + toSerialize["combination"] = o.Combination + } + if o.EventPlatform != nil { + toSerialize["event_platform"] = o.EventPlatform + } + if o.ReferenceTable != nil { + toSerialize["reference_table"] = o.ReferenceTable + } + if o.Static != nil { + toSerialize["static"] = o.Static + } + if o.UserStore != nil { + toSerialize["user_store"] = o.UserStore + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SegmentDataAttributesDataQuery) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Combination *string `json:"combination,omitempty"` + EventPlatform []SegmentDataAttributesDataQueryEventPlatformItems `json:"event_platform,omitempty"` + ReferenceTable []SegmentDataAttributesDataQueryReferenceTableItems `json:"reference_table,omitempty"` + Static []SegmentDataAttributesDataQueryStaticItems `json:"static,omitempty"` + UserStore []SegmentDataAttributesDataQueryUserStoreItems `json:"user_store,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"combination", "event_platform", "reference_table", "static", "user_store"}) + } else { + return err + } + o.Combination = all.Combination + o.EventPlatform = all.EventPlatform + o.ReferenceTable = all.ReferenceTable + o.Static = all.Static + o.UserStore = all.UserStore + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_segment_data_attributes_data_query_event_platform_items.go b/api/datadogV2/model_segment_data_attributes_data_query_event_platform_items.go new file mode 100644 index 00000000000..430a6cddfab --- /dev/null +++ b/api/datadogV2/model_segment_data_attributes_data_query_event_platform_items.go @@ -0,0 +1,241 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SegmentDataAttributesDataQueryEventPlatformItems +type SegmentDataAttributesDataQueryEventPlatformItems struct { + // + Facet string `json:"facet"` + // + From *string `json:"from,omitempty"` + // + Name *string `json:"name,omitempty"` + // + Query *string `json:"query,omitempty"` + // + 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{} `json:"-"` +} + +// NewSegmentDataAttributesDataQueryEventPlatformItems instantiates a new SegmentDataAttributesDataQueryEventPlatformItems 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 NewSegmentDataAttributesDataQueryEventPlatformItems(facet string) *SegmentDataAttributesDataQueryEventPlatformItems { + this := SegmentDataAttributesDataQueryEventPlatformItems{} + this.Facet = facet + return &this +} + +// NewSegmentDataAttributesDataQueryEventPlatformItemsWithDefaults instantiates a new SegmentDataAttributesDataQueryEventPlatformItems 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 NewSegmentDataAttributesDataQueryEventPlatformItemsWithDefaults() *SegmentDataAttributesDataQueryEventPlatformItems { + this := SegmentDataAttributesDataQueryEventPlatformItems{} + return &this +} + +// GetFacet returns the Facet field value. +func (o *SegmentDataAttributesDataQueryEventPlatformItems) 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 *SegmentDataAttributesDataQueryEventPlatformItems) GetFacetOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Facet, true +} + +// SetFacet sets field value. +func (o *SegmentDataAttributesDataQueryEventPlatformItems) SetFacet(v string) { + o.Facet = v +} + +// GetFrom returns the From field value if set, zero value otherwise. +func (o *SegmentDataAttributesDataQueryEventPlatformItems) 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 *SegmentDataAttributesDataQueryEventPlatformItems) 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 *SegmentDataAttributesDataQueryEventPlatformItems) 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 *SegmentDataAttributesDataQueryEventPlatformItems) SetFrom(v string) { + o.From = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SegmentDataAttributesDataQueryEventPlatformItems) 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 *SegmentDataAttributesDataQueryEventPlatformItems) 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 *SegmentDataAttributesDataQueryEventPlatformItems) 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 *SegmentDataAttributesDataQueryEventPlatformItems) SetName(v string) { + o.Name = &v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *SegmentDataAttributesDataQueryEventPlatformItems) 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 *SegmentDataAttributesDataQueryEventPlatformItems) 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 *SegmentDataAttributesDataQueryEventPlatformItems) 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 *SegmentDataAttributesDataQueryEventPlatformItems) SetQuery(v string) { + o.Query = &v +} + +// GetTo returns the To field value if set, zero value otherwise. +func (o *SegmentDataAttributesDataQueryEventPlatformItems) 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 *SegmentDataAttributesDataQueryEventPlatformItems) 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 *SegmentDataAttributesDataQueryEventPlatformItems) 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 *SegmentDataAttributesDataQueryEventPlatformItems) SetTo(v string) { + o.To = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SegmentDataAttributesDataQueryEventPlatformItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["facet"] = o.Facet + if o.From != nil { + toSerialize["from"] = o.From + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + 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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SegmentDataAttributesDataQueryEventPlatformItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Facet *string `json:"facet"` + From *string `json:"from,omitempty"` + Name *string `json:"name,omitempty"` + Query *string `json:"query,omitempty"` + To *string `json:"to,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Facet == nil { + return fmt.Errorf("required field facet missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"facet", "from", "name", "query", "to"}) + } else { + return err + } + o.Facet = *all.Facet + o.From = all.From + o.Name = all.Name + o.Query = all.Query + o.To = all.To + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_segment_data_attributes_data_query_reference_table_items.go b/api/datadogV2/model_segment_data_attributes_data_query_reference_table_items.go new file mode 100644 index 00000000000..b5189863aeb --- /dev/null +++ b/api/datadogV2/model_segment_data_attributes_data_query_reference_table_items.go @@ -0,0 +1,247 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SegmentDataAttributesDataQueryReferenceTableItems +type SegmentDataAttributesDataQueryReferenceTableItems struct { + // + Columns []SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems `json:"columns,omitempty"` + // + FilterQuery *string `json:"filter_query,omitempty"` + // + JoinCondition SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition `json:"join_condition"` + // + Name *string `json:"name,omitempty"` + // + TableName string `json:"table_name"` + // 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{} `json:"-"` +} + +// NewSegmentDataAttributesDataQueryReferenceTableItems instantiates a new SegmentDataAttributesDataQueryReferenceTableItems 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 NewSegmentDataAttributesDataQueryReferenceTableItems(joinCondition SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition, tableName string) *SegmentDataAttributesDataQueryReferenceTableItems { + this := SegmentDataAttributesDataQueryReferenceTableItems{} + this.JoinCondition = joinCondition + this.TableName = tableName + return &this +} + +// NewSegmentDataAttributesDataQueryReferenceTableItemsWithDefaults instantiates a new SegmentDataAttributesDataQueryReferenceTableItems 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 NewSegmentDataAttributesDataQueryReferenceTableItemsWithDefaults() *SegmentDataAttributesDataQueryReferenceTableItems { + this := SegmentDataAttributesDataQueryReferenceTableItems{} + return &this +} + +// GetColumns returns the Columns field value if set, zero value otherwise. +func (o *SegmentDataAttributesDataQueryReferenceTableItems) GetColumns() []SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems { + if o == nil || o.Columns == nil { + var ret []SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems + 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 *SegmentDataAttributesDataQueryReferenceTableItems) GetColumnsOk() (*[]SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems, 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 *SegmentDataAttributesDataQueryReferenceTableItems) HasColumns() bool { + return o != nil && o.Columns != nil +} + +// SetColumns gets a reference to the given []SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems and assigns it to the Columns field. +func (o *SegmentDataAttributesDataQueryReferenceTableItems) SetColumns(v []SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems) { + o.Columns = v +} + +// GetFilterQuery returns the FilterQuery field value if set, zero value otherwise. +func (o *SegmentDataAttributesDataQueryReferenceTableItems) GetFilterQuery() string { + if o == nil || o.FilterQuery == nil { + var ret string + return ret + } + return *o.FilterQuery +} + +// GetFilterQueryOk returns a tuple with the FilterQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SegmentDataAttributesDataQueryReferenceTableItems) GetFilterQueryOk() (*string, bool) { + if o == nil || o.FilterQuery == nil { + return nil, false + } + return o.FilterQuery, true +} + +// HasFilterQuery returns a boolean if a field has been set. +func (o *SegmentDataAttributesDataQueryReferenceTableItems) HasFilterQuery() bool { + return o != nil && o.FilterQuery != nil +} + +// SetFilterQuery gets a reference to the given string and assigns it to the FilterQuery field. +func (o *SegmentDataAttributesDataQueryReferenceTableItems) SetFilterQuery(v string) { + o.FilterQuery = &v +} + +// GetJoinCondition returns the JoinCondition field value. +func (o *SegmentDataAttributesDataQueryReferenceTableItems) GetJoinCondition() SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition { + if o == nil { + var ret SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition + return ret + } + return o.JoinCondition +} + +// GetJoinConditionOk returns a tuple with the JoinCondition field value +// and a boolean to check if the value has been set. +func (o *SegmentDataAttributesDataQueryReferenceTableItems) GetJoinConditionOk() (*SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition, bool) { + if o == nil { + return nil, false + } + return &o.JoinCondition, true +} + +// SetJoinCondition sets field value. +func (o *SegmentDataAttributesDataQueryReferenceTableItems) SetJoinCondition(v SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition) { + o.JoinCondition = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SegmentDataAttributesDataQueryReferenceTableItems) 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 *SegmentDataAttributesDataQueryReferenceTableItems) 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 *SegmentDataAttributesDataQueryReferenceTableItems) 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 *SegmentDataAttributesDataQueryReferenceTableItems) SetName(v string) { + o.Name = &v +} + +// GetTableName returns the TableName field value. +func (o *SegmentDataAttributesDataQueryReferenceTableItems) GetTableName() string { + if o == nil { + var ret string + return ret + } + return o.TableName +} + +// GetTableNameOk returns a tuple with the TableName field value +// and a boolean to check if the value has been set. +func (o *SegmentDataAttributesDataQueryReferenceTableItems) GetTableNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TableName, true +} + +// SetTableName sets field value. +func (o *SegmentDataAttributesDataQueryReferenceTableItems) SetTableName(v string) { + o.TableName = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SegmentDataAttributesDataQueryReferenceTableItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Columns != nil { + toSerialize["columns"] = o.Columns + } + if o.FilterQuery != nil { + toSerialize["filter_query"] = o.FilterQuery + } + toSerialize["join_condition"] = o.JoinCondition + if o.Name != nil { + toSerialize["name"] = o.Name + } + toSerialize["table_name"] = o.TableName + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SegmentDataAttributesDataQueryReferenceTableItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Columns []SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems `json:"columns,omitempty"` + FilterQuery *string `json:"filter_query,omitempty"` + JoinCondition *SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition `json:"join_condition"` + Name *string `json:"name,omitempty"` + TableName *string `json:"table_name"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.JoinCondition == nil { + return fmt.Errorf("required field join_condition missing") + } + if all.TableName == nil { + return fmt.Errorf("required field table_name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"columns", "filter_query", "join_condition", "name", "table_name"}) + } else { + return err + } + + hasInvalidField := false + o.Columns = all.Columns + o.FilterQuery = all.FilterQuery + if all.JoinCondition.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.JoinCondition = *all.JoinCondition + o.Name = all.Name + o.TableName = *all.TableName + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_segment_data_attributes_data_query_reference_table_items_columns_items.go b/api/datadogV2/model_segment_data_attributes_data_query_reference_table_items_columns_items.go new file mode 100644 index 00000000000..1aa0406fb46 --- /dev/null +++ b/api/datadogV2/model_segment_data_attributes_data_query_reference_table_items_columns_items.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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems +type SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems struct { + // + Alias *string `json:"alias,omitempty"` + // + 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{} `json:"-"` +} + +// NewSegmentDataAttributesDataQueryReferenceTableItemsColumnsItems instantiates a new SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems 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 NewSegmentDataAttributesDataQueryReferenceTableItemsColumnsItems() *SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems { + this := SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems{} + return &this +} + +// NewSegmentDataAttributesDataQueryReferenceTableItemsColumnsItemsWithDefaults instantiates a new SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems 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 NewSegmentDataAttributesDataQueryReferenceTableItemsColumnsItemsWithDefaults() *SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems { + this := SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems{} + return &this +} + +// GetAlias returns the Alias field value if set, zero value otherwise. +func (o *SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems) GetAlias() string { + if o == nil || o.Alias == nil { + var ret string + return ret + } + return *o.Alias +} + +// GetAliasOk returns a tuple with the Alias field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems) GetAliasOk() (*string, bool) { + if o == nil || o.Alias == nil { + return nil, false + } + return o.Alias, true +} + +// HasAlias returns a boolean if a field has been set. +func (o *SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems) HasAlias() bool { + return o != nil && o.Alias != nil +} + +// SetAlias gets a reference to the given string and assigns it to the Alias field. +func (o *SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems) SetAlias(v string) { + o.Alias = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems) 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 *SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems) 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 *SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems) 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 *SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Alias != nil { + toSerialize["alias"] = o.Alias + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Alias *string `json:"alias,omitempty"` + Name *string `json:"name,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"alias", "name"}) + } else { + return err + } + o.Alias = all.Alias + o.Name = all.Name + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_segment_data_attributes_data_query_reference_table_items_join_condition.go b/api/datadogV2/model_segment_data_attributes_data_query_reference_table_items_join_condition.go new file mode 100644 index 00000000000..016bff53f49 --- /dev/null +++ b/api/datadogV2/model_segment_data_attributes_data_query_reference_table_items_join_condition.go @@ -0,0 +1,136 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition +type SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition struct { + // + ColumnName string `json:"column_name"` + // + Facet *string `json:"facet,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{} `json:"-"` +} + +// NewSegmentDataAttributesDataQueryReferenceTableItemsJoinCondition instantiates a new SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition 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 NewSegmentDataAttributesDataQueryReferenceTableItemsJoinCondition(columnName string) *SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition { + this := SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition{} + this.ColumnName = columnName + return &this +} + +// NewSegmentDataAttributesDataQueryReferenceTableItemsJoinConditionWithDefaults instantiates a new SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition 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 NewSegmentDataAttributesDataQueryReferenceTableItemsJoinConditionWithDefaults() *SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition { + this := SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition{} + return &this +} + +// GetColumnName returns the ColumnName field value. +func (o *SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition) GetColumnName() string { + if o == nil { + var ret string + return ret + } + return o.ColumnName +} + +// GetColumnNameOk returns a tuple with the ColumnName field value +// and a boolean to check if the value has been set. +func (o *SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition) GetColumnNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ColumnName, true +} + +// SetColumnName sets field value. +func (o *SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition) SetColumnName(v string) { + o.ColumnName = v +} + +// GetFacet returns the Facet field value if set, zero value otherwise. +func (o *SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition) GetFacet() string { + if o == nil || o.Facet == nil { + var ret string + return ret + } + return *o.Facet +} + +// GetFacetOk returns a tuple with the Facet field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition) GetFacetOk() (*string, bool) { + if o == nil || o.Facet == nil { + return nil, false + } + return o.Facet, true +} + +// HasFacet returns a boolean if a field has been set. +func (o *SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition) HasFacet() bool { + return o != nil && o.Facet != nil +} + +// SetFacet gets a reference to the given string and assigns it to the Facet field. +func (o *SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition) SetFacet(v string) { + o.Facet = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["column_name"] = o.ColumnName + if o.Facet != nil { + toSerialize["facet"] = o.Facet + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ColumnName *string `json:"column_name"` + Facet *string `json:"facet,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.ColumnName == nil { + return fmt.Errorf("required field column_name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"column_name", "facet"}) + } else { + return err + } + o.ColumnName = *all.ColumnName + o.Facet = all.Facet + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_segment_data_attributes_data_query_static_items.go b/api/datadogV2/model_segment_data_attributes_data_query_static_items.go new file mode 100644 index 00000000000..845491ccffd --- /dev/null +++ b/api/datadogV2/model_segment_data_attributes_data_query_static_items.go @@ -0,0 +1,172 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SegmentDataAttributesDataQueryStaticItems +type SegmentDataAttributesDataQueryStaticItems struct { + // + Id *string `json:"id,omitempty"` + // + Name *string `json:"name,omitempty"` + // + UserCount *int64 `json:"user_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{} `json:"-"` +} + +// NewSegmentDataAttributesDataQueryStaticItems instantiates a new SegmentDataAttributesDataQueryStaticItems 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 NewSegmentDataAttributesDataQueryStaticItems() *SegmentDataAttributesDataQueryStaticItems { + this := SegmentDataAttributesDataQueryStaticItems{} + return &this +} + +// NewSegmentDataAttributesDataQueryStaticItemsWithDefaults instantiates a new SegmentDataAttributesDataQueryStaticItems 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 NewSegmentDataAttributesDataQueryStaticItemsWithDefaults() *SegmentDataAttributesDataQueryStaticItems { + this := SegmentDataAttributesDataQueryStaticItems{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SegmentDataAttributesDataQueryStaticItems) 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 *SegmentDataAttributesDataQueryStaticItems) 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 *SegmentDataAttributesDataQueryStaticItems) 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 *SegmentDataAttributesDataQueryStaticItems) SetId(v string) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SegmentDataAttributesDataQueryStaticItems) 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 *SegmentDataAttributesDataQueryStaticItems) 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 *SegmentDataAttributesDataQueryStaticItems) 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 *SegmentDataAttributesDataQueryStaticItems) SetName(v string) { + o.Name = &v +} + +// GetUserCount returns the UserCount field value if set, zero value otherwise. +func (o *SegmentDataAttributesDataQueryStaticItems) GetUserCount() int64 { + if o == nil || o.UserCount == nil { + var ret int64 + return ret + } + return *o.UserCount +} + +// GetUserCountOk returns a tuple with the UserCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SegmentDataAttributesDataQueryStaticItems) GetUserCountOk() (*int64, bool) { + if o == nil || o.UserCount == nil { + return nil, false + } + return o.UserCount, true +} + +// HasUserCount returns a boolean if a field has been set. +func (o *SegmentDataAttributesDataQueryStaticItems) HasUserCount() bool { + return o != nil && o.UserCount != nil +} + +// SetUserCount gets a reference to the given int64 and assigns it to the UserCount field. +func (o *SegmentDataAttributesDataQueryStaticItems) SetUserCount(v int64) { + o.UserCount = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SegmentDataAttributesDataQueryStaticItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.UserCount != nil { + toSerialize["user_count"] = o.UserCount + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SegmentDataAttributesDataQueryStaticItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + UserCount *int64 `json:"user_count,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"id", "name", "user_count"}) + } else { + return err + } + o.Id = all.Id + o.Name = all.Name + o.UserCount = all.UserCount + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_segment_data_attributes_data_query_user_store_items.go b/api/datadogV2/model_segment_data_attributes_data_query_user_store_items.go new file mode 100644 index 00000000000..e307d0ae912 --- /dev/null +++ b/api/datadogV2/model_segment_data_attributes_data_query_user_store_items.go @@ -0,0 +1,172 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SegmentDataAttributesDataQueryUserStoreItems +type SegmentDataAttributesDataQueryUserStoreItems struct { + // + Facet *string `json:"facet,omitempty"` + // + Name *string `json:"name,omitempty"` + // + 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{} `json:"-"` +} + +// NewSegmentDataAttributesDataQueryUserStoreItems instantiates a new SegmentDataAttributesDataQueryUserStoreItems 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 NewSegmentDataAttributesDataQueryUserStoreItems() *SegmentDataAttributesDataQueryUserStoreItems { + this := SegmentDataAttributesDataQueryUserStoreItems{} + return &this +} + +// NewSegmentDataAttributesDataQueryUserStoreItemsWithDefaults instantiates a new SegmentDataAttributesDataQueryUserStoreItems 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 NewSegmentDataAttributesDataQueryUserStoreItemsWithDefaults() *SegmentDataAttributesDataQueryUserStoreItems { + this := SegmentDataAttributesDataQueryUserStoreItems{} + return &this +} + +// GetFacet returns the Facet field value if set, zero value otherwise. +func (o *SegmentDataAttributesDataQueryUserStoreItems) GetFacet() string { + if o == nil || o.Facet == nil { + var ret string + return ret + } + return *o.Facet +} + +// GetFacetOk returns a tuple with the Facet field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SegmentDataAttributesDataQueryUserStoreItems) GetFacetOk() (*string, bool) { + if o == nil || o.Facet == nil { + return nil, false + } + return o.Facet, true +} + +// HasFacet returns a boolean if a field has been set. +func (o *SegmentDataAttributesDataQueryUserStoreItems) HasFacet() bool { + return o != nil && o.Facet != nil +} + +// SetFacet gets a reference to the given string and assigns it to the Facet field. +func (o *SegmentDataAttributesDataQueryUserStoreItems) SetFacet(v string) { + o.Facet = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SegmentDataAttributesDataQueryUserStoreItems) 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 *SegmentDataAttributesDataQueryUserStoreItems) 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 *SegmentDataAttributesDataQueryUserStoreItems) 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 *SegmentDataAttributesDataQueryUserStoreItems) SetName(v string) { + o.Name = &v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *SegmentDataAttributesDataQueryUserStoreItems) 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 *SegmentDataAttributesDataQueryUserStoreItems) 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 *SegmentDataAttributesDataQueryUserStoreItems) 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 *SegmentDataAttributesDataQueryUserStoreItems) SetQuery(v string) { + o.Query = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SegmentDataAttributesDataQueryUserStoreItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Facet != nil { + toSerialize["facet"] = o.Facet + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SegmentDataAttributesDataQueryUserStoreItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Facet *string `json:"facet,omitempty"` + Name *string `json:"name,omitempty"` + Query *string `json:"query,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"facet", "name", "query"}) + } else { + return err + } + o.Facet = all.Facet + o.Name = all.Name + o.Query = all.Query + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_segment_data_source.go b/api/datadogV2/model_segment_data_source.go new file mode 100644 index 00000000000..e8a61749909 --- /dev/null +++ b/api/datadogV2/model_segment_data_source.go @@ -0,0 +1,235 @@ +// Unless explicitly stated otherwise all files in this repository 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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SegmentDataSource +type SegmentDataSource struct { + // + Handle string `json:"handle"` + // + Icon *string `json:"icon,omitempty"` + // + Id string `json:"id"` + // + Name *string `json:"name,omitempty"` + // + Uuid string `json:"uuid"` + // 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{} `json:"-"` +} + +// NewSegmentDataSource instantiates a new SegmentDataSource 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 NewSegmentDataSource(handle string, id string, uuid string) *SegmentDataSource { + this := SegmentDataSource{} + this.Handle = handle + this.Id = id + this.Uuid = uuid + return &this +} + +// NewSegmentDataSourceWithDefaults instantiates a new SegmentDataSource 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 NewSegmentDataSourceWithDefaults() *SegmentDataSource { + this := SegmentDataSource{} + return &this +} + +// GetHandle returns the Handle field value. +func (o *SegmentDataSource) GetHandle() string { + if o == nil { + var ret string + return ret + } + return o.Handle +} + +// GetHandleOk returns a tuple with the Handle field value +// and a boolean to check if the value has been set. +func (o *SegmentDataSource) GetHandleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Handle, true +} + +// SetHandle sets field value. +func (o *SegmentDataSource) SetHandle(v string) { + o.Handle = v +} + +// GetIcon returns the Icon field value if set, zero value otherwise. +func (o *SegmentDataSource) 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 *SegmentDataSource) 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 *SegmentDataSource) 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 *SegmentDataSource) SetIcon(v string) { + o.Icon = &v +} + +// GetId returns the Id field value. +func (o *SegmentDataSource) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *SegmentDataSource) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *SegmentDataSource) SetId(v string) { + o.Id = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SegmentDataSource) 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 *SegmentDataSource) 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 *SegmentDataSource) 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 *SegmentDataSource) SetName(v string) { + o.Name = &v +} + +// GetUuid returns the Uuid field value. +func (o *SegmentDataSource) GetUuid() string { + if o == nil { + var ret string + return ret + } + return o.Uuid +} + +// GetUuidOk returns a tuple with the Uuid field value +// and a boolean to check if the value has been set. +func (o *SegmentDataSource) GetUuidOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Uuid, true +} + +// SetUuid sets field value. +func (o *SegmentDataSource) SetUuid(v string) { + o.Uuid = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SegmentDataSource) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["handle"] = o.Handle + if o.Icon != nil { + toSerialize["icon"] = o.Icon + } + toSerialize["id"] = o.Id + if o.Name != nil { + toSerialize["name"] = o.Name + } + toSerialize["uuid"] = o.Uuid + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SegmentDataSource) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Handle *string `json:"handle"` + Icon *string `json:"icon,omitempty"` + Id *string `json:"id"` + Name *string `json:"name,omitempty"` + Uuid *string `json:"uuid"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Handle == nil { + return fmt.Errorf("required field handle missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Uuid == nil { + return fmt.Errorf("required field uuid missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + 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 + } + + return nil +} diff --git a/api/datadogV2/model_segment_data_type.go b/api/datadogV2/model_segment_data_type.go new file mode 100644 index 00000000000..b6c200067da --- /dev/null +++ b/api/datadogV2/model_segment_data_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/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SegmentDataType +type SegmentDataType string + +// List of SegmentDataType. +const ( + SEGMENTDATATYPE_SEGMENT SegmentDataType = "segment" +) + +var allowedSegmentDataTypeEnumValues = []SegmentDataType{ + SEGMENTDATATYPE_SEGMENT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SegmentDataType) GetAllowedValues() []SegmentDataType { + return allowedSegmentDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SegmentDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SegmentDataType(value) + return nil +} + +// NewSegmentDataTypeFromValue returns a pointer to a valid SegmentDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSegmentDataTypeFromValue(v string) (*SegmentDataType, error) { + ev := SegmentDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SegmentDataType: valid values are %v", v, allowedSegmentDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SegmentDataType) IsValid() bool { + for _, existing := range allowedSegmentDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SegmentDataType value. +func (v SegmentDataType) Ptr() *SegmentDataType { + return &v +} diff --git a/examples/v2/cohort/GetRumCohort.go b/examples/v2/cohort/GetRumCohort.go new file mode 100644 index 00000000000..fd469454155 --- /dev/null +++ b/examples/v2/cohort/GetRumCohort.go @@ -0,0 +1,58 @@ +// Get rum cohort returns "Successful response with cohort analysis data" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.GetCohortRequest{ + Data: &datadogV2.GetCohortRequestData{ + Attributes: &datadogV2.GetCohortRequestDataAttributes{ + Definition: &datadogV2.GetCohortRequestDataAttributesDefinition{ + AudienceFilters: &datadogV2.GetCohortRequestDataAttributesDefinitionAudienceFilters{ + Accounts: []datadogV2.GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems{ + { + Name: "", + }, + }, + Segments: []datadogV2.GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems{ + { + Name: "", + SegmentId: "", + }, + }, + Users: []datadogV2.GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems{ + { + Name: "", + }, + }, + }, + }, + Time: &datadogV2.GetCohortRequestDataAttributesTime{}, + }, + Type: datadogV2.GETCOHORTREQUESTDATATYPE_COHORT_REQUEST, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.GetRumCohort", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewCohortApi(apiClient) + resp, r, err := api.GetRumCohort(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CohortApi.GetRumCohort`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `CohortApi.GetRumCohort`:\n%s\n", responseContent) +} diff --git a/examples/v2/cohort/GetRumCohortUsers.go b/examples/v2/cohort/GetRumCohortUsers.go new file mode 100644 index 00000000000..68d1163bbb3 --- /dev/null +++ b/examples/v2/cohort/GetRumCohortUsers.go @@ -0,0 +1,58 @@ +// Get rum cohort users returns "Successful response with cohort users" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.GetCohortUsersRequest{ + Data: &datadogV2.GetCohortUsersRequestData{ + Attributes: &datadogV2.GetCohortUsersRequestDataAttributes{ + Definition: &datadogV2.GetCohortUsersRequestDataAttributesDefinition{ + AudienceFilters: &datadogV2.GetCohortUsersRequestDataAttributesDefinitionAudienceFilters{ + Accounts: []datadogV2.GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems{ + { + Name: "", + }, + }, + Segments: []datadogV2.GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems{ + { + Name: "", + SegmentId: "", + }, + }, + Users: []datadogV2.GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems{ + { + Name: "", + }, + }, + }, + }, + Time: &datadogV2.GetCohortUsersRequestDataAttributesTime{}, + }, + Type: datadogV2.GETCOHORTUSERSREQUESTDATATYPE_COHORT_USERS_REQUEST, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.GetRumCohortUsers", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewCohortApi(apiClient) + resp, r, err := api.GetRumCohortUsers(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CohortApi.GetRumCohortUsers`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `CohortApi.GetRumCohortUsers`:\n%s\n", responseContent) +} diff --git a/examples/v2/funnel/GetRumFunnel.go b/examples/v2/funnel/GetRumFunnel.go new file mode 100644 index 00000000000..2bcbc582860 --- /dev/null +++ b/examples/v2/funnel/GetRumFunnel.go @@ -0,0 +1,62 @@ +// Get rum funnel returns "Successful response with funnel analysis data" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.FunnelRequest{ + Data: &datadogV2.FunnelRequestData{ + Attributes: &datadogV2.FunnelRequestDataAttributes{ + DataSource: datadog.PtrString("rum"), + EnforcedExecutionType: datadog.PtrString(""), + RequestId: datadog.PtrString(""), + Search: &datadogV2.FunnelRequestDataAttributesSearch{ + CrossSessionFilter: datadog.PtrString(""), + QueryString: datadog.PtrString("@type:view"), + Steps: []datadogV2.FunnelRequestDataAttributesSearchStepsItems{ + { + Facet: datadog.PtrString("@view.name"), + StepFilter: datadog.PtrString(""), + Value: datadog.PtrString("/apm/home"), + }, + { + Facet: datadog.PtrString("@view.name"), + StepFilter: datadog.PtrString(""), + Value: datadog.PtrString("/apm/traces"), + }, + }, + SubqueryId: datadog.PtrString(""), + }, + Time: &datadogV2.FunnelRequestDataAttributesTime{ + From: datadog.PtrInt64(1756425600000), + To: datadog.PtrInt64(1756857600000), + }, + }, + Id: datadog.PtrString("funnel_request"), + Type: datadogV2.FUNNELREQUESTDATATYPE_FUNNEL_REQUEST, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.GetRumFunnel", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewFunnelApi(apiClient) + resp, r, err := api.GetRumFunnel(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FunnelApi.GetRumFunnel`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `FunnelApi.GetRumFunnel`:\n%s\n", responseContent) +} diff --git a/examples/v2/funnel/GetRumFunnelStepSuggestions.go b/examples/v2/funnel/GetRumFunnelStepSuggestions.go new file mode 100644 index 00000000000..7986cf6662f --- /dev/null +++ b/examples/v2/funnel/GetRumFunnelStepSuggestions.go @@ -0,0 +1,58 @@ +// Get rum funnel step suggestions returns "Successful response with funnel step suggestions" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.FunnelSuggestionRequest{ + Data: &datadogV2.FunnelSuggestionRequestData{ + Attributes: &datadogV2.FunnelSuggestionRequestDataAttributes{ + DataSource: datadog.PtrString(""), + Search: &datadogV2.FunnelSuggestionRequestDataAttributesSearch{ + CrossSessionFilter: datadog.PtrString(""), + QueryString: datadog.PtrString("@type:view"), + Steps: []datadogV2.FunnelSuggestionRequestDataAttributesSearchStepsItems{ + { + Facet: datadog.PtrString("@view.name"), + StepFilter: datadog.PtrString(""), + Value: datadog.PtrString("/apm/home"), + }, + }, + SubqueryId: datadog.PtrString(""), + }, + TermSearch: &datadogV2.FunnelSuggestionRequestDataAttributesTermSearch{ + Query: datadog.PtrString("apm"), + }, + Time: &datadogV2.FunnelSuggestionRequestDataAttributesTime{ + From: datadog.PtrInt64(1756425600000), + To: datadog.PtrInt64(1756857600000), + }, + }, + Id: datadog.PtrString("funnel_suggestion_request"), + Type: datadogV2.FUNNELSUGGESTIONREQUESTDATATYPE_FUNNEL_SUGGESTION_REQUEST, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.GetRumFunnelStepSuggestions", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewFunnelApi(apiClient) + resp, r, err := api.GetRumFunnelStepSuggestions(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FunnelApi.GetRumFunnelStepSuggestions`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `FunnelApi.GetRumFunnelStepSuggestions`:\n%s\n", responseContent) +} diff --git a/examples/v2/segments/CreateRumSegment.go b/examples/v2/segments/CreateRumSegment.go new file mode 100644 index 00000000000..4073407f94d --- /dev/null +++ b/examples/v2/segments/CreateRumSegment.go @@ -0,0 +1,72 @@ +// Create rum segment returns "Segment created successfully" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.Segment{ + Data: &datadogV2.SegmentData{ + Attributes: &datadogV2.SegmentDataAttributes{ + CreatedAt: datadog.PtrTime(time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC)), + CreatedBy: &datadogV2.SegmentDataSource{ + Handle: "", + Id: "", + Uuid: "", + }, + DataQuery: datadogV2.SegmentDataAttributesDataQuery{ + EventPlatform: []datadogV2.SegmentDataAttributesDataQueryEventPlatformItems{ + { + Facet: "@usr.id", + From: datadog.PtrString("2025-08-01"), + Name: datadog.PtrString("high_value_users"), + Query: datadog.PtrString("@type:view @view.name:/logs @usr.session_duration:>300000"), + To: datadog.PtrString("2025-09-01"), + }, + }, + }, + Description: datadog.PtrString("Users who frequently visit logs and have high session duration"), + ModifiedAt: datadog.PtrTime(time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC)), + ModifiedBy: &datadogV2.SegmentDataSource{ + Handle: "", + Id: "", + Uuid: "", + }, + Name: "High-Value Users", + OrgId: datadog.PtrInt64(123456), + Source: datadog.PtrInt64(0), + Tags: []string{ + "high-value", + "logs", + "active", + }, + Version: datadog.PtrInt64(1), + }, + Id: datadog.PtrString("segment-12345"), + Type: datadogV2.SEGMENTDATATYPE_SEGMENT, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.CreateRumSegment", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewSegmentsApi(apiClient) + resp, r, err := api.CreateRumSegment(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SegmentsApi.CreateRumSegment`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `SegmentsApi.CreateRumSegment`:\n%s\n", responseContent) +} diff --git a/examples/v2/segments/InitializeRumSegments.go b/examples/v2/segments/InitializeRumSegments.go new file mode 100644 index 00000000000..de37d141fc9 --- /dev/null +++ b/examples/v2/segments/InitializeRumSegments.go @@ -0,0 +1,26 @@ +// Initialize rum segments returns "Default segments created successfully" response + +package main + +import ( + "context" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.InitializeRumSegments", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewSegmentsApi(apiClient) + r, err := api.InitializeRumSegments(ctx) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SegmentsApi.InitializeRumSegments`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/examples/v2/segments/ListRumSegments.go b/examples/v2/segments/ListRumSegments.go new file mode 100644 index 00000000000..88b5dfd5832 --- /dev/null +++ b/examples/v2/segments/ListRumSegments.go @@ -0,0 +1,30 @@ +// List rum segments returns "Successful response with list of segments" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.ListRumSegments", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewSegmentsApi(apiClient) + resp, r, err := api.ListRumSegments(ctx) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SegmentsApi.ListRumSegments`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `SegmentsApi.ListRumSegments`:\n%s\n", responseContent) +} diff --git a/examples/v2/user-flow/GetRumSankey.go b/examples/v2/user-flow/GetRumSankey.go new file mode 100644 index 00000000000..31cf492e731 --- /dev/null +++ b/examples/v2/user-flow/GetRumSankey.go @@ -0,0 +1,59 @@ +// Get rum sankey returns "Successful response with Sankey diagram data" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.SankeyRequest{ + Data: &datadogV2.SankeyRequestData{ + Attributes: &datadogV2.SankeyRequestDataAttributes{ + DataSource: datadog.PtrString(""), + Definition: &datadogV2.SankeyRequestDataAttributesDefinition{ + EntriesPerStep: datadog.PtrInt64(10), + NumberOfSteps: datadog.PtrInt64(5), + Source: datadog.PtrString("@view.name"), + Target: datadog.PtrString("@view.name"), + }, + EnforcedExecutionType: datadog.PtrString(""), + RequestId: datadog.PtrString(""), + Sampling: &datadogV2.SankeyRequestDataAttributesSampling{ + Enabled: datadog.PtrBool(true), + }, + Search: &datadogV2.SankeyRequestDataAttributesSearch{ + AudienceFilters: &datadogV2.SankeyRequestDataAttributesSearchAudienceFilters{}, + Query: datadog.PtrString("@type:view @application.id:*"), + SubqueryId: datadog.PtrString(""), + }, + Time: &datadogV2.SankeyRequestDataAttributesTime{ + From: datadog.PtrInt64(1756425600000), + To: datadog.PtrInt64(1756857600000), + }, + }, + Id: datadog.PtrString("sankey_request"), + Type: datadogV2.SANKEYREQUESTDATATYPE_SANKEY_REQUEST, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.GetRumSankey", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewUserFlowApi(apiClient) + resp, r, err := api.GetRumSankey(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserFlowApi.GetRumSankey`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `UserFlowApi.GetRumSankey`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/api_mappings.go b/tests/scenarios/api_mappings.go index 58d16ea4b1c..8b2cacd83b3 100644 --- a/tests/scenarios/api_mappings.go +++ b/tests/scenarios/api_mappings.go @@ -109,7 +109,11 @@ var apiMappings = map[string]map[string]reflect.Value{ "RestrictionPoliciesApi": reflect.ValueOf(datadogV2.NewRestrictionPoliciesApi), "RUMApi": reflect.ValueOf(datadogV2.NewRUMApi), "RumRetentionFiltersApi": reflect.ValueOf(datadogV2.NewRumRetentionFiltersApi), + "CohortApi": reflect.ValueOf(datadogV2.NewCohortApi), "RumMetricsApi": reflect.ValueOf(datadogV2.NewRumMetricsApi), + "FunnelApi": reflect.ValueOf(datadogV2.NewFunnelApi), + "UserFlowApi": reflect.ValueOf(datadogV2.NewUserFlowApi), + "SegmentsApi": reflect.ValueOf(datadogV2.NewSegmentsApi), "ServiceScorecardsApi": reflect.ValueOf(datadogV2.NewServiceScorecardsApi), "SensitiveDataScannerApi": reflect.ValueOf(datadogV2.NewSensitiveDataScannerApi), "ServiceAccountsApi": reflect.ValueOf(datadogV2.NewServiceAccountsApi), diff --git a/tests/scenarios/features/v2/cohort.feature b/tests/scenarios/features/v2/cohort.feature new file mode 100644 index 00000000000..8ca5e7bbdd9 --- /dev/null +++ b/tests/scenarios/features/v2/cohort.feature @@ -0,0 +1,24 @@ +@endpoint(cohort) @endpoint(cohort-v2) +Feature: Cohort + API for Cohort. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "Cohort" API + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Get rum cohort returns "Successful response with cohort analysis data" response + Given operation "GetRumCohort" enabled + And new "GetRumCohort" request + And body with value {"data": {"attributes": {"definition": {"audience_filters": {"accounts": [{"name": ""}], "segments": [{"name": "", "segment_id": ""}], "users": [{"name": ""}]}}, "time": {}}, "type": "cohort_request"}} + When the request is sent + Then the response status is 200 Successful response with cohort analysis data + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Get rum cohort users returns "Successful response with cohort users" response + Given operation "GetRumCohortUsers" enabled + And new "GetRumCohortUsers" request + And body with value {"data": {"attributes": {"definition": {"audience_filters": {"accounts": [{"name": ""}], "segments": [{"name": "", "segment_id": ""}], "users": [{"name": ""}]}}, "time": {}}, "type": "cohort_users_request"}} + When the request is sent + Then the response status is 200 Successful response with cohort users diff --git a/tests/scenarios/features/v2/funnel.feature b/tests/scenarios/features/v2/funnel.feature new file mode 100644 index 00000000000..929450400fe --- /dev/null +++ b/tests/scenarios/features/v2/funnel.feature @@ -0,0 +1,24 @@ +@endpoint(funnel) @endpoint(funnel-v2) +Feature: Funnel + API for funnel. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "Funnel" API + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Get rum funnel returns "Successful response with funnel analysis data" response + Given operation "GetRumFunnel" enabled + And new "GetRumFunnel" request + And body with value {"data": {"attributes": {"data_source": "rum", "enforced_execution_type": "", "request_id": "", "search": {"cross_session_filter": "", "query_string": "@type:view", "steps": [{"facet": "@view.name", "step_filter": "", "value": "/apm/home"}, {"facet": "@view.name", "step_filter": "", "value": "/apm/traces"}], "subquery_id": ""}, "time": {"from": 1756425600000, "to": 1756857600000}}, "id": "funnel_request", "type": "funnel_request"}} + When the request is sent + Then the response status is 200 Successful response with funnel analysis data + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Get rum funnel step suggestions returns "Successful response with funnel step suggestions" response + Given operation "GetRumFunnelStepSuggestions" enabled + And new "GetRumFunnelStepSuggestions" request + And body with value {"data": {"attributes": {"data_source": "", "search": {"cross_session_filter": "", "query_string": "@type:view", "steps": [{"facet": "@view.name", "step_filter": "", "value": "/apm/home"}], "subquery_id": ""}, "term_search": {"query": "apm"}, "time": {"from": 1756425600000, "to": 1756857600000}}, "id": "funnel_suggestion_request", "type": "funnel_suggestion_request"}} + When the request is sent + Then the response status is 200 Successful response with funnel step suggestions diff --git a/tests/scenarios/features/v2/segments.feature b/tests/scenarios/features/v2/segments.feature new file mode 100644 index 00000000000..95cc467d6d6 --- /dev/null +++ b/tests/scenarios/features/v2/segments.feature @@ -0,0 +1,30 @@ +@endpoint(segments) @endpoint(segments-v2) +Feature: Segments + API for segments. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "Segments" API + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Create rum segment returns "Segment created successfully" response + Given operation "CreateRumSegment" enabled + And new "CreateRumSegment" request + And body with value {"data": {"attributes": {"created_at": "0001-01-01T00:00:00Z", "created_by": {"handle": "", "id": "", "uuid": ""}, "data_query": {"event_platform": [{"facet": "@usr.id", "from": "2025-08-01", "name": "high_value_users", "query": "@type:view @view.name:/logs @usr.session_duration:>300000", "to": "2025-09-01"}]}, "description": "Users who frequently visit logs and have high session duration", "modified_at": "0001-01-01T00:00:00Z", "modified_by": {"handle": "", "id": "", "uuid": ""}, "name": "High-Value Users", "org_id": 123456, "source": 0, "tags": ["high-value", "logs", "active"], "version": 1}, "id": "segment-12345", "type": "segment"}} + When the request is sent + Then the response status is 201 Segment created successfully + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Initialize rum segments returns "Default segments created successfully" response + Given operation "InitializeRumSegments" enabled + And new "InitializeRumSegments" request + When the request is sent + Then the response status is 200 Default segments created successfully + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: List rum segments returns "Successful response with list of segments" response + Given operation "ListRumSegments" enabled + And new "ListRumSegments" request + When the request is sent + Then the response status is 200 Successful response with list of segments diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index f4a7f9e7f8d..f019e40f8b6 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -3254,6 +3254,18 @@ "type": "idempotent" } }, + "GetRumCohort": { + "tag": "Cohort", + "undo": { + "type": "safe" + } + }, + "GetRumCohortUsers": { + "tag": "Cohort", + "undo": { + "type": "safe" + } + }, "ListRumMetrics": { "tag": "Rum Metrics", "undo": { @@ -3303,6 +3315,42 @@ "type": "safe" } }, + "GetRumFunnel": { + "tag": "Funnel", + "undo": { + "type": "safe" + } + }, + "GetRumFunnelStepSuggestions": { + "tag": "Funnel", + "undo": { + "type": "safe" + } + }, + "GetRumSankey": { + "tag": "User Flow", + "undo": { + "type": "safe" + } + }, + "ListRumSegments": { + "tag": "Segments", + "undo": { + "type": "safe" + } + }, + "CreateRumSegment": { + "tag": "Segments", + "undo": { + "type": "safe" + } + }, + "InitializeRumSegments": { + "tag": "Segments", + "undo": { + "type": "safe" + } + }, "UploadIdPMetadata": { "tag": "Organizations", "undo": { diff --git a/tests/scenarios/features/v2/user_flow.feature b/tests/scenarios/features/v2/user_flow.feature new file mode 100644 index 00000000000..6dca1f69876 --- /dev/null +++ b/tests/scenarios/features/v2/user_flow.feature @@ -0,0 +1,14 @@ +@endpoint(user-flow) @endpoint(user-flow-v2) +Feature: User Flow + API for user flow. + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Get rum sankey returns "Successful response with Sankey diagram data" response + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "UserFlow" API + And operation "GetRumSankey" enabled + And new "GetRumSankey" request + And body with value {"data": {"attributes": {"data_source": "", "definition": {"entries_per_step": 10, "number_of_steps": 5, "source": "@view.name", "target": "@view.name"}, "enforced_execution_type": "", "request_id": "", "sampling": {"enabled": true}, "search": {"audience_filters": {}, "query": "@type:view @application.id:*", "subquery_id": ""}, "time": {"from": 1756425600000, "to": 1756857600000}}, "id": "sankey_request", "type": "sankey_request"}} + When the request is sent + Then the response status is 200 Successful response with Sankey diagram data