diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 93efc78e5..f95a76690 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/examples/v2_cohort_GetRumCohort.rs b/examples/v2_cohort_GetRumCohort.rs new file mode 100644 index 000000000..3495564bc --- /dev/null +++ b/examples/v2_cohort_GetRumCohort.rs @@ -0,0 +1,64 @@ +// Get rum cohort returns "Successful response with cohort analysis data" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_cohort::CohortAPI; +use datadog_api_client::datadogV2::model::GetCohortRequest; +use datadog_api_client::datadogV2::model::GetCohortRequestData; +use datadog_api_client::datadogV2::model::GetCohortRequestDataAttributes; +use datadog_api_client::datadogV2::model::GetCohortRequestDataAttributesDefinition; +use datadog_api_client::datadogV2::model::GetCohortRequestDataAttributesDefinitionAudienceFilters; +use datadog_api_client::datadogV2::model::GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems; +use datadog_api_client::datadogV2::model::GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems; +use datadog_api_client::datadogV2::model::GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems; +use datadog_api_client::datadogV2::model::GetCohortRequestDataAttributesTime; +use datadog_api_client::datadogV2::model::GetCohortRequestDataType; + +#[tokio::main] +async fn main() { + let body = + GetCohortRequest + ::new().data( + GetCohortRequestData::new( + GetCohortRequestDataType::COHORT_REQUEST, + ).attributes( + GetCohortRequestDataAttributes::new() + .definition( + GetCohortRequestDataAttributesDefinition + ::new().audience_filters( + GetCohortRequestDataAttributesDefinitionAudienceFilters::new() + .accounts( + vec![ + GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems::new( + "".to_string(), + ) + ], + ) + .segments( + vec![ + GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems::new( + "".to_string(), + "".to_string(), + ) + ], + ) + .users( + vec![ + GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems::new( + "".to_string(), + ) + ], + ), + ), + ) + .time(GetCohortRequestDataAttributesTime::new()), + ), + ); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.GetRumCohort", true); + let api = CohortAPI::with_config(configuration); + let resp = api.get_rum_cohort(body).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_cohort_GetRumCohortUsers.rs b/examples/v2_cohort_GetRumCohortUsers.rs new file mode 100644 index 000000000..b8c224c9f --- /dev/null +++ b/examples/v2_cohort_GetRumCohortUsers.rs @@ -0,0 +1,64 @@ +// Get rum cohort users returns "Successful response with cohort users" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_cohort::CohortAPI; +use datadog_api_client::datadogV2::model::GetCohortUsersRequest; +use datadog_api_client::datadogV2::model::GetCohortUsersRequestData; +use datadog_api_client::datadogV2::model::GetCohortUsersRequestDataAttributes; +use datadog_api_client::datadogV2::model::GetCohortUsersRequestDataAttributesDefinition; +use datadog_api_client::datadogV2::model::GetCohortUsersRequestDataAttributesDefinitionAudienceFilters; +use datadog_api_client::datadogV2::model::GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems; +use datadog_api_client::datadogV2::model::GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems; +use datadog_api_client::datadogV2::model::GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems; +use datadog_api_client::datadogV2::model::GetCohortUsersRequestDataAttributesTime; +use datadog_api_client::datadogV2::model::GetCohortUsersRequestDataType; + +#[tokio::main] +async fn main() { + let body = + GetCohortUsersRequest + ::new().data( + GetCohortUsersRequestData::new( + GetCohortUsersRequestDataType::COHORT_USERS_REQUEST, + ).attributes( + GetCohortUsersRequestDataAttributes::new() + .definition( + GetCohortUsersRequestDataAttributesDefinition + ::new().audience_filters( + GetCohortUsersRequestDataAttributesDefinitionAudienceFilters::new() + .accounts( + vec![ + GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems::new( + "".to_string(), + ) + ], + ) + .segments( + vec![ + GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems::new( + "".to_string(), + "".to_string(), + ) + ], + ) + .users( + vec![ + GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems::new( + "".to_string(), + ) + ], + ), + ), + ) + .time(GetCohortUsersRequestDataAttributesTime::new()), + ), + ); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.GetRumCohortUsers", true); + let api = CohortAPI::with_config(configuration); + let resp = api.get_rum_cohort_users(body).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_funnel_GetRumFunnel.rs b/examples/v2_funnel_GetRumFunnel.rs new file mode 100644 index 000000000..b9dd71efd --- /dev/null +++ b/examples/v2_funnel_GetRumFunnel.rs @@ -0,0 +1,54 @@ +// Get rum funnel returns "Successful response with funnel analysis data" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_funnel::FunnelAPI; +use datadog_api_client::datadogV2::model::FunnelRequest; +use datadog_api_client::datadogV2::model::FunnelRequestData; +use datadog_api_client::datadogV2::model::FunnelRequestDataAttributes; +use datadog_api_client::datadogV2::model::FunnelRequestDataAttributesSearch; +use datadog_api_client::datadogV2::model::FunnelRequestDataAttributesSearchStepsItems; +use datadog_api_client::datadogV2::model::FunnelRequestDataAttributesTime; +use datadog_api_client::datadogV2::model::FunnelRequestDataType; + +#[tokio::main] +async fn main() { + let body = FunnelRequest::new().data( + FunnelRequestData::new(FunnelRequestDataType::FUNNEL_REQUEST) + .attributes( + FunnelRequestDataAttributes::new() + .data_source("rum".to_string()) + .enforced_execution_type("".to_string()) + .request_id("".to_string()) + .search( + FunnelRequestDataAttributesSearch::new() + .cross_session_filter("".to_string()) + .query_string("@type:view".to_string()) + .steps(vec![ + FunnelRequestDataAttributesSearchStepsItems::new() + .facet("@view.name".to_string()) + .step_filter("".to_string()) + .value("/apm/home".to_string()), + FunnelRequestDataAttributesSearchStepsItems::new() + .facet("@view.name".to_string()) + .step_filter("".to_string()) + .value("/apm/traces".to_string()), + ]) + .subquery_id("".to_string()), + ) + .time( + FunnelRequestDataAttributesTime::new() + .from(1756425600000) + .to(1756857600000), + ), + ) + .id("funnel_request".to_string()), + ); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.GetRumFunnel", true); + let api = FunnelAPI::with_config(configuration); + let resp = api.get_rum_funnel(body).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_funnel_GetRumFunnelStepSuggestions.rs b/examples/v2_funnel_GetRumFunnelStepSuggestions.rs new file mode 100644 index 000000000..b081aa479 --- /dev/null +++ b/examples/v2_funnel_GetRumFunnelStepSuggestions.rs @@ -0,0 +1,55 @@ +// Get rum funnel step suggestions returns "Successful response with funnel step +// suggestions" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_funnel::FunnelAPI; +use datadog_api_client::datadogV2::model::FunnelSuggestionRequest; +use datadog_api_client::datadogV2::model::FunnelSuggestionRequestData; +use datadog_api_client::datadogV2::model::FunnelSuggestionRequestDataAttributes; +use datadog_api_client::datadogV2::model::FunnelSuggestionRequestDataAttributesSearch; +use datadog_api_client::datadogV2::model::FunnelSuggestionRequestDataAttributesSearchStepsItems; +use datadog_api_client::datadogV2::model::FunnelSuggestionRequestDataAttributesTermSearch; +use datadog_api_client::datadogV2::model::FunnelSuggestionRequestDataAttributesTime; +use datadog_api_client::datadogV2::model::FunnelSuggestionRequestDataType; + +#[tokio::main] +async fn main() { + let body = FunnelSuggestionRequest::new().data( + FunnelSuggestionRequestData::new( + FunnelSuggestionRequestDataType::FUNNEL_SUGGESTION_REQUEST, + ) + .attributes( + FunnelSuggestionRequestDataAttributes::new() + .data_source("".to_string()) + .search( + FunnelSuggestionRequestDataAttributesSearch::new() + .cross_session_filter("".to_string()) + .query_string("@type:view".to_string()) + .steps(vec![ + FunnelSuggestionRequestDataAttributesSearchStepsItems::new() + .facet("@view.name".to_string()) + .step_filter("".to_string()) + .value("/apm/home".to_string()), + ]) + .subquery_id("".to_string()), + ) + .term_search( + FunnelSuggestionRequestDataAttributesTermSearch::new().query("apm".to_string()), + ) + .time( + FunnelSuggestionRequestDataAttributesTime::new() + .from(1756425600000) + .to(1756857600000), + ), + ) + .id("funnel_suggestion_request".to_string()), + ); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.GetRumFunnelStepSuggestions", true); + let api = FunnelAPI::with_config(configuration); + let resp = api.get_rum_funnel_step_suggestions(body).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_segments_CreateRumSegment.rs b/examples/v2_segments_CreateRumSegment.rs new file mode 100644 index 000000000..52a540839 --- /dev/null +++ b/examples/v2_segments_CreateRumSegment.rs @@ -0,0 +1,75 @@ +// Create rum segment returns "Segment created successfully" response +use chrono::{DateTime, Utc}; +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_segments::SegmentsAPI; +use datadog_api_client::datadogV2::model::Segment; +use datadog_api_client::datadogV2::model::SegmentData; +use datadog_api_client::datadogV2::model::SegmentDataAttributes; +use datadog_api_client::datadogV2::model::SegmentDataAttributesDataQuery; +use datadog_api_client::datadogV2::model::SegmentDataAttributesDataQueryEventPlatformItems; +use datadog_api_client::datadogV2::model::SegmentDataSource; +use datadog_api_client::datadogV2::model::SegmentDataType; + +#[tokio::main] +async fn main() { + let body = Segment::new().data( + SegmentData::new(SegmentDataType::SEGMENT) + .attributes( + SegmentDataAttributes::new( + SegmentDataAttributesDataQuery::new().event_platform(vec![ + SegmentDataAttributesDataQueryEventPlatformItems::new( + "@usr.id".to_string(), + ) + .from("2025-08-01".to_string()) + .name("high_value_users".to_string()) + .query( + "@type:view @view.name:/logs @usr.session_duration:>300000".to_string(), + ) + .to("2025-09-01".to_string()), + ]), + "High-Value Users".to_string(), + ) + .created_at( + DateTime::parse_from_rfc3339("0001-01-01T00:00:00+00:00") + .expect("Failed to parse datetime") + .with_timezone(&Utc), + ) + .created_by(SegmentDataSource::new( + "".to_string(), + "".to_string(), + "".to_string(), + )) + .description( + "Users who frequently visit logs and have high session duration".to_string(), + ) + .modified_at( + DateTime::parse_from_rfc3339("0001-01-01T00:00:00+00:00") + .expect("Failed to parse datetime") + .with_timezone(&Utc), + ) + .modified_by(SegmentDataSource::new( + "".to_string(), + "".to_string(), + "".to_string(), + )) + .org_id(123456) + .source(0) + .tags(vec![ + "high-value".to_string(), + "logs".to_string(), + "active".to_string(), + ]) + .version(1), + ) + .id("segment-12345".to_string()), + ); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.CreateRumSegment", true); + let api = SegmentsAPI::with_config(configuration); + let resp = api.create_rum_segment(body).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_segments_InitializeRumSegments.rs b/examples/v2_segments_InitializeRumSegments.rs new file mode 100644 index 000000000..3ba9594d9 --- /dev/null +++ b/examples/v2_segments_InitializeRumSegments.rs @@ -0,0 +1,16 @@ +// Initialize rum segments returns "Default segments created successfully" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_segments::SegmentsAPI; + +#[tokio::main] +async fn main() { + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.InitializeRumSegments", true); + let api = SegmentsAPI::with_config(configuration); + let resp = api.initialize_rum_segments().await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_segments_ListRumSegments.rs b/examples/v2_segments_ListRumSegments.rs new file mode 100644 index 000000000..3fa452923 --- /dev/null +++ b/examples/v2_segments_ListRumSegments.rs @@ -0,0 +1,16 @@ +// List rum segments returns "Successful response with list of segments" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_segments::SegmentsAPI; + +#[tokio::main] +async fn main() { + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.ListRumSegments", true); + let api = SegmentsAPI::with_config(configuration); + let resp = api.list_rum_segments().await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_user-flow_GetRumSankey.rs b/examples/v2_user-flow_GetRumSankey.rs new file mode 100644 index 000000000..5b226c66d --- /dev/null +++ b/examples/v2_user-flow_GetRumSankey.rs @@ -0,0 +1,56 @@ +// Get rum sankey returns "Successful response with Sankey diagram data" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_user_flow::UserFlowAPI; +use datadog_api_client::datadogV2::model::SankeyRequest; +use datadog_api_client::datadogV2::model::SankeyRequestData; +use datadog_api_client::datadogV2::model::SankeyRequestDataAttributes; +use datadog_api_client::datadogV2::model::SankeyRequestDataAttributesDefinition; +use datadog_api_client::datadogV2::model::SankeyRequestDataAttributesSampling; +use datadog_api_client::datadogV2::model::SankeyRequestDataAttributesSearch; +use datadog_api_client::datadogV2::model::SankeyRequestDataAttributesSearchAudienceFilters; +use datadog_api_client::datadogV2::model::SankeyRequestDataAttributesTime; +use datadog_api_client::datadogV2::model::SankeyRequestDataType; + +#[tokio::main] +async fn main() { + let body = SankeyRequest::new().data( + SankeyRequestData::new(SankeyRequestDataType::SANKEY_REQUEST) + .attributes( + SankeyRequestDataAttributes::new() + .data_source("".to_string()) + .definition( + SankeyRequestDataAttributesDefinition::new() + .entries_per_step(10) + .number_of_steps(5) + .source("@view.name".to_string()) + .target("@view.name".to_string()), + ) + .enforced_execution_type("".to_string()) + .request_id("".to_string()) + .sampling(SankeyRequestDataAttributesSampling::new().enabled(true)) + .search( + SankeyRequestDataAttributesSearch::new() + .audience_filters( + SankeyRequestDataAttributesSearchAudienceFilters::new(), + ) + .query("@type:view @application.id:*".to_string()) + .subquery_id("".to_string()), + ) + .time( + SankeyRequestDataAttributesTime::new() + .from(1756425600000) + .to(1756857600000), + ), + ) + .id("sankey_request".to_string()), + ); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.GetRumSankey", true); + let api = UserFlowAPI::with_config(configuration); + let resp = api.get_rum_sankey(body).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/src/datadog/configuration.rs b/src/datadog/configuration.rs index 0de39ef54..1548520de 100644 --- a/src/datadog/configuration.rs +++ b/src/datadog/configuration.rs @@ -219,6 +219,14 @@ impl Default for Configuration { ("v2.list_pipelines".to_owned(), false), ("v2.update_pipeline".to_owned(), false), ("v2.validate_pipeline".to_owned(), false), + ("v2.get_rum_cohort".to_owned(), false), + ("v2.get_rum_cohort_users".to_owned(), false), + ("v2.get_rum_funnel".to_owned(), false), + ("v2.get_rum_funnel_step_suggestions".to_owned(), false), + ("v2.get_rum_sankey".to_owned(), false), + ("v2.create_rum_segment".to_owned(), false), + ("v2.initialize_rum_segments".to_owned(), false), + ("v2.list_rum_segments".to_owned(), false), ("v2.create_scorecard_outcomes_batch".to_owned(), false), ("v2.create_scorecard_rule".to_owned(), false), ("v2.delete_scorecard_rule".to_owned(), false), diff --git a/src/datadogV2/api/api_cohort.rs b/src/datadogV2/api/api_cohort.rs new file mode 100644 index 000000000..9bc0551c2 --- /dev/null +++ b/src/datadogV2/api/api_cohort.rs @@ -0,0 +1,385 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use crate::datadog; +use flate2::{ + write::{GzEncoder, ZlibEncoder}, + Compression, +}; +use log::warn; +use reqwest::header::{HeaderMap, HeaderValue}; +use serde::{Deserialize, Serialize}; +use std::io::Write; + +/// GetRumCohortError is a struct for typed errors of method [`CohortAPI::get_rum_cohort`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetRumCohortError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// GetRumCohortUsersError is a struct for typed errors of method [`CohortAPI::get_rum_cohort_users`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetRumCohortUsersError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// API for Cohort. +#[derive(Debug, Clone)] +pub struct CohortAPI { + config: datadog::Configuration, + client: reqwest_middleware::ClientWithMiddleware, +} + +impl Default for CohortAPI { + fn default() -> Self { + Self::with_config(datadog::Configuration::default()) + } +} + +impl CohortAPI { + pub fn new() -> Self { + Self::default() + } + pub fn with_config(config: datadog::Configuration) -> Self { + let mut reqwest_client_builder = reqwest::Client::builder(); + + if let Some(proxy_url) = &config.proxy_url { + let proxy = reqwest::Proxy::all(proxy_url).expect("Failed to parse proxy URL"); + reqwest_client_builder = reqwest_client_builder.proxy(proxy); + } + + let mut middleware_client_builder = + reqwest_middleware::ClientBuilder::new(reqwest_client_builder.build().unwrap()); + + if config.enable_retry { + struct RetryableStatus; + impl reqwest_retry::RetryableStrategy for RetryableStatus { + fn handle( + &self, + res: &Result, + ) -> Option { + match res { + Ok(success) => reqwest_retry::default_on_request_success(success), + Err(_) => None, + } + } + } + let backoff_policy = reqwest_retry::policies::ExponentialBackoff::builder() + .build_with_max_retries(config.max_retries); + + let retry_middleware = + reqwest_retry::RetryTransientMiddleware::new_with_policy_and_strategy( + backoff_policy, + RetryableStatus, + ); + + middleware_client_builder = middleware_client_builder.with(retry_middleware); + } + + let client = middleware_client_builder.build(); + + Self { config, client } + } + + pub fn with_client_and_config( + config: datadog::Configuration, + client: reqwest_middleware::ClientWithMiddleware, + ) -> Self { + Self { config, client } + } + + /// Analyze user cohorts for retention and conversion analysis + pub async fn get_rum_cohort( + &self, + body: crate::datadogV2::model::GetCohortRequest, + ) -> Result> { + match self.get_rum_cohort_with_http_info(body).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Analyze user cohorts for retention and conversion analysis + pub async fn get_rum_cohort_with_http_info( + &self, + body: crate::datadogV2::model::GetCohortRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.get_rum_cohort"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.get_rum_cohort' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/rum/cohort", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::(&local_content) + { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Get users within a specific cohort for retention analysis + pub async fn get_rum_cohort_users( + &self, + body: crate::datadogV2::model::GetCohortUsersRequest, + ) -> Result< + crate::datadogV2::model::GetCohortUsersResponse, + datadog::Error, + > { + match self.get_rum_cohort_users_with_http_info(body).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Get users within a specific cohort for retention analysis + pub async fn get_rum_cohort_users_with_http_info( + &self, + body: crate::datadogV2::model::GetCohortUsersRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.get_rum_cohort_users"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.get_rum_cohort_users' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/rum/cohort/users", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } +} diff --git a/src/datadogV2/api/api_funnel.rs b/src/datadogV2/api/api_funnel.rs new file mode 100644 index 000000000..cbba328c0 --- /dev/null +++ b/src/datadogV2/api/api_funnel.rs @@ -0,0 +1,387 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use crate::datadog; +use flate2::{ + write::{GzEncoder, ZlibEncoder}, + Compression, +}; +use log::warn; +use reqwest::header::{HeaderMap, HeaderValue}; +use serde::{Deserialize, Serialize}; +use std::io::Write; + +/// GetRumFunnelError is a struct for typed errors of method [`FunnelAPI::get_rum_funnel`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetRumFunnelError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// GetRumFunnelStepSuggestionsError is a struct for typed errors of method [`FunnelAPI::get_rum_funnel_step_suggestions`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetRumFunnelStepSuggestionsError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// API for funnel. +#[derive(Debug, Clone)] +pub struct FunnelAPI { + config: datadog::Configuration, + client: reqwest_middleware::ClientWithMiddleware, +} + +impl Default for FunnelAPI { + fn default() -> Self { + Self::with_config(datadog::Configuration::default()) + } +} + +impl FunnelAPI { + pub fn new() -> Self { + Self::default() + } + pub fn with_config(config: datadog::Configuration) -> Self { + let mut reqwest_client_builder = reqwest::Client::builder(); + + if let Some(proxy_url) = &config.proxy_url { + let proxy = reqwest::Proxy::all(proxy_url).expect("Failed to parse proxy URL"); + reqwest_client_builder = reqwest_client_builder.proxy(proxy); + } + + let mut middleware_client_builder = + reqwest_middleware::ClientBuilder::new(reqwest_client_builder.build().unwrap()); + + if config.enable_retry { + struct RetryableStatus; + impl reqwest_retry::RetryableStrategy for RetryableStatus { + fn handle( + &self, + res: &Result, + ) -> Option { + match res { + Ok(success) => reqwest_retry::default_on_request_success(success), + Err(_) => None, + } + } + } + let backoff_policy = reqwest_retry::policies::ExponentialBackoff::builder() + .build_with_max_retries(config.max_retries); + + let retry_middleware = + reqwest_retry::RetryTransientMiddleware::new_with_policy_and_strategy( + backoff_policy, + RetryableStatus, + ); + + middleware_client_builder = middleware_client_builder.with(retry_middleware); + } + + let client = middleware_client_builder.build(); + + Self { config, client } + } + + pub fn with_client_and_config( + config: datadog::Configuration, + client: reqwest_middleware::ClientWithMiddleware, + ) -> Self { + Self { config, client } + } + + /// Analyze conversion funnels to understand user drop-off patterns + pub async fn get_rum_funnel( + &self, + body: crate::datadogV2::model::FunnelRequest, + ) -> Result> { + match self.get_rum_funnel_with_http_info(body).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Analyze conversion funnels to understand user drop-off patterns + pub async fn get_rum_funnel_with_http_info( + &self, + body: crate::datadogV2::model::FunnelRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.get_rum_funnel"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.get_rum_funnel' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/rum/funnel", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::(&local_content) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Get suggested steps for building conversion funnels + pub async fn get_rum_funnel_step_suggestions( + &self, + body: crate::datadogV2::model::FunnelSuggestionRequest, + ) -> Result< + crate::datadogV2::model::FunnelSuggestionResponse, + datadog::Error, + > { + match self + .get_rum_funnel_step_suggestions_with_http_info(body) + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Get suggested steps for building conversion funnels + pub async fn get_rum_funnel_step_suggestions_with_http_info( + &self, + body: crate::datadogV2::model::FunnelSuggestionRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.get_rum_funnel_step_suggestions"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.get_rum_funnel_step_suggestions' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/rum/funnel/new_step_suggestions", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } +} diff --git a/src/datadogV2/api/api_segments.rs b/src/datadogV2/api/api_segments.rs new file mode 100644 index 000000000..ee6890544 --- /dev/null +++ b/src/datadogV2/api/api_segments.rs @@ -0,0 +1,419 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use crate::datadog; +use flate2::{ + write::{GzEncoder, ZlibEncoder}, + Compression, +}; +use log::warn; +use reqwest::header::{HeaderMap, HeaderValue}; +use serde::{Deserialize, Serialize}; +use std::io::Write; + +/// CreateRumSegmentError is a struct for typed errors of method [`SegmentsAPI::create_rum_segment`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateRumSegmentError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// InitializeRumSegmentsError is a struct for typed errors of method [`SegmentsAPI::initialize_rum_segments`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum InitializeRumSegmentsError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// ListRumSegmentsError is a struct for typed errors of method [`SegmentsAPI::list_rum_segments`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListRumSegmentsError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// API for segments. +#[derive(Debug, Clone)] +pub struct SegmentsAPI { + config: datadog::Configuration, + client: reqwest_middleware::ClientWithMiddleware, +} + +impl Default for SegmentsAPI { + fn default() -> Self { + Self::with_config(datadog::Configuration::default()) + } +} + +impl SegmentsAPI { + pub fn new() -> Self { + Self::default() + } + pub fn with_config(config: datadog::Configuration) -> Self { + let mut reqwest_client_builder = reqwest::Client::builder(); + + if let Some(proxy_url) = &config.proxy_url { + let proxy = reqwest::Proxy::all(proxy_url).expect("Failed to parse proxy URL"); + reqwest_client_builder = reqwest_client_builder.proxy(proxy); + } + + let mut middleware_client_builder = + reqwest_middleware::ClientBuilder::new(reqwest_client_builder.build().unwrap()); + + if config.enable_retry { + struct RetryableStatus; + impl reqwest_retry::RetryableStrategy for RetryableStatus { + fn handle( + &self, + res: &Result, + ) -> Option { + match res { + Ok(success) => reqwest_retry::default_on_request_success(success), + Err(_) => None, + } + } + } + let backoff_policy = reqwest_retry::policies::ExponentialBackoff::builder() + .build_with_max_retries(config.max_retries); + + let retry_middleware = + reqwest_retry::RetryTransientMiddleware::new_with_policy_and_strategy( + backoff_policy, + RetryableStatus, + ); + + middleware_client_builder = middleware_client_builder.with(retry_middleware); + } + + let client = middleware_client_builder.build(); + + Self { config, client } + } + + pub fn with_client_and_config( + config: datadog::Configuration, + client: reqwest_middleware::ClientWithMiddleware, + ) -> Self { + Self { config, client } + } + + /// Create a new user segment for audience targeting + pub async fn create_rum_segment( + &self, + body: crate::datadogV2::model::Segment, + ) -> Result> { + match self.create_rum_segment_with_http_info(body).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Create a new user segment for audience targeting + pub async fn create_rum_segment_with_http_info( + &self, + body: crate::datadogV2::model::Segment, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.create_rum_segment"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.create_rum_segment' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/rum/segment", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::(&local_content) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Initialize default segments for a new organization + pub async fn initialize_rum_segments( + &self, + ) -> Result<(), datadog::Error> { + match self.initialize_rum_segments_with_http_info().await { + Ok(_) => Ok(()), + Err(err) => Err(err), + } + } + + /// Initialize default segments for a new organization + pub async fn initialize_rum_segments_with_http_info( + &self, + ) -> Result, datadog::Error> { + let local_configuration = &self.config; + let operation_id = "v2.initialize_rum_segments"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.initialize_rum_segments' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/rum/segment/initialize", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("*/*")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: None, + }) + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// List all available user segments for audience targeting + pub async fn list_rum_segments( + &self, + ) -> Result> { + match self.list_rum_segments_with_http_info().await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// List all available user segments for audience targeting + pub async fn list_rum_segments_with_http_info( + &self, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.list_rum_segments"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.list_rum_segments' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/rum/segment", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::(&local_content) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } +} diff --git a/src/datadogV2/api/api_user_flow.rs b/src/datadogV2/api/api_user_flow.rs new file mode 100644 index 000000000..877805dca --- /dev/null +++ b/src/datadogV2/api/api_user_flow.rs @@ -0,0 +1,228 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use crate::datadog; +use flate2::{ + write::{GzEncoder, ZlibEncoder}, + Compression, +}; +use log::warn; +use reqwest::header::{HeaderMap, HeaderValue}; +use serde::{Deserialize, Serialize}; +use std::io::Write; + +/// GetRumSankeyError is a struct for typed errors of method [`UserFlowAPI::get_rum_sankey`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetRumSankeyError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// API for user flow. +#[derive(Debug, Clone)] +pub struct UserFlowAPI { + config: datadog::Configuration, + client: reqwest_middleware::ClientWithMiddleware, +} + +impl Default for UserFlowAPI { + fn default() -> Self { + Self::with_config(datadog::Configuration::default()) + } +} + +impl UserFlowAPI { + pub fn new() -> Self { + Self::default() + } + pub fn with_config(config: datadog::Configuration) -> Self { + let mut reqwest_client_builder = reqwest::Client::builder(); + + if let Some(proxy_url) = &config.proxy_url { + let proxy = reqwest::Proxy::all(proxy_url).expect("Failed to parse proxy URL"); + reqwest_client_builder = reqwest_client_builder.proxy(proxy); + } + + let mut middleware_client_builder = + reqwest_middleware::ClientBuilder::new(reqwest_client_builder.build().unwrap()); + + if config.enable_retry { + struct RetryableStatus; + impl reqwest_retry::RetryableStrategy for RetryableStatus { + fn handle( + &self, + res: &Result, + ) -> Option { + match res { + Ok(success) => reqwest_retry::default_on_request_success(success), + Err(_) => None, + } + } + } + let backoff_policy = reqwest_retry::policies::ExponentialBackoff::builder() + .build_with_max_retries(config.max_retries); + + let retry_middleware = + reqwest_retry::RetryTransientMiddleware::new_with_policy_and_strategy( + backoff_policy, + RetryableStatus, + ); + + middleware_client_builder = middleware_client_builder.with(retry_middleware); + } + + let client = middleware_client_builder.build(); + + Self { config, client } + } + + pub fn with_client_and_config( + config: datadog::Configuration, + client: reqwest_middleware::ClientWithMiddleware, + ) -> Self { + Self { config, client } + } + + /// Generate Sankey diagrams to visualize user flow paths and drop-off points + pub async fn get_rum_sankey( + &self, + body: crate::datadogV2::model::SankeyRequest, + ) -> Result> { + match self.get_rum_sankey_with_http_info(body).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Generate Sankey diagrams to visualize user flow paths and drop-off points + pub async fn get_rum_sankey_with_http_info( + &self, + body: crate::datadogV2::model::SankeyRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.get_rum_sankey"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.get_rum_sankey' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/rum/sankey", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::(&local_content) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } +} diff --git a/src/datadogV2/api/mod.rs b/src/datadogV2/api/mod.rs index 4675e95e7..3fdce1abc 100644 --- a/src/datadogV2/api/mod.rs +++ b/src/datadogV2/api/mod.rs @@ -21,6 +21,7 @@ pub mod api_ci_visibility_tests; pub mod api_cloud_cost_management; pub mod api_cloud_network_monitoring; pub mod api_cloudflare_integration; +pub mod api_cohort; pub mod api_confluent_cloud; pub mod api_container_images; pub mod api_containers; @@ -37,6 +38,7 @@ pub mod api_error_tracking; pub mod api_events; pub mod api_fastly_integration; pub mod api_fleet_automation; +pub mod api_funnel; pub mod api_gcp_integration; pub mod api_incident_services; pub mod api_incident_teams; @@ -67,6 +69,7 @@ pub mod api_rum; pub mod api_rum_metrics; pub mod api_rum_retention_filters; pub mod api_security_monitoring; +pub mod api_segments; pub mod api_sensitive_data_scanner; pub mod api_service_accounts; pub mod api_service_definition; @@ -81,5 +84,6 @@ pub mod api_synthetics; pub mod api_teams; pub mod api_test_optimization; pub mod api_usage_metering; +pub mod api_user_flow; pub mod api_users; pub mod api_workflow_automation; diff --git a/src/datadogV2/mod.rs b/src/datadogV2/mod.rs index 17059324e..54707d0fe 100644 --- a/src/datadogV2/mod.rs +++ b/src/datadogV2/mod.rs @@ -22,6 +22,7 @@ pub use self::api::api_ci_visibility_tests; pub use self::api::api_cloud_cost_management; pub use self::api::api_cloud_network_monitoring; pub use self::api::api_cloudflare_integration; +pub use self::api::api_cohort; pub use self::api::api_confluent_cloud; pub use self::api::api_container_images; pub use self::api::api_containers; @@ -38,6 +39,7 @@ pub use self::api::api_error_tracking; pub use self::api::api_events; pub use self::api::api_fastly_integration; pub use self::api::api_fleet_automation; +pub use self::api::api_funnel; pub use self::api::api_gcp_integration; pub use self::api::api_incident_services; pub use self::api::api_incident_teams; @@ -68,6 +70,7 @@ pub use self::api::api_rum; pub use self::api::api_rum_metrics; pub use self::api::api_rum_retention_filters; pub use self::api::api_security_monitoring; +pub use self::api::api_segments; pub use self::api::api_sensitive_data_scanner; pub use self::api::api_service_accounts; pub use self::api::api_service_definition; @@ -82,6 +85,7 @@ pub use self::api::api_synthetics; pub use self::api::api_teams; pub use self::api::api_test_optimization; pub use self::api::api_usage_metering; +pub use self::api::api_user_flow; pub use self::api::api_users; pub use self::api::api_workflow_automation; pub mod model; diff --git a/src/datadogV2/model/mod.rs b/src/datadogV2/model/mod.rs index 0a29a3b35..80163fca1 100644 --- a/src/datadogV2/model/mod.rs +++ b/src/datadogV2/model/mod.rs @@ -5184,6 +5184,68 @@ pub mod model_rum_application_update_attributes; pub use self::model_rum_application_update_attributes::RUMApplicationUpdateAttributes; pub mod model_rum_application_update_type; pub use self::model_rum_application_update_type::RUMApplicationUpdateType; +pub mod model_get_cohort_request; +pub use self::model_get_cohort_request::GetCohortRequest; +pub mod model_get_cohort_request_data; +pub use self::model_get_cohort_request_data::GetCohortRequestData; +pub mod model_get_cohort_request_data_attributes; +pub use self::model_get_cohort_request_data_attributes::GetCohortRequestDataAttributes; +pub mod model_get_cohort_request_data_attributes_definition; +pub use self::model_get_cohort_request_data_attributes_definition::GetCohortRequestDataAttributesDefinition; +pub mod model_get_cohort_request_data_attributes_definition_audience_filters; +pub use self::model_get_cohort_request_data_attributes_definition_audience_filters::GetCohortRequestDataAttributesDefinitionAudienceFilters; +pub mod model_get_cohort_request_data_attributes_definition_audience_filters_accounts_items; +pub use self::model_get_cohort_request_data_attributes_definition_audience_filters_accounts_items::GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems; +pub mod model_get_cohort_request_data_attributes_definition_audience_filters_segments_items; +pub use self::model_get_cohort_request_data_attributes_definition_audience_filters_segments_items::GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems; +pub mod model_get_cohort_request_data_attributes_definition_audience_filters_users_items; +pub use self::model_get_cohort_request_data_attributes_definition_audience_filters_users_items::GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems; +pub mod model_get_cohort_request_data_attributes_time; +pub use self::model_get_cohort_request_data_attributes_time::GetCohortRequestDataAttributesTime; +pub mod model_get_cohort_request_data_type; +pub use self::model_get_cohort_request_data_type::GetCohortRequestDataType; +pub mod model_get_cohort_response; +pub use self::model_get_cohort_response::GetCohortResponse; +pub mod model_get_cohort_response_data; +pub use self::model_get_cohort_response_data::GetCohortResponseData; +pub mod model_get_cohort_response_data_attributes; +pub use self::model_get_cohort_response_data_attributes::GetCohortResponseDataAttributes; +pub mod model_get_cohort_response_data_attributes_cohorts_items; +pub use self::model_get_cohort_response_data_attributes_cohorts_items::GetCohortResponseDataAttributesCohortsItems; +pub mod model_get_cohort_response_data_attributes_cohorts_items_values_items; +pub use self::model_get_cohort_response_data_attributes_cohorts_items_values_items::GetCohortResponseDataAttributesCohortsItemsValuesItems; +pub mod model_get_cohort_response_data_type; +pub use self::model_get_cohort_response_data_type::GetCohortResponseDataType; +pub mod model_get_cohort_users_request; +pub use self::model_get_cohort_users_request::GetCohortUsersRequest; +pub mod model_get_cohort_users_request_data; +pub use self::model_get_cohort_users_request_data::GetCohortUsersRequestData; +pub mod model_get_cohort_users_request_data_attributes; +pub use self::model_get_cohort_users_request_data_attributes::GetCohortUsersRequestDataAttributes; +pub mod model_get_cohort_users_request_data_attributes_definition; +pub use self::model_get_cohort_users_request_data_attributes_definition::GetCohortUsersRequestDataAttributesDefinition; +pub mod model_get_cohort_users_request_data_attributes_definition_audience_filters; +pub use self::model_get_cohort_users_request_data_attributes_definition_audience_filters::GetCohortUsersRequestDataAttributesDefinitionAudienceFilters; +pub mod model_get_cohort_users_request_data_attributes_definition_audience_filters_accounts_items; +pub use self::model_get_cohort_users_request_data_attributes_definition_audience_filters_accounts_items::GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems; +pub mod model_get_cohort_users_request_data_attributes_definition_audience_filters_segments_items; +pub use self::model_get_cohort_users_request_data_attributes_definition_audience_filters_segments_items::GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems; +pub mod model_get_cohort_users_request_data_attributes_definition_audience_filters_users_items; +pub use self::model_get_cohort_users_request_data_attributes_definition_audience_filters_users_items::GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems; +pub mod model_get_cohort_users_request_data_attributes_time; +pub use self::model_get_cohort_users_request_data_attributes_time::GetCohortUsersRequestDataAttributesTime; +pub mod model_get_cohort_users_request_data_type; +pub use self::model_get_cohort_users_request_data_type::GetCohortUsersRequestDataType; +pub mod model_get_cohort_users_response; +pub use self::model_get_cohort_users_response::GetCohortUsersResponse; +pub mod model_get_cohort_users_response_data; +pub use self::model_get_cohort_users_response_data::GetCohortUsersResponseData; +pub mod model_get_cohort_users_response_data_attributes; +pub use self::model_get_cohort_users_response_data_attributes::GetCohortUsersResponseDataAttributes; +pub mod model_get_cohort_users_response_data_attributes_users_items; +pub use self::model_get_cohort_users_response_data_attributes_users_items::GetCohortUsersResponseDataAttributesUsersItems; +pub mod model_get_cohort_users_response_data_type; +pub use self::model_get_cohort_users_response_data_type::GetCohortUsersResponseDataType; pub mod model_rum_metrics_response; pub use self::model_rum_metrics_response::RumMetricsResponse; pub mod model_rum_metric_response_data; @@ -5242,6 +5304,126 @@ pub mod model_rum_event_type; pub use self::model_rum_event_type::RUMEventType; pub mod model_rum_search_events_request; pub use self::model_rum_search_events_request::RUMSearchEventsRequest; +pub mod model_funnel_request; +pub use self::model_funnel_request::FunnelRequest; +pub mod model_funnel_request_data; +pub use self::model_funnel_request_data::FunnelRequestData; +pub mod model_funnel_request_data_attributes; +pub use self::model_funnel_request_data_attributes::FunnelRequestDataAttributes; +pub mod model_funnel_request_data_attributes_search; +pub use self::model_funnel_request_data_attributes_search::FunnelRequestDataAttributesSearch; +pub mod model_funnel_request_data_attributes_search_steps_items; +pub use self::model_funnel_request_data_attributes_search_steps_items::FunnelRequestDataAttributesSearchStepsItems; +pub mod model_funnel_request_data_attributes_time; +pub use self::model_funnel_request_data_attributes_time::FunnelRequestDataAttributesTime; +pub mod model_funnel_request_data_type; +pub use self::model_funnel_request_data_type::FunnelRequestDataType; +pub mod model_funnel_response; +pub use self::model_funnel_response::FunnelResponse; +pub mod model_funnel_response_data; +pub use self::model_funnel_response_data::FunnelResponseData; +pub mod model_funnel_response_data_attributes; +pub use self::model_funnel_response_data_attributes::FunnelResponseDataAttributes; +pub mod model_funnel_response_elapsed_time; +pub use self::model_funnel_response_elapsed_time::FunnelResponseElapsedTime; +pub mod model_funnel_response_data_attributes_funnel_steps_items; +pub use self::model_funnel_response_data_attributes_funnel_steps_items::FunnelResponseDataAttributesFunnelStepsItems; +pub mod model_funnel_response_data_type; +pub use self::model_funnel_response_data_type::FunnelResponseDataType; +pub mod model_funnel_suggestion_request; +pub use self::model_funnel_suggestion_request::FunnelSuggestionRequest; +pub mod model_funnel_suggestion_request_data; +pub use self::model_funnel_suggestion_request_data::FunnelSuggestionRequestData; +pub mod model_funnel_suggestion_request_data_attributes; +pub use self::model_funnel_suggestion_request_data_attributes::FunnelSuggestionRequestDataAttributes; +pub mod model_funnel_suggestion_request_data_attributes_search; +pub use self::model_funnel_suggestion_request_data_attributes_search::FunnelSuggestionRequestDataAttributesSearch; +pub mod model_funnel_suggestion_request_data_attributes_search_steps_items; +pub use self::model_funnel_suggestion_request_data_attributes_search_steps_items::FunnelSuggestionRequestDataAttributesSearchStepsItems; +pub mod model_funnel_suggestion_request_data_attributes_term_search; +pub use self::model_funnel_suggestion_request_data_attributes_term_search::FunnelSuggestionRequestDataAttributesTermSearch; +pub mod model_funnel_suggestion_request_data_attributes_time; +pub use self::model_funnel_suggestion_request_data_attributes_time::FunnelSuggestionRequestDataAttributesTime; +pub mod model_funnel_suggestion_request_data_type; +pub use self::model_funnel_suggestion_request_data_type::FunnelSuggestionRequestDataType; +pub mod model_funnel_suggestion_response; +pub use self::model_funnel_suggestion_response::FunnelSuggestionResponse; +pub mod model_funnel_suggestion_response_data; +pub use self::model_funnel_suggestion_response_data::FunnelSuggestionResponseData; +pub mod model_funnel_suggestion_response_data_attributes; +pub use self::model_funnel_suggestion_response_data_attributes::FunnelSuggestionResponseDataAttributes; +pub mod model_funnel_suggestion_response_data_attributes_actions_items; +pub use self::model_funnel_suggestion_response_data_attributes_actions_items::FunnelSuggestionResponseDataAttributesActionsItems; +pub mod model_funnel_suggestion_response_data_attributes_views_items; +pub use self::model_funnel_suggestion_response_data_attributes_views_items::FunnelSuggestionResponseDataAttributesViewsItems; +pub mod model_funnel_suggestion_response_data_type; +pub use self::model_funnel_suggestion_response_data_type::FunnelSuggestionResponseDataType; +pub mod model_sankey_request; +pub use self::model_sankey_request::SankeyRequest; +pub mod model_sankey_request_data; +pub use self::model_sankey_request_data::SankeyRequestData; +pub mod model_sankey_request_data_attributes; +pub use self::model_sankey_request_data_attributes::SankeyRequestDataAttributes; +pub mod model_sankey_request_data_attributes_definition; +pub use self::model_sankey_request_data_attributes_definition::SankeyRequestDataAttributesDefinition; +pub mod model_sankey_request_data_attributes_sampling; +pub use self::model_sankey_request_data_attributes_sampling::SankeyRequestDataAttributesSampling; +pub mod model_sankey_request_data_attributes_search; +pub use self::model_sankey_request_data_attributes_search::SankeyRequestDataAttributesSearch; +pub mod model_sankey_request_data_attributes_search_audience_filters; +pub use self::model_sankey_request_data_attributes_search_audience_filters::SankeyRequestDataAttributesSearchAudienceFilters; +pub mod model_sankey_request_data_attributes_search_audience_filters_accounts_items; +pub use self::model_sankey_request_data_attributes_search_audience_filters_accounts_items::SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems; +pub mod model_sankey_request_data_attributes_search_audience_filters_segments_items; +pub use self::model_sankey_request_data_attributes_search_audience_filters_segments_items::SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems; +pub mod model_sankey_request_data_attributes_search_audience_filters_users_items; +pub use self::model_sankey_request_data_attributes_search_audience_filters_users_items::SankeyRequestDataAttributesSearchAudienceFiltersUsersItems; +pub mod model_sankey_request_data_attributes_search_occurrences; +pub use self::model_sankey_request_data_attributes_search_occurrences::SankeyRequestDataAttributesSearchOccurrences; +pub mod model_sankey_request_data_attributes_time; +pub use self::model_sankey_request_data_attributes_time::SankeyRequestDataAttributesTime; +pub mod model_sankey_request_data_type; +pub use self::model_sankey_request_data_type::SankeyRequestDataType; +pub mod model_sankey_response; +pub use self::model_sankey_response::SankeyResponse; +pub mod model_sankey_response_data; +pub use self::model_sankey_response_data::SankeyResponseData; +pub mod model_sankey_response_data_attributes; +pub use self::model_sankey_response_data_attributes::SankeyResponseDataAttributes; +pub mod model_sankey_response_data_attributes_links_items; +pub use self::model_sankey_response_data_attributes_links_items::SankeyResponseDataAttributesLinksItems; +pub mod model_sankey_response_data_attributes_nodes_items; +pub use self::model_sankey_response_data_attributes_nodes_items::SankeyResponseDataAttributesNodesItems; +pub mod model_sankey_response_data_attributes_nodes_items_aggregated_nodes_items; +pub use self::model_sankey_response_data_attributes_nodes_items_aggregated_nodes_items::SankeyResponseDataAttributesNodesItemsAggregatedNodesItems; +pub mod model_sankey_response_data_type; +pub use self::model_sankey_response_data_type::SankeyResponseDataType; +pub mod model_segment_array; +pub use self::model_segment_array::SegmentArray; +pub mod model_segment_data; +pub use self::model_segment_data::SegmentData; +pub mod model_segment_data_attributes; +pub use self::model_segment_data_attributes::SegmentDataAttributes; +pub mod model_segment_data_source; +pub use self::model_segment_data_source::SegmentDataSource; +pub mod model_segment_data_attributes_data_query; +pub use self::model_segment_data_attributes_data_query::SegmentDataAttributesDataQuery; +pub mod model_segment_data_attributes_data_query_event_platform_items; +pub use self::model_segment_data_attributes_data_query_event_platform_items::SegmentDataAttributesDataQueryEventPlatformItems; +pub mod model_segment_data_attributes_data_query_reference_table_items; +pub use self::model_segment_data_attributes_data_query_reference_table_items::SegmentDataAttributesDataQueryReferenceTableItems; +pub mod model_segment_data_attributes_data_query_reference_table_items_columns_items; +pub use self::model_segment_data_attributes_data_query_reference_table_items_columns_items::SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems; +pub mod model_segment_data_attributes_data_query_reference_table_items_join_condition; +pub use self::model_segment_data_attributes_data_query_reference_table_items_join_condition::SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition; +pub mod model_segment_data_attributes_data_query_static_items; +pub use self::model_segment_data_attributes_data_query_static_items::SegmentDataAttributesDataQueryStaticItems; +pub mod model_segment_data_attributes_data_query_user_store_items; +pub use self::model_segment_data_attributes_data_query_user_store_items::SegmentDataAttributesDataQueryUserStoreItems; +pub mod model_segment_data_type; +pub use self::model_segment_data_type::SegmentDataType; +pub mod model_segment; +pub use self::model_segment::Segment; pub mod model_idp_metadata_form_data; pub use self::model_idp_metadata_form_data::IdPMetadataFormData; pub mod model_outcomes_response; diff --git a/src/datadogV2/model/model_funnel_request.rs b/src/datadogV2/model/model_funnel_request.rs new file mode 100644 index 000000000..d02e0c7b3 --- /dev/null +++ b/src/datadogV2/model/model_funnel_request.rs @@ -0,0 +1,103 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FunnelRequest { + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FunnelRequest { + pub fn new() -> FunnelRequest { + FunnelRequest { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::FunnelRequestData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for FunnelRequest { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for FunnelRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FunnelRequestVisitor; + impl<'a> Visitor<'a> for FunnelRequestVisitor { + type Value = FunnelRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = FunnelRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FunnelRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_funnel_request_data.rs b/src/datadogV2/model/model_funnel_request_data.rs new file mode 100644 index 000000000..6b771bf84 --- /dev/null +++ b/src/datadogV2/model/model_funnel_request_data.rs @@ -0,0 +1,134 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FunnelRequestData { + #[serde(rename = "attributes")] + pub attributes: Option, + #[serde(rename = "id")] + pub id: Option, + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::FunnelRequestDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FunnelRequestData { + pub fn new(type_: crate::datadogV2::model::FunnelRequestDataType) -> FunnelRequestData { + FunnelRequestData { + attributes: None, + id: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::FunnelRequestDataAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for FunnelRequestData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FunnelRequestDataVisitor; + impl<'a> Visitor<'a> for FunnelRequestDataVisitor { + type Value = FunnelRequestData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option = + None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::FunnelRequestDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = FunnelRequestData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FunnelRequestDataVisitor) + } +} diff --git a/src/datadogV2/model/model_funnel_request_data_attributes.rs b/src/datadogV2/model/model_funnel_request_data_attributes.rs new file mode 100644 index 000000000..f7b31d962 --- /dev/null +++ b/src/datadogV2/model/model_funnel_request_data_attributes.rs @@ -0,0 +1,174 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FunnelRequestDataAttributes { + #[serde(rename = "data_source")] + pub data_source: Option, + #[serde(rename = "enforced_execution_type")] + pub enforced_execution_type: Option, + #[serde(rename = "request_id")] + pub request_id: Option, + #[serde(rename = "search")] + pub search: Option, + #[serde(rename = "time")] + pub time: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FunnelRequestDataAttributes { + pub fn new() -> FunnelRequestDataAttributes { + FunnelRequestDataAttributes { + data_source: None, + enforced_execution_type: None, + request_id: None, + search: None, + time: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data_source(mut self, value: String) -> Self { + self.data_source = Some(value); + self + } + + pub fn enforced_execution_type(mut self, value: String) -> Self { + self.enforced_execution_type = Some(value); + self + } + + pub fn request_id(mut self, value: String) -> Self { + self.request_id = Some(value); + self + } + + pub fn search( + mut self, + value: crate::datadogV2::model::FunnelRequestDataAttributesSearch, + ) -> Self { + self.search = Some(value); + self + } + + pub fn time(mut self, value: crate::datadogV2::model::FunnelRequestDataAttributesTime) -> Self { + self.time = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for FunnelRequestDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for FunnelRequestDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FunnelRequestDataAttributesVisitor; + impl<'a> Visitor<'a> for FunnelRequestDataAttributesVisitor { + type Value = FunnelRequestDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data_source: Option = None; + let mut enforced_execution_type: Option = None; + let mut request_id: Option = None; + let mut search: Option = + None; + let mut time: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data_source" => { + if v.is_null() { + continue; + } + data_source = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "enforced_execution_type" => { + if v.is_null() { + continue; + } + enforced_execution_type = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "request_id" => { + if v.is_null() { + continue; + } + request_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "search" => { + if v.is_null() { + continue; + } + search = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "time" => { + if v.is_null() { + continue; + } + time = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = FunnelRequestDataAttributes { + data_source, + enforced_execution_type, + request_id, + search, + time, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FunnelRequestDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_funnel_request_data_attributes_search.rs b/src/datadogV2/model/model_funnel_request_data_attributes_search.rs new file mode 100644 index 000000000..c2fb636df --- /dev/null +++ b/src/datadogV2/model/model_funnel_request_data_attributes_search.rs @@ -0,0 +1,159 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FunnelRequestDataAttributesSearch { + #[serde(rename = "cross_session_filter")] + pub cross_session_filter: Option, + #[serde(rename = "query_string")] + pub query_string: Option, + #[serde(rename = "steps")] + pub steps: Option>, + #[serde(rename = "subquery_id")] + pub subquery_id: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FunnelRequestDataAttributesSearch { + pub fn new() -> FunnelRequestDataAttributesSearch { + FunnelRequestDataAttributesSearch { + cross_session_filter: None, + query_string: None, + steps: None, + subquery_id: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn cross_session_filter(mut self, value: String) -> Self { + self.cross_session_filter = Some(value); + self + } + + pub fn query_string(mut self, value: String) -> Self { + self.query_string = Some(value); + self + } + + pub fn steps( + mut self, + value: Vec, + ) -> Self { + self.steps = Some(value); + self + } + + pub fn subquery_id(mut self, value: String) -> Self { + self.subquery_id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for FunnelRequestDataAttributesSearch { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for FunnelRequestDataAttributesSearch { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FunnelRequestDataAttributesSearchVisitor; + impl<'a> Visitor<'a> for FunnelRequestDataAttributesSearchVisitor { + type Value = FunnelRequestDataAttributesSearch; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut cross_session_filter: Option = None; + let mut query_string: Option = None; + let mut steps: Option< + Vec, + > = None; + let mut subquery_id: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "cross_session_filter" => { + if v.is_null() { + continue; + } + cross_session_filter = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "query_string" => { + if v.is_null() { + continue; + } + query_string = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "steps" => { + if v.is_null() { + continue; + } + steps = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "subquery_id" => { + if v.is_null() { + continue; + } + subquery_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = FunnelRequestDataAttributesSearch { + cross_session_filter, + query_string, + steps, + subquery_id, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FunnelRequestDataAttributesSearchVisitor) + } +} diff --git a/src/datadogV2/model/model_funnel_request_data_attributes_search_steps_items.rs b/src/datadogV2/model/model_funnel_request_data_attributes_search_steps_items.rs new file mode 100644 index 000000000..68e682080 --- /dev/null +++ b/src/datadogV2/model/model_funnel_request_data_attributes_search_steps_items.rs @@ -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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FunnelRequestDataAttributesSearchStepsItems { + #[serde(rename = "facet")] + pub facet: Option, + #[serde(rename = "step_filter")] + pub step_filter: Option, + #[serde(rename = "value")] + pub value: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FunnelRequestDataAttributesSearchStepsItems { + pub fn new() -> FunnelRequestDataAttributesSearchStepsItems { + FunnelRequestDataAttributesSearchStepsItems { + facet: None, + step_filter: None, + value: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn facet(mut self, value: String) -> Self { + self.facet = Some(value); + self + } + + pub fn step_filter(mut self, value: String) -> Self { + self.step_filter = Some(value); + self + } + + pub fn value(mut self, value: String) -> Self { + self.value = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for FunnelRequestDataAttributesSearchStepsItems { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for FunnelRequestDataAttributesSearchStepsItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FunnelRequestDataAttributesSearchStepsItemsVisitor; + impl<'a> Visitor<'a> for FunnelRequestDataAttributesSearchStepsItemsVisitor { + type Value = FunnelRequestDataAttributesSearchStepsItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut facet: Option = None; + let mut step_filter: Option = None; + let mut value: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "facet" => { + if v.is_null() { + continue; + } + facet = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "step_filter" => { + if v.is_null() { + continue; + } + step_filter = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "value" => { + if v.is_null() { + continue; + } + value = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = FunnelRequestDataAttributesSearchStepsItems { + facet, + step_filter, + value, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FunnelRequestDataAttributesSearchStepsItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_funnel_request_data_attributes_time.rs b/src/datadogV2/model/model_funnel_request_data_attributes_time.rs new file mode 100644 index 000000000..6379437c2 --- /dev/null +++ b/src/datadogV2/model/model_funnel_request_data_attributes_time.rs @@ -0,0 +1,119 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FunnelRequestDataAttributesTime { + #[serde(rename = "from")] + pub from: Option, + #[serde(rename = "to")] + pub to: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FunnelRequestDataAttributesTime { + pub fn new() -> FunnelRequestDataAttributesTime { + FunnelRequestDataAttributesTime { + from: None, + to: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn from(mut self, value: i64) -> Self { + self.from = Some(value); + self + } + + pub fn to(mut self, value: i64) -> Self { + self.to = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for FunnelRequestDataAttributesTime { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for FunnelRequestDataAttributesTime { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FunnelRequestDataAttributesTimeVisitor; + impl<'a> Visitor<'a> for FunnelRequestDataAttributesTimeVisitor { + type Value = FunnelRequestDataAttributesTime; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut from: Option = None; + let mut to: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "from" => { + if v.is_null() { + continue; + } + from = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "to" => { + if v.is_null() { + continue; + } + to = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = FunnelRequestDataAttributesTime { + from, + to, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FunnelRequestDataAttributesTimeVisitor) + } +} diff --git a/src/datadogV2/model/model_funnel_request_data_type.rs b/src/datadogV2/model/model_funnel_request_data_type.rs new file mode 100644 index 000000000..fdc2fbebb --- /dev/null +++ b/src/datadogV2/model/model_funnel_request_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum FunnelRequestDataType { + FUNNEL_REQUEST, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for FunnelRequestDataType { + fn to_string(&self) -> String { + match self { + Self::FUNNEL_REQUEST => String::from("funnel_request"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for FunnelRequestDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for FunnelRequestDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "funnel_request" => Self::FUNNEL_REQUEST, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_funnel_response.rs b/src/datadogV2/model/model_funnel_response.rs new file mode 100644 index 000000000..a1082ee70 --- /dev/null +++ b/src/datadogV2/model/model_funnel_response.rs @@ -0,0 +1,103 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FunnelResponse { + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FunnelResponse { + pub fn new() -> FunnelResponse { + FunnelResponse { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::FunnelResponseData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for FunnelResponse { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for FunnelResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FunnelResponseVisitor; + impl<'a> Visitor<'a> for FunnelResponseVisitor { + type Value = FunnelResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = FunnelResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FunnelResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_funnel_response_data.rs b/src/datadogV2/model/model_funnel_response_data.rs new file mode 100644 index 000000000..8f4fa295e --- /dev/null +++ b/src/datadogV2/model/model_funnel_response_data.rs @@ -0,0 +1,134 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FunnelResponseData { + #[serde(rename = "attributes")] + pub attributes: Option, + #[serde(rename = "id")] + pub id: Option, + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::FunnelResponseDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FunnelResponseData { + pub fn new(type_: crate::datadogV2::model::FunnelResponseDataType) -> FunnelResponseData { + FunnelResponseData { + attributes: None, + id: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::FunnelResponseDataAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for FunnelResponseData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FunnelResponseDataVisitor; + impl<'a> Visitor<'a> for FunnelResponseDataVisitor { + type Value = FunnelResponseData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option = + None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::FunnelResponseDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = FunnelResponseData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FunnelResponseDataVisitor) + } +} diff --git a/src/datadogV2/model/model_funnel_response_data_attributes.rs b/src/datadogV2/model/model_funnel_response_data_attributes.rs new file mode 100644 index 000000000..f03d4ee69 --- /dev/null +++ b/src/datadogV2/model/model_funnel_response_data_attributes.rs @@ -0,0 +1,166 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FunnelResponseDataAttributes { + #[serde(rename = "end_to_end_conversion_rate")] + pub end_to_end_conversion_rate: Option, + #[serde(rename = "end_to_end_elapsed_time")] + pub end_to_end_elapsed_time: Option, + #[serde(rename = "funnel_steps")] + pub funnel_steps: + Option>, + #[serde(rename = "initial_count")] + pub initial_count: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FunnelResponseDataAttributes { + pub fn new() -> FunnelResponseDataAttributes { + FunnelResponseDataAttributes { + end_to_end_conversion_rate: None, + end_to_end_elapsed_time: None, + funnel_steps: None, + initial_count: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn end_to_end_conversion_rate(mut self, value: f64) -> Self { + self.end_to_end_conversion_rate = Some(value); + self + } + + pub fn end_to_end_elapsed_time( + mut self, + value: crate::datadogV2::model::FunnelResponseElapsedTime, + ) -> Self { + self.end_to_end_elapsed_time = Some(value); + self + } + + pub fn funnel_steps( + mut self, + value: Vec, + ) -> Self { + self.funnel_steps = Some(value); + self + } + + pub fn initial_count(mut self, value: i64) -> Self { + self.initial_count = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for FunnelResponseDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for FunnelResponseDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FunnelResponseDataAttributesVisitor; + impl<'a> Visitor<'a> for FunnelResponseDataAttributesVisitor { + type Value = FunnelResponseDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut end_to_end_conversion_rate: Option = None; + let mut end_to_end_elapsed_time: Option< + crate::datadogV2::model::FunnelResponseElapsedTime, + > = None; + let mut funnel_steps: Option< + Vec, + > = None; + let mut initial_count: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "end_to_end_conversion_rate" => { + if v.is_null() { + continue; + } + end_to_end_conversion_rate = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "end_to_end_elapsed_time" => { + if v.is_null() { + continue; + } + end_to_end_elapsed_time = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "funnel_steps" => { + if v.is_null() { + continue; + } + funnel_steps = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "initial_count" => { + if v.is_null() { + continue; + } + initial_count = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = FunnelResponseDataAttributes { + end_to_end_conversion_rate, + end_to_end_elapsed_time, + funnel_steps, + initial_count, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FunnelResponseDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_funnel_response_data_attributes_funnel_steps_items.rs b/src/datadogV2/model/model_funnel_response_data_attributes_funnel_steps_items.rs new file mode 100644 index 000000000..df73a6e53 --- /dev/null +++ b/src/datadogV2/model/model_funnel_response_data_attributes_funnel_steps_items.rs @@ -0,0 +1,141 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FunnelResponseDataAttributesFunnelStepsItems { + #[serde(rename = "elapsed_time_to_next_step")] + pub elapsed_time_to_next_step: Option, + #[serde(rename = "label")] + pub label: Option, + #[serde(rename = "value")] + pub value: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FunnelResponseDataAttributesFunnelStepsItems { + pub fn new() -> FunnelResponseDataAttributesFunnelStepsItems { + FunnelResponseDataAttributesFunnelStepsItems { + elapsed_time_to_next_step: None, + label: None, + value: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn elapsed_time_to_next_step( + mut self, + value: crate::datadogV2::model::FunnelResponseElapsedTime, + ) -> Self { + self.elapsed_time_to_next_step = Some(value); + self + } + + pub fn label(mut self, value: String) -> Self { + self.label = Some(value); + self + } + + pub fn value(mut self, value: i64) -> Self { + self.value = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for FunnelResponseDataAttributesFunnelStepsItems { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for FunnelResponseDataAttributesFunnelStepsItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FunnelResponseDataAttributesFunnelStepsItemsVisitor; + impl<'a> Visitor<'a> for FunnelResponseDataAttributesFunnelStepsItemsVisitor { + type Value = FunnelResponseDataAttributesFunnelStepsItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut elapsed_time_to_next_step: Option< + crate::datadogV2::model::FunnelResponseElapsedTime, + > = None; + let mut label: Option = None; + let mut value: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "elapsed_time_to_next_step" => { + if v.is_null() { + continue; + } + elapsed_time_to_next_step = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "label" => { + if v.is_null() { + continue; + } + label = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "value" => { + if v.is_null() { + continue; + } + value = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = FunnelResponseDataAttributesFunnelStepsItems { + elapsed_time_to_next_step, + label, + value, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FunnelResponseDataAttributesFunnelStepsItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_funnel_response_data_type.rs b/src/datadogV2/model/model_funnel_response_data_type.rs new file mode 100644 index 000000000..89c1dd8f2 --- /dev/null +++ b/src/datadogV2/model/model_funnel_response_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum FunnelResponseDataType { + FUNNEL_RESPONSE, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for FunnelResponseDataType { + fn to_string(&self) -> String { + match self { + Self::FUNNEL_RESPONSE => String::from("funnel_response"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for FunnelResponseDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for FunnelResponseDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "funnel_response" => Self::FUNNEL_RESPONSE, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_funnel_response_elapsed_time.rs b/src/datadogV2/model/model_funnel_response_elapsed_time.rs new file mode 100644 index 000000000..6c97752a2 --- /dev/null +++ b/src/datadogV2/model/model_funnel_response_elapsed_time.rs @@ -0,0 +1,183 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FunnelResponseElapsedTime { + #[serde(rename = "avg")] + pub avg: Option, + #[serde(rename = "max")] + pub max: Option, + #[serde(rename = "min")] + pub min: Option, + #[serde(rename = "p5")] + pub p5: Option, + #[serde(rename = "p50")] + pub p50: Option, + #[serde(rename = "p95")] + pub p95: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FunnelResponseElapsedTime { + pub fn new() -> FunnelResponseElapsedTime { + FunnelResponseElapsedTime { + avg: None, + max: None, + min: None, + p5: None, + p50: None, + p95: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn avg(mut self, value: i64) -> Self { + self.avg = Some(value); + self + } + + pub fn max(mut self, value: i64) -> Self { + self.max = Some(value); + self + } + + pub fn min(mut self, value: i64) -> Self { + self.min = Some(value); + self + } + + pub fn p5(mut self, value: i64) -> Self { + self.p5 = Some(value); + self + } + + pub fn p50(mut self, value: i64) -> Self { + self.p50 = Some(value); + self + } + + pub fn p95(mut self, value: i64) -> Self { + self.p95 = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for FunnelResponseElapsedTime { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for FunnelResponseElapsedTime { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FunnelResponseElapsedTimeVisitor; + impl<'a> Visitor<'a> for FunnelResponseElapsedTimeVisitor { + type Value = FunnelResponseElapsedTime; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut avg: Option = None; + let mut max: Option = None; + let mut min: Option = None; + let mut p5: Option = None; + let mut p50: Option = None; + let mut p95: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "avg" => { + if v.is_null() { + continue; + } + avg = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "max" => { + if v.is_null() { + continue; + } + max = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "min" => { + if v.is_null() { + continue; + } + min = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "p5" => { + if v.is_null() { + continue; + } + p5 = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "p50" => { + if v.is_null() { + continue; + } + p50 = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "p95" => { + if v.is_null() { + continue; + } + p95 = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = FunnelResponseElapsedTime { + avg, + max, + min, + p5, + p50, + p95, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FunnelResponseElapsedTimeVisitor) + } +} diff --git a/src/datadogV2/model/model_funnel_suggestion_request.rs b/src/datadogV2/model/model_funnel_suggestion_request.rs new file mode 100644 index 000000000..c0c5aa9f8 --- /dev/null +++ b/src/datadogV2/model/model_funnel_suggestion_request.rs @@ -0,0 +1,103 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FunnelSuggestionRequest { + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FunnelSuggestionRequest { + pub fn new() -> FunnelSuggestionRequest { + FunnelSuggestionRequest { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::FunnelSuggestionRequestData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for FunnelSuggestionRequest { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for FunnelSuggestionRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FunnelSuggestionRequestVisitor; + impl<'a> Visitor<'a> for FunnelSuggestionRequestVisitor { + type Value = FunnelSuggestionRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = FunnelSuggestionRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FunnelSuggestionRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_funnel_suggestion_request_data.rs b/src/datadogV2/model/model_funnel_suggestion_request_data.rs new file mode 100644 index 000000000..a1caa109d --- /dev/null +++ b/src/datadogV2/model/model_funnel_suggestion_request_data.rs @@ -0,0 +1,138 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FunnelSuggestionRequestData { + #[serde(rename = "attributes")] + pub attributes: Option, + #[serde(rename = "id")] + pub id: Option, + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::FunnelSuggestionRequestDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FunnelSuggestionRequestData { + pub fn new( + type_: crate::datadogV2::model::FunnelSuggestionRequestDataType, + ) -> FunnelSuggestionRequestData { + FunnelSuggestionRequestData { + attributes: None, + id: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::FunnelSuggestionRequestDataAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for FunnelSuggestionRequestData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FunnelSuggestionRequestDataVisitor; + impl<'a> Visitor<'a> for FunnelSuggestionRequestDataVisitor { + type Value = FunnelSuggestionRequestData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::FunnelSuggestionRequestDataAttributes, + > = None; + let mut id: Option = None; + let mut type_: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::FunnelSuggestionRequestDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = FunnelSuggestionRequestData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FunnelSuggestionRequestDataVisitor) + } +} diff --git a/src/datadogV2/model/model_funnel_suggestion_request_data_attributes.rs b/src/datadogV2/model/model_funnel_suggestion_request_data_attributes.rs new file mode 100644 index 000000000..ee36f93f2 --- /dev/null +++ b/src/datadogV2/model/model_funnel_suggestion_request_data_attributes.rs @@ -0,0 +1,169 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FunnelSuggestionRequestDataAttributes { + #[serde(rename = "data_source")] + pub data_source: Option, + #[serde(rename = "search")] + pub search: Option, + #[serde(rename = "term_search")] + pub term_search: + Option, + #[serde(rename = "time")] + pub time: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FunnelSuggestionRequestDataAttributes { + pub fn new() -> FunnelSuggestionRequestDataAttributes { + FunnelSuggestionRequestDataAttributes { + data_source: None, + search: None, + term_search: None, + time: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data_source(mut self, value: String) -> Self { + self.data_source = Some(value); + self + } + + pub fn search( + mut self, + value: crate::datadogV2::model::FunnelSuggestionRequestDataAttributesSearch, + ) -> Self { + self.search = Some(value); + self + } + + pub fn term_search( + mut self, + value: crate::datadogV2::model::FunnelSuggestionRequestDataAttributesTermSearch, + ) -> Self { + self.term_search = Some(value); + self + } + + pub fn time( + mut self, + value: crate::datadogV2::model::FunnelSuggestionRequestDataAttributesTime, + ) -> Self { + self.time = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for FunnelSuggestionRequestDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for FunnelSuggestionRequestDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FunnelSuggestionRequestDataAttributesVisitor; + impl<'a> Visitor<'a> for FunnelSuggestionRequestDataAttributesVisitor { + type Value = FunnelSuggestionRequestDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data_source: Option = None; + let mut search: Option< + crate::datadogV2::model::FunnelSuggestionRequestDataAttributesSearch, + > = None; + let mut term_search: Option< + crate::datadogV2::model::FunnelSuggestionRequestDataAttributesTermSearch, + > = None; + let mut time: Option< + crate::datadogV2::model::FunnelSuggestionRequestDataAttributesTime, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data_source" => { + if v.is_null() { + continue; + } + data_source = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "search" => { + if v.is_null() { + continue; + } + search = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "term_search" => { + if v.is_null() { + continue; + } + term_search = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "time" => { + if v.is_null() { + continue; + } + time = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = FunnelSuggestionRequestDataAttributes { + data_source, + search, + term_search, + time, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FunnelSuggestionRequestDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_funnel_suggestion_request_data_attributes_search.rs b/src/datadogV2/model/model_funnel_suggestion_request_data_attributes_search.rs new file mode 100644 index 000000000..6bd2d3dd8 --- /dev/null +++ b/src/datadogV2/model/model_funnel_suggestion_request_data_attributes_search.rs @@ -0,0 +1,158 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FunnelSuggestionRequestDataAttributesSearch { + #[serde(rename = "cross_session_filter")] + pub cross_session_filter: Option, + #[serde(rename = "query_string")] + pub query_string: Option, + #[serde(rename = "steps")] + pub steps: + Option>, + #[serde(rename = "subquery_id")] + pub subquery_id: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FunnelSuggestionRequestDataAttributesSearch { + pub fn new() -> FunnelSuggestionRequestDataAttributesSearch { + FunnelSuggestionRequestDataAttributesSearch { + cross_session_filter: None, + query_string: None, + steps: None, + subquery_id: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn cross_session_filter(mut self, value: String) -> Self { + self.cross_session_filter = Some(value); + self + } + + pub fn query_string(mut self, value: String) -> Self { + self.query_string = Some(value); + self + } + + pub fn steps( + mut self, + value: Vec, + ) -> Self { + self.steps = Some(value); + self + } + + pub fn subquery_id(mut self, value: String) -> Self { + self.subquery_id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for FunnelSuggestionRequestDataAttributesSearch { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for FunnelSuggestionRequestDataAttributesSearch { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FunnelSuggestionRequestDataAttributesSearchVisitor; + impl<'a> Visitor<'a> for FunnelSuggestionRequestDataAttributesSearchVisitor { + type Value = FunnelSuggestionRequestDataAttributesSearch; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut cross_session_filter: Option = None; + let mut query_string: Option = None; + let mut steps: Option> = None; + let mut subquery_id: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "cross_session_filter" => { + if v.is_null() { + continue; + } + cross_session_filter = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "query_string" => { + if v.is_null() { + continue; + } + query_string = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "steps" => { + if v.is_null() { + continue; + } + steps = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "subquery_id" => { + if v.is_null() { + continue; + } + subquery_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = FunnelSuggestionRequestDataAttributesSearch { + cross_session_filter, + query_string, + steps, + subquery_id, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FunnelSuggestionRequestDataAttributesSearchVisitor) + } +} diff --git a/src/datadogV2/model/model_funnel_suggestion_request_data_attributes_search_steps_items.rs b/src/datadogV2/model/model_funnel_suggestion_request_data_attributes_search_steps_items.rs new file mode 100644 index 000000000..97f74d13b --- /dev/null +++ b/src/datadogV2/model/model_funnel_suggestion_request_data_attributes_search_steps_items.rs @@ -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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FunnelSuggestionRequestDataAttributesSearchStepsItems { + #[serde(rename = "facet")] + pub facet: Option, + #[serde(rename = "step_filter")] + pub step_filter: Option, + #[serde(rename = "value")] + pub value: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FunnelSuggestionRequestDataAttributesSearchStepsItems { + pub fn new() -> FunnelSuggestionRequestDataAttributesSearchStepsItems { + FunnelSuggestionRequestDataAttributesSearchStepsItems { + facet: None, + step_filter: None, + value: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn facet(mut self, value: String) -> Self { + self.facet = Some(value); + self + } + + pub fn step_filter(mut self, value: String) -> Self { + self.step_filter = Some(value); + self + } + + pub fn value(mut self, value: String) -> Self { + self.value = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for FunnelSuggestionRequestDataAttributesSearchStepsItems { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for FunnelSuggestionRequestDataAttributesSearchStepsItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FunnelSuggestionRequestDataAttributesSearchStepsItemsVisitor; + impl<'a> Visitor<'a> for FunnelSuggestionRequestDataAttributesSearchStepsItemsVisitor { + type Value = FunnelSuggestionRequestDataAttributesSearchStepsItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut facet: Option = None; + let mut step_filter: Option = None; + let mut value: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "facet" => { + if v.is_null() { + continue; + } + facet = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "step_filter" => { + if v.is_null() { + continue; + } + step_filter = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "value" => { + if v.is_null() { + continue; + } + value = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = FunnelSuggestionRequestDataAttributesSearchStepsItems { + facet, + step_filter, + value, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FunnelSuggestionRequestDataAttributesSearchStepsItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_funnel_suggestion_request_data_attributes_term_search.rs b/src/datadogV2/model/model_funnel_suggestion_request_data_attributes_term_search.rs new file mode 100644 index 000000000..24c302751 --- /dev/null +++ b/src/datadogV2/model/model_funnel_suggestion_request_data_attributes_term_search.rs @@ -0,0 +1,103 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FunnelSuggestionRequestDataAttributesTermSearch { + #[serde(rename = "query")] + pub query: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FunnelSuggestionRequestDataAttributesTermSearch { + pub fn new() -> FunnelSuggestionRequestDataAttributesTermSearch { + FunnelSuggestionRequestDataAttributesTermSearch { + query: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn query(mut self, value: String) -> Self { + self.query = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for FunnelSuggestionRequestDataAttributesTermSearch { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for FunnelSuggestionRequestDataAttributesTermSearch { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FunnelSuggestionRequestDataAttributesTermSearchVisitor; + impl<'a> Visitor<'a> for FunnelSuggestionRequestDataAttributesTermSearchVisitor { + type Value = FunnelSuggestionRequestDataAttributesTermSearch; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut query: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "query" => { + if v.is_null() { + continue; + } + query = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = FunnelSuggestionRequestDataAttributesTermSearch { + query, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FunnelSuggestionRequestDataAttributesTermSearchVisitor) + } +} diff --git a/src/datadogV2/model/model_funnel_suggestion_request_data_attributes_time.rs b/src/datadogV2/model/model_funnel_suggestion_request_data_attributes_time.rs new file mode 100644 index 000000000..af66eec59 --- /dev/null +++ b/src/datadogV2/model/model_funnel_suggestion_request_data_attributes_time.rs @@ -0,0 +1,119 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FunnelSuggestionRequestDataAttributesTime { + #[serde(rename = "from")] + pub from: Option, + #[serde(rename = "to")] + pub to: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FunnelSuggestionRequestDataAttributesTime { + pub fn new() -> FunnelSuggestionRequestDataAttributesTime { + FunnelSuggestionRequestDataAttributesTime { + from: None, + to: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn from(mut self, value: i64) -> Self { + self.from = Some(value); + self + } + + pub fn to(mut self, value: i64) -> Self { + self.to = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for FunnelSuggestionRequestDataAttributesTime { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for FunnelSuggestionRequestDataAttributesTime { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FunnelSuggestionRequestDataAttributesTimeVisitor; + impl<'a> Visitor<'a> for FunnelSuggestionRequestDataAttributesTimeVisitor { + type Value = FunnelSuggestionRequestDataAttributesTime; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut from: Option = None; + let mut to: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "from" => { + if v.is_null() { + continue; + } + from = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "to" => { + if v.is_null() { + continue; + } + to = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = FunnelSuggestionRequestDataAttributesTime { + from, + to, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FunnelSuggestionRequestDataAttributesTimeVisitor) + } +} diff --git a/src/datadogV2/model/model_funnel_suggestion_request_data_type.rs b/src/datadogV2/model/model_funnel_suggestion_request_data_type.rs new file mode 100644 index 000000000..827d5cc2f --- /dev/null +++ b/src/datadogV2/model/model_funnel_suggestion_request_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum FunnelSuggestionRequestDataType { + FUNNEL_SUGGESTION_REQUEST, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for FunnelSuggestionRequestDataType { + fn to_string(&self) -> String { + match self { + Self::FUNNEL_SUGGESTION_REQUEST => String::from("funnel_suggestion_request"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for FunnelSuggestionRequestDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for FunnelSuggestionRequestDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "funnel_suggestion_request" => Self::FUNNEL_SUGGESTION_REQUEST, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_funnel_suggestion_response.rs b/src/datadogV2/model/model_funnel_suggestion_response.rs new file mode 100644 index 000000000..a0a2304d6 --- /dev/null +++ b/src/datadogV2/model/model_funnel_suggestion_response.rs @@ -0,0 +1,103 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FunnelSuggestionResponse { + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FunnelSuggestionResponse { + pub fn new() -> FunnelSuggestionResponse { + FunnelSuggestionResponse { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::FunnelSuggestionResponseData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for FunnelSuggestionResponse { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for FunnelSuggestionResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FunnelSuggestionResponseVisitor; + impl<'a> Visitor<'a> for FunnelSuggestionResponseVisitor { + type Value = FunnelSuggestionResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = FunnelSuggestionResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FunnelSuggestionResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_funnel_suggestion_response_data.rs b/src/datadogV2/model/model_funnel_suggestion_response_data.rs new file mode 100644 index 000000000..6b451926f --- /dev/null +++ b/src/datadogV2/model/model_funnel_suggestion_response_data.rs @@ -0,0 +1,138 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FunnelSuggestionResponseData { + #[serde(rename = "attributes")] + pub attributes: Option, + #[serde(rename = "id")] + pub id: Option, + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::FunnelSuggestionResponseDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FunnelSuggestionResponseData { + pub fn new( + type_: crate::datadogV2::model::FunnelSuggestionResponseDataType, + ) -> FunnelSuggestionResponseData { + FunnelSuggestionResponseData { + attributes: None, + id: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::FunnelSuggestionResponseDataAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for FunnelSuggestionResponseData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FunnelSuggestionResponseDataVisitor; + impl<'a> Visitor<'a> for FunnelSuggestionResponseDataVisitor { + type Value = FunnelSuggestionResponseData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::FunnelSuggestionResponseDataAttributes, + > = None; + let mut id: Option = None; + let mut type_: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::FunnelSuggestionResponseDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = FunnelSuggestionResponseData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FunnelSuggestionResponseDataVisitor) + } +} diff --git a/src/datadogV2/model/model_funnel_suggestion_response_data_attributes.rs b/src/datadogV2/model/model_funnel_suggestion_response_data_attributes.rs new file mode 100644 index 000000000..874894862 --- /dev/null +++ b/src/datadogV2/model/model_funnel_suggestion_response_data_attributes.rs @@ -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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FunnelSuggestionResponseDataAttributes { + #[serde(rename = "actions")] + pub actions: + Option>, + #[serde(rename = "views")] + pub views: + Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FunnelSuggestionResponseDataAttributes { + pub fn new() -> FunnelSuggestionResponseDataAttributes { + FunnelSuggestionResponseDataAttributes { + actions: None, + views: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn actions( + mut self, + value: Vec, + ) -> Self { + self.actions = Some(value); + self + } + + pub fn views( + mut self, + value: Vec, + ) -> Self { + self.views = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for FunnelSuggestionResponseDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for FunnelSuggestionResponseDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FunnelSuggestionResponseDataAttributesVisitor; + impl<'a> Visitor<'a> for FunnelSuggestionResponseDataAttributesVisitor { + type Value = FunnelSuggestionResponseDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut actions: Option< + Vec< + crate::datadogV2::model::FunnelSuggestionResponseDataAttributesActionsItems, + >, + > = None; + let mut views: Option< + Vec, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "actions" => { + if v.is_null() { + continue; + } + actions = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "views" => { + if v.is_null() { + continue; + } + views = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = FunnelSuggestionResponseDataAttributes { + actions, + views, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FunnelSuggestionResponseDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_funnel_suggestion_response_data_attributes_actions_items.rs b/src/datadogV2/model/model_funnel_suggestion_response_data_attributes_actions_items.rs new file mode 100644 index 000000000..f336716f1 --- /dev/null +++ b/src/datadogV2/model/model_funnel_suggestion_response_data_attributes_actions_items.rs @@ -0,0 +1,103 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FunnelSuggestionResponseDataAttributesActionsItems { + #[serde(rename = "name")] + pub name: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FunnelSuggestionResponseDataAttributesActionsItems { + pub fn new() -> FunnelSuggestionResponseDataAttributesActionsItems { + FunnelSuggestionResponseDataAttributesActionsItems { + name: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for FunnelSuggestionResponseDataAttributesActionsItems { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for FunnelSuggestionResponseDataAttributesActionsItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FunnelSuggestionResponseDataAttributesActionsItemsVisitor; + impl<'a> Visitor<'a> for FunnelSuggestionResponseDataAttributesActionsItemsVisitor { + type Value = FunnelSuggestionResponseDataAttributesActionsItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut name: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = FunnelSuggestionResponseDataAttributesActionsItems { + name, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FunnelSuggestionResponseDataAttributesActionsItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_funnel_suggestion_response_data_attributes_views_items.rs b/src/datadogV2/model/model_funnel_suggestion_response_data_attributes_views_items.rs new file mode 100644 index 000000000..77c8d1206 --- /dev/null +++ b/src/datadogV2/model/model_funnel_suggestion_response_data_attributes_views_items.rs @@ -0,0 +1,103 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FunnelSuggestionResponseDataAttributesViewsItems { + #[serde(rename = "name")] + pub name: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FunnelSuggestionResponseDataAttributesViewsItems { + pub fn new() -> FunnelSuggestionResponseDataAttributesViewsItems { + FunnelSuggestionResponseDataAttributesViewsItems { + name: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for FunnelSuggestionResponseDataAttributesViewsItems { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for FunnelSuggestionResponseDataAttributesViewsItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FunnelSuggestionResponseDataAttributesViewsItemsVisitor; + impl<'a> Visitor<'a> for FunnelSuggestionResponseDataAttributesViewsItemsVisitor { + type Value = FunnelSuggestionResponseDataAttributesViewsItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut name: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = FunnelSuggestionResponseDataAttributesViewsItems { + name, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FunnelSuggestionResponseDataAttributesViewsItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_funnel_suggestion_response_data_type.rs b/src/datadogV2/model/model_funnel_suggestion_response_data_type.rs new file mode 100644 index 000000000..2a951373f --- /dev/null +++ b/src/datadogV2/model/model_funnel_suggestion_response_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum FunnelSuggestionResponseDataType { + FUNNEL_SUGGESTION_RESPONSE, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for FunnelSuggestionResponseDataType { + fn to_string(&self) -> String { + match self { + Self::FUNNEL_SUGGESTION_RESPONSE => String::from("funnel_suggestion_response"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for FunnelSuggestionResponseDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for FunnelSuggestionResponseDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "funnel_suggestion_response" => Self::FUNNEL_SUGGESTION_RESPONSE, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_get_cohort_request.rs b/src/datadogV2/model/model_get_cohort_request.rs new file mode 100644 index 000000000..fb7d02006 --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_request.rs @@ -0,0 +1,103 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortRequest { + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetCohortRequest { + pub fn new() -> GetCohortRequest { + GetCohortRequest { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::GetCohortRequestData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for GetCohortRequest { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for GetCohortRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortRequestVisitor; + impl<'a> Visitor<'a> for GetCohortRequestVisitor { + type Value = GetCohortRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = GetCohortRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetCohortRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_get_cohort_request_data.rs b/src/datadogV2/model/model_get_cohort_request_data.rs new file mode 100644 index 000000000..7f82de8b0 --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_request_data.rs @@ -0,0 +1,135 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortRequestData { + #[serde(rename = "attributes")] + pub attributes: Option, + #[serde(rename = "id")] + pub id: Option, + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::GetCohortRequestDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetCohortRequestData { + pub fn new(type_: crate::datadogV2::model::GetCohortRequestDataType) -> GetCohortRequestData { + GetCohortRequestData { + attributes: None, + id: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::GetCohortRequestDataAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for GetCohortRequestData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortRequestDataVisitor; + impl<'a> Visitor<'a> for GetCohortRequestDataVisitor { + type Value = GetCohortRequestData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::GetCohortRequestDataAttributes, + > = None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::GetCohortRequestDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = GetCohortRequestData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetCohortRequestDataVisitor) + } +} diff --git a/src/datadogV2/model/model_get_cohort_request_data_attributes.rs b/src/datadogV2/model/model_get_cohort_request_data_attributes.rs new file mode 100644 index 000000000..bb4fad35f --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_request_data_attributes.rs @@ -0,0 +1,195 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortRequestDataAttributes { + #[serde(rename = "data_source")] + pub data_source: Option, + #[serde(rename = "definition")] + pub definition: Option, + #[serde(rename = "enforced_execution_type")] + pub enforced_execution_type: Option, + #[serde(rename = "request_id")] + pub request_id: Option, + #[serde(rename = "time")] + pub time: Option, + #[serde(rename = "window_size")] + pub window_size: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetCohortRequestDataAttributes { + pub fn new() -> GetCohortRequestDataAttributes { + GetCohortRequestDataAttributes { + data_source: None, + definition: None, + enforced_execution_type: None, + request_id: None, + time: None, + window_size: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data_source(mut self, value: String) -> Self { + self.data_source = Some(value); + self + } + + pub fn definition( + mut self, + value: crate::datadogV2::model::GetCohortRequestDataAttributesDefinition, + ) -> Self { + self.definition = Some(value); + self + } + + pub fn enforced_execution_type(mut self, value: String) -> Self { + self.enforced_execution_type = Some(value); + self + } + + pub fn request_id(mut self, value: String) -> Self { + self.request_id = Some(value); + self + } + + pub fn time( + mut self, + value: crate::datadogV2::model::GetCohortRequestDataAttributesTime, + ) -> Self { + self.time = Some(value); + self + } + + pub fn window_size(mut self, value: String) -> Self { + self.window_size = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for GetCohortRequestDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for GetCohortRequestDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortRequestDataAttributesVisitor; + impl<'a> Visitor<'a> for GetCohortRequestDataAttributesVisitor { + type Value = GetCohortRequestDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data_source: Option = None; + let mut definition: Option< + crate::datadogV2::model::GetCohortRequestDataAttributesDefinition, + > = None; + let mut enforced_execution_type: Option = None; + let mut request_id: Option = None; + let mut time: Option = + None; + let mut window_size: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data_source" => { + if v.is_null() { + continue; + } + data_source = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "definition" => { + if v.is_null() { + continue; + } + definition = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "enforced_execution_type" => { + if v.is_null() { + continue; + } + enforced_execution_type = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "request_id" => { + if v.is_null() { + continue; + } + request_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "time" => { + if v.is_null() { + continue; + } + time = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "window_size" => { + if v.is_null() { + continue; + } + window_size = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = GetCohortRequestDataAttributes { + data_source, + definition, + enforced_execution_type, + request_id, + time, + window_size, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetCohortRequestDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_get_cohort_request_data_attributes_definition.rs b/src/datadogV2/model/model_get_cohort_request_data_attributes_definition.rs new file mode 100644 index 000000000..19ea4402b --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_request_data_attributes_definition.rs @@ -0,0 +1,158 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortRequestDataAttributesDefinition { + #[serde(rename = "audience_filters")] + pub audience_filters: + Option, + #[serde(rename = "inclusion_search")] + pub inclusion_search: Option, + #[serde(rename = "return_search")] + pub return_search: Option, + #[serde(rename = "segment_id")] + pub segment_id: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetCohortRequestDataAttributesDefinition { + pub fn new() -> GetCohortRequestDataAttributesDefinition { + GetCohortRequestDataAttributesDefinition { + audience_filters: None, + inclusion_search: None, + return_search: None, + segment_id: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn audience_filters( + mut self, + value: crate::datadogV2::model::GetCohortRequestDataAttributesDefinitionAudienceFilters, + ) -> Self { + self.audience_filters = Some(value); + self + } + + pub fn inclusion_search(mut self, value: String) -> Self { + self.inclusion_search = Some(value); + self + } + + pub fn return_search(mut self, value: String) -> Self { + self.return_search = Some(value); + self + } + + pub fn segment_id(mut self, value: String) -> Self { + self.segment_id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for GetCohortRequestDataAttributesDefinition { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for GetCohortRequestDataAttributesDefinition { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortRequestDataAttributesDefinitionVisitor; + impl<'a> Visitor<'a> for GetCohortRequestDataAttributesDefinitionVisitor { + type Value = GetCohortRequestDataAttributesDefinition; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut audience_filters: Option = None; + let mut inclusion_search: Option = None; + let mut return_search: Option = None; + let mut segment_id: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "audience_filters" => { + if v.is_null() { + continue; + } + audience_filters = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "inclusion_search" => { + if v.is_null() { + continue; + } + inclusion_search = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "return_search" => { + if v.is_null() { + continue; + } + return_search = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "segment_id" => { + if v.is_null() { + continue; + } + segment_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = GetCohortRequestDataAttributesDefinition { + audience_filters, + inclusion_search, + return_search, + segment_id, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetCohortRequestDataAttributesDefinitionVisitor) + } +} diff --git a/src/datadogV2/model/model_get_cohort_request_data_attributes_definition_audience_filters.rs b/src/datadogV2/model/model_get_cohort_request_data_attributes_definition_audience_filters.rs new file mode 100644 index 000000000..41b839451 --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_request_data_attributes_definition_audience_filters.rs @@ -0,0 +1,160 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortRequestDataAttributesDefinitionAudienceFilters { + #[serde(rename = "accounts")] + pub accounts: Option>, + #[serde(rename = "formula")] + pub formula: Option, + #[serde(rename = "segments")] + pub segments: Option>, + #[serde(rename = "users")] + pub users: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool +} + +impl GetCohortRequestDataAttributesDefinitionAudienceFilters { + pub fn new() -> GetCohortRequestDataAttributesDefinitionAudienceFilters { + GetCohortRequestDataAttributesDefinitionAudienceFilters { + accounts: None, + formula: None, + segments: None, + users: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn accounts( + mut self, + value: Vec, + ) -> Self { + self.accounts = Some(value); + self + } + + pub fn formula(mut self, value: String) -> Self { + self.formula = Some(value); + self + } + + pub fn segments( + mut self, + value: Vec, + ) -> Self { + self.segments = Some(value); + self + } + + pub fn users( + mut self, + value: Vec, + ) -> Self { + self.users = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for GetCohortRequestDataAttributesDefinitionAudienceFilters { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for GetCohortRequestDataAttributesDefinitionAudienceFilters { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortRequestDataAttributesDefinitionAudienceFiltersVisitor; + impl<'a> Visitor<'a> for GetCohortRequestDataAttributesDefinitionAudienceFiltersVisitor { + type Value = GetCohortRequestDataAttributesDefinitionAudienceFilters; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut accounts: Option> = None; + let mut formula: Option = None; + let mut segments: Option> = None; + let mut users: Option> = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "accounts" => { + if v.is_null() { + continue; + } + accounts = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "formula" => { + if v.is_null() { + continue; + } + formula = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "segments" => { + if v.is_null() { + continue; + } + segments = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "users" => { + if v.is_null() { + continue; + } + users = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = GetCohortRequestDataAttributesDefinitionAudienceFilters { + accounts, + formula, + segments, + users, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetCohortRequestDataAttributesDefinitionAudienceFiltersVisitor) + } +} diff --git a/src/datadogV2/model/model_get_cohort_request_data_attributes_definition_audience_filters_accounts_items.rs b/src/datadogV2/model/model_get_cohort_request_data_attributes_definition_audience_filters_accounts_items.rs new file mode 100644 index 000000000..02bbeccae --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_request_data_attributes_definition_audience_filters_accounts_items.rs @@ -0,0 +1,115 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems { + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "query")] + pub query: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems { + pub fn new( + name: String, + ) -> GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems { + GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems { + name, + query: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn query(mut self, value: String) -> Self { + self.query = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> + for GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems +{ + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItemsVisitor; + impl<'a> Visitor<'a> + for GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItemsVisitor + { + type Value = GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut name: Option = None; + let mut query: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "query" => { + if v.is_null() { + continue; + } + query = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + + let content = + GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItems { + name, + query, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any( + GetCohortRequestDataAttributesDefinitionAudienceFiltersAccountsItemsVisitor, + ) + } +} diff --git a/src/datadogV2/model/model_get_cohort_request_data_attributes_definition_audience_filters_segments_items.rs b/src/datadogV2/model/model_get_cohort_request_data_attributes_definition_audience_filters_segments_items.rs new file mode 100644 index 000000000..477250821 --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_request_data_attributes_definition_audience_filters_segments_items.rs @@ -0,0 +1,109 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems { + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "segment_id")] + pub segment_id: String, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems { + pub fn new( + name: String, + segment_id: String, + ) -> GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems { + GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems { + name, + segment_id, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> + for GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems +{ + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItemsVisitor; + impl<'a> Visitor<'a> + for GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItemsVisitor + { + type Value = GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut name: Option = None; + let mut segment_id: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "segment_id" => { + segment_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + let segment_id = segment_id.ok_or_else(|| M::Error::missing_field("segment_id"))?; + + let content = + GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItems { + name, + segment_id, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any( + GetCohortRequestDataAttributesDefinitionAudienceFiltersSegmentsItemsVisitor, + ) + } +} diff --git a/src/datadogV2/model/model_get_cohort_request_data_attributes_definition_audience_filters_users_items.rs b/src/datadogV2/model/model_get_cohort_request_data_attributes_definition_audience_filters_users_items.rs new file mode 100644 index 000000000..0c99ff461 --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_request_data_attributes_definition_audience_filters_users_items.rs @@ -0,0 +1,108 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems { + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "query")] + pub query: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems { + pub fn new(name: String) -> GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems { + GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems { + name, + query: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn query(mut self, value: String) -> Self { + self.query = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItemsVisitor; + impl<'a> Visitor<'a> for GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItemsVisitor { + type Value = GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut name: Option = None; + let mut query: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "query" => { + if v.is_null() { + continue; + } + query = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + + let content = GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItems { + name, + query, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any( + GetCohortRequestDataAttributesDefinitionAudienceFiltersUsersItemsVisitor, + ) + } +} diff --git a/src/datadogV2/model/model_get_cohort_request_data_attributes_time.rs b/src/datadogV2/model/model_get_cohort_request_data_attributes_time.rs new file mode 100644 index 000000000..9a638fa1d --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_request_data_attributes_time.rs @@ -0,0 +1,119 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortRequestDataAttributesTime { + #[serde(rename = "from")] + pub from: Option, + #[serde(rename = "to")] + pub to: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetCohortRequestDataAttributesTime { + pub fn new() -> GetCohortRequestDataAttributesTime { + GetCohortRequestDataAttributesTime { + from: None, + to: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn from(mut self, value: i64) -> Self { + self.from = Some(value); + self + } + + pub fn to(mut self, value: i64) -> Self { + self.to = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for GetCohortRequestDataAttributesTime { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for GetCohortRequestDataAttributesTime { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortRequestDataAttributesTimeVisitor; + impl<'a> Visitor<'a> for GetCohortRequestDataAttributesTimeVisitor { + type Value = GetCohortRequestDataAttributesTime; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut from: Option = None; + let mut to: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "from" => { + if v.is_null() { + continue; + } + from = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "to" => { + if v.is_null() { + continue; + } + to = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = GetCohortRequestDataAttributesTime { + from, + to, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetCohortRequestDataAttributesTimeVisitor) + } +} diff --git a/src/datadogV2/model/model_get_cohort_request_data_type.rs b/src/datadogV2/model/model_get_cohort_request_data_type.rs new file mode 100644 index 000000000..55e6c515e --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_request_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum GetCohortRequestDataType { + COHORT_REQUEST, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for GetCohortRequestDataType { + fn to_string(&self) -> String { + match self { + Self::COHORT_REQUEST => String::from("cohort_request"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for GetCohortRequestDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for GetCohortRequestDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "cohort_request" => Self::COHORT_REQUEST, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_get_cohort_response.rs b/src/datadogV2/model/model_get_cohort_response.rs new file mode 100644 index 000000000..77be61a41 --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_response.rs @@ -0,0 +1,103 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortResponse { + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetCohortResponse { + pub fn new() -> GetCohortResponse { + GetCohortResponse { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::GetCohortResponseData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for GetCohortResponse { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for GetCohortResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortResponseVisitor; + impl<'a> Visitor<'a> for GetCohortResponseVisitor { + type Value = GetCohortResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = GetCohortResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetCohortResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_get_cohort_response_data.rs b/src/datadogV2/model/model_get_cohort_response_data.rs new file mode 100644 index 000000000..9f0a69ae1 --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_response_data.rs @@ -0,0 +1,135 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortResponseData { + #[serde(rename = "attributes")] + pub attributes: Option, + #[serde(rename = "id")] + pub id: Option, + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::GetCohortResponseDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetCohortResponseData { + pub fn new(type_: crate::datadogV2::model::GetCohortResponseDataType) -> GetCohortResponseData { + GetCohortResponseData { + attributes: None, + id: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::GetCohortResponseDataAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for GetCohortResponseData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortResponseDataVisitor; + impl<'a> Visitor<'a> for GetCohortResponseDataVisitor { + type Value = GetCohortResponseData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::GetCohortResponseDataAttributes, + > = None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::GetCohortResponseDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = GetCohortResponseData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetCohortResponseDataVisitor) + } +} diff --git a/src/datadogV2/model/model_get_cohort_response_data_attributes.rs b/src/datadogV2/model/model_get_cohort_response_data_attributes.rs new file mode 100644 index 000000000..c93de3ea2 --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_response_data_attributes.rs @@ -0,0 +1,108 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortResponseDataAttributes { + #[serde(rename = "cohorts")] + pub cohorts: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetCohortResponseDataAttributes { + pub fn new() -> GetCohortResponseDataAttributes { + GetCohortResponseDataAttributes { + cohorts: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn cohorts( + mut self, + value: Vec, + ) -> Self { + self.cohorts = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for GetCohortResponseDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for GetCohortResponseDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortResponseDataAttributesVisitor; + impl<'a> Visitor<'a> for GetCohortResponseDataAttributesVisitor { + type Value = GetCohortResponseDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut cohorts: Option< + Vec, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "cohorts" => { + if v.is_null() { + continue; + } + cohorts = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = GetCohortResponseDataAttributes { + cohorts, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetCohortResponseDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_get_cohort_response_data_attributes_cohorts_items.rs b/src/datadogV2/model/model_get_cohort_response_data_attributes_cohorts_items.rs new file mode 100644 index 000000000..afce8b3a9 --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_response_data_attributes_cohorts_items.rs @@ -0,0 +1,157 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortResponseDataAttributesCohortsItems { + #[serde(rename = "cohort")] + pub cohort: Option, + #[serde(rename = "cohort_size")] + pub cohort_size: Option, + #[serde(rename = "start_time")] + pub start_time: Option, + #[serde(rename = "values")] + pub values: Option< + Vec, + >, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetCohortResponseDataAttributesCohortsItems { + pub fn new() -> GetCohortResponseDataAttributesCohortsItems { + GetCohortResponseDataAttributesCohortsItems { + cohort: None, + cohort_size: None, + start_time: None, + values: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn cohort(mut self, value: String) -> Self { + self.cohort = Some(value); + self + } + + pub fn cohort_size(mut self, value: i64) -> Self { + self.cohort_size = Some(value); + self + } + + pub fn start_time(mut self, value: i64) -> Self { + self.start_time = Some(value); + self + } + + pub fn values( + mut self, + value: Vec, + ) -> Self { + self.values = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for GetCohortResponseDataAttributesCohortsItems { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for GetCohortResponseDataAttributesCohortsItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortResponseDataAttributesCohortsItemsVisitor; + impl<'a> Visitor<'a> for GetCohortResponseDataAttributesCohortsItemsVisitor { + type Value = GetCohortResponseDataAttributesCohortsItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut cohort: Option = None; + let mut cohort_size: Option = None; + let mut start_time: Option = None; + let mut values: Option> = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "cohort" => { + if v.is_null() { + continue; + } + cohort = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "cohort_size" => { + if v.is_null() { + continue; + } + cohort_size = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "start_time" => { + if v.is_null() { + continue; + } + start_time = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "values" => { + if v.is_null() { + continue; + } + values = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = GetCohortResponseDataAttributesCohortsItems { + cohort, + cohort_size, + start_time, + values, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetCohortResponseDataAttributesCohortsItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_get_cohort_response_data_attributes_cohorts_items_values_items.rs b/src/datadogV2/model/model_get_cohort_response_data_attributes_cohorts_items_values_items.rs new file mode 100644 index 000000000..2e7e75291 --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_response_data_attributes_cohorts_items_values_items.rs @@ -0,0 +1,169 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortResponseDataAttributesCohortsItemsValuesItems { + #[serde(rename = "absolute_value")] + pub absolute_value: Option, + #[serde(rename = "end_time")] + pub end_time: Option, + #[serde(rename = "relative_value")] + pub relative_value: Option, + #[serde(rename = "start_time")] + pub start_time: Option, + #[serde(rename = "window")] + pub window: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetCohortResponseDataAttributesCohortsItemsValuesItems { + pub fn new() -> GetCohortResponseDataAttributesCohortsItemsValuesItems { + GetCohortResponseDataAttributesCohortsItemsValuesItems { + absolute_value: None, + end_time: None, + relative_value: None, + start_time: None, + window: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn absolute_value(mut self, value: i64) -> Self { + self.absolute_value = Some(value); + self + } + + pub fn end_time(mut self, value: i64) -> Self { + self.end_time = Some(value); + self + } + + pub fn relative_value(mut self, value: f64) -> Self { + self.relative_value = Some(value); + self + } + + pub fn start_time(mut self, value: i64) -> Self { + self.start_time = Some(value); + self + } + + pub fn window(mut self, value: i64) -> Self { + self.window = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for GetCohortResponseDataAttributesCohortsItemsValuesItems { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for GetCohortResponseDataAttributesCohortsItemsValuesItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortResponseDataAttributesCohortsItemsValuesItemsVisitor; + impl<'a> Visitor<'a> for GetCohortResponseDataAttributesCohortsItemsValuesItemsVisitor { + type Value = GetCohortResponseDataAttributesCohortsItemsValuesItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut absolute_value: Option = None; + let mut end_time: Option = None; + let mut relative_value: Option = None; + let mut start_time: Option = None; + let mut window: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "absolute_value" => { + if v.is_null() { + continue; + } + absolute_value = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "end_time" => { + if v.is_null() { + continue; + } + end_time = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "relative_value" => { + if v.is_null() { + continue; + } + relative_value = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "start_time" => { + if v.is_null() { + continue; + } + start_time = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "window" => { + if v.is_null() { + continue; + } + window = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = GetCohortResponseDataAttributesCohortsItemsValuesItems { + absolute_value, + end_time, + relative_value, + start_time, + window, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetCohortResponseDataAttributesCohortsItemsValuesItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_get_cohort_response_data_type.rs b/src/datadogV2/model/model_get_cohort_response_data_type.rs new file mode 100644 index 000000000..d4c4bddfa --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_response_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum GetCohortResponseDataType { + COHORT_RESPONSE, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for GetCohortResponseDataType { + fn to_string(&self) -> String { + match self { + Self::COHORT_RESPONSE => String::from("cohort_response"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for GetCohortResponseDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for GetCohortResponseDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "cohort_response" => Self::COHORT_RESPONSE, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_get_cohort_users_request.rs b/src/datadogV2/model/model_get_cohort_users_request.rs new file mode 100644 index 000000000..989b86d80 --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_users_request.rs @@ -0,0 +1,103 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortUsersRequest { + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetCohortUsersRequest { + pub fn new() -> GetCohortUsersRequest { + GetCohortUsersRequest { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::GetCohortUsersRequestData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for GetCohortUsersRequest { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for GetCohortUsersRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortUsersRequestVisitor; + impl<'a> Visitor<'a> for GetCohortUsersRequestVisitor { + type Value = GetCohortUsersRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = GetCohortUsersRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetCohortUsersRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_get_cohort_users_request_data.rs b/src/datadogV2/model/model_get_cohort_users_request_data.rs new file mode 100644 index 000000000..316848726 --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_users_request_data.rs @@ -0,0 +1,138 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortUsersRequestData { + #[serde(rename = "attributes")] + pub attributes: Option, + #[serde(rename = "id")] + pub id: Option, + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::GetCohortUsersRequestDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetCohortUsersRequestData { + pub fn new( + type_: crate::datadogV2::model::GetCohortUsersRequestDataType, + ) -> GetCohortUsersRequestData { + GetCohortUsersRequestData { + attributes: None, + id: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::GetCohortUsersRequestDataAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for GetCohortUsersRequestData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortUsersRequestDataVisitor; + impl<'a> Visitor<'a> for GetCohortUsersRequestDataVisitor { + type Value = GetCohortUsersRequestData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::GetCohortUsersRequestDataAttributes, + > = None; + let mut id: Option = None; + let mut type_: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::GetCohortUsersRequestDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = GetCohortUsersRequestData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetCohortUsersRequestDataVisitor) + } +} diff --git a/src/datadogV2/model/model_get_cohort_users_request_data_attributes.rs b/src/datadogV2/model/model_get_cohort_users_request_data_attributes.rs new file mode 100644 index 000000000..1eef669c5 --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_users_request_data_attributes.rs @@ -0,0 +1,196 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortUsersRequestDataAttributes { + #[serde(rename = "data_source")] + pub data_source: Option, + #[serde(rename = "definition")] + pub definition: Option, + #[serde(rename = "execution")] + pub execution: Option, + #[serde(rename = "time")] + pub time: Option, + #[serde(rename = "user_selection")] + pub user_selection: Option, + #[serde(rename = "window_size")] + pub window_size: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetCohortUsersRequestDataAttributes { + pub fn new() -> GetCohortUsersRequestDataAttributes { + GetCohortUsersRequestDataAttributes { + data_source: None, + definition: None, + execution: None, + time: None, + user_selection: None, + window_size: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data_source(mut self, value: String) -> Self { + self.data_source = Some(value); + self + } + + pub fn definition( + mut self, + value: crate::datadogV2::model::GetCohortUsersRequestDataAttributesDefinition, + ) -> Self { + self.definition = Some(value); + self + } + + pub fn execution(mut self, value: i64) -> Self { + self.execution = Some(value); + self + } + + pub fn time( + mut self, + value: crate::datadogV2::model::GetCohortUsersRequestDataAttributesTime, + ) -> Self { + self.time = Some(value); + self + } + + pub fn user_selection(mut self, value: String) -> Self { + self.user_selection = Some(value); + self + } + + pub fn window_size(mut self, value: String) -> Self { + self.window_size = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for GetCohortUsersRequestDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for GetCohortUsersRequestDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortUsersRequestDataAttributesVisitor; + impl<'a> Visitor<'a> for GetCohortUsersRequestDataAttributesVisitor { + type Value = GetCohortUsersRequestDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data_source: Option = None; + let mut definition: Option< + crate::datadogV2::model::GetCohortUsersRequestDataAttributesDefinition, + > = None; + let mut execution: Option = None; + let mut time: Option< + crate::datadogV2::model::GetCohortUsersRequestDataAttributesTime, + > = None; + let mut user_selection: Option = None; + let mut window_size: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data_source" => { + if v.is_null() { + continue; + } + data_source = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "definition" => { + if v.is_null() { + continue; + } + definition = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "execution" => { + if v.is_null() { + continue; + } + execution = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "time" => { + if v.is_null() { + continue; + } + time = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_selection" => { + if v.is_null() { + continue; + } + user_selection = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "window_size" => { + if v.is_null() { + continue; + } + window_size = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = GetCohortUsersRequestDataAttributes { + data_source, + definition, + execution, + time, + user_selection, + window_size, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetCohortUsersRequestDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_get_cohort_users_request_data_attributes_definition.rs b/src/datadogV2/model/model_get_cohort_users_request_data_attributes_definition.rs new file mode 100644 index 000000000..5f288139b --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_users_request_data_attributes_definition.rs @@ -0,0 +1,191 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortUsersRequestDataAttributesDefinition { + #[serde(rename = "audience_filters")] + pub audience_filters: Option< + crate::datadogV2::model::GetCohortUsersRequestDataAttributesDefinitionAudienceFilters, + >, + #[serde(rename = "cohort")] + pub cohort: Option, + #[serde(rename = "inclusion_search")] + pub inclusion_search: Option, + #[serde(rename = "return_search")] + pub return_search: Option, + #[serde(rename = "segment_id")] + pub segment_id: Option, + #[serde(rename = "window")] + pub window: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetCohortUsersRequestDataAttributesDefinition { + pub fn new() -> GetCohortUsersRequestDataAttributesDefinition { + GetCohortUsersRequestDataAttributesDefinition { + audience_filters: None, + cohort: None, + inclusion_search: None, + return_search: None, + segment_id: None, + window: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn audience_filters( + mut self, + value: crate::datadogV2::model::GetCohortUsersRequestDataAttributesDefinitionAudienceFilters, + ) -> Self { + self.audience_filters = Some(value); + self + } + + pub fn cohort(mut self, value: String) -> Self { + self.cohort = Some(value); + self + } + + pub fn inclusion_search(mut self, value: String) -> Self { + self.inclusion_search = Some(value); + self + } + + pub fn return_search(mut self, value: String) -> Self { + self.return_search = Some(value); + self + } + + pub fn segment_id(mut self, value: String) -> Self { + self.segment_id = Some(value); + self + } + + pub fn window(mut self, value: i64) -> Self { + self.window = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for GetCohortUsersRequestDataAttributesDefinition { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for GetCohortUsersRequestDataAttributesDefinition { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortUsersRequestDataAttributesDefinitionVisitor; + impl<'a> Visitor<'a> for GetCohortUsersRequestDataAttributesDefinitionVisitor { + type Value = GetCohortUsersRequestDataAttributesDefinition; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut audience_filters: Option = None; + let mut cohort: Option = None; + let mut inclusion_search: Option = None; + let mut return_search: Option = None; + let mut segment_id: Option = None; + let mut window: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "audience_filters" => { + if v.is_null() { + continue; + } + audience_filters = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "cohort" => { + if v.is_null() { + continue; + } + cohort = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "inclusion_search" => { + if v.is_null() { + continue; + } + inclusion_search = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "return_search" => { + if v.is_null() { + continue; + } + return_search = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "segment_id" => { + if v.is_null() { + continue; + } + segment_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "window" => { + if v.is_null() { + continue; + } + window = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = GetCohortUsersRequestDataAttributesDefinition { + audience_filters, + cohort, + inclusion_search, + return_search, + segment_id, + window, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetCohortUsersRequestDataAttributesDefinitionVisitor) + } +} diff --git a/src/datadogV2/model/model_get_cohort_users_request_data_attributes_definition_audience_filters.rs b/src/datadogV2/model/model_get_cohort_users_request_data_attributes_definition_audience_filters.rs new file mode 100644 index 000000000..82dd77c71 --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_users_request_data_attributes_definition_audience_filters.rs @@ -0,0 +1,161 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortUsersRequestDataAttributesDefinitionAudienceFilters { + #[serde(rename = "accounts")] + pub accounts: Option>, + #[serde(rename = "formula")] + pub formula: Option, + #[serde(rename = "segments")] + pub segments: Option>, + #[serde(rename = "users")] + pub users: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool +} + +impl GetCohortUsersRequestDataAttributesDefinitionAudienceFilters { + pub fn new() -> GetCohortUsersRequestDataAttributesDefinitionAudienceFilters { + GetCohortUsersRequestDataAttributesDefinitionAudienceFilters { + accounts: None, + formula: None, + segments: None, + users: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn accounts( + mut self, + value: Vec, + ) -> Self { + self.accounts = Some(value); + self + } + + pub fn formula(mut self, value: String) -> Self { + self.formula = Some(value); + self + } + + pub fn segments( + mut self, + value: Vec, + ) -> Self { + self.segments = Some(value); + self + } + + pub fn users( + mut self, + value: Vec, + ) -> Self { + self.users = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for GetCohortUsersRequestDataAttributesDefinitionAudienceFilters { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for GetCohortUsersRequestDataAttributesDefinitionAudienceFilters { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersVisitor; + impl<'a> Visitor<'a> for GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersVisitor { + type Value = GetCohortUsersRequestDataAttributesDefinitionAudienceFilters; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut accounts: Option> = None; + let mut formula: Option = None; + let mut segments: Option> = None; + let mut users: Option> = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "accounts" => { + if v.is_null() { + continue; + } + accounts = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "formula" => { + if v.is_null() { + continue; + } + formula = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "segments" => { + if v.is_null() { + continue; + } + segments = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "users" => { + if v.is_null() { + continue; + } + users = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = GetCohortUsersRequestDataAttributesDefinitionAudienceFilters { + accounts, + formula, + segments, + users, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer + .deserialize_any(GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersVisitor) + } +} diff --git a/src/datadogV2/model/model_get_cohort_users_request_data_attributes_definition_audience_filters_accounts_items.rs b/src/datadogV2/model/model_get_cohort_users_request_data_attributes_definition_audience_filters_accounts_items.rs new file mode 100644 index 000000000..fbe89b125 --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_users_request_data_attributes_definition_audience_filters_accounts_items.rs @@ -0,0 +1,115 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems { + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "query")] + pub query: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems { + pub fn new( + name: String, + ) -> GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems { + GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems { + name, + query: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn query(mut self, value: String) -> Self { + self.query = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> + for GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems +{ + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItemsVisitor; + impl<'a> Visitor<'a> + for GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItemsVisitor + { + type Value = GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut name: Option = None; + let mut query: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "query" => { + if v.is_null() { + continue; + } + query = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + + let content = + GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems { + name, + query, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any( + GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItemsVisitor, + ) + } +} diff --git a/src/datadogV2/model/model_get_cohort_users_request_data_attributes_definition_audience_filters_segments_items.rs b/src/datadogV2/model/model_get_cohort_users_request_data_attributes_definition_audience_filters_segments_items.rs new file mode 100644 index 000000000..6aa3b771e --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_users_request_data_attributes_definition_audience_filters_segments_items.rs @@ -0,0 +1,109 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems { + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "segment_id")] + pub segment_id: String, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems { + pub fn new( + name: String, + segment_id: String, + ) -> GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems { + GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems { + name, + segment_id, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> + for GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems +{ + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItemsVisitor; + impl<'a> Visitor<'a> + for GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItemsVisitor + { + type Value = GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut name: Option = None; + let mut segment_id: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "segment_id" => { + segment_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + let segment_id = segment_id.ok_or_else(|| M::Error::missing_field("segment_id"))?; + + let content = + GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems { + name, + segment_id, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any( + GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItemsVisitor, + ) + } +} diff --git a/src/datadogV2/model/model_get_cohort_users_request_data_attributes_definition_audience_filters_users_items.rs b/src/datadogV2/model/model_get_cohort_users_request_data_attributes_definition_audience_filters_users_items.rs new file mode 100644 index 000000000..88c145dd8 --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_users_request_data_attributes_definition_audience_filters_users_items.rs @@ -0,0 +1,115 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems { + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "query")] + pub query: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems { + pub fn new( + name: String, + ) -> GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems { + GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems { + name, + query: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn query(mut self, value: String) -> Self { + self.query = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> + for GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems +{ + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItemsVisitor; + impl<'a> Visitor<'a> + for GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItemsVisitor + { + type Value = GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut name: Option = None; + let mut query: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "query" => { + if v.is_null() { + continue; + } + query = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + + let content = + GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems { + name, + query, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any( + GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItemsVisitor, + ) + } +} diff --git a/src/datadogV2/model/model_get_cohort_users_request_data_attributes_time.rs b/src/datadogV2/model/model_get_cohort_users_request_data_attributes_time.rs new file mode 100644 index 000000000..278fbb1d9 --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_users_request_data_attributes_time.rs @@ -0,0 +1,119 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortUsersRequestDataAttributesTime { + #[serde(rename = "from")] + pub from: Option, + #[serde(rename = "to")] + pub to: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetCohortUsersRequestDataAttributesTime { + pub fn new() -> GetCohortUsersRequestDataAttributesTime { + GetCohortUsersRequestDataAttributesTime { + from: None, + to: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn from(mut self, value: i64) -> Self { + self.from = Some(value); + self + } + + pub fn to(mut self, value: i64) -> Self { + self.to = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for GetCohortUsersRequestDataAttributesTime { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for GetCohortUsersRequestDataAttributesTime { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortUsersRequestDataAttributesTimeVisitor; + impl<'a> Visitor<'a> for GetCohortUsersRequestDataAttributesTimeVisitor { + type Value = GetCohortUsersRequestDataAttributesTime; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut from: Option = None; + let mut to: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "from" => { + if v.is_null() { + continue; + } + from = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "to" => { + if v.is_null() { + continue; + } + to = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = GetCohortUsersRequestDataAttributesTime { + from, + to, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetCohortUsersRequestDataAttributesTimeVisitor) + } +} diff --git a/src/datadogV2/model/model_get_cohort_users_request_data_type.rs b/src/datadogV2/model/model_get_cohort_users_request_data_type.rs new file mode 100644 index 000000000..bc472c3ce --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_users_request_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum GetCohortUsersRequestDataType { + COHORT_USERS_REQUEST, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for GetCohortUsersRequestDataType { + fn to_string(&self) -> String { + match self { + Self::COHORT_USERS_REQUEST => String::from("cohort_users_request"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for GetCohortUsersRequestDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for GetCohortUsersRequestDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "cohort_users_request" => Self::COHORT_USERS_REQUEST, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_get_cohort_users_response.rs b/src/datadogV2/model/model_get_cohort_users_response.rs new file mode 100644 index 000000000..c11ed8f3b --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_users_response.rs @@ -0,0 +1,103 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortUsersResponse { + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetCohortUsersResponse { + pub fn new() -> GetCohortUsersResponse { + GetCohortUsersResponse { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::GetCohortUsersResponseData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for GetCohortUsersResponse { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for GetCohortUsersResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortUsersResponseVisitor; + impl<'a> Visitor<'a> for GetCohortUsersResponseVisitor { + type Value = GetCohortUsersResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = GetCohortUsersResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetCohortUsersResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_get_cohort_users_response_data.rs b/src/datadogV2/model/model_get_cohort_users_response_data.rs new file mode 100644 index 000000000..5778fb297 --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_users_response_data.rs @@ -0,0 +1,138 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortUsersResponseData { + #[serde(rename = "attributes")] + pub attributes: Option, + #[serde(rename = "id")] + pub id: Option, + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::GetCohortUsersResponseDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetCohortUsersResponseData { + pub fn new( + type_: crate::datadogV2::model::GetCohortUsersResponseDataType, + ) -> GetCohortUsersResponseData { + GetCohortUsersResponseData { + attributes: None, + id: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::GetCohortUsersResponseDataAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for GetCohortUsersResponseData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortUsersResponseDataVisitor; + impl<'a> Visitor<'a> for GetCohortUsersResponseDataVisitor { + type Value = GetCohortUsersResponseData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::GetCohortUsersResponseDataAttributes, + > = None; + let mut id: Option = None; + let mut type_: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::GetCohortUsersResponseDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = GetCohortUsersResponseData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetCohortUsersResponseDataVisitor) + } +} diff --git a/src/datadogV2/model/model_get_cohort_users_response_data_attributes.rs b/src/datadogV2/model/model_get_cohort_users_response_data_attributes.rs new file mode 100644 index 000000000..ab6e25db0 --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_users_response_data_attributes.rs @@ -0,0 +1,108 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortUsersResponseDataAttributes { + #[serde(rename = "users")] + pub users: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetCohortUsersResponseDataAttributes { + pub fn new() -> GetCohortUsersResponseDataAttributes { + GetCohortUsersResponseDataAttributes { + users: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn users( + mut self, + value: Vec, + ) -> Self { + self.users = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for GetCohortUsersResponseDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for GetCohortUsersResponseDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortUsersResponseDataAttributesVisitor; + impl<'a> Visitor<'a> for GetCohortUsersResponseDataAttributesVisitor { + type Value = GetCohortUsersResponseDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut users: Option< + Vec, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "users" => { + if v.is_null() { + continue; + } + users = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = GetCohortUsersResponseDataAttributes { + users, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetCohortUsersResponseDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_get_cohort_users_response_data_attributes_users_items.rs b/src/datadogV2/model/model_get_cohort_users_response_data_attributes_users_items.rs new file mode 100644 index 000000000..86580e6ca --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_users_response_data_attributes_users_items.rs @@ -0,0 +1,135 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetCohortUsersResponseDataAttributesUsersItems { + #[serde(rename = "email")] + pub email: Option, + #[serde(rename = "id")] + pub id: Option, + #[serde(rename = "name")] + pub name: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetCohortUsersResponseDataAttributesUsersItems { + pub fn new() -> GetCohortUsersResponseDataAttributesUsersItems { + GetCohortUsersResponseDataAttributesUsersItems { + email: None, + id: None, + name: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn email(mut self, value: String) -> Self { + self.email = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for GetCohortUsersResponseDataAttributesUsersItems { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for GetCohortUsersResponseDataAttributesUsersItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetCohortUsersResponseDataAttributesUsersItemsVisitor; + impl<'a> Visitor<'a> for GetCohortUsersResponseDataAttributesUsersItemsVisitor { + type Value = GetCohortUsersResponseDataAttributesUsersItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut email: Option = None; + let mut id: Option = None; + let mut name: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "email" => { + if v.is_null() { + continue; + } + email = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = GetCohortUsersResponseDataAttributesUsersItems { + email, + id, + name, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetCohortUsersResponseDataAttributesUsersItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_get_cohort_users_response_data_type.rs b/src/datadogV2/model/model_get_cohort_users_response_data_type.rs new file mode 100644 index 000000000..3b5de446c --- /dev/null +++ b/src/datadogV2/model/model_get_cohort_users_response_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum GetCohortUsersResponseDataType { + COHORT_USERS_RESPONSE, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for GetCohortUsersResponseDataType { + fn to_string(&self) -> String { + match self { + Self::COHORT_USERS_RESPONSE => String::from("cohort_users_response"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for GetCohortUsersResponseDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for GetCohortUsersResponseDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "cohort_users_response" => Self::COHORT_USERS_RESPONSE, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_sankey_request.rs b/src/datadogV2/model/model_sankey_request.rs new file mode 100644 index 000000000..82a06d541 --- /dev/null +++ b/src/datadogV2/model/model_sankey_request.rs @@ -0,0 +1,103 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SankeyRequest { + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SankeyRequest { + pub fn new() -> SankeyRequest { + SankeyRequest { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::SankeyRequestData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for SankeyRequest { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for SankeyRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SankeyRequestVisitor; + impl<'a> Visitor<'a> for SankeyRequestVisitor { + type Value = SankeyRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = SankeyRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SankeyRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_sankey_request_data.rs b/src/datadogV2/model/model_sankey_request_data.rs new file mode 100644 index 000000000..94cdaf5d4 --- /dev/null +++ b/src/datadogV2/model/model_sankey_request_data.rs @@ -0,0 +1,134 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SankeyRequestData { + #[serde(rename = "attributes")] + pub attributes: Option, + #[serde(rename = "id")] + pub id: Option, + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::SankeyRequestDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SankeyRequestData { + pub fn new(type_: crate::datadogV2::model::SankeyRequestDataType) -> SankeyRequestData { + SankeyRequestData { + attributes: None, + id: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::SankeyRequestDataAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SankeyRequestData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SankeyRequestDataVisitor; + impl<'a> Visitor<'a> for SankeyRequestDataVisitor { + type Value = SankeyRequestData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option = + None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::SankeyRequestDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = SankeyRequestData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SankeyRequestDataVisitor) + } +} diff --git a/src/datadogV2/model/model_sankey_request_data_attributes.rs b/src/datadogV2/model/model_sankey_request_data_attributes.rs new file mode 100644 index 000000000..53e43ade5 --- /dev/null +++ b/src/datadogV2/model/model_sankey_request_data_attributes.rs @@ -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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SankeyRequestDataAttributes { + #[serde(rename = "data_source")] + pub data_source: Option, + #[serde(rename = "definition")] + pub definition: Option, + #[serde(rename = "enforced_execution_type")] + pub enforced_execution_type: Option, + #[serde(rename = "request_id")] + pub request_id: Option, + #[serde(rename = "sampling")] + pub sampling: Option, + #[serde(rename = "search")] + pub search: Option, + #[serde(rename = "time")] + pub time: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SankeyRequestDataAttributes { + pub fn new() -> SankeyRequestDataAttributes { + SankeyRequestDataAttributes { + data_source: None, + definition: None, + enforced_execution_type: None, + request_id: None, + sampling: None, + search: None, + time: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data_source(mut self, value: String) -> Self { + self.data_source = Some(value); + self + } + + pub fn definition( + mut self, + value: crate::datadogV2::model::SankeyRequestDataAttributesDefinition, + ) -> Self { + self.definition = Some(value); + self + } + + pub fn enforced_execution_type(mut self, value: String) -> Self { + self.enforced_execution_type = Some(value); + self + } + + pub fn request_id(mut self, value: String) -> Self { + self.request_id = Some(value); + self + } + + pub fn sampling( + mut self, + value: crate::datadogV2::model::SankeyRequestDataAttributesSampling, + ) -> Self { + self.sampling = Some(value); + self + } + + pub fn search( + mut self, + value: crate::datadogV2::model::SankeyRequestDataAttributesSearch, + ) -> Self { + self.search = Some(value); + self + } + + pub fn time(mut self, value: crate::datadogV2::model::SankeyRequestDataAttributesTime) -> Self { + self.time = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for SankeyRequestDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for SankeyRequestDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SankeyRequestDataAttributesVisitor; + impl<'a> Visitor<'a> for SankeyRequestDataAttributesVisitor { + type Value = SankeyRequestDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data_source: Option = None; + let mut definition: Option< + crate::datadogV2::model::SankeyRequestDataAttributesDefinition, + > = None; + let mut enforced_execution_type: Option = None; + let mut request_id: Option = None; + let mut sampling: Option< + crate::datadogV2::model::SankeyRequestDataAttributesSampling, + > = None; + let mut search: Option = + None; + let mut time: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data_source" => { + if v.is_null() { + continue; + } + data_source = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "definition" => { + if v.is_null() { + continue; + } + definition = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "enforced_execution_type" => { + if v.is_null() { + continue; + } + enforced_execution_type = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "request_id" => { + if v.is_null() { + continue; + } + request_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "sampling" => { + if v.is_null() { + continue; + } + sampling = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "search" => { + if v.is_null() { + continue; + } + search = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "time" => { + if v.is_null() { + continue; + } + time = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = SankeyRequestDataAttributes { + data_source, + definition, + enforced_execution_type, + request_id, + sampling, + search, + time, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SankeyRequestDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_sankey_request_data_attributes_definition.rs b/src/datadogV2/model/model_sankey_request_data_attributes_definition.rs new file mode 100644 index 000000000..2d523cd88 --- /dev/null +++ b/src/datadogV2/model/model_sankey_request_data_attributes_definition.rs @@ -0,0 +1,153 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SankeyRequestDataAttributesDefinition { + #[serde(rename = "entries_per_step")] + pub entries_per_step: Option, + #[serde(rename = "number_of_steps")] + pub number_of_steps: Option, + #[serde(rename = "source")] + pub source: Option, + #[serde(rename = "target")] + pub target: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SankeyRequestDataAttributesDefinition { + pub fn new() -> SankeyRequestDataAttributesDefinition { + SankeyRequestDataAttributesDefinition { + entries_per_step: None, + number_of_steps: None, + source: None, + target: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn entries_per_step(mut self, value: i64) -> Self { + self.entries_per_step = Some(value); + self + } + + pub fn number_of_steps(mut self, value: i64) -> Self { + self.number_of_steps = Some(value); + self + } + + pub fn source(mut self, value: String) -> Self { + self.source = Some(value); + self + } + + pub fn target(mut self, value: String) -> Self { + self.target = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for SankeyRequestDataAttributesDefinition { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for SankeyRequestDataAttributesDefinition { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SankeyRequestDataAttributesDefinitionVisitor; + impl<'a> Visitor<'a> for SankeyRequestDataAttributesDefinitionVisitor { + type Value = SankeyRequestDataAttributesDefinition; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut entries_per_step: Option = None; + let mut number_of_steps: Option = None; + let mut source: Option = None; + let mut target: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "entries_per_step" => { + if v.is_null() { + continue; + } + entries_per_step = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "number_of_steps" => { + if v.is_null() { + continue; + } + number_of_steps = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "source" => { + if v.is_null() { + continue; + } + source = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "target" => { + if v.is_null() { + continue; + } + target = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = SankeyRequestDataAttributesDefinition { + entries_per_step, + number_of_steps, + source, + target, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SankeyRequestDataAttributesDefinitionVisitor) + } +} diff --git a/src/datadogV2/model/model_sankey_request_data_attributes_sampling.rs b/src/datadogV2/model/model_sankey_request_data_attributes_sampling.rs new file mode 100644 index 000000000..20bfb83ae --- /dev/null +++ b/src/datadogV2/model/model_sankey_request_data_attributes_sampling.rs @@ -0,0 +1,104 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SankeyRequestDataAttributesSampling { + /// The `sampling` `enabled`. + #[serde(rename = "enabled")] + pub enabled: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SankeyRequestDataAttributesSampling { + pub fn new() -> SankeyRequestDataAttributesSampling { + SankeyRequestDataAttributesSampling { + enabled: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn enabled(mut self, value: bool) -> Self { + self.enabled = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for SankeyRequestDataAttributesSampling { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for SankeyRequestDataAttributesSampling { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SankeyRequestDataAttributesSamplingVisitor; + impl<'a> Visitor<'a> for SankeyRequestDataAttributesSamplingVisitor { + type Value = SankeyRequestDataAttributesSampling; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut enabled: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "enabled" => { + if v.is_null() { + continue; + } + enabled = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = SankeyRequestDataAttributesSampling { + enabled, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SankeyRequestDataAttributesSamplingVisitor) + } +} diff --git a/src/datadogV2/model/model_sankey_request_data_attributes_search.rs b/src/datadogV2/model/model_sankey_request_data_attributes_search.rs new file mode 100644 index 000000000..af0004939 --- /dev/null +++ b/src/datadogV2/model/model_sankey_request_data_attributes_search.rs @@ -0,0 +1,165 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SankeyRequestDataAttributesSearch { + #[serde(rename = "audience_filters")] + pub audience_filters: + Option, + #[serde(rename = "occurrences")] + pub occurrences: Option, + #[serde(rename = "query")] + pub query: Option, + #[serde(rename = "subquery_id")] + pub subquery_id: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SankeyRequestDataAttributesSearch { + pub fn new() -> SankeyRequestDataAttributesSearch { + SankeyRequestDataAttributesSearch { + audience_filters: None, + occurrences: None, + query: None, + subquery_id: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn audience_filters( + mut self, + value: crate::datadogV2::model::SankeyRequestDataAttributesSearchAudienceFilters, + ) -> Self { + self.audience_filters = Some(value); + self + } + + pub fn occurrences( + mut self, + value: crate::datadogV2::model::SankeyRequestDataAttributesSearchOccurrences, + ) -> Self { + self.occurrences = Some(value); + self + } + + pub fn query(mut self, value: String) -> Self { + self.query = Some(value); + self + } + + pub fn subquery_id(mut self, value: String) -> Self { + self.subquery_id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for SankeyRequestDataAttributesSearch { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for SankeyRequestDataAttributesSearch { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SankeyRequestDataAttributesSearchVisitor; + impl<'a> Visitor<'a> for SankeyRequestDataAttributesSearchVisitor { + type Value = SankeyRequestDataAttributesSearch; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut audience_filters: Option< + crate::datadogV2::model::SankeyRequestDataAttributesSearchAudienceFilters, + > = None; + let mut occurrences: Option< + crate::datadogV2::model::SankeyRequestDataAttributesSearchOccurrences, + > = None; + let mut query: Option = None; + let mut subquery_id: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "audience_filters" => { + if v.is_null() { + continue; + } + audience_filters = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "occurrences" => { + if v.is_null() { + continue; + } + occurrences = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "query" => { + if v.is_null() { + continue; + } + query = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "subquery_id" => { + if v.is_null() { + continue; + } + subquery_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = SankeyRequestDataAttributesSearch { + audience_filters, + occurrences, + query, + subquery_id, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SankeyRequestDataAttributesSearchVisitor) + } +} diff --git a/src/datadogV2/model/model_sankey_request_data_attributes_search_audience_filters.rs b/src/datadogV2/model/model_sankey_request_data_attributes_search_audience_filters.rs new file mode 100644 index 000000000..5a9694fbc --- /dev/null +++ b/src/datadogV2/model/model_sankey_request_data_attributes_search_audience_filters.rs @@ -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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SankeyRequestDataAttributesSearchAudienceFilters { + #[serde(rename = "accounts")] + pub accounts: Option< + Vec, + >, + #[serde(rename = "formula")] + pub formula: Option, + #[serde(rename = "segments")] + pub segments: Option< + Vec, + >, + #[serde(rename = "users")] + pub users: Option< + Vec, + >, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SankeyRequestDataAttributesSearchAudienceFilters { + pub fn new() -> SankeyRequestDataAttributesSearchAudienceFilters { + SankeyRequestDataAttributesSearchAudienceFilters { + accounts: None, + formula: None, + segments: None, + users: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn accounts( + mut self, + value: Vec< + crate::datadogV2::model::SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems, + >, + ) -> Self { + self.accounts = Some(value); + self + } + + pub fn formula(mut self, value: String) -> Self { + self.formula = Some(value); + self + } + + pub fn segments( + mut self, + value: Vec< + crate::datadogV2::model::SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems, + >, + ) -> Self { + self.segments = Some(value); + self + } + + pub fn users( + mut self, + value: Vec< + crate::datadogV2::model::SankeyRequestDataAttributesSearchAudienceFiltersUsersItems, + >, + ) -> Self { + self.users = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for SankeyRequestDataAttributesSearchAudienceFilters { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for SankeyRequestDataAttributesSearchAudienceFilters { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SankeyRequestDataAttributesSearchAudienceFiltersVisitor; + impl<'a> Visitor<'a> for SankeyRequestDataAttributesSearchAudienceFiltersVisitor { + type Value = SankeyRequestDataAttributesSearchAudienceFilters; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut accounts: Option> = None; + let mut formula: Option = None; + let mut segments: Option> = None; + let mut users: Option> = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "accounts" => { + if v.is_null() { + continue; + } + accounts = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "formula" => { + if v.is_null() { + continue; + } + formula = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "segments" => { + if v.is_null() { + continue; + } + segments = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "users" => { + if v.is_null() { + continue; + } + users = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = SankeyRequestDataAttributesSearchAudienceFilters { + accounts, + formula, + segments, + users, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SankeyRequestDataAttributesSearchAudienceFiltersVisitor) + } +} diff --git a/src/datadogV2/model/model_sankey_request_data_attributes_search_audience_filters_accounts_items.rs b/src/datadogV2/model/model_sankey_request_data_attributes_search_audience_filters_accounts_items.rs new file mode 100644 index 000000000..18222e437 --- /dev/null +++ b/src/datadogV2/model/model_sankey_request_data_attributes_search_audience_filters_accounts_items.rs @@ -0,0 +1,107 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems { + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "query")] + pub query: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems { + pub fn new(name: String) -> SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems { + SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems { + name, + query: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn query(mut self, value: String) -> Self { + self.query = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SankeyRequestDataAttributesSearchAudienceFiltersAccountsItemsVisitor; + impl<'a> Visitor<'a> for SankeyRequestDataAttributesSearchAudienceFiltersAccountsItemsVisitor { + type Value = SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut name: Option = None; + let mut query: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "query" => { + if v.is_null() { + continue; + } + query = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + + let content = SankeyRequestDataAttributesSearchAudienceFiltersAccountsItems { + name, + query, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer + .deserialize_any(SankeyRequestDataAttributesSearchAudienceFiltersAccountsItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_sankey_request_data_attributes_search_audience_filters_segments_items.rs b/src/datadogV2/model/model_sankey_request_data_attributes_search_audience_filters_segments_items.rs new file mode 100644 index 000000000..9423bf2dc --- /dev/null +++ b/src/datadogV2/model/model_sankey_request_data_attributes_search_audience_filters_segments_items.rs @@ -0,0 +1,103 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems { + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "segment_id")] + pub segment_id: String, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems { + pub fn new( + name: String, + segment_id: String, + ) -> SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems { + SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems { + name, + segment_id, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItemsVisitor; + impl<'a> Visitor<'a> for SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItemsVisitor { + type Value = SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut name: Option = None; + let mut segment_id: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "segment_id" => { + segment_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + let segment_id = segment_id.ok_or_else(|| M::Error::missing_field("segment_id"))?; + + let content = SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItems { + name, + segment_id, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer + .deserialize_any(SankeyRequestDataAttributesSearchAudienceFiltersSegmentsItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_sankey_request_data_attributes_search_audience_filters_users_items.rs b/src/datadogV2/model/model_sankey_request_data_attributes_search_audience_filters_users_items.rs new file mode 100644 index 000000000..1f83a4f1c --- /dev/null +++ b/src/datadogV2/model/model_sankey_request_data_attributes_search_audience_filters_users_items.rs @@ -0,0 +1,107 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SankeyRequestDataAttributesSearchAudienceFiltersUsersItems { + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "query")] + pub query: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SankeyRequestDataAttributesSearchAudienceFiltersUsersItems { + pub fn new(name: String) -> SankeyRequestDataAttributesSearchAudienceFiltersUsersItems { + SankeyRequestDataAttributesSearchAudienceFiltersUsersItems { + name, + query: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn query(mut self, value: String) -> Self { + self.query = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SankeyRequestDataAttributesSearchAudienceFiltersUsersItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SankeyRequestDataAttributesSearchAudienceFiltersUsersItemsVisitor; + impl<'a> Visitor<'a> for SankeyRequestDataAttributesSearchAudienceFiltersUsersItemsVisitor { + type Value = SankeyRequestDataAttributesSearchAudienceFiltersUsersItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut name: Option = None; + let mut query: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "query" => { + if v.is_null() { + continue; + } + query = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + + let content = SankeyRequestDataAttributesSearchAudienceFiltersUsersItems { + name, + query, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer + .deserialize_any(SankeyRequestDataAttributesSearchAudienceFiltersUsersItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_sankey_request_data_attributes_search_occurrences.rs b/src/datadogV2/model/model_sankey_request_data_attributes_search_occurrences.rs new file mode 100644 index 000000000..a7257639f --- /dev/null +++ b/src/datadogV2/model/model_sankey_request_data_attributes_search_occurrences.rs @@ -0,0 +1,115 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SankeyRequestDataAttributesSearchOccurrences { + #[serde(rename = "meta")] + pub meta: Option>, + #[serde(rename = "operator")] + pub operator: String, + #[serde(rename = "value")] + pub value: String, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SankeyRequestDataAttributesSearchOccurrences { + pub fn new(operator: String, value: String) -> SankeyRequestDataAttributesSearchOccurrences { + SankeyRequestDataAttributesSearchOccurrences { + meta: None, + operator, + value, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn meta(mut self, value: std::collections::BTreeMap) -> Self { + self.meta = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SankeyRequestDataAttributesSearchOccurrences { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SankeyRequestDataAttributesSearchOccurrencesVisitor; + impl<'a> Visitor<'a> for SankeyRequestDataAttributesSearchOccurrencesVisitor { + type Value = SankeyRequestDataAttributesSearchOccurrences; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut meta: Option> = None; + let mut operator: Option = None; + let mut value: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "meta" => { + if v.is_null() { + continue; + } + meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "operator" => { + operator = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "value" => { + value = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let operator = operator.ok_or_else(|| M::Error::missing_field("operator"))?; + let value = value.ok_or_else(|| M::Error::missing_field("value"))?; + + let content = SankeyRequestDataAttributesSearchOccurrences { + meta, + operator, + value, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SankeyRequestDataAttributesSearchOccurrencesVisitor) + } +} diff --git a/src/datadogV2/model/model_sankey_request_data_attributes_time.rs b/src/datadogV2/model/model_sankey_request_data_attributes_time.rs new file mode 100644 index 000000000..e792bdc81 --- /dev/null +++ b/src/datadogV2/model/model_sankey_request_data_attributes_time.rs @@ -0,0 +1,119 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SankeyRequestDataAttributesTime { + #[serde(rename = "from")] + pub from: Option, + #[serde(rename = "to")] + pub to: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SankeyRequestDataAttributesTime { + pub fn new() -> SankeyRequestDataAttributesTime { + SankeyRequestDataAttributesTime { + from: None, + to: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn from(mut self, value: i64) -> Self { + self.from = Some(value); + self + } + + pub fn to(mut self, value: i64) -> Self { + self.to = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for SankeyRequestDataAttributesTime { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for SankeyRequestDataAttributesTime { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SankeyRequestDataAttributesTimeVisitor; + impl<'a> Visitor<'a> for SankeyRequestDataAttributesTimeVisitor { + type Value = SankeyRequestDataAttributesTime; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut from: Option = None; + let mut to: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "from" => { + if v.is_null() { + continue; + } + from = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "to" => { + if v.is_null() { + continue; + } + to = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = SankeyRequestDataAttributesTime { + from, + to, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SankeyRequestDataAttributesTimeVisitor) + } +} diff --git a/src/datadogV2/model/model_sankey_request_data_type.rs b/src/datadogV2/model/model_sankey_request_data_type.rs new file mode 100644 index 000000000..88cafceba --- /dev/null +++ b/src/datadogV2/model/model_sankey_request_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum SankeyRequestDataType { + SANKEY_REQUEST, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for SankeyRequestDataType { + fn to_string(&self) -> String { + match self { + Self::SANKEY_REQUEST => String::from("sankey_request"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for SankeyRequestDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for SankeyRequestDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "sankey_request" => Self::SANKEY_REQUEST, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_sankey_response.rs b/src/datadogV2/model/model_sankey_response.rs new file mode 100644 index 000000000..a3669cfa6 --- /dev/null +++ b/src/datadogV2/model/model_sankey_response.rs @@ -0,0 +1,103 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SankeyResponse { + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SankeyResponse { + pub fn new() -> SankeyResponse { + SankeyResponse { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::SankeyResponseData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for SankeyResponse { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for SankeyResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SankeyResponseVisitor; + impl<'a> Visitor<'a> for SankeyResponseVisitor { + type Value = SankeyResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = SankeyResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SankeyResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_sankey_response_data.rs b/src/datadogV2/model/model_sankey_response_data.rs new file mode 100644 index 000000000..b4cade893 --- /dev/null +++ b/src/datadogV2/model/model_sankey_response_data.rs @@ -0,0 +1,134 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SankeyResponseData { + #[serde(rename = "attributes")] + pub attributes: Option, + #[serde(rename = "id")] + pub id: Option, + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::SankeyResponseDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SankeyResponseData { + pub fn new(type_: crate::datadogV2::model::SankeyResponseDataType) -> SankeyResponseData { + SankeyResponseData { + attributes: None, + id: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::SankeyResponseDataAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SankeyResponseData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SankeyResponseDataVisitor; + impl<'a> Visitor<'a> for SankeyResponseDataVisitor { + type Value = SankeyResponseData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option = + None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::SankeyResponseDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = SankeyResponseData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SankeyResponseDataVisitor) + } +} diff --git a/src/datadogV2/model/model_sankey_response_data_attributes.rs b/src/datadogV2/model/model_sankey_response_data_attributes.rs new file mode 100644 index 000000000..9a9b45d5a --- /dev/null +++ b/src/datadogV2/model/model_sankey_response_data_attributes.rs @@ -0,0 +1,129 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SankeyResponseDataAttributes { + #[serde(rename = "links")] + pub links: Option>, + #[serde(rename = "nodes")] + pub nodes: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SankeyResponseDataAttributes { + pub fn new() -> SankeyResponseDataAttributes { + SankeyResponseDataAttributes { + links: None, + nodes: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn links( + mut self, + value: Vec, + ) -> Self { + self.links = Some(value); + self + } + + pub fn nodes( + mut self, + value: Vec, + ) -> Self { + self.nodes = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for SankeyResponseDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for SankeyResponseDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SankeyResponseDataAttributesVisitor; + impl<'a> Visitor<'a> for SankeyResponseDataAttributesVisitor { + type Value = SankeyResponseDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut links: Option< + Vec, + > = None; + let mut nodes: Option< + Vec, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "links" => { + if v.is_null() { + continue; + } + links = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "nodes" => { + if v.is_null() { + continue; + } + nodes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = SankeyResponseDataAttributes { + links, + nodes, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SankeyResponseDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_sankey_response_data_attributes_links_items.rs b/src/datadogV2/model/model_sankey_response_data_attributes_links_items.rs new file mode 100644 index 000000000..4c989c6b9 --- /dev/null +++ b/src/datadogV2/model/model_sankey_response_data_attributes_links_items.rs @@ -0,0 +1,167 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SankeyResponseDataAttributesLinksItems { + #[serde(rename = "column")] + pub column: Option, + #[serde(rename = "id")] + pub id: Option, + #[serde(rename = "source")] + pub source: Option, + #[serde(rename = "target")] + pub target: Option, + #[serde(rename = "value")] + pub value: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SankeyResponseDataAttributesLinksItems { + pub fn new() -> SankeyResponseDataAttributesLinksItems { + SankeyResponseDataAttributesLinksItems { + column: None, + id: None, + source: None, + target: None, + value: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn column(mut self, value: i64) -> Self { + self.column = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn source(mut self, value: String) -> Self { + self.source = Some(value); + self + } + + pub fn target(mut self, value: String) -> Self { + self.target = Some(value); + self + } + + pub fn value(mut self, value: i64) -> Self { + self.value = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for SankeyResponseDataAttributesLinksItems { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for SankeyResponseDataAttributesLinksItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SankeyResponseDataAttributesLinksItemsVisitor; + impl<'a> Visitor<'a> for SankeyResponseDataAttributesLinksItemsVisitor { + type Value = SankeyResponseDataAttributesLinksItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut column: Option = None; + let mut id: Option = None; + let mut source: Option = None; + let mut target: Option = None; + let mut value: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "column" => { + if v.is_null() { + continue; + } + column = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "source" => { + if v.is_null() { + continue; + } + source = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "target" => { + if v.is_null() { + continue; + } + target = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "value" => { + if v.is_null() { + continue; + } + value = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = SankeyResponseDataAttributesLinksItems { + column, + id, + source, + target, + value, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SankeyResponseDataAttributesLinksItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_sankey_response_data_attributes_nodes_items.rs b/src/datadogV2/model/model_sankey_response_data_attributes_nodes_items.rs new file mode 100644 index 000000000..a8ec840d1 --- /dev/null +++ b/src/datadogV2/model/model_sankey_response_data_attributes_nodes_items.rs @@ -0,0 +1,225 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SankeyResponseDataAttributesNodesItems { + #[serde(rename = "aggregated_nodes")] + pub aggregated_nodes: Option< + Vec, + >, + #[serde(rename = "column")] + pub column: Option, + #[serde(rename = "id")] + pub id: Option, + #[serde(rename = "incoming_value")] + pub incoming_value: Option, + #[serde(rename = "name")] + pub name: Option, + #[serde(rename = "outgoing_value")] + pub outgoing_value: Option, + #[serde(rename = "type")] + pub type_: Option, + #[serde(rename = "value")] + pub value: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SankeyResponseDataAttributesNodesItems { + pub fn new() -> SankeyResponseDataAttributesNodesItems { + SankeyResponseDataAttributesNodesItems { + aggregated_nodes: None, + column: None, + id: None, + incoming_value: None, + name: None, + outgoing_value: None, + type_: None, + value: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn aggregated_nodes( + mut self, + value: Vec< + crate::datadogV2::model::SankeyResponseDataAttributesNodesItemsAggregatedNodesItems, + >, + ) -> Self { + self.aggregated_nodes = Some(value); + self + } + + pub fn column(mut self, value: i64) -> Self { + self.column = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn incoming_value(mut self, value: i64) -> Self { + self.incoming_value = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn outgoing_value(mut self, value: i64) -> Self { + self.outgoing_value = Some(value); + self + } + + pub fn type_(mut self, value: String) -> Self { + self.type_ = Some(value); + self + } + + pub fn value(mut self, value: i64) -> Self { + self.value = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for SankeyResponseDataAttributesNodesItems { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for SankeyResponseDataAttributesNodesItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SankeyResponseDataAttributesNodesItemsVisitor; + impl<'a> Visitor<'a> for SankeyResponseDataAttributesNodesItemsVisitor { + type Value = SankeyResponseDataAttributesNodesItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut aggregated_nodes: Option> = None; + let mut column: Option = None; + let mut id: Option = None; + let mut incoming_value: Option = None; + let mut name: Option = None; + let mut outgoing_value: Option = None; + let mut type_: Option = None; + let mut value: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "aggregated_nodes" => { + if v.is_null() { + continue; + } + aggregated_nodes = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "column" => { + if v.is_null() { + continue; + } + column = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "incoming_value" => { + if v.is_null() { + continue; + } + incoming_value = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "outgoing_value" => { + if v.is_null() { + continue; + } + outgoing_value = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + if v.is_null() { + continue; + } + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "value" => { + if v.is_null() { + continue; + } + value = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = SankeyResponseDataAttributesNodesItems { + aggregated_nodes, + column, + id, + incoming_value, + name, + outgoing_value, + type_, + value, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SankeyResponseDataAttributesNodesItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_sankey_response_data_attributes_nodes_items_aggregated_nodes_items.rs b/src/datadogV2/model/model_sankey_response_data_attributes_nodes_items_aggregated_nodes_items.rs new file mode 100644 index 000000000..05f81b0cb --- /dev/null +++ b/src/datadogV2/model/model_sankey_response_data_attributes_nodes_items_aggregated_nodes_items.rs @@ -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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SankeyResponseDataAttributesNodesItemsAggregatedNodesItems { + #[serde(rename = "id")] + pub id: Option, + #[serde(rename = "incoming_value")] + pub incoming_value: Option, + #[serde(rename = "name")] + pub name: Option, + #[serde(rename = "outgoing_value")] + pub outgoing_value: Option, + #[serde(rename = "type")] + pub type_: Option, + #[serde(rename = "value")] + pub value: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SankeyResponseDataAttributesNodesItemsAggregatedNodesItems { + pub fn new() -> SankeyResponseDataAttributesNodesItemsAggregatedNodesItems { + SankeyResponseDataAttributesNodesItemsAggregatedNodesItems { + id: None, + incoming_value: None, + name: None, + outgoing_value: None, + type_: None, + value: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn incoming_value(mut self, value: i64) -> Self { + self.incoming_value = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn outgoing_value(mut self, value: i64) -> Self { + self.outgoing_value = Some(value); + self + } + + pub fn type_(mut self, value: String) -> Self { + self.type_ = Some(value); + self + } + + pub fn value(mut self, value: i64) -> Self { + self.value = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for SankeyResponseDataAttributesNodesItemsAggregatedNodesItems { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for SankeyResponseDataAttributesNodesItemsAggregatedNodesItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SankeyResponseDataAttributesNodesItemsAggregatedNodesItemsVisitor; + impl<'a> Visitor<'a> for SankeyResponseDataAttributesNodesItemsAggregatedNodesItemsVisitor { + type Value = SankeyResponseDataAttributesNodesItemsAggregatedNodesItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut id: Option = None; + let mut incoming_value: Option = None; + let mut name: Option = None; + let mut outgoing_value: Option = None; + let mut type_: Option = None; + let mut value: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "incoming_value" => { + if v.is_null() { + continue; + } + incoming_value = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "outgoing_value" => { + if v.is_null() { + continue; + } + outgoing_value = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + if v.is_null() { + continue; + } + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "value" => { + if v.is_null() { + continue; + } + value = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = SankeyResponseDataAttributesNodesItemsAggregatedNodesItems { + id, + incoming_value, + name, + outgoing_value, + type_, + value, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer + .deserialize_any(SankeyResponseDataAttributesNodesItemsAggregatedNodesItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_sankey_response_data_type.rs b/src/datadogV2/model/model_sankey_response_data_type.rs new file mode 100644 index 000000000..e4e1091f4 --- /dev/null +++ b/src/datadogV2/model/model_sankey_response_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum SankeyResponseDataType { + SANKEY_RESPONSE, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for SankeyResponseDataType { + fn to_string(&self) -> String { + match self { + Self::SANKEY_RESPONSE => String::from("sankey_response"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for SankeyResponseDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for SankeyResponseDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "sankey_response" => Self::SANKEY_RESPONSE, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_segment.rs b/src/datadogV2/model/model_segment.rs new file mode 100644 index 000000000..9ad89d7fa --- /dev/null +++ b/src/datadogV2/model/model_segment.rs @@ -0,0 +1,103 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct Segment { + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl Segment { + pub fn new() -> Segment { + Segment { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::SegmentData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for Segment { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for Segment { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SegmentVisitor; + impl<'a> Visitor<'a> for SegmentVisitor { + type Value = Segment; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = Segment { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SegmentVisitor) + } +} diff --git a/src/datadogV2/model/model_segment_array.rs b/src/datadogV2/model/model_segment_array.rs new file mode 100644 index 000000000..998a352de --- /dev/null +++ b/src/datadogV2/model/model_segment_array.rs @@ -0,0 +1,90 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SegmentArray { + #[serde(rename = "data")] + pub data: Vec, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SegmentArray { + pub fn new(data: Vec) -> SegmentArray { + SegmentArray { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SegmentArray { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SegmentArrayVisitor; + impl<'a> Visitor<'a> for SegmentArrayVisitor { + type Value = SegmentArray; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option> = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = SegmentArray { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SegmentArrayVisitor) + } +} diff --git a/src/datadogV2/model/model_segment_data.rs b/src/datadogV2/model/model_segment_data.rs new file mode 100644 index 000000000..012fb35db --- /dev/null +++ b/src/datadogV2/model/model_segment_data.rs @@ -0,0 +1,132 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SegmentData { + #[serde(rename = "attributes")] + pub attributes: Option, + #[serde(rename = "id")] + pub id: Option, + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::SegmentDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SegmentData { + pub fn new(type_: crate::datadogV2::model::SegmentDataType) -> SegmentData { + SegmentData { + attributes: None, + id: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes(mut self, value: crate::datadogV2::model::SegmentDataAttributes) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SegmentData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SegmentDataVisitor; + impl<'a> Visitor<'a> for SegmentDataVisitor { + type Value = SegmentData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option = None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::SegmentDataType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = SegmentData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SegmentDataVisitor) + } +} diff --git a/src/datadogV2/model/model_segment_data_attributes.rs b/src/datadogV2/model/model_segment_data_attributes.rs new file mode 100644 index 000000000..fc9da188e --- /dev/null +++ b/src/datadogV2/model/model_segment_data_attributes.rs @@ -0,0 +1,319 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SegmentDataAttributes { + #[serde(rename = "created_at")] + pub created_at: Option>, + #[serde(rename = "created_by")] + pub created_by: Option, + #[serde(rename = "data_query")] + pub data_query: crate::datadogV2::model::SegmentDataAttributesDataQuery, + #[serde(rename = "description")] + pub description: Option, + #[serde(rename = "disabled_at")] + pub disabled_at: Option>, + #[serde(rename = "disabled_by")] + pub disabled_by: Option, + #[serde(rename = "materialization_row_count")] + pub materialization_row_count: Option, + #[serde(rename = "materialized_at")] + pub materialized_at: Option, + #[serde(rename = "modified_at")] + pub modified_at: Option>, + #[serde(rename = "modified_by")] + pub modified_by: Option, + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "org_id")] + pub org_id: Option, + #[serde(rename = "source")] + pub source: Option, + #[serde(rename = "tags")] + pub tags: Option>, + #[serde(rename = "version")] + pub version: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SegmentDataAttributes { + pub fn new( + data_query: crate::datadogV2::model::SegmentDataAttributesDataQuery, + name: String, + ) -> SegmentDataAttributes { + SegmentDataAttributes { + created_at: None, + created_by: None, + data_query, + description: None, + disabled_at: None, + disabled_by: None, + materialization_row_count: None, + materialized_at: None, + modified_at: None, + modified_by: None, + name, + org_id: None, + source: None, + tags: None, + version: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn created_at(mut self, value: chrono::DateTime) -> Self { + self.created_at = Some(value); + self + } + + pub fn created_by(mut self, value: crate::datadogV2::model::SegmentDataSource) -> Self { + self.created_by = Some(value); + self + } + + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + pub fn disabled_at(mut self, value: chrono::DateTime) -> Self { + self.disabled_at = Some(value); + self + } + + pub fn disabled_by(mut self, value: crate::datadogV2::model::SegmentDataSource) -> Self { + self.disabled_by = Some(value); + self + } + + pub fn materialization_row_count(mut self, value: i64) -> Self { + self.materialization_row_count = Some(value); + self + } + + pub fn materialized_at(mut self, value: String) -> Self { + self.materialized_at = Some(value); + self + } + + pub fn modified_at(mut self, value: chrono::DateTime) -> Self { + self.modified_at = Some(value); + self + } + + pub fn modified_by(mut self, value: crate::datadogV2::model::SegmentDataSource) -> Self { + self.modified_by = Some(value); + self + } + + pub fn org_id(mut self, value: i64) -> Self { + self.org_id = Some(value); + self + } + + pub fn source(mut self, value: i64) -> Self { + self.source = Some(value); + self + } + + pub fn tags(mut self, value: Vec) -> Self { + self.tags = Some(value); + self + } + + pub fn version(mut self, value: i64) -> Self { + self.version = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SegmentDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SegmentDataAttributesVisitor; + impl<'a> Visitor<'a> for SegmentDataAttributesVisitor { + type Value = SegmentDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut created_at: Option> = None; + let mut created_by: Option = None; + let mut data_query: Option< + crate::datadogV2::model::SegmentDataAttributesDataQuery, + > = None; + let mut description: Option = None; + let mut disabled_at: Option> = None; + let mut disabled_by: Option = None; + let mut materialization_row_count: Option = None; + let mut materialized_at: Option = None; + let mut modified_at: Option> = None; + let mut modified_by: Option = None; + let mut name: Option = None; + let mut org_id: Option = None; + let mut source: Option = None; + let mut tags: Option> = None; + let mut version: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "created_at" => { + if v.is_null() { + continue; + } + created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "created_by" => { + if v.is_null() { + continue; + } + created_by = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "data_query" => { + data_query = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "description" => { + if v.is_null() { + continue; + } + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "disabled_at" => { + if v.is_null() { + continue; + } + disabled_at = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "disabled_by" => { + if v.is_null() { + continue; + } + disabled_by = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "materialization_row_count" => { + if v.is_null() { + continue; + } + materialization_row_count = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "materialized_at" => { + if v.is_null() { + continue; + } + materialized_at = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "modified_at" => { + if v.is_null() { + continue; + } + modified_at = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "modified_by" => { + if v.is_null() { + continue; + } + modified_by = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "org_id" => { + if v.is_null() { + continue; + } + org_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "source" => { + if v.is_null() { + continue; + } + source = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "tags" => { + if v.is_null() { + continue; + } + tags = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "version" => { + if v.is_null() { + continue; + } + version = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data_query = data_query.ok_or_else(|| M::Error::missing_field("data_query"))?; + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + + let content = SegmentDataAttributes { + 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, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SegmentDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_segment_data_attributes_data_query.rs b/src/datadogV2/model/model_segment_data_attributes_data_query.rs new file mode 100644 index 000000000..5a7a7f1dc --- /dev/null +++ b/src/datadogV2/model/model_segment_data_attributes_data_query.rs @@ -0,0 +1,193 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SegmentDataAttributesDataQuery { + #[serde(rename = "combination")] + pub combination: Option, + #[serde(rename = "event_platform")] + pub event_platform: + Option>, + #[serde(rename = "reference_table")] + pub reference_table: + Option>, + #[serde(rename = "static")] + pub static_: Option>, + #[serde(rename = "user_store")] + pub user_store: + Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SegmentDataAttributesDataQuery { + pub fn new() -> SegmentDataAttributesDataQuery { + SegmentDataAttributesDataQuery { + combination: None, + event_platform: None, + reference_table: None, + static_: None, + user_store: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn combination(mut self, value: String) -> Self { + self.combination = Some(value); + self + } + + pub fn event_platform( + mut self, + value: Vec, + ) -> Self { + self.event_platform = Some(value); + self + } + + pub fn reference_table( + mut self, + value: Vec, + ) -> Self { + self.reference_table = Some(value); + self + } + + pub fn static_( + mut self, + value: Vec, + ) -> Self { + self.static_ = Some(value); + self + } + + pub fn user_store( + mut self, + value: Vec, + ) -> Self { + self.user_store = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for SegmentDataAttributesDataQuery { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for SegmentDataAttributesDataQuery { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SegmentDataAttributesDataQueryVisitor; + impl<'a> Visitor<'a> for SegmentDataAttributesDataQueryVisitor { + type Value = SegmentDataAttributesDataQuery; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut combination: Option = None; + let mut event_platform: Option< + Vec, + > = None; + let mut reference_table: Option< + Vec, + > = None; + let mut static_: Option< + Vec, + > = None; + let mut user_store: Option< + Vec, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "combination" => { + if v.is_null() { + continue; + } + combination = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "event_platform" => { + if v.is_null() { + continue; + } + event_platform = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "reference_table" => { + if v.is_null() { + continue; + } + reference_table = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "static" => { + if v.is_null() { + continue; + } + static_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_store" => { + if v.is_null() { + continue; + } + user_store = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = SegmentDataAttributesDataQuery { + combination, + event_platform, + reference_table, + static_, + user_store, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SegmentDataAttributesDataQueryVisitor) + } +} diff --git a/src/datadogV2/model/model_segment_data_attributes_data_query_event_platform_items.rs b/src/datadogV2/model/model_segment_data_attributes_data_query_event_platform_items.rs new file mode 100644 index 000000000..1d1c6ff72 --- /dev/null +++ b/src/datadogV2/model/model_segment_data_attributes_data_query_event_platform_items.rs @@ -0,0 +1,154 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SegmentDataAttributesDataQueryEventPlatformItems { + #[serde(rename = "facet")] + pub facet: String, + #[serde(rename = "from")] + pub from: Option, + #[serde(rename = "name")] + pub name: Option, + #[serde(rename = "query")] + pub query: Option, + #[serde(rename = "to")] + pub to: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SegmentDataAttributesDataQueryEventPlatformItems { + pub fn new(facet: String) -> SegmentDataAttributesDataQueryEventPlatformItems { + SegmentDataAttributesDataQueryEventPlatformItems { + facet, + from: None, + name: None, + query: None, + to: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn from(mut self, value: String) -> Self { + self.from = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn query(mut self, value: String) -> Self { + self.query = Some(value); + self + } + + pub fn to(mut self, value: String) -> Self { + self.to = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SegmentDataAttributesDataQueryEventPlatformItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SegmentDataAttributesDataQueryEventPlatformItemsVisitor; + impl<'a> Visitor<'a> for SegmentDataAttributesDataQueryEventPlatformItemsVisitor { + type Value = SegmentDataAttributesDataQueryEventPlatformItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut facet: Option = None; + let mut from: Option = None; + let mut name: Option = None; + let mut query: Option = None; + let mut to: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "facet" => { + facet = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "from" => { + if v.is_null() { + continue; + } + from = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "query" => { + if v.is_null() { + continue; + } + query = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "to" => { + if v.is_null() { + continue; + } + to = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let facet = facet.ok_or_else(|| M::Error::missing_field("facet"))?; + + let content = SegmentDataAttributesDataQueryEventPlatformItems { + facet, + from, + name, + query, + to, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SegmentDataAttributesDataQueryEventPlatformItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_segment_data_attributes_data_query_reference_table_items.rs b/src/datadogV2/model/model_segment_data_attributes_data_query_reference_table_items.rs new file mode 100644 index 000000000..900d0fa70 --- /dev/null +++ b/src/datadogV2/model/model_segment_data_attributes_data_query_reference_table_items.rs @@ -0,0 +1,161 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SegmentDataAttributesDataQueryReferenceTableItems { + #[serde(rename = "columns")] + pub columns: Option< + Vec, + >, + #[serde(rename = "filter_query")] + pub filter_query: Option, + #[serde(rename = "join_condition")] + pub join_condition: + crate::datadogV2::model::SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition, + #[serde(rename = "name")] + pub name: Option, + #[serde(rename = "table_name")] + pub table_name: String, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SegmentDataAttributesDataQueryReferenceTableItems { + pub fn new( + join_condition: crate::datadogV2::model::SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition, + table_name: String, + ) -> SegmentDataAttributesDataQueryReferenceTableItems { + SegmentDataAttributesDataQueryReferenceTableItems { + columns: None, + filter_query: None, + join_condition, + name: None, + table_name, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn columns( + mut self, + value: Vec< + crate::datadogV2::model::SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems, + >, + ) -> Self { + self.columns = Some(value); + self + } + + pub fn filter_query(mut self, value: String) -> Self { + self.filter_query = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SegmentDataAttributesDataQueryReferenceTableItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SegmentDataAttributesDataQueryReferenceTableItemsVisitor; + impl<'a> Visitor<'a> for SegmentDataAttributesDataQueryReferenceTableItemsVisitor { + type Value = SegmentDataAttributesDataQueryReferenceTableItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut columns: Option> = None; + let mut filter_query: Option = None; + let mut join_condition: Option = None; + let mut name: Option = None; + let mut table_name: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "columns" => { + if v.is_null() { + continue; + } + columns = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "filter_query" => { + if v.is_null() { + continue; + } + filter_query = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "join_condition" => { + join_condition = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "table_name" => { + table_name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let join_condition = + join_condition.ok_or_else(|| M::Error::missing_field("join_condition"))?; + let table_name = table_name.ok_or_else(|| M::Error::missing_field("table_name"))?; + + let content = SegmentDataAttributesDataQueryReferenceTableItems { + columns, + filter_query, + join_condition, + name, + table_name, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SegmentDataAttributesDataQueryReferenceTableItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_segment_data_attributes_data_query_reference_table_items_columns_items.rs b/src/datadogV2/model/model_segment_data_attributes_data_query_reference_table_items_columns_items.rs new file mode 100644 index 000000000..a5439740d --- /dev/null +++ b/src/datadogV2/model/model_segment_data_attributes_data_query_reference_table_items_columns_items.rs @@ -0,0 +1,120 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems { + #[serde(rename = "alias")] + pub alias: Option, + #[serde(rename = "name")] + pub name: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems { + pub fn new() -> SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems { + SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems { + alias: None, + name: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn alias(mut self, value: String) -> Self { + self.alias = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SegmentDataAttributesDataQueryReferenceTableItemsColumnsItemsVisitor; + impl<'a> Visitor<'a> for SegmentDataAttributesDataQueryReferenceTableItemsColumnsItemsVisitor { + type Value = SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut alias: Option = None; + let mut name: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "alias" => { + if v.is_null() { + continue; + } + alias = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = SegmentDataAttributesDataQueryReferenceTableItemsColumnsItems { + alias, + name, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer + .deserialize_any(SegmentDataAttributesDataQueryReferenceTableItemsColumnsItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_segment_data_attributes_data_query_reference_table_items_join_condition.rs b/src/datadogV2/model/model_segment_data_attributes_data_query_reference_table_items_join_condition.rs new file mode 100644 index 000000000..41ab9f7cf --- /dev/null +++ b/src/datadogV2/model/model_segment_data_attributes_data_query_reference_table_items_join_condition.rs @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition { + #[serde(rename = "column_name")] + pub column_name: String, + #[serde(rename = "facet")] + pub facet: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition { + pub fn new( + column_name: String, + ) -> SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition { + SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition { + column_name, + facet: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn facet(mut self, value: String) -> Self { + self.facet = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SegmentDataAttributesDataQueryReferenceTableItemsJoinConditionVisitor; + impl<'a> Visitor<'a> for SegmentDataAttributesDataQueryReferenceTableItemsJoinConditionVisitor { + type Value = SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut column_name: Option = None; + let mut facet: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "column_name" => { + column_name = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "facet" => { + if v.is_null() { + continue; + } + facet = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let column_name = + column_name.ok_or_else(|| M::Error::missing_field("column_name"))?; + + let content = SegmentDataAttributesDataQueryReferenceTableItemsJoinCondition { + column_name, + facet, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer + .deserialize_any(SegmentDataAttributesDataQueryReferenceTableItemsJoinConditionVisitor) + } +} diff --git a/src/datadogV2/model/model_segment_data_attributes_data_query_static_items.rs b/src/datadogV2/model/model_segment_data_attributes_data_query_static_items.rs new file mode 100644 index 000000000..d36708b98 --- /dev/null +++ b/src/datadogV2/model/model_segment_data_attributes_data_query_static_items.rs @@ -0,0 +1,135 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SegmentDataAttributesDataQueryStaticItems { + #[serde(rename = "id")] + pub id: Option, + #[serde(rename = "name")] + pub name: Option, + #[serde(rename = "user_count")] + pub user_count: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SegmentDataAttributesDataQueryStaticItems { + pub fn new() -> SegmentDataAttributesDataQueryStaticItems { + SegmentDataAttributesDataQueryStaticItems { + id: None, + name: None, + user_count: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn user_count(mut self, value: i64) -> Self { + self.user_count = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for SegmentDataAttributesDataQueryStaticItems { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for SegmentDataAttributesDataQueryStaticItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SegmentDataAttributesDataQueryStaticItemsVisitor; + impl<'a> Visitor<'a> for SegmentDataAttributesDataQueryStaticItemsVisitor { + type Value = SegmentDataAttributesDataQueryStaticItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut id: Option = None; + let mut name: Option = None; + let mut user_count: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_count" => { + if v.is_null() { + continue; + } + user_count = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = SegmentDataAttributesDataQueryStaticItems { + id, + name, + user_count, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SegmentDataAttributesDataQueryStaticItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_segment_data_attributes_data_query_user_store_items.rs b/src/datadogV2/model/model_segment_data_attributes_data_query_user_store_items.rs new file mode 100644 index 000000000..778b5145b --- /dev/null +++ b/src/datadogV2/model/model_segment_data_attributes_data_query_user_store_items.rs @@ -0,0 +1,135 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SegmentDataAttributesDataQueryUserStoreItems { + #[serde(rename = "facet")] + pub facet: Option, + #[serde(rename = "name")] + pub name: Option, + #[serde(rename = "query")] + pub query: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SegmentDataAttributesDataQueryUserStoreItems { + pub fn new() -> SegmentDataAttributesDataQueryUserStoreItems { + SegmentDataAttributesDataQueryUserStoreItems { + facet: None, + name: None, + query: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn facet(mut self, value: String) -> Self { + self.facet = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn query(mut self, value: String) -> Self { + self.query = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for SegmentDataAttributesDataQueryUserStoreItems { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for SegmentDataAttributesDataQueryUserStoreItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SegmentDataAttributesDataQueryUserStoreItemsVisitor; + impl<'a> Visitor<'a> for SegmentDataAttributesDataQueryUserStoreItemsVisitor { + type Value = SegmentDataAttributesDataQueryUserStoreItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut facet: Option = None; + let mut name: Option = None; + let mut query: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "facet" => { + if v.is_null() { + continue; + } + facet = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "query" => { + if v.is_null() { + continue; + } + query = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = SegmentDataAttributesDataQueryUserStoreItems { + facet, + name, + query, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SegmentDataAttributesDataQueryUserStoreItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_segment_data_source.rs b/src/datadogV2/model/model_segment_data_source.rs new file mode 100644 index 000000000..94851c4df --- /dev/null +++ b/src/datadogV2/model/model_segment_data_source.rs @@ -0,0 +1,140 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SegmentDataSource { + #[serde(rename = "handle")] + pub handle: String, + #[serde(rename = "icon")] + pub icon: Option, + #[serde(rename = "id")] + pub id: String, + #[serde(rename = "name")] + pub name: Option, + #[serde(rename = "uuid")] + pub uuid: String, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SegmentDataSource { + pub fn new(handle: String, id: String, uuid: String) -> SegmentDataSource { + SegmentDataSource { + handle, + icon: None, + id, + name: None, + uuid, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn icon(mut self, value: String) -> Self { + self.icon = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SegmentDataSource { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SegmentDataSourceVisitor; + impl<'a> Visitor<'a> for SegmentDataSourceVisitor { + type Value = SegmentDataSource; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut handle: Option = None; + let mut icon: Option = None; + let mut id: Option = None; + let mut name: Option = None; + let mut uuid: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "handle" => { + handle = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "icon" => { + if v.is_null() { + continue; + } + icon = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "uuid" => { + uuid = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let handle = handle.ok_or_else(|| M::Error::missing_field("handle"))?; + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let uuid = uuid.ok_or_else(|| M::Error::missing_field("uuid"))?; + + let content = SegmentDataSource { + handle, + icon, + id, + name, + uuid, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SegmentDataSourceVisitor) + } +} diff --git a/src/datadogV2/model/model_segment_data_type.rs b/src/datadogV2/model/model_segment_data_type.rs new file mode 100644 index 000000000..d0b676792 --- /dev/null +++ b/src/datadogV2/model/model_segment_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum SegmentDataType { + SEGMENT, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for SegmentDataType { + fn to_string(&self) -> String { + match self { + Self::SEGMENT => String::from("segment"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for SegmentDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for SegmentDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "segment" => Self::SEGMENT, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/tests/scenarios/features/v2/cohort.feature b/tests/scenarios/features/v2/cohort.feature new file mode 100644 index 000000000..8ca5e7bbd --- /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 000000000..929450400 --- /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 000000000..95cc467d6 --- /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 f4a7f9e7f..f019e40f8 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 000000000..6dca1f698 --- /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 diff --git a/tests/scenarios/function_mappings.rs b/tests/scenarios/function_mappings.rs index 43cff6b63..1822c5484 100644 --- a/tests/scenarios/function_mappings.rs +++ b/tests/scenarios/function_mappings.rs @@ -133,7 +133,11 @@ pub struct ApiInstances { pub v2_api_rum: Option, pub v2_api_rum_retention_filters: Option, + pub v2_api_cohort: Option, pub v2_api_rum_metrics: Option, + pub v2_api_funnel: Option, + pub v2_api_user_flow: Option, + pub v2_api_segments: Option, pub v2_api_service_scorecards: Option, pub v2_api_sensitive_data_scanner: Option, @@ -870,6 +874,13 @@ pub fn initialize_api_instance(world: &mut DatadogWorld, api: String) { world.http_client.as_ref().unwrap().clone() )); } + "Cohort" => { + world.api_instances.v2_api_cohort = + Some(datadogV2::api_cohort::CohortAPI::with_client_and_config( + world.config.clone(), + world.http_client.as_ref().unwrap().clone(), + )); + } "RumMetrics" => { world.api_instances.v2_api_rum_metrics = Some( datadogV2::api_rum_metrics::RumMetricsAPI::with_client_and_config( @@ -878,6 +889,29 @@ pub fn initialize_api_instance(world: &mut DatadogWorld, api: String) { ), ); } + "Funnel" => { + world.api_instances.v2_api_funnel = + Some(datadogV2::api_funnel::FunnelAPI::with_client_and_config( + world.config.clone(), + world.http_client.as_ref().unwrap().clone(), + )); + } + "UserFlow" => { + world.api_instances.v2_api_user_flow = Some( + datadogV2::api_user_flow::UserFlowAPI::with_client_and_config( + world.config.clone(), + world.http_client.as_ref().unwrap().clone(), + ), + ); + } + "Segments" => { + world.api_instances.v2_api_segments = Some( + datadogV2::api_segments::SegmentsAPI::with_client_and_config( + world.config.clone(), + world.http_client.as_ref().unwrap().clone(), + ), + ); + } "ServiceScorecards" => { world.api_instances.v2_api_service_scorecards = Some( datadogV2::api_service_scorecards::ServiceScorecardsAPI::with_client_and_config( @@ -3929,6 +3963,12 @@ pub fn collect_function_calls(world: &mut DatadogWorld) { "v2.UpdateRetentionFilter".into(), test_v2_update_retention_filter, ); + world + .function_mappings + .insert("v2.GetRumCohort".into(), test_v2_get_rum_cohort); + world + .function_mappings + .insert("v2.GetRumCohortUsers".into(), test_v2_get_rum_cohort_users); world .function_mappings .insert("v2.ListRumMetrics".into(), test_v2_list_rum_metrics); @@ -3944,6 +3984,26 @@ pub fn collect_function_calls(world: &mut DatadogWorld) { world .function_mappings .insert("v2.UpdateRumMetric".into(), test_v2_update_rum_metric); + world + .function_mappings + .insert("v2.GetRumFunnel".into(), test_v2_get_rum_funnel); + world.function_mappings.insert( + "v2.GetRumFunnelStepSuggestions".into(), + test_v2_get_rum_funnel_step_suggestions, + ); + world + .function_mappings + .insert("v2.GetRumSankey".into(), test_v2_get_rum_sankey); + world + .function_mappings + .insert("v2.ListRumSegments".into(), test_v2_list_rum_segments); + world + .function_mappings + .insert("v2.CreateRumSegment".into(), test_v2_create_rum_segment); + world.function_mappings.insert( + "v2.InitializeRumSegments".into(), + test_v2_initialize_rum_segments, + ); world.function_mappings.insert( "v2.ListScorecardOutcomes".into(), test_v2_list_scorecard_outcomes, @@ -30013,6 +30073,56 @@ fn test_v2_update_retention_filter(world: &mut DatadogWorld, _parameters: &HashM world.response.code = response.status.as_u16(); } +fn test_v2_get_rum_cohort(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_cohort + .as_ref() + .expect("api instance not found"); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on(api.get_rum_cohort_with_http_info(body)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_get_rum_cohort_users(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_cohort + .as_ref() + .expect("api instance not found"); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on(api.get_rum_cohort_users_with_http_info(body)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + fn test_v2_list_rum_metrics(world: &mut DatadogWorld, _parameters: &HashMap) { let api = world .api_instances @@ -30138,6 +30248,157 @@ fn test_v2_update_rum_metric(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_funnel + .as_ref() + .expect("api instance not found"); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on(api.get_rum_funnel_with_http_info(body)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_get_rum_funnel_step_suggestions( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_funnel + .as_ref() + .expect("api instance not found"); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on(api.get_rum_funnel_step_suggestions_with_http_info(body)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_get_rum_sankey(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_user_flow + .as_ref() + .expect("api instance not found"); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on(api.get_rum_sankey_with_http_info(body)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_list_rum_segments(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_segments + .as_ref() + .expect("api instance not found"); + let response = match block_on(api.list_rum_segments_with_http_info()) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_create_rum_segment(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_segments + .as_ref() + .expect("api instance not found"); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on(api.create_rum_segment_with_http_info(body)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_initialize_rum_segments(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_segments + .as_ref() + .expect("api instance not found"); + let response = match block_on(api.initialize_rum_segments_with_http_info()) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + fn test_v2_list_scorecard_outcomes(world: &mut DatadogWorld, _parameters: &HashMap) { let api = world .api_instances