From ce47ef026a84f8f1366bd53b91d2bcd9a6411d8b Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 19 Feb 2026 11:58:37 +0000 Subject: [PATCH] Regenerate client from commit 093fce2 of spec repo --- .generator/schemas/v2/openapi.yaml | 1032 +++++++++++++++++ api/datadog/configuration.go | 8 + api/datadogV2/api_rum_user_segments.go | 815 +++++++++++++ api/datadogV2/doc.go | 8 + .../model_rum_segment_create_attributes.go | 212 ++++ .../model_rum_segment_create_data.go | 146 +++ .../model_rum_segment_create_request.go | 110 ++ api/datadogV2/model_rum_segment_data_query.go | 277 +++++ .../model_rum_segment_delete_attributes.go | 211 ++++ .../model_rum_segment_delete_data.go | 178 +++ .../model_rum_segment_delete_response.go | 110 ++ .../model_rum_segment_delete_type.go | 64 + .../model_rum_segment_event_platform.go | 235 ++++ api/datadogV2/model_rum_segment_journey.go | 207 ++++ .../model_rum_segment_list_response.go | 101 ++ .../model_rum_segment_reference_table.go | 241 ++++ ...odel_rum_segment_reference_table_column.go | 101 ++ ..._segment_reference_table_join_condition.go | 133 +++ .../model_rum_segment_resource_type.go | 64 + api/datadogV2/model_rum_segment_response.go | 110 ++ .../model_rum_segment_response_attributes.go | 549 +++++++++ .../model_rum_segment_response_data.go | 178 +++ .../model_rum_segment_segment_type.go | 74 ++ api/datadogV2/model_rum_segment_source.go | 66 ++ .../model_rum_segment_static_entry.go | 165 +++ .../model_rum_segment_template_instance.go | 206 ++++ ...odel_rum_segment_template_list_response.go | 101 ++ ...odel_rum_segment_template_parameter_def.go | 165 +++ ...odel_rum_segment_template_resource_type.go | 64 + ...um_segment_template_response_attributes.go | 344 ++++++ ...odel_rum_segment_template_response_data.go | 178 +++ .../model_rum_segment_template_status.go | 68 ++ .../model_rum_segment_update_attributes.go | 216 ++++ .../model_rum_segment_update_data.go | 178 +++ .../model_rum_segment_update_request.go | 110 ++ api/datadogV2/model_rum_segment_user.go | 229 ++++ ...el_rum_static_segment_create_attributes.go | 209 ++++ .../model_rum_static_segment_create_data.go | 146 +++ ...model_rum_static_segment_create_request.go | 110 ++ ...model_rum_static_segment_journey_filter.go | 133 +++ .../model_rum_static_segment_journey_node.go | 101 ++ ...rum_static_segment_journey_query_object.go | 101 ++ .../model_rum_static_segment_request_type.go | 64 + .../v2/rum-user-segments/CreateRumSegment.go | 95 ++ .../CreateRumStaticSegment.go | 54 + .../v2/rum-user-segments/DeleteRumSegment.go | 30 + .../v2/rum-user-segments/GetRumSegment.go | 30 + .../InitializeRumSegments.go | 26 + .../ListRumSegmentTemplates.go | 30 + .../v2/rum-user-segments/ListRumSegments.go | 30 + .../v2/rum-user-segments/UpdateRumSegment.go | 92 ++ tests/scenarios/api_mappings.go | 1 + .../features/v2/rum_user_segments.feature | 167 +++ tests/scenarios/features/v2/undo.json | 62 + 54 files changed, 8735 insertions(+) create mode 100644 api/datadogV2/api_rum_user_segments.go create mode 100644 api/datadogV2/model_rum_segment_create_attributes.go create mode 100644 api/datadogV2/model_rum_segment_create_data.go create mode 100644 api/datadogV2/model_rum_segment_create_request.go create mode 100644 api/datadogV2/model_rum_segment_data_query.go create mode 100644 api/datadogV2/model_rum_segment_delete_attributes.go create mode 100644 api/datadogV2/model_rum_segment_delete_data.go create mode 100644 api/datadogV2/model_rum_segment_delete_response.go create mode 100644 api/datadogV2/model_rum_segment_delete_type.go create mode 100644 api/datadogV2/model_rum_segment_event_platform.go create mode 100644 api/datadogV2/model_rum_segment_journey.go create mode 100644 api/datadogV2/model_rum_segment_list_response.go create mode 100644 api/datadogV2/model_rum_segment_reference_table.go create mode 100644 api/datadogV2/model_rum_segment_reference_table_column.go create mode 100644 api/datadogV2/model_rum_segment_reference_table_join_condition.go create mode 100644 api/datadogV2/model_rum_segment_resource_type.go create mode 100644 api/datadogV2/model_rum_segment_response.go create mode 100644 api/datadogV2/model_rum_segment_response_attributes.go create mode 100644 api/datadogV2/model_rum_segment_response_data.go create mode 100644 api/datadogV2/model_rum_segment_segment_type.go create mode 100644 api/datadogV2/model_rum_segment_source.go create mode 100644 api/datadogV2/model_rum_segment_static_entry.go create mode 100644 api/datadogV2/model_rum_segment_template_instance.go create mode 100644 api/datadogV2/model_rum_segment_template_list_response.go create mode 100644 api/datadogV2/model_rum_segment_template_parameter_def.go create mode 100644 api/datadogV2/model_rum_segment_template_resource_type.go create mode 100644 api/datadogV2/model_rum_segment_template_response_attributes.go create mode 100644 api/datadogV2/model_rum_segment_template_response_data.go create mode 100644 api/datadogV2/model_rum_segment_template_status.go create mode 100644 api/datadogV2/model_rum_segment_update_attributes.go create mode 100644 api/datadogV2/model_rum_segment_update_data.go create mode 100644 api/datadogV2/model_rum_segment_update_request.go create mode 100644 api/datadogV2/model_rum_segment_user.go create mode 100644 api/datadogV2/model_rum_static_segment_create_attributes.go create mode 100644 api/datadogV2/model_rum_static_segment_create_data.go create mode 100644 api/datadogV2/model_rum_static_segment_create_request.go create mode 100644 api/datadogV2/model_rum_static_segment_journey_filter.go create mode 100644 api/datadogV2/model_rum_static_segment_journey_node.go create mode 100644 api/datadogV2/model_rum_static_segment_journey_query_object.go create mode 100644 api/datadogV2/model_rum_static_segment_request_type.go create mode 100644 examples/v2/rum-user-segments/CreateRumSegment.go create mode 100644 examples/v2/rum-user-segments/CreateRumStaticSegment.go create mode 100644 examples/v2/rum-user-segments/DeleteRumSegment.go create mode 100644 examples/v2/rum-user-segments/GetRumSegment.go create mode 100644 examples/v2/rum-user-segments/InitializeRumSegments.go create mode 100644 examples/v2/rum-user-segments/ListRumSegmentTemplates.go create mode 100644 examples/v2/rum-user-segments/ListRumSegments.go create mode 100644 examples/v2/rum-user-segments/UpdateRumSegment.go create mode 100644 tests/scenarios/features/v2/rum_user_segments.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index b9a63afce0a..59e19780a68 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -51317,6 +51317,713 @@ components: $ref: '#/components/schemas/RumRetentionFilterData' type: array type: object + RumSegmentCreateAttributes: + description: Attributes for creating a new segment. + properties: + data_query: + $ref: '#/components/schemas/RumSegmentDataQuery' + description: + description: A description of the segment. + example: Users who visited the homepage. + type: string + name: + description: The name of the segment. + example: My Segment + type: string + tags: + description: A list of tags for the segment. + example: + - team:frontend + items: + type: string + type: array + required: + - name + - data_query + type: object + RumSegmentCreateData: + description: Data object for a segment creation request. + properties: + attributes: + $ref: '#/components/schemas/RumSegmentCreateAttributes' + type: + $ref: '#/components/schemas/RumSegmentResourceType' + required: + - type + - attributes + type: object + RumSegmentCreateRequest: + description: Request body for creating a new segment. + properties: + data: + $ref: '#/components/schemas/RumSegmentCreateData' + required: + - data + type: object + RumSegmentDataQuery: + description: Query definition for the segment. Contains one or more query blocks + and an optional combination formula. + properties: + combination: + description: Boolean expression combining multiple query blocks. + example: (logs && apm_home) && NOT(apm_trace) + type: string + event_platforms: + description: List of event platform query blocks. + items: + $ref: '#/components/schemas/RumSegmentEventPlatform' + type: array + journeys: + description: List of journey-based query blocks. + items: + $ref: '#/components/schemas/RumSegmentJourney' + type: array + reference_tables: + description: List of reference table query blocks. + items: + $ref: '#/components/schemas/RumSegmentReferenceTable' + type: array + static: + description: List of static user list blocks. + items: + $ref: '#/components/schemas/RumSegmentStaticEntry' + type: array + templates: + description: List of template-based query blocks. + items: + $ref: '#/components/schemas/RumSegmentTemplateInstance' + type: array + type: object + RumSegmentDeleteAttributes: + description: Attributes of a deleted segment response. + properties: + disabled_at: + description: The timestamp when the segment was disabled in RFC 3339 format. + example: '2024-03-15T10:30:00Z' + format: date-time + type: string + disabled_by: + $ref: '#/components/schemas/RumSegmentUser' + name: + description: The name of the deleted segment. + example: My Segment + type: string + uuid: + description: The unique identifier of the deleted segment. + example: a1b2c3d4-1234-5678-9abc-123456789abc + type: string + required: + - uuid + - name + - disabled_at + - disabled_by + type: object + RumSegmentDeleteData: + description: Data object for a deleted segment response. + properties: + attributes: + $ref: '#/components/schemas/RumSegmentDeleteAttributes' + id: + description: Unique identifier for the deleted segment. + example: a1b2c3d4-1234-5678-9abc-123456789abc + type: string + type: + $ref: '#/components/schemas/RumSegmentDeleteType' + required: + - id + - type + - attributes + type: object + RumSegmentDeleteResponse: + description: Response for a segment deletion. + properties: + data: + $ref: '#/components/schemas/RumSegmentDeleteData' + required: + - data + type: object + RumSegmentDeleteType: + description: Type of the deleted segment resource. + enum: + - deleted_segment + example: deleted_segment + type: string + x-enum-varnames: + - DELETED_SEGMENT + RumSegmentEventPlatform: + description: An event platform query block within a segment data query. + properties: + facet: + description: The facet to extract user identifiers from. + example: '@usr.id' + type: string + from: + description: The start of the time range in milliseconds since epoch. + example: 1709888355000 + format: int64 + type: integer + name: + description: The name of this query block. + example: logs + type: string + query: + description: The search query for filtering events. + example: '@type:view @view.url_path:/logs' + type: string + to: + description: The end of the time range in milliseconds since epoch. + example: 1710493155000 + format: int64 + type: integer + required: + - name + - query + - facet + type: object + RumSegmentJourney: + description: A journey-based query block within a segment data query. + properties: + conversion_type: + description: The type of conversion to track. + example: any + type: string + group_by: + description: The facet to group journey results by. + example: '@usr.id' + type: string + name: + description: The name of this journey query block. + example: my_journey + type: string + search: + description: The search query for filtering events. + example: '@type:view' + type: string + type: object + RumSegmentListResponse: + description: Response for listing segments. + properties: + data: + description: The list of segments. + items: + $ref: '#/components/schemas/RumSegmentResponseData' + type: array + required: + - data + type: object + RumSegmentReferenceTable: + description: A reference table query block within a segment data query. + properties: + columns: + description: The columns to include from the reference table. + items: + $ref: '#/components/schemas/RumSegmentReferenceTableColumn' + type: array + filter_query: + description: An optional filter query for the reference table data. + example: '' + type: string + join_condition: + $ref: '#/components/schemas/RumSegmentReferenceTableJoinCondition' + name: + description: The name of this query block. + example: my_ref_table + type: string + table_name: + description: The name of the reference table. + example: my_table + type: string + required: + - name + - table_name + - columns + - join_condition + type: object + RumSegmentReferenceTableColumn: + description: A column definition in a reference table query block. + properties: + name: + description: The name of the column. + example: user_id + type: string + required: + - name + type: object + RumSegmentReferenceTableJoinCondition: + description: The join condition for a reference table query block. + properties: + column_name: + description: The reference table column to join on. + example: user_id + type: string + facet: + description: The RUM facet to join on. + example: '@usr.id' + type: string + required: + - facet + - column_name + type: object + RumSegmentResourceType: + description: Type of the segment resource. + enum: + - segment + example: segment + type: string + x-enum-varnames: + - SEGMENT + RumSegmentResponse: + description: Response containing a single segment. + properties: + data: + $ref: '#/components/schemas/RumSegmentResponseData' + required: + - data + type: object + RumSegmentResponseAttributes: + description: Attributes of a segment in a response. + properties: + created_at: + description: The creation timestamp in RFC 3339 format. + example: '2024-03-15T10:30:00Z' + format: date-time + type: string + created_by: + $ref: '#/components/schemas/RumSegmentUser' + data_query: + $ref: '#/components/schemas/RumSegmentDataQuery' + description: + description: A description of the segment. + example: Users who visited the homepage. + type: string + modified_at: + description: The last modification timestamp in RFC 3339 format. + example: '2024-03-15T10:30:00Z' + format: date-time + type: string + modified_by: + $ref: '#/components/schemas/RumSegmentUser' + name: + description: The name of the segment. + example: My Segment + type: string + org_id: + description: The organization identifier. + example: 123456 + format: int64 + type: integer + row_count: + description: The number of users in the segment. + example: 500 + format: int64 + type: integer + source: + $ref: '#/components/schemas/RumSegmentSource' + tags: + description: A list of tags for the segment. + example: + - team:frontend + items: + type: string + type: array + type: + $ref: '#/components/schemas/RumSegmentSegmentType' + uuid: + description: The unique identifier of the segment. + example: a1b2c3d4-1234-5678-9abc-123456789abc + type: string + version: + description: The version number of the segment. + example: 1 + format: int64 + type: integer + required: + - uuid + - org_id + - name + - description + - data_query + - created_by + - modified_by + - created_at + - modified_at + - row_count + - version + - tags + - type + - source + type: object + RumSegmentResponseData: + description: Data object for a segment in a response. + properties: + attributes: + $ref: '#/components/schemas/RumSegmentResponseAttributes' + id: + description: The unique identifier of the segment. + example: a1b2c3d4-1234-5678-9abc-123456789abc + type: string + type: + $ref: '#/components/schemas/RumSegmentResourceType' + required: + - id + - type + - attributes + type: object + RumSegmentSegmentType: + description: The type of a segment based on its data query configuration. + enum: + - static + - event_platform + - combination + - journeys + - reference_table + - templates + example: event_platform + type: string + x-enum-varnames: + - STATIC + - EVENT_PLATFORM + - COMBINATION + - JOURNEYS + - REFERENCE_TABLE + - TEMPLATES + RumSegmentSource: + description: The source of a segment. + enum: + - user_created + - initial + example: user_created + type: string + x-enum-varnames: + - USER_CREATED + - INITIAL + RumSegmentStaticEntry: + description: A static user list entry within a segment data query. + properties: + id: + description: The identifier of the static list. + example: static-list-1 + type: string + name: + description: The name of the static list. + example: My Static List + type: string + user_count: + description: The number of users in the static list. + example: 500 + format: int64 + type: integer + required: + - id + - name + - user_count + type: object + RumSegmentTemplateInstance: + description: A template-based query block within a segment data query. + properties: + from: + description: The start of the time range in milliseconds since epoch. + example: 1709888355000 + format: int64 + type: integer + parameters: + additionalProperties: + type: string + description: The template parameters as key-value pairs. + example: + threshold: '5' + type: object + template_id: + description: The identifier of the template. + example: stickiness-v1 + type: string + to: + description: The end of the time range in milliseconds since epoch. + example: 1710493155000 + format: int64 + type: integer + required: + - template_id + type: object + RumSegmentTemplateListResponse: + description: Response for listing segment templates. + properties: + data: + description: The list of segment templates. + items: + $ref: '#/components/schemas/RumSegmentTemplateResponseData' + type: array + required: + - data + type: object + RumSegmentTemplateParameterDef: + description: A parameter definition for a segment template. + properties: + default: + description: The default value for the parameter. + example: '5' + type: string + description: + description: A description of the parameter. + example: The minimum number of sessions. + type: string + validate: + description: Validation rules for the parameter. + example: required + type: string + required: + - description + - default + - validate + type: object + RumSegmentTemplateResourceType: + description: Type of the segment template resource. + enum: + - template_metadata + example: template_metadata + type: string + x-enum-varnames: + - TEMPLATE_METADATA + RumSegmentTemplateResponseAttributes: + description: Attributes of a segment template in a response. + properties: + category: + description: The category of the template. + example: engagement + type: string + created_at: + description: The creation timestamp in RFC 3339 format. + example: '2024-01-01T00:00:00Z' + format: date-time + type: string + description: + description: A description of the template. + example: Users who visited at least N times. + type: string + modified_at: + description: The last modification timestamp in RFC 3339 format. + example: '2024-01-01T00:00:00Z' + format: date-time + type: string + name: + description: The name of the template. + example: stickiness-v1 + type: string + parameters: + additionalProperties: + $ref: '#/components/schemas/RumSegmentTemplateParameterDef' + description: The template parameter definitions. + type: object + status: + $ref: '#/components/schemas/RumSegmentTemplateStatus' + version: + description: The version number of the template. + example: 1 + format: int64 + type: integer + required: + - name + - description + - category + - parameters + - status + - version + - created_at + - modified_at + type: object + RumSegmentTemplateResponseData: + description: Data object for a segment template in a response. + properties: + attributes: + $ref: '#/components/schemas/RumSegmentTemplateResponseAttributes' + id: + description: The unique identifier of the template. + example: stickiness-v1 + type: string + type: + $ref: '#/components/schemas/RumSegmentTemplateResourceType' + required: + - id + - type + - attributes + type: object + RumSegmentTemplateStatus: + description: The status of a segment template. + enum: + - active + - deprecated + - archived + example: active + type: string + x-enum-varnames: + - ACTIVE + - DEPRECATED + - ARCHIVED + RumSegmentUpdateAttributes: + description: Attributes for updating a segment. All fields are optional. + properties: + data_query: + $ref: '#/components/schemas/RumSegmentDataQuery' + description: + description: The updated description of the segment. + example: Updated description. + type: string + name: + description: The updated name of the segment. + example: Updated Segment Name + type: string + tags: + description: The updated list of tags for the segment. + example: + - team:backend + items: + type: string + type: array + type: object + RumSegmentUpdateData: + description: Data object for a segment update request. + properties: + attributes: + $ref: '#/components/schemas/RumSegmentUpdateAttributes' + id: + description: The identifier of the segment to update. + example: a1b2c3d4-1234-5678-9abc-123456789abc + type: string + type: + $ref: '#/components/schemas/RumSegmentResourceType' + required: + - id + - type + - attributes + type: object + RumSegmentUpdateRequest: + description: Request body for updating a segment. + properties: + data: + $ref: '#/components/schemas/RumSegmentUpdateData' + required: + - data + type: object + RumSegmentUser: + description: A user who performed an action on a segment. + properties: + handle: + description: The email handle of the user. + example: john.doe@example.com + type: string + icon: + description: The URL of the user icon. + example: https://example.com/icon.png + type: string + id: + description: The numeric identifier of the user. + example: '12' + type: string + name: + description: The display name of the user. + example: John Doe + type: string + uuid: + description: The unique identifier of the user. + example: user-uuid-123 + type: string + required: + - id + - uuid + - name + - handle + - icon + type: object + RumStaticSegmentCreateAttributes: + description: Attributes for creating a new static segment. + properties: + description: + description: A description of the static segment. + example: Users from a specific journey. + type: string + journey_query_object: + $ref: '#/components/schemas/RumStaticSegmentJourneyQueryObject' + name: + description: The name of the static segment. + example: My Static Segment + type: string + tags: + description: A list of tags for the static segment. + example: + - team:frontend + items: + type: string + type: array + required: + - name + - description + - journey_query_object + type: object + RumStaticSegmentCreateData: + description: Data object for a static segment creation request. + properties: + attributes: + $ref: '#/components/schemas/RumStaticSegmentCreateAttributes' + type: + $ref: '#/components/schemas/RumStaticSegmentRequestType' + required: + - type + - attributes + type: object + RumStaticSegmentCreateRequest: + description: Request body for creating a new static segment. + properties: + data: + $ref: '#/components/schemas/RumStaticSegmentCreateData' + required: + - data + type: object + RumStaticSegmentJourneyFilter: + description: A filter within a journey query node. + properties: + attribute: + description: The attribute to filter on. + example: '@type' + type: string + value: + description: The value to match. + example: view + type: string + required: + - attribute + - value + type: object + RumStaticSegmentJourneyNode: + description: A node in a journey query object. + properties: + filters: + description: The list of filters for this node. + items: + $ref: '#/components/schemas/RumStaticSegmentJourneyFilter' + type: array + required: + - filters + type: object + RumStaticSegmentJourneyQueryObject: + description: The journey query object used to compute the static segment user + list. + properties: + nodes: + description: The list of journey nodes defining the query. + items: + $ref: '#/components/schemas/RumStaticSegmentJourneyNode' + type: array + required: + - nodes + type: object + RumStaticSegmentRequestType: + description: Type of the static segment creation request resource. + enum: + - create_static_segment_request + example: create_static_segment_request + type: string + x-enum-varnames: + - CREATE_STATIC_SEGMENT_REQUEST RunRetentionFilterName: description: The name of a RUM retention filter. example: Retention filter for session @@ -93185,6 +93892,329 @@ paths: summary: List rum replay viewership history sessions tags: - Rum Replay Viewership + /api/v2/rum/segment: + get: + description: List all user segments for the current organization. Supports sorting + and pagination. + operationId: ListRumSegments + parameters: + - description: Sort order for the segments list. + in: query + name: sort + required: false + schema: + example: name + type: string + - description: Maximum number of segments to return. + in: query + name: limit + required: false + schema: + example: 25 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RumSegmentListResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List all RUM segments + tags: + - RUM User Segments + x-unstable: '**Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: Create a new user segment for the current organization. + operationId: CreateRumSegment + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RumSegmentCreateRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/RumSegmentResponse' + description: Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '409': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Conflict + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create a RUM segment + tags: + - RUM User Segments + x-unstable: '**Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/rum/segment/initialize: + post: + description: Initialize default segments for the current organization. This + creates a set of predefined segments if they do not already exist. + operationId: InitializeRumSegments + responses: + '200': + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Initialize RUM segments + tags: + - RUM User Segments + x-unstable: '**Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/rum/segment/static: + post: + description: Create a new static user segment from a journey query. Static segments + contain a fixed list of users computed from the query at creation time. + operationId: CreateRumStaticSegment + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RumStaticSegmentCreateRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/RumSegmentResponse' + description: Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '409': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Conflict + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create a static RUM segment + tags: + - RUM User Segments + x-unstable: '**Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/rum/segment/templates: + get: + description: List all available segment templates. Templates provide predefined + segment configurations that can be customized with parameters. + operationId: ListRumSegmentTemplates + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RumSegmentTemplateListResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List RUM segment templates + tags: + - RUM User Segments + x-unstable: '**Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/rum/segment/{segment_id}: + delete: + description: Delete a user segment by its identifier. + operationId: DeleteRumSegment + parameters: + - description: The identifier of the segment. + in: path + name: segment_id + required: true + schema: + example: a1b2c3d4-1234-5678-9abc-123456789abc + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RumSegmentDeleteResponse' + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete a RUM segment + tags: + - RUM User Segments + x-unstable: '**Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + get: + description: Get a specific user segment by its identifier. + operationId: GetRumSegment + parameters: + - description: The identifier of the segment. + in: path + name: segment_id + required: true + schema: + example: a1b2c3d4-1234-5678-9abc-123456789abc + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RumSegmentResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get a RUM segment + tags: + - RUM User Segments + x-unstable: '**Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + put: + description: Update an existing user segment. All fields in the request body + are optional. + operationId: UpdateRumSegment + parameters: + - description: The identifier of the segment. + in: path + name: segment_id + required: true + schema: + example: a1b2c3d4-1234-5678-9abc-123456789abc + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RumSegmentUpdateRequest' + required: true + responses: + '204': + description: No Content + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '409': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Conflict + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Update a RUM segment + tags: + - RUM User Segments + x-unstable: '**Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/saml_configurations/idp_metadata: post: description: 'Endpoint for uploading IdP metadata for SAML setup. @@ -104793,6 +105823,8 @@ tags: aggregate your RUM events over HTTP. See the [RUM & Session Replay page](https://docs.datadoghq.com/real_user_monitoring/) for more information name: RUM +- description: Manage RUM user segments for audience targeting and analysis. + name: RUM User Segments - description: View and manage Reference Tables in your organization. name: Reference Tables - description: 'A restriction policy defines the access control rules for a resource, diff --git a/api/datadog/configuration.go b/api/datadog/configuration.go index 5997c4f634e..e683be4d117 100644 --- a/api/datadog/configuration.go +++ b/api/datadog/configuration.go @@ -817,6 +817,14 @@ func NewConfiguration() *Configuration { "v2.QueryEventFilteredUsers": false, "v2.QueryUsers": false, "v2.UpdateConnection": false, + "v2.CreateRumSegment": false, + "v2.CreateRumStaticSegment": false, + "v2.DeleteRumSegment": false, + "v2.GetRumSegment": false, + "v2.InitializeRumSegments": false, + "v2.ListRumSegments": false, + "v2.ListRumSegmentTemplates": false, + "v2.UpdateRumSegment": false, "v2.CreateScorecardOutcomesBatch": false, "v2.CreateScorecardRule": false, "v2.DeleteScorecardRule": false, diff --git a/api/datadogV2/api_rum_user_segments.go b/api/datadogV2/api_rum_user_segments.go new file mode 100644 index 00000000000..1ace0f0072a --- /dev/null +++ b/api/datadogV2/api_rum_user_segments.go @@ -0,0 +1,815 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + _context "context" + _fmt "fmt" + _log "log" + _nethttp "net/http" + _neturl "net/url" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RUMUserSegmentsApi service type +type RUMUserSegmentsApi datadog.Service + +// CreateRumSegment Create a RUM segment. +// Create a new user segment for the current organization. +func (a *RUMUserSegmentsApi) CreateRumSegment(ctx _context.Context, body RumSegmentCreateRequest) (RumSegmentResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue RumSegmentResponse + ) + + operationId := "v2.CreateRumSegment" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.RUMUserSegmentsApi.CreateRumSegment") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/rum/segment" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 409 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// CreateRumStaticSegment Create a static RUM segment. +// Create a new static user segment from a journey query. Static segments contain a fixed list of users computed from the query at creation time. +func (a *RUMUserSegmentsApi) CreateRumStaticSegment(ctx _context.Context, body RumStaticSegmentCreateRequest) (RumSegmentResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue RumSegmentResponse + ) + + operationId := "v2.CreateRumStaticSegment" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.RUMUserSegmentsApi.CreateRumStaticSegment") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/rum/segment/static" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 409 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// DeleteRumSegment Delete a RUM segment. +// Delete a user segment by its identifier. +func (a *RUMUserSegmentsApi) DeleteRumSegment(ctx _context.Context, segmentId string) (RumSegmentDeleteResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarReturnValue RumSegmentDeleteResponse + ) + + operationId := "v2.DeleteRumSegment" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.RUMUserSegmentsApi.DeleteRumSegment") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/rum/segment/{segment_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{segment_id}", _neturl.PathEscape(datadog.ParameterToString(segmentId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetRumSegment Get a RUM segment. +// Get a specific user segment by its identifier. +func (a *RUMUserSegmentsApi) GetRumSegment(ctx _context.Context, segmentId string) (RumSegmentResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue RumSegmentResponse + ) + + operationId := "v2.GetRumSegment" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.RUMUserSegmentsApi.GetRumSegment") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/rum/segment/{segment_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{segment_id}", _neturl.PathEscape(datadog.ParameterToString(segmentId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// InitializeRumSegments Initialize RUM segments. +// Initialize default segments for the current organization. This creates a set of predefined segments if they do not already exist. +func (a *RUMUserSegmentsApi) InitializeRumSegments(ctx _context.Context) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + ) + + operationId := "v2.InitializeRumSegments" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.RUMUserSegmentsApi.InitializeRumSegments") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/rum/segment/initialize" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// ListRumSegmentTemplates List RUM segment templates. +// List all available segment templates. Templates provide predefined segment configurations that can be customized with parameters. +func (a *RUMUserSegmentsApi) ListRumSegmentTemplates(ctx _context.Context) (RumSegmentTemplateListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue RumSegmentTemplateListResponse + ) + + operationId := "v2.ListRumSegmentTemplates" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.RUMUserSegmentsApi.ListRumSegmentTemplates") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/rum/segment/templates" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListRumSegmentsOptionalParameters holds optional parameters for ListRumSegments. +type ListRumSegmentsOptionalParameters struct { + Sort *string + Limit *int32 +} + +// NewListRumSegmentsOptionalParameters creates an empty struct for parameters. +func NewListRumSegmentsOptionalParameters() *ListRumSegmentsOptionalParameters { + this := ListRumSegmentsOptionalParameters{} + return &this +} + +// WithSort sets the corresponding parameter name and returns the struct. +func (r *ListRumSegmentsOptionalParameters) WithSort(sort string) *ListRumSegmentsOptionalParameters { + r.Sort = &sort + return r +} + +// WithLimit sets the corresponding parameter name and returns the struct. +func (r *ListRumSegmentsOptionalParameters) WithLimit(limit int32) *ListRumSegmentsOptionalParameters { + r.Limit = &limit + return r +} + +// ListRumSegments List all RUM segments. +// List all user segments for the current organization. Supports sorting and pagination. +func (a *RUMUserSegmentsApi) ListRumSegments(ctx _context.Context, o ...ListRumSegmentsOptionalParameters) (RumSegmentListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue RumSegmentListResponse + optionalParams ListRumSegmentsOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListRumSegmentsOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.ListRumSegments" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.RUMUserSegmentsApi.ListRumSegments") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/rum/segment" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.Sort != nil { + localVarQueryParams.Add("sort", datadog.ParameterToString(*optionalParams.Sort, "")) + } + if optionalParams.Limit != nil { + localVarQueryParams.Add("limit", datadog.ParameterToString(*optionalParams.Limit, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// UpdateRumSegment Update a RUM segment. +// Update an existing user segment. All fields in the request body are optional. +func (a *RUMUserSegmentsApi) UpdateRumSegment(ctx _context.Context, segmentId string, body RumSegmentUpdateRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + ) + + operationId := "v2.UpdateRumSegment" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.RUMUserSegmentsApi.UpdateRumSegment") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/rum/segment/{segment_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{segment_id}", _neturl.PathEscape(datadog.ParameterToString(segmentId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "*/*" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 409 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// NewRUMUserSegmentsApi Returns NewRUMUserSegmentsApi. +func NewRUMUserSegmentsApi(client *datadog.APIClient) *RUMUserSegmentsApi { + return &RUMUserSegmentsApi{ + Client: client, + } +} diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index b16d1cb811c..cd50ef33b58 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -538,6 +538,14 @@ // - [RUMApi.ListRUMEvents] // - [RUMApi.SearchRUMEvents] // - [RUMApi.UpdateRUMApplication] +// - [RUMUserSegmentsApi.CreateRumSegment] +// - [RUMUserSegmentsApi.CreateRumStaticSegment] +// - [RUMUserSegmentsApi.DeleteRumSegment] +// - [RUMUserSegmentsApi.GetRumSegment] +// - [RUMUserSegmentsApi.InitializeRumSegments] +// - [RUMUserSegmentsApi.ListRumSegmentTemplates] +// - [RUMUserSegmentsApi.ListRumSegments] +// - [RUMUserSegmentsApi.UpdateRumSegment] // - [ReferenceTablesApi.CreateReferenceTable] // - [ReferenceTablesApi.CreateReferenceTableUpload] // - [ReferenceTablesApi.DeleteRows] diff --git a/api/datadogV2/model_rum_segment_create_attributes.go b/api/datadogV2/model_rum_segment_create_attributes.go new file mode 100644 index 00000000000..c0fb431737a --- /dev/null +++ b/api/datadogV2/model_rum_segment_create_attributes.go @@ -0,0 +1,212 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentCreateAttributes Attributes for creating a new segment. +type RumSegmentCreateAttributes struct { + // Query definition for the segment. Contains one or more query blocks and an optional combination formula. + DataQuery RumSegmentDataQuery `json:"data_query"` + // A description of the segment. + Description *string `json:"description,omitempty"` + // The name of the segment. + Name string `json:"name"` + // A list of tags for the segment. + Tags []string `json:"tags,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumSegmentCreateAttributes instantiates a new RumSegmentCreateAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumSegmentCreateAttributes(dataQuery RumSegmentDataQuery, name string) *RumSegmentCreateAttributes { + this := RumSegmentCreateAttributes{} + this.DataQuery = dataQuery + this.Name = name + return &this +} + +// NewRumSegmentCreateAttributesWithDefaults instantiates a new RumSegmentCreateAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumSegmentCreateAttributesWithDefaults() *RumSegmentCreateAttributes { + this := RumSegmentCreateAttributes{} + return &this +} + +// GetDataQuery returns the DataQuery field value. +func (o *RumSegmentCreateAttributes) GetDataQuery() RumSegmentDataQuery { + if o == nil { + var ret RumSegmentDataQuery + return ret + } + return o.DataQuery +} + +// GetDataQueryOk returns a tuple with the DataQuery field value +// and a boolean to check if the value has been set. +func (o *RumSegmentCreateAttributes) GetDataQueryOk() (*RumSegmentDataQuery, bool) { + if o == nil { + return nil, false + } + return &o.DataQuery, true +} + +// SetDataQuery sets field value. +func (o *RumSegmentCreateAttributes) SetDataQuery(v RumSegmentDataQuery) { + o.DataQuery = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *RumSegmentCreateAttributes) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumSegmentCreateAttributes) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *RumSegmentCreateAttributes) HasDescription() bool { + return o != nil && o.Description != nil +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *RumSegmentCreateAttributes) SetDescription(v string) { + o.Description = &v +} + +// GetName returns the Name field value. +func (o *RumSegmentCreateAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *RumSegmentCreateAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *RumSegmentCreateAttributes) SetName(v string) { + o.Name = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *RumSegmentCreateAttributes) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumSegmentCreateAttributes) GetTagsOk() (*[]string, bool) { + if o == nil || o.Tags == nil { + return nil, false + } + return &o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *RumSegmentCreateAttributes) HasTags() bool { + return o != nil && o.Tags != nil +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *RumSegmentCreateAttributes) SetTags(v []string) { + o.Tags = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumSegmentCreateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data_query"] = o.DataQuery + if o.Description != nil { + toSerialize["description"] = o.Description + } + toSerialize["name"] = o.Name + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumSegmentCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + DataQuery *RumSegmentDataQuery `json:"data_query"` + Description *string `json:"description,omitempty"` + Name *string `json:"name"` + Tags []string `json:"tags,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.DataQuery == nil { + return fmt.Errorf("required field data_query missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data_query", "description", "name", "tags"}) + } else { + return err + } + + hasInvalidField := false + if all.DataQuery.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.DataQuery = *all.DataQuery + o.Description = all.Description + o.Name = *all.Name + o.Tags = all.Tags + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_rum_segment_create_data.go b/api/datadogV2/model_rum_segment_create_data.go new file mode 100644 index 00000000000..c89aff32131 --- /dev/null +++ b/api/datadogV2/model_rum_segment_create_data.go @@ -0,0 +1,146 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentCreateData Data object for a segment creation request. +type RumSegmentCreateData struct { + // Attributes for creating a new segment. + Attributes RumSegmentCreateAttributes `json:"attributes"` + // Type of the segment resource. + Type RumSegmentResourceType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumSegmentCreateData instantiates a new RumSegmentCreateData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumSegmentCreateData(attributes RumSegmentCreateAttributes, typeVar RumSegmentResourceType) *RumSegmentCreateData { + this := RumSegmentCreateData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewRumSegmentCreateDataWithDefaults instantiates a new RumSegmentCreateData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumSegmentCreateDataWithDefaults() *RumSegmentCreateData { + this := RumSegmentCreateData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *RumSegmentCreateData) GetAttributes() RumSegmentCreateAttributes { + if o == nil { + var ret RumSegmentCreateAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *RumSegmentCreateData) GetAttributesOk() (*RumSegmentCreateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *RumSegmentCreateData) SetAttributes(v RumSegmentCreateAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *RumSegmentCreateData) GetType() RumSegmentResourceType { + if o == nil { + var ret RumSegmentResourceType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *RumSegmentCreateData) GetTypeOk() (*RumSegmentResourceType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *RumSegmentCreateData) SetType(v RumSegmentResourceType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumSegmentCreateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumSegmentCreateData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *RumSegmentCreateAttributes `json:"attributes"` + Type *RumSegmentResourceType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_rum_segment_create_request.go b/api/datadogV2/model_rum_segment_create_request.go new file mode 100644 index 00000000000..b530c08b59a --- /dev/null +++ b/api/datadogV2/model_rum_segment_create_request.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentCreateRequest Request body for creating a new segment. +type RumSegmentCreateRequest struct { + // Data object for a segment creation request. + Data RumSegmentCreateData `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumSegmentCreateRequest instantiates a new RumSegmentCreateRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumSegmentCreateRequest(data RumSegmentCreateData) *RumSegmentCreateRequest { + this := RumSegmentCreateRequest{} + this.Data = data + return &this +} + +// NewRumSegmentCreateRequestWithDefaults instantiates a new RumSegmentCreateRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumSegmentCreateRequestWithDefaults() *RumSegmentCreateRequest { + this := RumSegmentCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *RumSegmentCreateRequest) GetData() RumSegmentCreateData { + if o == nil { + var ret RumSegmentCreateData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *RumSegmentCreateRequest) GetDataOk() (*RumSegmentCreateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *RumSegmentCreateRequest) SetData(v RumSegmentCreateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumSegmentCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumSegmentCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *RumSegmentCreateData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_rum_segment_data_query.go b/api/datadogV2/model_rum_segment_data_query.go new file mode 100644 index 00000000000..a08a962c600 --- /dev/null +++ b/api/datadogV2/model_rum_segment_data_query.go @@ -0,0 +1,277 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentDataQuery Query definition for the segment. Contains one or more query blocks and an optional combination formula. +type RumSegmentDataQuery struct { + // Boolean expression combining multiple query blocks. + Combination *string `json:"combination,omitempty"` + // List of event platform query blocks. + EventPlatforms []RumSegmentEventPlatform `json:"event_platforms,omitempty"` + // List of journey-based query blocks. + Journeys []RumSegmentJourney `json:"journeys,omitempty"` + // List of reference table query blocks. + ReferenceTables []RumSegmentReferenceTable `json:"reference_tables,omitempty"` + // List of static user list blocks. + Static []RumSegmentStaticEntry `json:"static,omitempty"` + // List of template-based query blocks. + Templates []RumSegmentTemplateInstance `json:"templates,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumSegmentDataQuery instantiates a new RumSegmentDataQuery object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumSegmentDataQuery() *RumSegmentDataQuery { + this := RumSegmentDataQuery{} + return &this +} + +// NewRumSegmentDataQueryWithDefaults instantiates a new RumSegmentDataQuery object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumSegmentDataQueryWithDefaults() *RumSegmentDataQuery { + this := RumSegmentDataQuery{} + return &this +} + +// GetCombination returns the Combination field value if set, zero value otherwise. +func (o *RumSegmentDataQuery) GetCombination() string { + if o == nil || o.Combination == nil { + var ret string + return ret + } + return *o.Combination +} + +// GetCombinationOk returns a tuple with the Combination field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumSegmentDataQuery) GetCombinationOk() (*string, bool) { + if o == nil || o.Combination == nil { + return nil, false + } + return o.Combination, true +} + +// HasCombination returns a boolean if a field has been set. +func (o *RumSegmentDataQuery) HasCombination() bool { + return o != nil && o.Combination != nil +} + +// SetCombination gets a reference to the given string and assigns it to the Combination field. +func (o *RumSegmentDataQuery) SetCombination(v string) { + o.Combination = &v +} + +// GetEventPlatforms returns the EventPlatforms field value if set, zero value otherwise. +func (o *RumSegmentDataQuery) GetEventPlatforms() []RumSegmentEventPlatform { + if o == nil || o.EventPlatforms == nil { + var ret []RumSegmentEventPlatform + return ret + } + return o.EventPlatforms +} + +// GetEventPlatformsOk returns a tuple with the EventPlatforms field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumSegmentDataQuery) GetEventPlatformsOk() (*[]RumSegmentEventPlatform, bool) { + if o == nil || o.EventPlatforms == nil { + return nil, false + } + return &o.EventPlatforms, true +} + +// HasEventPlatforms returns a boolean if a field has been set. +func (o *RumSegmentDataQuery) HasEventPlatforms() bool { + return o != nil && o.EventPlatforms != nil +} + +// SetEventPlatforms gets a reference to the given []RumSegmentEventPlatform and assigns it to the EventPlatforms field. +func (o *RumSegmentDataQuery) SetEventPlatforms(v []RumSegmentEventPlatform) { + o.EventPlatforms = v +} + +// GetJourneys returns the Journeys field value if set, zero value otherwise. +func (o *RumSegmentDataQuery) GetJourneys() []RumSegmentJourney { + if o == nil || o.Journeys == nil { + var ret []RumSegmentJourney + return ret + } + return o.Journeys +} + +// GetJourneysOk returns a tuple with the Journeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumSegmentDataQuery) GetJourneysOk() (*[]RumSegmentJourney, bool) { + if o == nil || o.Journeys == nil { + return nil, false + } + return &o.Journeys, true +} + +// HasJourneys returns a boolean if a field has been set. +func (o *RumSegmentDataQuery) HasJourneys() bool { + return o != nil && o.Journeys != nil +} + +// SetJourneys gets a reference to the given []RumSegmentJourney and assigns it to the Journeys field. +func (o *RumSegmentDataQuery) SetJourneys(v []RumSegmentJourney) { + o.Journeys = v +} + +// GetReferenceTables returns the ReferenceTables field value if set, zero value otherwise. +func (o *RumSegmentDataQuery) GetReferenceTables() []RumSegmentReferenceTable { + if o == nil || o.ReferenceTables == nil { + var ret []RumSegmentReferenceTable + return ret + } + return o.ReferenceTables +} + +// GetReferenceTablesOk returns a tuple with the ReferenceTables field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumSegmentDataQuery) GetReferenceTablesOk() (*[]RumSegmentReferenceTable, bool) { + if o == nil || o.ReferenceTables == nil { + return nil, false + } + return &o.ReferenceTables, true +} + +// HasReferenceTables returns a boolean if a field has been set. +func (o *RumSegmentDataQuery) HasReferenceTables() bool { + return o != nil && o.ReferenceTables != nil +} + +// SetReferenceTables gets a reference to the given []RumSegmentReferenceTable and assigns it to the ReferenceTables field. +func (o *RumSegmentDataQuery) SetReferenceTables(v []RumSegmentReferenceTable) { + o.ReferenceTables = v +} + +// GetStatic returns the Static field value if set, zero value otherwise. +func (o *RumSegmentDataQuery) GetStatic() []RumSegmentStaticEntry { + if o == nil || o.Static == nil { + var ret []RumSegmentStaticEntry + return ret + } + return o.Static +} + +// GetStaticOk returns a tuple with the Static field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumSegmentDataQuery) GetStaticOk() (*[]RumSegmentStaticEntry, bool) { + if o == nil || o.Static == nil { + return nil, false + } + return &o.Static, true +} + +// HasStatic returns a boolean if a field has been set. +func (o *RumSegmentDataQuery) HasStatic() bool { + return o != nil && o.Static != nil +} + +// SetStatic gets a reference to the given []RumSegmentStaticEntry and assigns it to the Static field. +func (o *RumSegmentDataQuery) SetStatic(v []RumSegmentStaticEntry) { + o.Static = v +} + +// GetTemplates returns the Templates field value if set, zero value otherwise. +func (o *RumSegmentDataQuery) GetTemplates() []RumSegmentTemplateInstance { + if o == nil || o.Templates == nil { + var ret []RumSegmentTemplateInstance + return ret + } + return o.Templates +} + +// GetTemplatesOk returns a tuple with the Templates field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumSegmentDataQuery) GetTemplatesOk() (*[]RumSegmentTemplateInstance, bool) { + if o == nil || o.Templates == nil { + return nil, false + } + return &o.Templates, true +} + +// HasTemplates returns a boolean if a field has been set. +func (o *RumSegmentDataQuery) HasTemplates() bool { + return o != nil && o.Templates != nil +} + +// SetTemplates gets a reference to the given []RumSegmentTemplateInstance and assigns it to the Templates field. +func (o *RumSegmentDataQuery) SetTemplates(v []RumSegmentTemplateInstance) { + o.Templates = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumSegmentDataQuery) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Combination != nil { + toSerialize["combination"] = o.Combination + } + if o.EventPlatforms != nil { + toSerialize["event_platforms"] = o.EventPlatforms + } + if o.Journeys != nil { + toSerialize["journeys"] = o.Journeys + } + if o.ReferenceTables != nil { + toSerialize["reference_tables"] = o.ReferenceTables + } + if o.Static != nil { + toSerialize["static"] = o.Static + } + if o.Templates != nil { + toSerialize["templates"] = o.Templates + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumSegmentDataQuery) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Combination *string `json:"combination,omitempty"` + EventPlatforms []RumSegmentEventPlatform `json:"event_platforms,omitempty"` + Journeys []RumSegmentJourney `json:"journeys,omitempty"` + ReferenceTables []RumSegmentReferenceTable `json:"reference_tables,omitempty"` + Static []RumSegmentStaticEntry `json:"static,omitempty"` + Templates []RumSegmentTemplateInstance `json:"templates,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"combination", "event_platforms", "journeys", "reference_tables", "static", "templates"}) + } else { + return err + } + o.Combination = all.Combination + o.EventPlatforms = all.EventPlatforms + o.Journeys = all.Journeys + o.ReferenceTables = all.ReferenceTables + o.Static = all.Static + o.Templates = all.Templates + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_rum_segment_delete_attributes.go b/api/datadogV2/model_rum_segment_delete_attributes.go new file mode 100644 index 00000000000..90ea3dcae41 --- /dev/null +++ b/api/datadogV2/model_rum_segment_delete_attributes.go @@ -0,0 +1,211 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentDeleteAttributes Attributes of a deleted segment response. +type RumSegmentDeleteAttributes struct { + // The timestamp when the segment was disabled in RFC 3339 format. + DisabledAt time.Time `json:"disabled_at"` + // A user who performed an action on a segment. + DisabledBy RumSegmentUser `json:"disabled_by"` + // The name of the deleted segment. + Name string `json:"name"` + // The unique identifier of the deleted segment. + Uuid string `json:"uuid"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumSegmentDeleteAttributes instantiates a new RumSegmentDeleteAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumSegmentDeleteAttributes(disabledAt time.Time, disabledBy RumSegmentUser, name string, uuid string) *RumSegmentDeleteAttributes { + this := RumSegmentDeleteAttributes{} + this.DisabledAt = disabledAt + this.DisabledBy = disabledBy + this.Name = name + this.Uuid = uuid + return &this +} + +// NewRumSegmentDeleteAttributesWithDefaults instantiates a new RumSegmentDeleteAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumSegmentDeleteAttributesWithDefaults() *RumSegmentDeleteAttributes { + this := RumSegmentDeleteAttributes{} + return &this +} + +// GetDisabledAt returns the DisabledAt field value. +func (o *RumSegmentDeleteAttributes) GetDisabledAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.DisabledAt +} + +// GetDisabledAtOk returns a tuple with the DisabledAt field value +// and a boolean to check if the value has been set. +func (o *RumSegmentDeleteAttributes) GetDisabledAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.DisabledAt, true +} + +// SetDisabledAt sets field value. +func (o *RumSegmentDeleteAttributes) SetDisabledAt(v time.Time) { + o.DisabledAt = v +} + +// GetDisabledBy returns the DisabledBy field value. +func (o *RumSegmentDeleteAttributes) GetDisabledBy() RumSegmentUser { + if o == nil { + var ret RumSegmentUser + return ret + } + return o.DisabledBy +} + +// GetDisabledByOk returns a tuple with the DisabledBy field value +// and a boolean to check if the value has been set. +func (o *RumSegmentDeleteAttributes) GetDisabledByOk() (*RumSegmentUser, bool) { + if o == nil { + return nil, false + } + return &o.DisabledBy, true +} + +// SetDisabledBy sets field value. +func (o *RumSegmentDeleteAttributes) SetDisabledBy(v RumSegmentUser) { + o.DisabledBy = v +} + +// GetName returns the Name field value. +func (o *RumSegmentDeleteAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *RumSegmentDeleteAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *RumSegmentDeleteAttributes) SetName(v string) { + o.Name = v +} + +// GetUuid returns the Uuid field value. +func (o *RumSegmentDeleteAttributes) GetUuid() string { + if o == nil { + var ret string + return ret + } + return o.Uuid +} + +// GetUuidOk returns a tuple with the Uuid field value +// and a boolean to check if the value has been set. +func (o *RumSegmentDeleteAttributes) GetUuidOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Uuid, true +} + +// SetUuid sets field value. +func (o *RumSegmentDeleteAttributes) SetUuid(v string) { + o.Uuid = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumSegmentDeleteAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.DisabledAt.Nanosecond() == 0 { + toSerialize["disabled_at"] = o.DisabledAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["disabled_at"] = o.DisabledAt.Format("2006-01-02T15:04:05.000Z07:00") + } + toSerialize["disabled_by"] = o.DisabledBy + toSerialize["name"] = o.Name + toSerialize["uuid"] = o.Uuid + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumSegmentDeleteAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + DisabledAt *time.Time `json:"disabled_at"` + DisabledBy *RumSegmentUser `json:"disabled_by"` + Name *string `json:"name"` + Uuid *string `json:"uuid"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.DisabledAt == nil { + return fmt.Errorf("required field disabled_at missing") + } + if all.DisabledBy == nil { + return fmt.Errorf("required field disabled_by missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Uuid == nil { + return fmt.Errorf("required field uuid missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"disabled_at", "disabled_by", "name", "uuid"}) + } else { + return err + } + + hasInvalidField := false + o.DisabledAt = *all.DisabledAt + if all.DisabledBy.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.DisabledBy = *all.DisabledBy + o.Name = *all.Name + o.Uuid = *all.Uuid + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_rum_segment_delete_data.go b/api/datadogV2/model_rum_segment_delete_data.go new file mode 100644 index 00000000000..3292a378ca8 --- /dev/null +++ b/api/datadogV2/model_rum_segment_delete_data.go @@ -0,0 +1,178 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentDeleteData Data object for a deleted segment response. +type RumSegmentDeleteData struct { + // Attributes of a deleted segment response. + Attributes RumSegmentDeleteAttributes `json:"attributes"` + // Unique identifier for the deleted segment. + Id string `json:"id"` + // Type of the deleted segment resource. + Type RumSegmentDeleteType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumSegmentDeleteData instantiates a new RumSegmentDeleteData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumSegmentDeleteData(attributes RumSegmentDeleteAttributes, id string, typeVar RumSegmentDeleteType) *RumSegmentDeleteData { + this := RumSegmentDeleteData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewRumSegmentDeleteDataWithDefaults instantiates a new RumSegmentDeleteData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumSegmentDeleteDataWithDefaults() *RumSegmentDeleteData { + this := RumSegmentDeleteData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *RumSegmentDeleteData) GetAttributes() RumSegmentDeleteAttributes { + if o == nil { + var ret RumSegmentDeleteAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *RumSegmentDeleteData) GetAttributesOk() (*RumSegmentDeleteAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *RumSegmentDeleteData) SetAttributes(v RumSegmentDeleteAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *RumSegmentDeleteData) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *RumSegmentDeleteData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *RumSegmentDeleteData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *RumSegmentDeleteData) GetType() RumSegmentDeleteType { + if o == nil { + var ret RumSegmentDeleteType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *RumSegmentDeleteData) GetTypeOk() (*RumSegmentDeleteType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *RumSegmentDeleteData) SetType(v RumSegmentDeleteType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumSegmentDeleteData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumSegmentDeleteData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *RumSegmentDeleteAttributes `json:"attributes"` + Id *string `json:"id"` + Type *RumSegmentDeleteType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_rum_segment_delete_response.go b/api/datadogV2/model_rum_segment_delete_response.go new file mode 100644 index 00000000000..590e2e00159 --- /dev/null +++ b/api/datadogV2/model_rum_segment_delete_response.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentDeleteResponse Response for a segment deletion. +type RumSegmentDeleteResponse struct { + // Data object for a deleted segment response. + Data RumSegmentDeleteData `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumSegmentDeleteResponse instantiates a new RumSegmentDeleteResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumSegmentDeleteResponse(data RumSegmentDeleteData) *RumSegmentDeleteResponse { + this := RumSegmentDeleteResponse{} + this.Data = data + return &this +} + +// NewRumSegmentDeleteResponseWithDefaults instantiates a new RumSegmentDeleteResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumSegmentDeleteResponseWithDefaults() *RumSegmentDeleteResponse { + this := RumSegmentDeleteResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *RumSegmentDeleteResponse) GetData() RumSegmentDeleteData { + if o == nil { + var ret RumSegmentDeleteData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *RumSegmentDeleteResponse) GetDataOk() (*RumSegmentDeleteData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *RumSegmentDeleteResponse) SetData(v RumSegmentDeleteData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumSegmentDeleteResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumSegmentDeleteResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *RumSegmentDeleteData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_rum_segment_delete_type.go b/api/datadogV2/model_rum_segment_delete_type.go new file mode 100644 index 00000000000..5875466a72c --- /dev/null +++ b/api/datadogV2/model_rum_segment_delete_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentDeleteType Type of the deleted segment resource. +type RumSegmentDeleteType string + +// List of RumSegmentDeleteType. +const ( + RUMSEGMENTDELETETYPE_DELETED_SEGMENT RumSegmentDeleteType = "deleted_segment" +) + +var allowedRumSegmentDeleteTypeEnumValues = []RumSegmentDeleteType{ + RUMSEGMENTDELETETYPE_DELETED_SEGMENT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *RumSegmentDeleteType) GetAllowedValues() []RumSegmentDeleteType { + return allowedRumSegmentDeleteTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *RumSegmentDeleteType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = RumSegmentDeleteType(value) + return nil +} + +// NewRumSegmentDeleteTypeFromValue returns a pointer to a valid RumSegmentDeleteType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewRumSegmentDeleteTypeFromValue(v string) (*RumSegmentDeleteType, error) { + ev := RumSegmentDeleteType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for RumSegmentDeleteType: valid values are %v", v, allowedRumSegmentDeleteTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v RumSegmentDeleteType) IsValid() bool { + for _, existing := range allowedRumSegmentDeleteTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to RumSegmentDeleteType value. +func (v RumSegmentDeleteType) Ptr() *RumSegmentDeleteType { + return &v +} diff --git a/api/datadogV2/model_rum_segment_event_platform.go b/api/datadogV2/model_rum_segment_event_platform.go new file mode 100644 index 00000000000..11792eab9b2 --- /dev/null +++ b/api/datadogV2/model_rum_segment_event_platform.go @@ -0,0 +1,235 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentEventPlatform An event platform query block within a segment data query. +type RumSegmentEventPlatform struct { + // The facet to extract user identifiers from. + Facet string `json:"facet"` + // The start of the time range in milliseconds since epoch. + From *int64 `json:"from,omitempty"` + // The name of this query block. + Name string `json:"name"` + // The search query for filtering events. + Query string `json:"query"` + // The end of the time range in milliseconds since epoch. + To *int64 `json:"to,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumSegmentEventPlatform instantiates a new RumSegmentEventPlatform object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumSegmentEventPlatform(facet string, name string, query string) *RumSegmentEventPlatform { + this := RumSegmentEventPlatform{} + this.Facet = facet + this.Name = name + this.Query = query + return &this +} + +// NewRumSegmentEventPlatformWithDefaults instantiates a new RumSegmentEventPlatform object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumSegmentEventPlatformWithDefaults() *RumSegmentEventPlatform { + this := RumSegmentEventPlatform{} + return &this +} + +// GetFacet returns the Facet field value. +func (o *RumSegmentEventPlatform) GetFacet() string { + if o == nil { + var ret string + return ret + } + return o.Facet +} + +// GetFacetOk returns a tuple with the Facet field value +// and a boolean to check if the value has been set. +func (o *RumSegmentEventPlatform) GetFacetOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Facet, true +} + +// SetFacet sets field value. +func (o *RumSegmentEventPlatform) SetFacet(v string) { + o.Facet = v +} + +// GetFrom returns the From field value if set, zero value otherwise. +func (o *RumSegmentEventPlatform) GetFrom() int64 { + if o == nil || o.From == nil { + var ret int64 + return ret + } + return *o.From +} + +// GetFromOk returns a tuple with the From field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumSegmentEventPlatform) GetFromOk() (*int64, bool) { + if o == nil || o.From == nil { + return nil, false + } + return o.From, true +} + +// HasFrom returns a boolean if a field has been set. +func (o *RumSegmentEventPlatform) HasFrom() bool { + return o != nil && o.From != nil +} + +// SetFrom gets a reference to the given int64 and assigns it to the From field. +func (o *RumSegmentEventPlatform) SetFrom(v int64) { + o.From = &v +} + +// GetName returns the Name field value. +func (o *RumSegmentEventPlatform) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *RumSegmentEventPlatform) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *RumSegmentEventPlatform) SetName(v string) { + o.Name = v +} + +// GetQuery returns the Query field value. +func (o *RumSegmentEventPlatform) GetQuery() string { + if o == nil { + var ret string + return ret + } + return o.Query +} + +// GetQueryOk returns a tuple with the Query field value +// and a boolean to check if the value has been set. +func (o *RumSegmentEventPlatform) GetQueryOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Query, true +} + +// SetQuery sets field value. +func (o *RumSegmentEventPlatform) SetQuery(v string) { + o.Query = v +} + +// GetTo returns the To field value if set, zero value otherwise. +func (o *RumSegmentEventPlatform) GetTo() int64 { + if o == nil || o.To == nil { + var ret int64 + return ret + } + return *o.To +} + +// GetToOk returns a tuple with the To field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumSegmentEventPlatform) GetToOk() (*int64, bool) { + if o == nil || o.To == nil { + return nil, false + } + return o.To, true +} + +// HasTo returns a boolean if a field has been set. +func (o *RumSegmentEventPlatform) HasTo() bool { + return o != nil && o.To != nil +} + +// SetTo gets a reference to the given int64 and assigns it to the To field. +func (o *RumSegmentEventPlatform) SetTo(v int64) { + o.To = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumSegmentEventPlatform) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["facet"] = o.Facet + if o.From != nil { + toSerialize["from"] = o.From + } + toSerialize["name"] = o.Name + toSerialize["query"] = o.Query + if o.To != nil { + toSerialize["to"] = o.To + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumSegmentEventPlatform) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Facet *string `json:"facet"` + From *int64 `json:"from,omitempty"` + Name *string `json:"name"` + Query *string `json:"query"` + To *int64 `json:"to,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Facet == nil { + return fmt.Errorf("required field facet missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Query == nil { + return fmt.Errorf("required field query missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"facet", "from", "name", "query", "to"}) + } else { + return err + } + o.Facet = *all.Facet + o.From = all.From + o.Name = *all.Name + o.Query = *all.Query + o.To = all.To + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_rum_segment_journey.go b/api/datadogV2/model_rum_segment_journey.go new file mode 100644 index 00000000000..5ab787e8747 --- /dev/null +++ b/api/datadogV2/model_rum_segment_journey.go @@ -0,0 +1,207 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentJourney A journey-based query block within a segment data query. +type RumSegmentJourney struct { + // The type of conversion to track. + ConversionType *string `json:"conversion_type,omitempty"` + // The facet to group journey results by. + GroupBy *string `json:"group_by,omitempty"` + // The name of this journey query block. + Name *string `json:"name,omitempty"` + // The search query for filtering events. + Search *string `json:"search,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumSegmentJourney instantiates a new RumSegmentJourney object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumSegmentJourney() *RumSegmentJourney { + this := RumSegmentJourney{} + return &this +} + +// NewRumSegmentJourneyWithDefaults instantiates a new RumSegmentJourney object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumSegmentJourneyWithDefaults() *RumSegmentJourney { + this := RumSegmentJourney{} + return &this +} + +// GetConversionType returns the ConversionType field value if set, zero value otherwise. +func (o *RumSegmentJourney) GetConversionType() string { + if o == nil || o.ConversionType == nil { + var ret string + return ret + } + return *o.ConversionType +} + +// GetConversionTypeOk returns a tuple with the ConversionType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumSegmentJourney) GetConversionTypeOk() (*string, bool) { + if o == nil || o.ConversionType == nil { + return nil, false + } + return o.ConversionType, true +} + +// HasConversionType returns a boolean if a field has been set. +func (o *RumSegmentJourney) HasConversionType() bool { + return o != nil && o.ConversionType != nil +} + +// SetConversionType gets a reference to the given string and assigns it to the ConversionType field. +func (o *RumSegmentJourney) SetConversionType(v string) { + o.ConversionType = &v +} + +// GetGroupBy returns the GroupBy field value if set, zero value otherwise. +func (o *RumSegmentJourney) GetGroupBy() string { + if o == nil || o.GroupBy == nil { + var ret string + return ret + } + return *o.GroupBy +} + +// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumSegmentJourney) GetGroupByOk() (*string, bool) { + if o == nil || o.GroupBy == nil { + return nil, false + } + return o.GroupBy, true +} + +// HasGroupBy returns a boolean if a field has been set. +func (o *RumSegmentJourney) HasGroupBy() bool { + return o != nil && o.GroupBy != nil +} + +// SetGroupBy gets a reference to the given string and assigns it to the GroupBy field. +func (o *RumSegmentJourney) SetGroupBy(v string) { + o.GroupBy = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *RumSegmentJourney) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumSegmentJourney) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *RumSegmentJourney) HasName() bool { + return o != nil && o.Name != nil +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *RumSegmentJourney) SetName(v string) { + o.Name = &v +} + +// GetSearch returns the Search field value if set, zero value otherwise. +func (o *RumSegmentJourney) GetSearch() string { + if o == nil || o.Search == nil { + var ret string + return ret + } + return *o.Search +} + +// GetSearchOk returns a tuple with the Search field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumSegmentJourney) GetSearchOk() (*string, bool) { + if o == nil || o.Search == nil { + return nil, false + } + return o.Search, true +} + +// HasSearch returns a boolean if a field has been set. +func (o *RumSegmentJourney) HasSearch() bool { + return o != nil && o.Search != nil +} + +// SetSearch gets a reference to the given string and assigns it to the Search field. +func (o *RumSegmentJourney) SetSearch(v string) { + o.Search = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumSegmentJourney) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.ConversionType != nil { + toSerialize["conversion_type"] = o.ConversionType + } + if o.GroupBy != nil { + toSerialize["group_by"] = o.GroupBy + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Search != nil { + toSerialize["search"] = o.Search + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumSegmentJourney) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ConversionType *string `json:"conversion_type,omitempty"` + GroupBy *string `json:"group_by,omitempty"` + Name *string `json:"name,omitempty"` + Search *string `json:"search,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"conversion_type", "group_by", "name", "search"}) + } else { + return err + } + o.ConversionType = all.ConversionType + o.GroupBy = all.GroupBy + o.Name = all.Name + o.Search = all.Search + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_rum_segment_list_response.go b/api/datadogV2/model_rum_segment_list_response.go new file mode 100644 index 00000000000..84e7948a499 --- /dev/null +++ b/api/datadogV2/model_rum_segment_list_response.go @@ -0,0 +1,101 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentListResponse Response for listing segments. +type RumSegmentListResponse struct { + // The list of segments. + Data []RumSegmentResponseData `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumSegmentListResponse instantiates a new RumSegmentListResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumSegmentListResponse(data []RumSegmentResponseData) *RumSegmentListResponse { + this := RumSegmentListResponse{} + this.Data = data + return &this +} + +// NewRumSegmentListResponseWithDefaults instantiates a new RumSegmentListResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumSegmentListResponseWithDefaults() *RumSegmentListResponse { + this := RumSegmentListResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *RumSegmentListResponse) GetData() []RumSegmentResponseData { + if o == nil { + var ret []RumSegmentResponseData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *RumSegmentListResponse) GetDataOk() (*[]RumSegmentResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *RumSegmentListResponse) SetData(v []RumSegmentResponseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumSegmentListResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumSegmentListResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]RumSegmentResponseData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_rum_segment_reference_table.go b/api/datadogV2/model_rum_segment_reference_table.go new file mode 100644 index 00000000000..48be66215e8 --- /dev/null +++ b/api/datadogV2/model_rum_segment_reference_table.go @@ -0,0 +1,241 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentReferenceTable A reference table query block within a segment data query. +type RumSegmentReferenceTable struct { + // The columns to include from the reference table. + Columns []RumSegmentReferenceTableColumn `json:"columns"` + // An optional filter query for the reference table data. + FilterQuery *string `json:"filter_query,omitempty"` + // The join condition for a reference table query block. + JoinCondition RumSegmentReferenceTableJoinCondition `json:"join_condition"` + // The name of this query block. + Name string `json:"name"` + // The name of the reference table. + TableName string `json:"table_name"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumSegmentReferenceTable instantiates a new RumSegmentReferenceTable object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumSegmentReferenceTable(columns []RumSegmentReferenceTableColumn, joinCondition RumSegmentReferenceTableJoinCondition, name string, tableName string) *RumSegmentReferenceTable { + this := RumSegmentReferenceTable{} + this.Columns = columns + this.JoinCondition = joinCondition + this.Name = name + this.TableName = tableName + return &this +} + +// NewRumSegmentReferenceTableWithDefaults instantiates a new RumSegmentReferenceTable object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumSegmentReferenceTableWithDefaults() *RumSegmentReferenceTable { + this := RumSegmentReferenceTable{} + return &this +} + +// GetColumns returns the Columns field value. +func (o *RumSegmentReferenceTable) GetColumns() []RumSegmentReferenceTableColumn { + if o == nil { + var ret []RumSegmentReferenceTableColumn + return ret + } + return o.Columns +} + +// GetColumnsOk returns a tuple with the Columns field value +// and a boolean to check if the value has been set. +func (o *RumSegmentReferenceTable) GetColumnsOk() (*[]RumSegmentReferenceTableColumn, bool) { + if o == nil { + return nil, false + } + return &o.Columns, true +} + +// SetColumns sets field value. +func (o *RumSegmentReferenceTable) SetColumns(v []RumSegmentReferenceTableColumn) { + o.Columns = v +} + +// GetFilterQuery returns the FilterQuery field value if set, zero value otherwise. +func (o *RumSegmentReferenceTable) GetFilterQuery() string { + if o == nil || o.FilterQuery == nil { + var ret string + return ret + } + return *o.FilterQuery +} + +// GetFilterQueryOk returns a tuple with the FilterQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumSegmentReferenceTable) GetFilterQueryOk() (*string, bool) { + if o == nil || o.FilterQuery == nil { + return nil, false + } + return o.FilterQuery, true +} + +// HasFilterQuery returns a boolean if a field has been set. +func (o *RumSegmentReferenceTable) HasFilterQuery() bool { + return o != nil && o.FilterQuery != nil +} + +// SetFilterQuery gets a reference to the given string and assigns it to the FilterQuery field. +func (o *RumSegmentReferenceTable) SetFilterQuery(v string) { + o.FilterQuery = &v +} + +// GetJoinCondition returns the JoinCondition field value. +func (o *RumSegmentReferenceTable) GetJoinCondition() RumSegmentReferenceTableJoinCondition { + if o == nil { + var ret RumSegmentReferenceTableJoinCondition + return ret + } + return o.JoinCondition +} + +// GetJoinConditionOk returns a tuple with the JoinCondition field value +// and a boolean to check if the value has been set. +func (o *RumSegmentReferenceTable) GetJoinConditionOk() (*RumSegmentReferenceTableJoinCondition, bool) { + if o == nil { + return nil, false + } + return &o.JoinCondition, true +} + +// SetJoinCondition sets field value. +func (o *RumSegmentReferenceTable) SetJoinCondition(v RumSegmentReferenceTableJoinCondition) { + o.JoinCondition = v +} + +// GetName returns the Name field value. +func (o *RumSegmentReferenceTable) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *RumSegmentReferenceTable) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *RumSegmentReferenceTable) SetName(v string) { + o.Name = v +} + +// GetTableName returns the TableName field value. +func (o *RumSegmentReferenceTable) GetTableName() string { + if o == nil { + var ret string + return ret + } + return o.TableName +} + +// GetTableNameOk returns a tuple with the TableName field value +// and a boolean to check if the value has been set. +func (o *RumSegmentReferenceTable) GetTableNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TableName, true +} + +// SetTableName sets field value. +func (o *RumSegmentReferenceTable) SetTableName(v string) { + o.TableName = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumSegmentReferenceTable) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["columns"] = o.Columns + if o.FilterQuery != nil { + toSerialize["filter_query"] = o.FilterQuery + } + toSerialize["join_condition"] = o.JoinCondition + toSerialize["name"] = o.Name + toSerialize["table_name"] = o.TableName + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumSegmentReferenceTable) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Columns *[]RumSegmentReferenceTableColumn `json:"columns"` + FilterQuery *string `json:"filter_query,omitempty"` + JoinCondition *RumSegmentReferenceTableJoinCondition `json:"join_condition"` + Name *string `json:"name"` + TableName *string `json:"table_name"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Columns == nil { + return fmt.Errorf("required field columns missing") + } + if all.JoinCondition == nil { + return fmt.Errorf("required field join_condition missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.TableName == nil { + return fmt.Errorf("required field table_name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"columns", "filter_query", "join_condition", "name", "table_name"}) + } else { + return err + } + + hasInvalidField := false + o.Columns = *all.Columns + o.FilterQuery = all.FilterQuery + if all.JoinCondition.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.JoinCondition = *all.JoinCondition + o.Name = *all.Name + o.TableName = *all.TableName + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_rum_segment_reference_table_column.go b/api/datadogV2/model_rum_segment_reference_table_column.go new file mode 100644 index 00000000000..4d155c04c92 --- /dev/null +++ b/api/datadogV2/model_rum_segment_reference_table_column.go @@ -0,0 +1,101 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentReferenceTableColumn A column definition in a reference table query block. +type RumSegmentReferenceTableColumn struct { + // The name of the column. + Name string `json:"name"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumSegmentReferenceTableColumn instantiates a new RumSegmentReferenceTableColumn object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumSegmentReferenceTableColumn(name string) *RumSegmentReferenceTableColumn { + this := RumSegmentReferenceTableColumn{} + this.Name = name + return &this +} + +// NewRumSegmentReferenceTableColumnWithDefaults instantiates a new RumSegmentReferenceTableColumn object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumSegmentReferenceTableColumnWithDefaults() *RumSegmentReferenceTableColumn { + this := RumSegmentReferenceTableColumn{} + return &this +} + +// GetName returns the Name field value. +func (o *RumSegmentReferenceTableColumn) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *RumSegmentReferenceTableColumn) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *RumSegmentReferenceTableColumn) SetName(v string) { + o.Name = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumSegmentReferenceTableColumn) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumSegmentReferenceTableColumn) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Name *string `json:"name"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"name"}) + } else { + return err + } + o.Name = *all.Name + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_rum_segment_reference_table_join_condition.go b/api/datadogV2/model_rum_segment_reference_table_join_condition.go new file mode 100644 index 00000000000..e03eabaf51a --- /dev/null +++ b/api/datadogV2/model_rum_segment_reference_table_join_condition.go @@ -0,0 +1,133 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentReferenceTableJoinCondition The join condition for a reference table query block. +type RumSegmentReferenceTableJoinCondition struct { + // The reference table column to join on. + ColumnName string `json:"column_name"` + // The RUM facet to join on. + Facet string `json:"facet"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumSegmentReferenceTableJoinCondition instantiates a new RumSegmentReferenceTableJoinCondition object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumSegmentReferenceTableJoinCondition(columnName string, facet string) *RumSegmentReferenceTableJoinCondition { + this := RumSegmentReferenceTableJoinCondition{} + this.ColumnName = columnName + this.Facet = facet + return &this +} + +// NewRumSegmentReferenceTableJoinConditionWithDefaults instantiates a new RumSegmentReferenceTableJoinCondition object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumSegmentReferenceTableJoinConditionWithDefaults() *RumSegmentReferenceTableJoinCondition { + this := RumSegmentReferenceTableJoinCondition{} + return &this +} + +// GetColumnName returns the ColumnName field value. +func (o *RumSegmentReferenceTableJoinCondition) GetColumnName() string { + if o == nil { + var ret string + return ret + } + return o.ColumnName +} + +// GetColumnNameOk returns a tuple with the ColumnName field value +// and a boolean to check if the value has been set. +func (o *RumSegmentReferenceTableJoinCondition) GetColumnNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ColumnName, true +} + +// SetColumnName sets field value. +func (o *RumSegmentReferenceTableJoinCondition) SetColumnName(v string) { + o.ColumnName = v +} + +// GetFacet returns the Facet field value. +func (o *RumSegmentReferenceTableJoinCondition) GetFacet() string { + if o == nil { + var ret string + return ret + } + return o.Facet +} + +// GetFacetOk returns a tuple with the Facet field value +// and a boolean to check if the value has been set. +func (o *RumSegmentReferenceTableJoinCondition) GetFacetOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Facet, true +} + +// SetFacet sets field value. +func (o *RumSegmentReferenceTableJoinCondition) SetFacet(v string) { + o.Facet = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumSegmentReferenceTableJoinCondition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["column_name"] = o.ColumnName + toSerialize["facet"] = o.Facet + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumSegmentReferenceTableJoinCondition) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ColumnName *string `json:"column_name"` + Facet *string `json:"facet"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.ColumnName == nil { + return fmt.Errorf("required field column_name missing") + } + if all.Facet == nil { + return fmt.Errorf("required field facet missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"column_name", "facet"}) + } else { + return err + } + o.ColumnName = *all.ColumnName + o.Facet = *all.Facet + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_rum_segment_resource_type.go b/api/datadogV2/model_rum_segment_resource_type.go new file mode 100644 index 00000000000..74a746671a7 --- /dev/null +++ b/api/datadogV2/model_rum_segment_resource_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentResourceType Type of the segment resource. +type RumSegmentResourceType string + +// List of RumSegmentResourceType. +const ( + RUMSEGMENTRESOURCETYPE_SEGMENT RumSegmentResourceType = "segment" +) + +var allowedRumSegmentResourceTypeEnumValues = []RumSegmentResourceType{ + RUMSEGMENTRESOURCETYPE_SEGMENT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *RumSegmentResourceType) GetAllowedValues() []RumSegmentResourceType { + return allowedRumSegmentResourceTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *RumSegmentResourceType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = RumSegmentResourceType(value) + return nil +} + +// NewRumSegmentResourceTypeFromValue returns a pointer to a valid RumSegmentResourceType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewRumSegmentResourceTypeFromValue(v string) (*RumSegmentResourceType, error) { + ev := RumSegmentResourceType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for RumSegmentResourceType: valid values are %v", v, allowedRumSegmentResourceTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v RumSegmentResourceType) IsValid() bool { + for _, existing := range allowedRumSegmentResourceTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to RumSegmentResourceType value. +func (v RumSegmentResourceType) Ptr() *RumSegmentResourceType { + return &v +} diff --git a/api/datadogV2/model_rum_segment_response.go b/api/datadogV2/model_rum_segment_response.go new file mode 100644 index 00000000000..e4a4484bcdf --- /dev/null +++ b/api/datadogV2/model_rum_segment_response.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentResponse Response containing a single segment. +type RumSegmentResponse struct { + // Data object for a segment in a response. + Data RumSegmentResponseData `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumSegmentResponse instantiates a new RumSegmentResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumSegmentResponse(data RumSegmentResponseData) *RumSegmentResponse { + this := RumSegmentResponse{} + this.Data = data + return &this +} + +// NewRumSegmentResponseWithDefaults instantiates a new RumSegmentResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumSegmentResponseWithDefaults() *RumSegmentResponse { + this := RumSegmentResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *RumSegmentResponse) GetData() RumSegmentResponseData { + if o == nil { + var ret RumSegmentResponseData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *RumSegmentResponse) GetDataOk() (*RumSegmentResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *RumSegmentResponse) SetData(v RumSegmentResponseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumSegmentResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumSegmentResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *RumSegmentResponseData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_rum_segment_response_attributes.go b/api/datadogV2/model_rum_segment_response_attributes.go new file mode 100644 index 00000000000..3aa14dc6f50 --- /dev/null +++ b/api/datadogV2/model_rum_segment_response_attributes.go @@ -0,0 +1,549 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentResponseAttributes Attributes of a segment in a response. +type RumSegmentResponseAttributes struct { + // The creation timestamp in RFC 3339 format. + CreatedAt time.Time `json:"created_at"` + // A user who performed an action on a segment. + CreatedBy RumSegmentUser `json:"created_by"` + // Query definition for the segment. Contains one or more query blocks and an optional combination formula. + DataQuery RumSegmentDataQuery `json:"data_query"` + // A description of the segment. + Description string `json:"description"` + // The last modification timestamp in RFC 3339 format. + ModifiedAt time.Time `json:"modified_at"` + // A user who performed an action on a segment. + ModifiedBy RumSegmentUser `json:"modified_by"` + // The name of the segment. + Name string `json:"name"` + // The organization identifier. + OrgId int64 `json:"org_id"` + // The number of users in the segment. + RowCount int64 `json:"row_count"` + // The source of a segment. + Source RumSegmentSource `json:"source"` + // A list of tags for the segment. + Tags []string `json:"tags"` + // The type of a segment based on its data query configuration. + Type RumSegmentSegmentType `json:"type"` + // The unique identifier of the segment. + Uuid string `json:"uuid"` + // The version number of the segment. + Version int64 `json:"version"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumSegmentResponseAttributes instantiates a new RumSegmentResponseAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumSegmentResponseAttributes(createdAt time.Time, createdBy RumSegmentUser, dataQuery RumSegmentDataQuery, description string, modifiedAt time.Time, modifiedBy RumSegmentUser, name string, orgId int64, rowCount int64, source RumSegmentSource, tags []string, typeVar RumSegmentSegmentType, uuid string, version int64) *RumSegmentResponseAttributes { + this := RumSegmentResponseAttributes{} + this.CreatedAt = createdAt + this.CreatedBy = createdBy + this.DataQuery = dataQuery + this.Description = description + this.ModifiedAt = modifiedAt + this.ModifiedBy = modifiedBy + this.Name = name + this.OrgId = orgId + this.RowCount = rowCount + this.Source = source + this.Tags = tags + this.Type = typeVar + this.Uuid = uuid + this.Version = version + return &this +} + +// NewRumSegmentResponseAttributesWithDefaults instantiates a new RumSegmentResponseAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumSegmentResponseAttributesWithDefaults() *RumSegmentResponseAttributes { + this := RumSegmentResponseAttributes{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value. +func (o *RumSegmentResponseAttributes) GetCreatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *RumSegmentResponseAttributes) GetCreatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value. +func (o *RumSegmentResponseAttributes) SetCreatedAt(v time.Time) { + o.CreatedAt = v +} + +// GetCreatedBy returns the CreatedBy field value. +func (o *RumSegmentResponseAttributes) GetCreatedBy() RumSegmentUser { + if o == nil { + var ret RumSegmentUser + return ret + } + return o.CreatedBy +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value +// and a boolean to check if the value has been set. +func (o *RumSegmentResponseAttributes) GetCreatedByOk() (*RumSegmentUser, bool) { + if o == nil { + return nil, false + } + return &o.CreatedBy, true +} + +// SetCreatedBy sets field value. +func (o *RumSegmentResponseAttributes) SetCreatedBy(v RumSegmentUser) { + o.CreatedBy = v +} + +// GetDataQuery returns the DataQuery field value. +func (o *RumSegmentResponseAttributes) GetDataQuery() RumSegmentDataQuery { + if o == nil { + var ret RumSegmentDataQuery + return ret + } + return o.DataQuery +} + +// GetDataQueryOk returns a tuple with the DataQuery field value +// and a boolean to check if the value has been set. +func (o *RumSegmentResponseAttributes) GetDataQueryOk() (*RumSegmentDataQuery, bool) { + if o == nil { + return nil, false + } + return &o.DataQuery, true +} + +// SetDataQuery sets field value. +func (o *RumSegmentResponseAttributes) SetDataQuery(v RumSegmentDataQuery) { + o.DataQuery = v +} + +// GetDescription returns the Description field value. +func (o *RumSegmentResponseAttributes) GetDescription() string { + if o == nil { + var ret string + return ret + } + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *RumSegmentResponseAttributes) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Description, true +} + +// SetDescription sets field value. +func (o *RumSegmentResponseAttributes) SetDescription(v string) { + o.Description = v +} + +// GetModifiedAt returns the ModifiedAt field value. +func (o *RumSegmentResponseAttributes) GetModifiedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value +// and a boolean to check if the value has been set. +func (o *RumSegmentResponseAttributes) GetModifiedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.ModifiedAt, true +} + +// SetModifiedAt sets field value. +func (o *RumSegmentResponseAttributes) SetModifiedAt(v time.Time) { + o.ModifiedAt = v +} + +// GetModifiedBy returns the ModifiedBy field value. +func (o *RumSegmentResponseAttributes) GetModifiedBy() RumSegmentUser { + if o == nil { + var ret RumSegmentUser + return ret + } + return o.ModifiedBy +} + +// GetModifiedByOk returns a tuple with the ModifiedBy field value +// and a boolean to check if the value has been set. +func (o *RumSegmentResponseAttributes) GetModifiedByOk() (*RumSegmentUser, bool) { + if o == nil { + return nil, false + } + return &o.ModifiedBy, true +} + +// SetModifiedBy sets field value. +func (o *RumSegmentResponseAttributes) SetModifiedBy(v RumSegmentUser) { + o.ModifiedBy = v +} + +// GetName returns the Name field value. +func (o *RumSegmentResponseAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *RumSegmentResponseAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *RumSegmentResponseAttributes) SetName(v string) { + o.Name = v +} + +// GetOrgId returns the OrgId field value. +func (o *RumSegmentResponseAttributes) GetOrgId() int64 { + if o == nil { + var ret int64 + return ret + } + return o.OrgId +} + +// GetOrgIdOk returns a tuple with the OrgId field value +// and a boolean to check if the value has been set. +func (o *RumSegmentResponseAttributes) GetOrgIdOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.OrgId, true +} + +// SetOrgId sets field value. +func (o *RumSegmentResponseAttributes) SetOrgId(v int64) { + o.OrgId = v +} + +// GetRowCount returns the RowCount field value. +func (o *RumSegmentResponseAttributes) GetRowCount() int64 { + if o == nil { + var ret int64 + return ret + } + return o.RowCount +} + +// GetRowCountOk returns a tuple with the RowCount field value +// and a boolean to check if the value has been set. +func (o *RumSegmentResponseAttributes) GetRowCountOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.RowCount, true +} + +// SetRowCount sets field value. +func (o *RumSegmentResponseAttributes) SetRowCount(v int64) { + o.RowCount = v +} + +// GetSource returns the Source field value. +func (o *RumSegmentResponseAttributes) GetSource() RumSegmentSource { + if o == nil { + var ret RumSegmentSource + return ret + } + return o.Source +} + +// GetSourceOk returns a tuple with the Source field value +// and a boolean to check if the value has been set. +func (o *RumSegmentResponseAttributes) GetSourceOk() (*RumSegmentSource, bool) { + if o == nil { + return nil, false + } + return &o.Source, true +} + +// SetSource sets field value. +func (o *RumSegmentResponseAttributes) SetSource(v RumSegmentSource) { + o.Source = v +} + +// GetTags returns the Tags field value. +func (o *RumSegmentResponseAttributes) GetTags() []string { + if o == nil { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value +// and a boolean to check if the value has been set. +func (o *RumSegmentResponseAttributes) GetTagsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Tags, true +} + +// SetTags sets field value. +func (o *RumSegmentResponseAttributes) SetTags(v []string) { + o.Tags = v +} + +// GetType returns the Type field value. +func (o *RumSegmentResponseAttributes) GetType() RumSegmentSegmentType { + if o == nil { + var ret RumSegmentSegmentType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *RumSegmentResponseAttributes) GetTypeOk() (*RumSegmentSegmentType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *RumSegmentResponseAttributes) SetType(v RumSegmentSegmentType) { + o.Type = v +} + +// GetUuid returns the Uuid field value. +func (o *RumSegmentResponseAttributes) GetUuid() string { + if o == nil { + var ret string + return ret + } + return o.Uuid +} + +// GetUuidOk returns a tuple with the Uuid field value +// and a boolean to check if the value has been set. +func (o *RumSegmentResponseAttributes) GetUuidOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Uuid, true +} + +// SetUuid sets field value. +func (o *RumSegmentResponseAttributes) SetUuid(v string) { + o.Uuid = v +} + +// GetVersion returns the Version field value. +func (o *RumSegmentResponseAttributes) GetVersion() int64 { + if o == nil { + var ret int64 + return ret + } + return o.Version +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +func (o *RumSegmentResponseAttributes) GetVersionOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.Version, true +} + +// SetVersion sets field value. +func (o *RumSegmentResponseAttributes) SetVersion(v int64) { + o.Version = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumSegmentResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CreatedAt.Nanosecond() == 0 { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + toSerialize["created_by"] = o.CreatedBy + toSerialize["data_query"] = o.DataQuery + toSerialize["description"] = o.Description + if o.ModifiedAt.Nanosecond() == 0 { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + toSerialize["modified_by"] = o.ModifiedBy + toSerialize["name"] = o.Name + toSerialize["org_id"] = o.OrgId + toSerialize["row_count"] = o.RowCount + toSerialize["source"] = o.Source + toSerialize["tags"] = o.Tags + toSerialize["type"] = o.Type + toSerialize["uuid"] = o.Uuid + toSerialize["version"] = o.Version + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumSegmentResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CreatedAt *time.Time `json:"created_at"` + CreatedBy *RumSegmentUser `json:"created_by"` + DataQuery *RumSegmentDataQuery `json:"data_query"` + Description *string `json:"description"` + ModifiedAt *time.Time `json:"modified_at"` + ModifiedBy *RumSegmentUser `json:"modified_by"` + Name *string `json:"name"` + OrgId *int64 `json:"org_id"` + RowCount *int64 `json:"row_count"` + Source *RumSegmentSource `json:"source"` + Tags *[]string `json:"tags"` + Type *RumSegmentSegmentType `json:"type"` + Uuid *string `json:"uuid"` + Version *int64 `json:"version"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.CreatedAt == nil { + return fmt.Errorf("required field created_at missing") + } + if all.CreatedBy == nil { + return fmt.Errorf("required field created_by missing") + } + if all.DataQuery == nil { + return fmt.Errorf("required field data_query missing") + } + if all.Description == nil { + return fmt.Errorf("required field description missing") + } + if all.ModifiedAt == nil { + return fmt.Errorf("required field modified_at missing") + } + if all.ModifiedBy == nil { + return fmt.Errorf("required field modified_by missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.OrgId == nil { + return fmt.Errorf("required field org_id missing") + } + if all.RowCount == nil { + return fmt.Errorf("required field row_count missing") + } + if all.Source == nil { + return fmt.Errorf("required field source missing") + } + if all.Tags == nil { + return fmt.Errorf("required field tags missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + if all.Uuid == nil { + return fmt.Errorf("required field uuid missing") + } + if all.Version == nil { + return fmt.Errorf("required field version missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "created_by", "data_query", "description", "modified_at", "modified_by", "name", "org_id", "row_count", "source", "tags", "type", "uuid", "version"}) + } else { + return err + } + + hasInvalidField := false + o.CreatedAt = *all.CreatedAt + if all.CreatedBy.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.CreatedBy = *all.CreatedBy + if all.DataQuery.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.DataQuery = *all.DataQuery + o.Description = *all.Description + o.ModifiedAt = *all.ModifiedAt + if all.ModifiedBy.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ModifiedBy = *all.ModifiedBy + o.Name = *all.Name + o.OrgId = *all.OrgId + o.RowCount = *all.RowCount + if !all.Source.IsValid() { + hasInvalidField = true + } else { + o.Source = *all.Source + } + o.Tags = *all.Tags + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + o.Uuid = *all.Uuid + o.Version = *all.Version + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_rum_segment_response_data.go b/api/datadogV2/model_rum_segment_response_data.go new file mode 100644 index 00000000000..13f38fbf46e --- /dev/null +++ b/api/datadogV2/model_rum_segment_response_data.go @@ -0,0 +1,178 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentResponseData Data object for a segment in a response. +type RumSegmentResponseData struct { + // Attributes of a segment in a response. + Attributes RumSegmentResponseAttributes `json:"attributes"` + // The unique identifier of the segment. + Id string `json:"id"` + // Type of the segment resource. + Type RumSegmentResourceType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumSegmentResponseData instantiates a new RumSegmentResponseData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumSegmentResponseData(attributes RumSegmentResponseAttributes, id string, typeVar RumSegmentResourceType) *RumSegmentResponseData { + this := RumSegmentResponseData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewRumSegmentResponseDataWithDefaults instantiates a new RumSegmentResponseData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumSegmentResponseDataWithDefaults() *RumSegmentResponseData { + this := RumSegmentResponseData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *RumSegmentResponseData) GetAttributes() RumSegmentResponseAttributes { + if o == nil { + var ret RumSegmentResponseAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *RumSegmentResponseData) GetAttributesOk() (*RumSegmentResponseAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *RumSegmentResponseData) SetAttributes(v RumSegmentResponseAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *RumSegmentResponseData) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *RumSegmentResponseData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *RumSegmentResponseData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *RumSegmentResponseData) GetType() RumSegmentResourceType { + if o == nil { + var ret RumSegmentResourceType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *RumSegmentResponseData) GetTypeOk() (*RumSegmentResourceType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *RumSegmentResponseData) SetType(v RumSegmentResourceType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumSegmentResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumSegmentResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *RumSegmentResponseAttributes `json:"attributes"` + Id *string `json:"id"` + Type *RumSegmentResourceType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_rum_segment_segment_type.go b/api/datadogV2/model_rum_segment_segment_type.go new file mode 100644 index 00000000000..89f904f2652 --- /dev/null +++ b/api/datadogV2/model_rum_segment_segment_type.go @@ -0,0 +1,74 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentSegmentType The type of a segment based on its data query configuration. +type RumSegmentSegmentType string + +// List of RumSegmentSegmentType. +const ( + RUMSEGMENTSEGMENTTYPE_STATIC RumSegmentSegmentType = "static" + RUMSEGMENTSEGMENTTYPE_EVENT_PLATFORM RumSegmentSegmentType = "event_platform" + RUMSEGMENTSEGMENTTYPE_COMBINATION RumSegmentSegmentType = "combination" + RUMSEGMENTSEGMENTTYPE_JOURNEYS RumSegmentSegmentType = "journeys" + RUMSEGMENTSEGMENTTYPE_REFERENCE_TABLE RumSegmentSegmentType = "reference_table" + RUMSEGMENTSEGMENTTYPE_TEMPLATES RumSegmentSegmentType = "templates" +) + +var allowedRumSegmentSegmentTypeEnumValues = []RumSegmentSegmentType{ + RUMSEGMENTSEGMENTTYPE_STATIC, + RUMSEGMENTSEGMENTTYPE_EVENT_PLATFORM, + RUMSEGMENTSEGMENTTYPE_COMBINATION, + RUMSEGMENTSEGMENTTYPE_JOURNEYS, + RUMSEGMENTSEGMENTTYPE_REFERENCE_TABLE, + RUMSEGMENTSEGMENTTYPE_TEMPLATES, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *RumSegmentSegmentType) GetAllowedValues() []RumSegmentSegmentType { + return allowedRumSegmentSegmentTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *RumSegmentSegmentType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = RumSegmentSegmentType(value) + return nil +} + +// NewRumSegmentSegmentTypeFromValue returns a pointer to a valid RumSegmentSegmentType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewRumSegmentSegmentTypeFromValue(v string) (*RumSegmentSegmentType, error) { + ev := RumSegmentSegmentType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for RumSegmentSegmentType: valid values are %v", v, allowedRumSegmentSegmentTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v RumSegmentSegmentType) IsValid() bool { + for _, existing := range allowedRumSegmentSegmentTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to RumSegmentSegmentType value. +func (v RumSegmentSegmentType) Ptr() *RumSegmentSegmentType { + return &v +} diff --git a/api/datadogV2/model_rum_segment_source.go b/api/datadogV2/model_rum_segment_source.go new file mode 100644 index 00000000000..f892a891b36 --- /dev/null +++ b/api/datadogV2/model_rum_segment_source.go @@ -0,0 +1,66 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentSource The source of a segment. +type RumSegmentSource string + +// List of RumSegmentSource. +const ( + RUMSEGMENTSOURCE_USER_CREATED RumSegmentSource = "user_created" + RUMSEGMENTSOURCE_INITIAL RumSegmentSource = "initial" +) + +var allowedRumSegmentSourceEnumValues = []RumSegmentSource{ + RUMSEGMENTSOURCE_USER_CREATED, + RUMSEGMENTSOURCE_INITIAL, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *RumSegmentSource) GetAllowedValues() []RumSegmentSource { + return allowedRumSegmentSourceEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *RumSegmentSource) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = RumSegmentSource(value) + return nil +} + +// NewRumSegmentSourceFromValue returns a pointer to a valid RumSegmentSource +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewRumSegmentSourceFromValue(v string) (*RumSegmentSource, error) { + ev := RumSegmentSource(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for RumSegmentSource: valid values are %v", v, allowedRumSegmentSourceEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v RumSegmentSource) IsValid() bool { + for _, existing := range allowedRumSegmentSourceEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to RumSegmentSource value. +func (v RumSegmentSource) Ptr() *RumSegmentSource { + return &v +} diff --git a/api/datadogV2/model_rum_segment_static_entry.go b/api/datadogV2/model_rum_segment_static_entry.go new file mode 100644 index 00000000000..19b64d3f849 --- /dev/null +++ b/api/datadogV2/model_rum_segment_static_entry.go @@ -0,0 +1,165 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentStaticEntry A static user list entry within a segment data query. +type RumSegmentStaticEntry struct { + // The identifier of the static list. + Id string `json:"id"` + // The name of the static list. + Name string `json:"name"` + // The number of users in the static list. + UserCount int64 `json:"user_count"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumSegmentStaticEntry instantiates a new RumSegmentStaticEntry object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumSegmentStaticEntry(id string, name string, userCount int64) *RumSegmentStaticEntry { + this := RumSegmentStaticEntry{} + this.Id = id + this.Name = name + this.UserCount = userCount + return &this +} + +// NewRumSegmentStaticEntryWithDefaults instantiates a new RumSegmentStaticEntry object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumSegmentStaticEntryWithDefaults() *RumSegmentStaticEntry { + this := RumSegmentStaticEntry{} + return &this +} + +// GetId returns the Id field value. +func (o *RumSegmentStaticEntry) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *RumSegmentStaticEntry) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *RumSegmentStaticEntry) SetId(v string) { + o.Id = v +} + +// GetName returns the Name field value. +func (o *RumSegmentStaticEntry) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *RumSegmentStaticEntry) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *RumSegmentStaticEntry) SetName(v string) { + o.Name = v +} + +// GetUserCount returns the UserCount field value. +func (o *RumSegmentStaticEntry) GetUserCount() int64 { + if o == nil { + var ret int64 + return ret + } + return o.UserCount +} + +// GetUserCountOk returns a tuple with the UserCount field value +// and a boolean to check if the value has been set. +func (o *RumSegmentStaticEntry) GetUserCountOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.UserCount, true +} + +// SetUserCount sets field value. +func (o *RumSegmentStaticEntry) SetUserCount(v int64) { + o.UserCount = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumSegmentStaticEntry) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + toSerialize["user_count"] = o.UserCount + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumSegmentStaticEntry) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *string `json:"id"` + Name *string `json:"name"` + UserCount *int64 `json:"user_count"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.UserCount == nil { + return fmt.Errorf("required field user_count missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"id", "name", "user_count"}) + } else { + return err + } + o.Id = *all.Id + o.Name = *all.Name + o.UserCount = *all.UserCount + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_rum_segment_template_instance.go b/api/datadogV2/model_rum_segment_template_instance.go new file mode 100644 index 00000000000..eddccbc5662 --- /dev/null +++ b/api/datadogV2/model_rum_segment_template_instance.go @@ -0,0 +1,206 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentTemplateInstance A template-based query block within a segment data query. +type RumSegmentTemplateInstance struct { + // The start of the time range in milliseconds since epoch. + From *int64 `json:"from,omitempty"` + // The template parameters as key-value pairs. + Parameters map[string]string `json:"parameters,omitempty"` + // The identifier of the template. + TemplateId string `json:"template_id"` + // The end of the time range in milliseconds since epoch. + To *int64 `json:"to,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumSegmentTemplateInstance instantiates a new RumSegmentTemplateInstance object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumSegmentTemplateInstance(templateId string) *RumSegmentTemplateInstance { + this := RumSegmentTemplateInstance{} + this.TemplateId = templateId + return &this +} + +// NewRumSegmentTemplateInstanceWithDefaults instantiates a new RumSegmentTemplateInstance object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumSegmentTemplateInstanceWithDefaults() *RumSegmentTemplateInstance { + this := RumSegmentTemplateInstance{} + return &this +} + +// GetFrom returns the From field value if set, zero value otherwise. +func (o *RumSegmentTemplateInstance) GetFrom() int64 { + if o == nil || o.From == nil { + var ret int64 + return ret + } + return *o.From +} + +// GetFromOk returns a tuple with the From field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumSegmentTemplateInstance) GetFromOk() (*int64, bool) { + if o == nil || o.From == nil { + return nil, false + } + return o.From, true +} + +// HasFrom returns a boolean if a field has been set. +func (o *RumSegmentTemplateInstance) HasFrom() bool { + return o != nil && o.From != nil +} + +// SetFrom gets a reference to the given int64 and assigns it to the From field. +func (o *RumSegmentTemplateInstance) SetFrom(v int64) { + o.From = &v +} + +// GetParameters returns the Parameters field value if set, zero value otherwise. +func (o *RumSegmentTemplateInstance) GetParameters() map[string]string { + if o == nil || o.Parameters == nil { + var ret map[string]string + return ret + } + return o.Parameters +} + +// GetParametersOk returns a tuple with the Parameters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumSegmentTemplateInstance) GetParametersOk() (*map[string]string, bool) { + if o == nil || o.Parameters == nil { + return nil, false + } + return &o.Parameters, true +} + +// HasParameters returns a boolean if a field has been set. +func (o *RumSegmentTemplateInstance) HasParameters() bool { + return o != nil && o.Parameters != nil +} + +// SetParameters gets a reference to the given map[string]string and assigns it to the Parameters field. +func (o *RumSegmentTemplateInstance) SetParameters(v map[string]string) { + o.Parameters = v +} + +// GetTemplateId returns the TemplateId field value. +func (o *RumSegmentTemplateInstance) GetTemplateId() string { + if o == nil { + var ret string + return ret + } + return o.TemplateId +} + +// GetTemplateIdOk returns a tuple with the TemplateId field value +// and a boolean to check if the value has been set. +func (o *RumSegmentTemplateInstance) GetTemplateIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TemplateId, true +} + +// SetTemplateId sets field value. +func (o *RumSegmentTemplateInstance) SetTemplateId(v string) { + o.TemplateId = v +} + +// GetTo returns the To field value if set, zero value otherwise. +func (o *RumSegmentTemplateInstance) GetTo() int64 { + if o == nil || o.To == nil { + var ret int64 + return ret + } + return *o.To +} + +// GetToOk returns a tuple with the To field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumSegmentTemplateInstance) GetToOk() (*int64, bool) { + if o == nil || o.To == nil { + return nil, false + } + return o.To, true +} + +// HasTo returns a boolean if a field has been set. +func (o *RumSegmentTemplateInstance) HasTo() bool { + return o != nil && o.To != nil +} + +// SetTo gets a reference to the given int64 and assigns it to the To field. +func (o *RumSegmentTemplateInstance) SetTo(v int64) { + o.To = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumSegmentTemplateInstance) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.From != nil { + toSerialize["from"] = o.From + } + if o.Parameters != nil { + toSerialize["parameters"] = o.Parameters + } + toSerialize["template_id"] = o.TemplateId + if o.To != nil { + toSerialize["to"] = o.To + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumSegmentTemplateInstance) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + From *int64 `json:"from,omitempty"` + Parameters map[string]string `json:"parameters,omitempty"` + TemplateId *string `json:"template_id"` + To *int64 `json:"to,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.TemplateId == nil { + return fmt.Errorf("required field template_id missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"from", "parameters", "template_id", "to"}) + } else { + return err + } + o.From = all.From + o.Parameters = all.Parameters + o.TemplateId = *all.TemplateId + o.To = all.To + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_rum_segment_template_list_response.go b/api/datadogV2/model_rum_segment_template_list_response.go new file mode 100644 index 00000000000..88a4b3ba2cd --- /dev/null +++ b/api/datadogV2/model_rum_segment_template_list_response.go @@ -0,0 +1,101 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentTemplateListResponse Response for listing segment templates. +type RumSegmentTemplateListResponse struct { + // The list of segment templates. + Data []RumSegmentTemplateResponseData `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumSegmentTemplateListResponse instantiates a new RumSegmentTemplateListResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumSegmentTemplateListResponse(data []RumSegmentTemplateResponseData) *RumSegmentTemplateListResponse { + this := RumSegmentTemplateListResponse{} + this.Data = data + return &this +} + +// NewRumSegmentTemplateListResponseWithDefaults instantiates a new RumSegmentTemplateListResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumSegmentTemplateListResponseWithDefaults() *RumSegmentTemplateListResponse { + this := RumSegmentTemplateListResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *RumSegmentTemplateListResponse) GetData() []RumSegmentTemplateResponseData { + if o == nil { + var ret []RumSegmentTemplateResponseData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *RumSegmentTemplateListResponse) GetDataOk() (*[]RumSegmentTemplateResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *RumSegmentTemplateListResponse) SetData(v []RumSegmentTemplateResponseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumSegmentTemplateListResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumSegmentTemplateListResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]RumSegmentTemplateResponseData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_rum_segment_template_parameter_def.go b/api/datadogV2/model_rum_segment_template_parameter_def.go new file mode 100644 index 00000000000..c8d9d0ac8ef --- /dev/null +++ b/api/datadogV2/model_rum_segment_template_parameter_def.go @@ -0,0 +1,165 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentTemplateParameterDef A parameter definition for a segment template. +type RumSegmentTemplateParameterDef struct { + // The default value for the parameter. + Default string `json:"default"` + // A description of the parameter. + Description string `json:"description"` + // Validation rules for the parameter. + Validate string `json:"validate"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumSegmentTemplateParameterDef instantiates a new RumSegmentTemplateParameterDef object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumSegmentTemplateParameterDef(defaultVar string, description string, validate string) *RumSegmentTemplateParameterDef { + this := RumSegmentTemplateParameterDef{} + this.Default = defaultVar + this.Description = description + this.Validate = validate + return &this +} + +// NewRumSegmentTemplateParameterDefWithDefaults instantiates a new RumSegmentTemplateParameterDef object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumSegmentTemplateParameterDefWithDefaults() *RumSegmentTemplateParameterDef { + this := RumSegmentTemplateParameterDef{} + return &this +} + +// GetDefault returns the Default field value. +func (o *RumSegmentTemplateParameterDef) GetDefault() string { + if o == nil { + var ret string + return ret + } + return o.Default +} + +// GetDefaultOk returns a tuple with the Default field value +// and a boolean to check if the value has been set. +func (o *RumSegmentTemplateParameterDef) GetDefaultOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Default, true +} + +// SetDefault sets field value. +func (o *RumSegmentTemplateParameterDef) SetDefault(v string) { + o.Default = v +} + +// GetDescription returns the Description field value. +func (o *RumSegmentTemplateParameterDef) GetDescription() string { + if o == nil { + var ret string + return ret + } + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *RumSegmentTemplateParameterDef) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Description, true +} + +// SetDescription sets field value. +func (o *RumSegmentTemplateParameterDef) SetDescription(v string) { + o.Description = v +} + +// GetValidate returns the Validate field value. +func (o *RumSegmentTemplateParameterDef) GetValidate() string { + if o == nil { + var ret string + return ret + } + return o.Validate +} + +// GetValidateOk returns a tuple with the Validate field value +// and a boolean to check if the value has been set. +func (o *RumSegmentTemplateParameterDef) GetValidateOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Validate, true +} + +// SetValidate sets field value. +func (o *RumSegmentTemplateParameterDef) SetValidate(v string) { + o.Validate = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumSegmentTemplateParameterDef) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["default"] = o.Default + toSerialize["description"] = o.Description + toSerialize["validate"] = o.Validate + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumSegmentTemplateParameterDef) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Default *string `json:"default"` + Description *string `json:"description"` + Validate *string `json:"validate"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Default == nil { + return fmt.Errorf("required field default missing") + } + if all.Description == nil { + return fmt.Errorf("required field description missing") + } + if all.Validate == nil { + return fmt.Errorf("required field validate missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"default", "description", "validate"}) + } else { + return err + } + o.Default = *all.Default + o.Description = *all.Description + o.Validate = *all.Validate + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_rum_segment_template_resource_type.go b/api/datadogV2/model_rum_segment_template_resource_type.go new file mode 100644 index 00000000000..2eac2357a10 --- /dev/null +++ b/api/datadogV2/model_rum_segment_template_resource_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentTemplateResourceType Type of the segment template resource. +type RumSegmentTemplateResourceType string + +// List of RumSegmentTemplateResourceType. +const ( + RUMSEGMENTTEMPLATERESOURCETYPE_TEMPLATE_METADATA RumSegmentTemplateResourceType = "template_metadata" +) + +var allowedRumSegmentTemplateResourceTypeEnumValues = []RumSegmentTemplateResourceType{ + RUMSEGMENTTEMPLATERESOURCETYPE_TEMPLATE_METADATA, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *RumSegmentTemplateResourceType) GetAllowedValues() []RumSegmentTemplateResourceType { + return allowedRumSegmentTemplateResourceTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *RumSegmentTemplateResourceType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = RumSegmentTemplateResourceType(value) + return nil +} + +// NewRumSegmentTemplateResourceTypeFromValue returns a pointer to a valid RumSegmentTemplateResourceType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewRumSegmentTemplateResourceTypeFromValue(v string) (*RumSegmentTemplateResourceType, error) { + ev := RumSegmentTemplateResourceType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for RumSegmentTemplateResourceType: valid values are %v", v, allowedRumSegmentTemplateResourceTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v RumSegmentTemplateResourceType) IsValid() bool { + for _, existing := range allowedRumSegmentTemplateResourceTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to RumSegmentTemplateResourceType value. +func (v RumSegmentTemplateResourceType) Ptr() *RumSegmentTemplateResourceType { + return &v +} diff --git a/api/datadogV2/model_rum_segment_template_response_attributes.go b/api/datadogV2/model_rum_segment_template_response_attributes.go new file mode 100644 index 00000000000..9c5153b87b3 --- /dev/null +++ b/api/datadogV2/model_rum_segment_template_response_attributes.go @@ -0,0 +1,344 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentTemplateResponseAttributes Attributes of a segment template in a response. +type RumSegmentTemplateResponseAttributes struct { + // The category of the template. + Category string `json:"category"` + // The creation timestamp in RFC 3339 format. + CreatedAt time.Time `json:"created_at"` + // A description of the template. + Description string `json:"description"` + // The last modification timestamp in RFC 3339 format. + ModifiedAt time.Time `json:"modified_at"` + // The name of the template. + Name string `json:"name"` + // The template parameter definitions. + Parameters map[string]RumSegmentTemplateParameterDef `json:"parameters"` + // The status of a segment template. + Status RumSegmentTemplateStatus `json:"status"` + // The version number of the template. + Version int64 `json:"version"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumSegmentTemplateResponseAttributes instantiates a new RumSegmentTemplateResponseAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumSegmentTemplateResponseAttributes(category string, createdAt time.Time, description string, modifiedAt time.Time, name string, parameters map[string]RumSegmentTemplateParameterDef, status RumSegmentTemplateStatus, version int64) *RumSegmentTemplateResponseAttributes { + this := RumSegmentTemplateResponseAttributes{} + this.Category = category + this.CreatedAt = createdAt + this.Description = description + this.ModifiedAt = modifiedAt + this.Name = name + this.Parameters = parameters + this.Status = status + this.Version = version + return &this +} + +// NewRumSegmentTemplateResponseAttributesWithDefaults instantiates a new RumSegmentTemplateResponseAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumSegmentTemplateResponseAttributesWithDefaults() *RumSegmentTemplateResponseAttributes { + this := RumSegmentTemplateResponseAttributes{} + return &this +} + +// GetCategory returns the Category field value. +func (o *RumSegmentTemplateResponseAttributes) GetCategory() string { + if o == nil { + var ret string + return ret + } + return o.Category +} + +// GetCategoryOk returns a tuple with the Category field value +// and a boolean to check if the value has been set. +func (o *RumSegmentTemplateResponseAttributes) GetCategoryOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Category, true +} + +// SetCategory sets field value. +func (o *RumSegmentTemplateResponseAttributes) SetCategory(v string) { + o.Category = v +} + +// GetCreatedAt returns the CreatedAt field value. +func (o *RumSegmentTemplateResponseAttributes) GetCreatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *RumSegmentTemplateResponseAttributes) GetCreatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value. +func (o *RumSegmentTemplateResponseAttributes) SetCreatedAt(v time.Time) { + o.CreatedAt = v +} + +// GetDescription returns the Description field value. +func (o *RumSegmentTemplateResponseAttributes) GetDescription() string { + if o == nil { + var ret string + return ret + } + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *RumSegmentTemplateResponseAttributes) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Description, true +} + +// SetDescription sets field value. +func (o *RumSegmentTemplateResponseAttributes) SetDescription(v string) { + o.Description = v +} + +// GetModifiedAt returns the ModifiedAt field value. +func (o *RumSegmentTemplateResponseAttributes) GetModifiedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value +// and a boolean to check if the value has been set. +func (o *RumSegmentTemplateResponseAttributes) GetModifiedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.ModifiedAt, true +} + +// SetModifiedAt sets field value. +func (o *RumSegmentTemplateResponseAttributes) SetModifiedAt(v time.Time) { + o.ModifiedAt = v +} + +// GetName returns the Name field value. +func (o *RumSegmentTemplateResponseAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *RumSegmentTemplateResponseAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *RumSegmentTemplateResponseAttributes) SetName(v string) { + o.Name = v +} + +// GetParameters returns the Parameters field value. +func (o *RumSegmentTemplateResponseAttributes) GetParameters() map[string]RumSegmentTemplateParameterDef { + if o == nil { + var ret map[string]RumSegmentTemplateParameterDef + return ret + } + return o.Parameters +} + +// GetParametersOk returns a tuple with the Parameters field value +// and a boolean to check if the value has been set. +func (o *RumSegmentTemplateResponseAttributes) GetParametersOk() (*map[string]RumSegmentTemplateParameterDef, bool) { + if o == nil { + return nil, false + } + return &o.Parameters, true +} + +// SetParameters sets field value. +func (o *RumSegmentTemplateResponseAttributes) SetParameters(v map[string]RumSegmentTemplateParameterDef) { + o.Parameters = v +} + +// GetStatus returns the Status field value. +func (o *RumSegmentTemplateResponseAttributes) GetStatus() RumSegmentTemplateStatus { + if o == nil { + var ret RumSegmentTemplateStatus + return ret + } + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *RumSegmentTemplateResponseAttributes) GetStatusOk() (*RumSegmentTemplateStatus, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value. +func (o *RumSegmentTemplateResponseAttributes) SetStatus(v RumSegmentTemplateStatus) { + o.Status = v +} + +// GetVersion returns the Version field value. +func (o *RumSegmentTemplateResponseAttributes) GetVersion() int64 { + if o == nil { + var ret int64 + return ret + } + return o.Version +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +func (o *RumSegmentTemplateResponseAttributes) GetVersionOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.Version, true +} + +// SetVersion sets field value. +func (o *RumSegmentTemplateResponseAttributes) SetVersion(v int64) { + o.Version = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumSegmentTemplateResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["category"] = o.Category + if o.CreatedAt.Nanosecond() == 0 { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + toSerialize["description"] = o.Description + if o.ModifiedAt.Nanosecond() == 0 { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + toSerialize["name"] = o.Name + toSerialize["parameters"] = o.Parameters + toSerialize["status"] = o.Status + toSerialize["version"] = o.Version + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumSegmentTemplateResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Category *string `json:"category"` + CreatedAt *time.Time `json:"created_at"` + Description *string `json:"description"` + ModifiedAt *time.Time `json:"modified_at"` + Name *string `json:"name"` + Parameters *map[string]RumSegmentTemplateParameterDef `json:"parameters"` + Status *RumSegmentTemplateStatus `json:"status"` + Version *int64 `json:"version"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Category == nil { + return fmt.Errorf("required field category missing") + } + if all.CreatedAt == nil { + return fmt.Errorf("required field created_at missing") + } + if all.Description == nil { + return fmt.Errorf("required field description missing") + } + if all.ModifiedAt == nil { + return fmt.Errorf("required field modified_at missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Parameters == nil { + return fmt.Errorf("required field parameters missing") + } + if all.Status == nil { + return fmt.Errorf("required field status missing") + } + if all.Version == nil { + return fmt.Errorf("required field version missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"category", "created_at", "description", "modified_at", "name", "parameters", "status", "version"}) + } else { + return err + } + + hasInvalidField := false + o.Category = *all.Category + o.CreatedAt = *all.CreatedAt + o.Description = *all.Description + o.ModifiedAt = *all.ModifiedAt + o.Name = *all.Name + o.Parameters = *all.Parameters + if !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = *all.Status + } + o.Version = *all.Version + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_rum_segment_template_response_data.go b/api/datadogV2/model_rum_segment_template_response_data.go new file mode 100644 index 00000000000..dd364b9f50d --- /dev/null +++ b/api/datadogV2/model_rum_segment_template_response_data.go @@ -0,0 +1,178 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentTemplateResponseData Data object for a segment template in a response. +type RumSegmentTemplateResponseData struct { + // Attributes of a segment template in a response. + Attributes RumSegmentTemplateResponseAttributes `json:"attributes"` + // The unique identifier of the template. + Id string `json:"id"` + // Type of the segment template resource. + Type RumSegmentTemplateResourceType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumSegmentTemplateResponseData instantiates a new RumSegmentTemplateResponseData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumSegmentTemplateResponseData(attributes RumSegmentTemplateResponseAttributes, id string, typeVar RumSegmentTemplateResourceType) *RumSegmentTemplateResponseData { + this := RumSegmentTemplateResponseData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewRumSegmentTemplateResponseDataWithDefaults instantiates a new RumSegmentTemplateResponseData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumSegmentTemplateResponseDataWithDefaults() *RumSegmentTemplateResponseData { + this := RumSegmentTemplateResponseData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *RumSegmentTemplateResponseData) GetAttributes() RumSegmentTemplateResponseAttributes { + if o == nil { + var ret RumSegmentTemplateResponseAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *RumSegmentTemplateResponseData) GetAttributesOk() (*RumSegmentTemplateResponseAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *RumSegmentTemplateResponseData) SetAttributes(v RumSegmentTemplateResponseAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *RumSegmentTemplateResponseData) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *RumSegmentTemplateResponseData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *RumSegmentTemplateResponseData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *RumSegmentTemplateResponseData) GetType() RumSegmentTemplateResourceType { + if o == nil { + var ret RumSegmentTemplateResourceType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *RumSegmentTemplateResponseData) GetTypeOk() (*RumSegmentTemplateResourceType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *RumSegmentTemplateResponseData) SetType(v RumSegmentTemplateResourceType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumSegmentTemplateResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumSegmentTemplateResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *RumSegmentTemplateResponseAttributes `json:"attributes"` + Id *string `json:"id"` + Type *RumSegmentTemplateResourceType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_rum_segment_template_status.go b/api/datadogV2/model_rum_segment_template_status.go new file mode 100644 index 00000000000..d8cef12edbf --- /dev/null +++ b/api/datadogV2/model_rum_segment_template_status.go @@ -0,0 +1,68 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentTemplateStatus The status of a segment template. +type RumSegmentTemplateStatus string + +// List of RumSegmentTemplateStatus. +const ( + RUMSEGMENTTEMPLATESTATUS_ACTIVE RumSegmentTemplateStatus = "active" + RUMSEGMENTTEMPLATESTATUS_DEPRECATED RumSegmentTemplateStatus = "deprecated" + RUMSEGMENTTEMPLATESTATUS_ARCHIVED RumSegmentTemplateStatus = "archived" +) + +var allowedRumSegmentTemplateStatusEnumValues = []RumSegmentTemplateStatus{ + RUMSEGMENTTEMPLATESTATUS_ACTIVE, + RUMSEGMENTTEMPLATESTATUS_DEPRECATED, + RUMSEGMENTTEMPLATESTATUS_ARCHIVED, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *RumSegmentTemplateStatus) GetAllowedValues() []RumSegmentTemplateStatus { + return allowedRumSegmentTemplateStatusEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *RumSegmentTemplateStatus) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = RumSegmentTemplateStatus(value) + return nil +} + +// NewRumSegmentTemplateStatusFromValue returns a pointer to a valid RumSegmentTemplateStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewRumSegmentTemplateStatusFromValue(v string) (*RumSegmentTemplateStatus, error) { + ev := RumSegmentTemplateStatus(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for RumSegmentTemplateStatus: valid values are %v", v, allowedRumSegmentTemplateStatusEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v RumSegmentTemplateStatus) IsValid() bool { + for _, existing := range allowedRumSegmentTemplateStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to RumSegmentTemplateStatus value. +func (v RumSegmentTemplateStatus) Ptr() *RumSegmentTemplateStatus { + return &v +} diff --git a/api/datadogV2/model_rum_segment_update_attributes.go b/api/datadogV2/model_rum_segment_update_attributes.go new file mode 100644 index 00000000000..9c75ff3a637 --- /dev/null +++ b/api/datadogV2/model_rum_segment_update_attributes.go @@ -0,0 +1,216 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentUpdateAttributes Attributes for updating a segment. All fields are optional. +type RumSegmentUpdateAttributes struct { + // Query definition for the segment. Contains one or more query blocks and an optional combination formula. + DataQuery *RumSegmentDataQuery `json:"data_query,omitempty"` + // The updated description of the segment. + Description *string `json:"description,omitempty"` + // The updated name of the segment. + Name *string `json:"name,omitempty"` + // The updated list of tags for the segment. + Tags []string `json:"tags,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumSegmentUpdateAttributes instantiates a new RumSegmentUpdateAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumSegmentUpdateAttributes() *RumSegmentUpdateAttributes { + this := RumSegmentUpdateAttributes{} + return &this +} + +// NewRumSegmentUpdateAttributesWithDefaults instantiates a new RumSegmentUpdateAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumSegmentUpdateAttributesWithDefaults() *RumSegmentUpdateAttributes { + this := RumSegmentUpdateAttributes{} + return &this +} + +// GetDataQuery returns the DataQuery field value if set, zero value otherwise. +func (o *RumSegmentUpdateAttributes) GetDataQuery() RumSegmentDataQuery { + if o == nil || o.DataQuery == nil { + var ret RumSegmentDataQuery + return ret + } + return *o.DataQuery +} + +// GetDataQueryOk returns a tuple with the DataQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumSegmentUpdateAttributes) GetDataQueryOk() (*RumSegmentDataQuery, bool) { + if o == nil || o.DataQuery == nil { + return nil, false + } + return o.DataQuery, true +} + +// HasDataQuery returns a boolean if a field has been set. +func (o *RumSegmentUpdateAttributes) HasDataQuery() bool { + return o != nil && o.DataQuery != nil +} + +// SetDataQuery gets a reference to the given RumSegmentDataQuery and assigns it to the DataQuery field. +func (o *RumSegmentUpdateAttributes) SetDataQuery(v RumSegmentDataQuery) { + o.DataQuery = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *RumSegmentUpdateAttributes) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumSegmentUpdateAttributes) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *RumSegmentUpdateAttributes) HasDescription() bool { + return o != nil && o.Description != nil +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *RumSegmentUpdateAttributes) SetDescription(v string) { + o.Description = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *RumSegmentUpdateAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumSegmentUpdateAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *RumSegmentUpdateAttributes) HasName() bool { + return o != nil && o.Name != nil +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *RumSegmentUpdateAttributes) SetName(v string) { + o.Name = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *RumSegmentUpdateAttributes) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumSegmentUpdateAttributes) GetTagsOk() (*[]string, bool) { + if o == nil || o.Tags == nil { + return nil, false + } + return &o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *RumSegmentUpdateAttributes) HasTags() bool { + return o != nil && o.Tags != nil +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *RumSegmentUpdateAttributes) SetTags(v []string) { + o.Tags = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumSegmentUpdateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.DataQuery != nil { + toSerialize["data_query"] = o.DataQuery + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumSegmentUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + DataQuery *RumSegmentDataQuery `json:"data_query,omitempty"` + Description *string `json:"description,omitempty"` + Name *string `json:"name,omitempty"` + Tags []string `json:"tags,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data_query", "description", "name", "tags"}) + } else { + return err + } + + hasInvalidField := false + if all.DataQuery != nil && all.DataQuery.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.DataQuery = all.DataQuery + o.Description = all.Description + o.Name = all.Name + o.Tags = all.Tags + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_rum_segment_update_data.go b/api/datadogV2/model_rum_segment_update_data.go new file mode 100644 index 00000000000..eee1d573643 --- /dev/null +++ b/api/datadogV2/model_rum_segment_update_data.go @@ -0,0 +1,178 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentUpdateData Data object for a segment update request. +type RumSegmentUpdateData struct { + // Attributes for updating a segment. All fields are optional. + Attributes RumSegmentUpdateAttributes `json:"attributes"` + // The identifier of the segment to update. + Id string `json:"id"` + // Type of the segment resource. + Type RumSegmentResourceType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumSegmentUpdateData instantiates a new RumSegmentUpdateData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumSegmentUpdateData(attributes RumSegmentUpdateAttributes, id string, typeVar RumSegmentResourceType) *RumSegmentUpdateData { + this := RumSegmentUpdateData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewRumSegmentUpdateDataWithDefaults instantiates a new RumSegmentUpdateData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumSegmentUpdateDataWithDefaults() *RumSegmentUpdateData { + this := RumSegmentUpdateData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *RumSegmentUpdateData) GetAttributes() RumSegmentUpdateAttributes { + if o == nil { + var ret RumSegmentUpdateAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *RumSegmentUpdateData) GetAttributesOk() (*RumSegmentUpdateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *RumSegmentUpdateData) SetAttributes(v RumSegmentUpdateAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *RumSegmentUpdateData) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *RumSegmentUpdateData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *RumSegmentUpdateData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *RumSegmentUpdateData) GetType() RumSegmentResourceType { + if o == nil { + var ret RumSegmentResourceType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *RumSegmentUpdateData) GetTypeOk() (*RumSegmentResourceType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *RumSegmentUpdateData) SetType(v RumSegmentResourceType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumSegmentUpdateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumSegmentUpdateData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *RumSegmentUpdateAttributes `json:"attributes"` + Id *string `json:"id"` + Type *RumSegmentResourceType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_rum_segment_update_request.go b/api/datadogV2/model_rum_segment_update_request.go new file mode 100644 index 00000000000..c0ff73dc8a0 --- /dev/null +++ b/api/datadogV2/model_rum_segment_update_request.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentUpdateRequest Request body for updating a segment. +type RumSegmentUpdateRequest struct { + // Data object for a segment update request. + Data RumSegmentUpdateData `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumSegmentUpdateRequest instantiates a new RumSegmentUpdateRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumSegmentUpdateRequest(data RumSegmentUpdateData) *RumSegmentUpdateRequest { + this := RumSegmentUpdateRequest{} + this.Data = data + return &this +} + +// NewRumSegmentUpdateRequestWithDefaults instantiates a new RumSegmentUpdateRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumSegmentUpdateRequestWithDefaults() *RumSegmentUpdateRequest { + this := RumSegmentUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *RumSegmentUpdateRequest) GetData() RumSegmentUpdateData { + if o == nil { + var ret RumSegmentUpdateData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *RumSegmentUpdateRequest) GetDataOk() (*RumSegmentUpdateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *RumSegmentUpdateRequest) SetData(v RumSegmentUpdateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumSegmentUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumSegmentUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *RumSegmentUpdateData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_rum_segment_user.go b/api/datadogV2/model_rum_segment_user.go new file mode 100644 index 00000000000..3662265de0f --- /dev/null +++ b/api/datadogV2/model_rum_segment_user.go @@ -0,0 +1,229 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumSegmentUser A user who performed an action on a segment. +type RumSegmentUser struct { + // The email handle of the user. + Handle string `json:"handle"` + // The URL of the user icon. + Icon string `json:"icon"` + // The numeric identifier of the user. + Id string `json:"id"` + // The display name of the user. + Name string `json:"name"` + // The unique identifier of the user. + Uuid string `json:"uuid"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumSegmentUser instantiates a new RumSegmentUser object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumSegmentUser(handle string, icon string, id string, name string, uuid string) *RumSegmentUser { + this := RumSegmentUser{} + this.Handle = handle + this.Icon = icon + this.Id = id + this.Name = name + this.Uuid = uuid + return &this +} + +// NewRumSegmentUserWithDefaults instantiates a new RumSegmentUser object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumSegmentUserWithDefaults() *RumSegmentUser { + this := RumSegmentUser{} + return &this +} + +// GetHandle returns the Handle field value. +func (o *RumSegmentUser) GetHandle() string { + if o == nil { + var ret string + return ret + } + return o.Handle +} + +// GetHandleOk returns a tuple with the Handle field value +// and a boolean to check if the value has been set. +func (o *RumSegmentUser) GetHandleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Handle, true +} + +// SetHandle sets field value. +func (o *RumSegmentUser) SetHandle(v string) { + o.Handle = v +} + +// GetIcon returns the Icon field value. +func (o *RumSegmentUser) GetIcon() string { + if o == nil { + var ret string + return ret + } + return o.Icon +} + +// GetIconOk returns a tuple with the Icon field value +// and a boolean to check if the value has been set. +func (o *RumSegmentUser) GetIconOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Icon, true +} + +// SetIcon sets field value. +func (o *RumSegmentUser) SetIcon(v string) { + o.Icon = v +} + +// GetId returns the Id field value. +func (o *RumSegmentUser) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *RumSegmentUser) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *RumSegmentUser) SetId(v string) { + o.Id = v +} + +// GetName returns the Name field value. +func (o *RumSegmentUser) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *RumSegmentUser) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *RumSegmentUser) SetName(v string) { + o.Name = v +} + +// GetUuid returns the Uuid field value. +func (o *RumSegmentUser) GetUuid() string { + if o == nil { + var ret string + return ret + } + return o.Uuid +} + +// GetUuidOk returns a tuple with the Uuid field value +// and a boolean to check if the value has been set. +func (o *RumSegmentUser) GetUuidOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Uuid, true +} + +// SetUuid sets field value. +func (o *RumSegmentUser) SetUuid(v string) { + o.Uuid = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumSegmentUser) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["handle"] = o.Handle + toSerialize["icon"] = o.Icon + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + toSerialize["uuid"] = o.Uuid + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumSegmentUser) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Handle *string `json:"handle"` + Icon *string `json:"icon"` + Id *string `json:"id"` + Name *string `json:"name"` + Uuid *string `json:"uuid"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Handle == nil { + return fmt.Errorf("required field handle missing") + } + if all.Icon == nil { + return fmt.Errorf("required field icon missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Uuid == nil { + return fmt.Errorf("required field uuid missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"handle", "icon", "id", "name", "uuid"}) + } else { + return err + } + o.Handle = *all.Handle + o.Icon = *all.Icon + o.Id = *all.Id + o.Name = *all.Name + o.Uuid = *all.Uuid + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_rum_static_segment_create_attributes.go b/api/datadogV2/model_rum_static_segment_create_attributes.go new file mode 100644 index 00000000000..fba4d65980d --- /dev/null +++ b/api/datadogV2/model_rum_static_segment_create_attributes.go @@ -0,0 +1,209 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumStaticSegmentCreateAttributes Attributes for creating a new static segment. +type RumStaticSegmentCreateAttributes struct { + // A description of the static segment. + Description string `json:"description"` + // The journey query object used to compute the static segment user list. + JourneyQueryObject RumStaticSegmentJourneyQueryObject `json:"journey_query_object"` + // The name of the static segment. + Name string `json:"name"` + // A list of tags for the static segment. + Tags []string `json:"tags,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumStaticSegmentCreateAttributes instantiates a new RumStaticSegmentCreateAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumStaticSegmentCreateAttributes(description string, journeyQueryObject RumStaticSegmentJourneyQueryObject, name string) *RumStaticSegmentCreateAttributes { + this := RumStaticSegmentCreateAttributes{} + this.Description = description + this.JourneyQueryObject = journeyQueryObject + this.Name = name + return &this +} + +// NewRumStaticSegmentCreateAttributesWithDefaults instantiates a new RumStaticSegmentCreateAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumStaticSegmentCreateAttributesWithDefaults() *RumStaticSegmentCreateAttributes { + this := RumStaticSegmentCreateAttributes{} + return &this +} + +// GetDescription returns the Description field value. +func (o *RumStaticSegmentCreateAttributes) GetDescription() string { + if o == nil { + var ret string + return ret + } + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *RumStaticSegmentCreateAttributes) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Description, true +} + +// SetDescription sets field value. +func (o *RumStaticSegmentCreateAttributes) SetDescription(v string) { + o.Description = v +} + +// GetJourneyQueryObject returns the JourneyQueryObject field value. +func (o *RumStaticSegmentCreateAttributes) GetJourneyQueryObject() RumStaticSegmentJourneyQueryObject { + if o == nil { + var ret RumStaticSegmentJourneyQueryObject + return ret + } + return o.JourneyQueryObject +} + +// GetJourneyQueryObjectOk returns a tuple with the JourneyQueryObject field value +// and a boolean to check if the value has been set. +func (o *RumStaticSegmentCreateAttributes) GetJourneyQueryObjectOk() (*RumStaticSegmentJourneyQueryObject, bool) { + if o == nil { + return nil, false + } + return &o.JourneyQueryObject, true +} + +// SetJourneyQueryObject sets field value. +func (o *RumStaticSegmentCreateAttributes) SetJourneyQueryObject(v RumStaticSegmentJourneyQueryObject) { + o.JourneyQueryObject = v +} + +// GetName returns the Name field value. +func (o *RumStaticSegmentCreateAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *RumStaticSegmentCreateAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *RumStaticSegmentCreateAttributes) SetName(v string) { + o.Name = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *RumStaticSegmentCreateAttributes) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumStaticSegmentCreateAttributes) GetTagsOk() (*[]string, bool) { + if o == nil || o.Tags == nil { + return nil, false + } + return &o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *RumStaticSegmentCreateAttributes) HasTags() bool { + return o != nil && o.Tags != nil +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *RumStaticSegmentCreateAttributes) SetTags(v []string) { + o.Tags = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumStaticSegmentCreateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["description"] = o.Description + toSerialize["journey_query_object"] = o.JourneyQueryObject + toSerialize["name"] = o.Name + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumStaticSegmentCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Description *string `json:"description"` + JourneyQueryObject *RumStaticSegmentJourneyQueryObject `json:"journey_query_object"` + Name *string `json:"name"` + Tags []string `json:"tags,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Description == nil { + return fmt.Errorf("required field description missing") + } + if all.JourneyQueryObject == nil { + return fmt.Errorf("required field journey_query_object missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"description", "journey_query_object", "name", "tags"}) + } else { + return err + } + + hasInvalidField := false + o.Description = *all.Description + if all.JourneyQueryObject.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.JourneyQueryObject = *all.JourneyQueryObject + o.Name = *all.Name + o.Tags = all.Tags + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_rum_static_segment_create_data.go b/api/datadogV2/model_rum_static_segment_create_data.go new file mode 100644 index 00000000000..963ad19ea00 --- /dev/null +++ b/api/datadogV2/model_rum_static_segment_create_data.go @@ -0,0 +1,146 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumStaticSegmentCreateData Data object for a static segment creation request. +type RumStaticSegmentCreateData struct { + // Attributes for creating a new static segment. + Attributes RumStaticSegmentCreateAttributes `json:"attributes"` + // Type of the static segment creation request resource. + Type RumStaticSegmentRequestType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumStaticSegmentCreateData instantiates a new RumStaticSegmentCreateData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumStaticSegmentCreateData(attributes RumStaticSegmentCreateAttributes, typeVar RumStaticSegmentRequestType) *RumStaticSegmentCreateData { + this := RumStaticSegmentCreateData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewRumStaticSegmentCreateDataWithDefaults instantiates a new RumStaticSegmentCreateData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumStaticSegmentCreateDataWithDefaults() *RumStaticSegmentCreateData { + this := RumStaticSegmentCreateData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *RumStaticSegmentCreateData) GetAttributes() RumStaticSegmentCreateAttributes { + if o == nil { + var ret RumStaticSegmentCreateAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *RumStaticSegmentCreateData) GetAttributesOk() (*RumStaticSegmentCreateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *RumStaticSegmentCreateData) SetAttributes(v RumStaticSegmentCreateAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *RumStaticSegmentCreateData) GetType() RumStaticSegmentRequestType { + if o == nil { + var ret RumStaticSegmentRequestType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *RumStaticSegmentCreateData) GetTypeOk() (*RumStaticSegmentRequestType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *RumStaticSegmentCreateData) SetType(v RumStaticSegmentRequestType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumStaticSegmentCreateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumStaticSegmentCreateData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *RumStaticSegmentCreateAttributes `json:"attributes"` + Type *RumStaticSegmentRequestType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_rum_static_segment_create_request.go b/api/datadogV2/model_rum_static_segment_create_request.go new file mode 100644 index 00000000000..b6339143d18 --- /dev/null +++ b/api/datadogV2/model_rum_static_segment_create_request.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumStaticSegmentCreateRequest Request body for creating a new static segment. +type RumStaticSegmentCreateRequest struct { + // Data object for a static segment creation request. + Data RumStaticSegmentCreateData `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumStaticSegmentCreateRequest instantiates a new RumStaticSegmentCreateRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumStaticSegmentCreateRequest(data RumStaticSegmentCreateData) *RumStaticSegmentCreateRequest { + this := RumStaticSegmentCreateRequest{} + this.Data = data + return &this +} + +// NewRumStaticSegmentCreateRequestWithDefaults instantiates a new RumStaticSegmentCreateRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumStaticSegmentCreateRequestWithDefaults() *RumStaticSegmentCreateRequest { + this := RumStaticSegmentCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *RumStaticSegmentCreateRequest) GetData() RumStaticSegmentCreateData { + if o == nil { + var ret RumStaticSegmentCreateData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *RumStaticSegmentCreateRequest) GetDataOk() (*RumStaticSegmentCreateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *RumStaticSegmentCreateRequest) SetData(v RumStaticSegmentCreateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumStaticSegmentCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumStaticSegmentCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *RumStaticSegmentCreateData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_rum_static_segment_journey_filter.go b/api/datadogV2/model_rum_static_segment_journey_filter.go new file mode 100644 index 00000000000..eb1f4791d3c --- /dev/null +++ b/api/datadogV2/model_rum_static_segment_journey_filter.go @@ -0,0 +1,133 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumStaticSegmentJourneyFilter A filter within a journey query node. +type RumStaticSegmentJourneyFilter struct { + // The attribute to filter on. + Attribute string `json:"attribute"` + // The value to match. + Value string `json:"value"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumStaticSegmentJourneyFilter instantiates a new RumStaticSegmentJourneyFilter object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumStaticSegmentJourneyFilter(attribute string, value string) *RumStaticSegmentJourneyFilter { + this := RumStaticSegmentJourneyFilter{} + this.Attribute = attribute + this.Value = value + return &this +} + +// NewRumStaticSegmentJourneyFilterWithDefaults instantiates a new RumStaticSegmentJourneyFilter object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumStaticSegmentJourneyFilterWithDefaults() *RumStaticSegmentJourneyFilter { + this := RumStaticSegmentJourneyFilter{} + return &this +} + +// GetAttribute returns the Attribute field value. +func (o *RumStaticSegmentJourneyFilter) GetAttribute() string { + if o == nil { + var ret string + return ret + } + return o.Attribute +} + +// GetAttributeOk returns a tuple with the Attribute field value +// and a boolean to check if the value has been set. +func (o *RumStaticSegmentJourneyFilter) GetAttributeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Attribute, true +} + +// SetAttribute sets field value. +func (o *RumStaticSegmentJourneyFilter) SetAttribute(v string) { + o.Attribute = v +} + +// GetValue returns the Value field value. +func (o *RumStaticSegmentJourneyFilter) GetValue() string { + if o == nil { + var ret string + return ret + } + return o.Value +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *RumStaticSegmentJourneyFilter) GetValueOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Value, true +} + +// SetValue sets field value. +func (o *RumStaticSegmentJourneyFilter) SetValue(v string) { + o.Value = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumStaticSegmentJourneyFilter) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attribute"] = o.Attribute + toSerialize["value"] = o.Value + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumStaticSegmentJourneyFilter) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attribute *string `json:"attribute"` + Value *string `json:"value"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attribute == nil { + return fmt.Errorf("required field attribute missing") + } + if all.Value == nil { + return fmt.Errorf("required field value missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attribute", "value"}) + } else { + return err + } + o.Attribute = *all.Attribute + o.Value = *all.Value + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_rum_static_segment_journey_node.go b/api/datadogV2/model_rum_static_segment_journey_node.go new file mode 100644 index 00000000000..5f9d66d21ad --- /dev/null +++ b/api/datadogV2/model_rum_static_segment_journey_node.go @@ -0,0 +1,101 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumStaticSegmentJourneyNode A node in a journey query object. +type RumStaticSegmentJourneyNode struct { + // The list of filters for this node. + Filters []RumStaticSegmentJourneyFilter `json:"filters"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumStaticSegmentJourneyNode instantiates a new RumStaticSegmentJourneyNode object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumStaticSegmentJourneyNode(filters []RumStaticSegmentJourneyFilter) *RumStaticSegmentJourneyNode { + this := RumStaticSegmentJourneyNode{} + this.Filters = filters + return &this +} + +// NewRumStaticSegmentJourneyNodeWithDefaults instantiates a new RumStaticSegmentJourneyNode object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumStaticSegmentJourneyNodeWithDefaults() *RumStaticSegmentJourneyNode { + this := RumStaticSegmentJourneyNode{} + return &this +} + +// GetFilters returns the Filters field value. +func (o *RumStaticSegmentJourneyNode) GetFilters() []RumStaticSegmentJourneyFilter { + if o == nil { + var ret []RumStaticSegmentJourneyFilter + return ret + } + return o.Filters +} + +// GetFiltersOk returns a tuple with the Filters field value +// and a boolean to check if the value has been set. +func (o *RumStaticSegmentJourneyNode) GetFiltersOk() (*[]RumStaticSegmentJourneyFilter, bool) { + if o == nil { + return nil, false + } + return &o.Filters, true +} + +// SetFilters sets field value. +func (o *RumStaticSegmentJourneyNode) SetFilters(v []RumStaticSegmentJourneyFilter) { + o.Filters = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumStaticSegmentJourneyNode) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["filters"] = o.Filters + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumStaticSegmentJourneyNode) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Filters *[]RumStaticSegmentJourneyFilter `json:"filters"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Filters == nil { + return fmt.Errorf("required field filters missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"filters"}) + } else { + return err + } + o.Filters = *all.Filters + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_rum_static_segment_journey_query_object.go b/api/datadogV2/model_rum_static_segment_journey_query_object.go new file mode 100644 index 00000000000..1017e775534 --- /dev/null +++ b/api/datadogV2/model_rum_static_segment_journey_query_object.go @@ -0,0 +1,101 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumStaticSegmentJourneyQueryObject The journey query object used to compute the static segment user list. +type RumStaticSegmentJourneyQueryObject struct { + // The list of journey nodes defining the query. + Nodes []RumStaticSegmentJourneyNode `json:"nodes"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumStaticSegmentJourneyQueryObject instantiates a new RumStaticSegmentJourneyQueryObject object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewRumStaticSegmentJourneyQueryObject(nodes []RumStaticSegmentJourneyNode) *RumStaticSegmentJourneyQueryObject { + this := RumStaticSegmentJourneyQueryObject{} + this.Nodes = nodes + return &this +} + +// NewRumStaticSegmentJourneyQueryObjectWithDefaults instantiates a new RumStaticSegmentJourneyQueryObject object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewRumStaticSegmentJourneyQueryObjectWithDefaults() *RumStaticSegmentJourneyQueryObject { + this := RumStaticSegmentJourneyQueryObject{} + return &this +} + +// GetNodes returns the Nodes field value. +func (o *RumStaticSegmentJourneyQueryObject) GetNodes() []RumStaticSegmentJourneyNode { + if o == nil { + var ret []RumStaticSegmentJourneyNode + return ret + } + return o.Nodes +} + +// GetNodesOk returns a tuple with the Nodes field value +// and a boolean to check if the value has been set. +func (o *RumStaticSegmentJourneyQueryObject) GetNodesOk() (*[]RumStaticSegmentJourneyNode, bool) { + if o == nil { + return nil, false + } + return &o.Nodes, true +} + +// SetNodes sets field value. +func (o *RumStaticSegmentJourneyQueryObject) SetNodes(v []RumStaticSegmentJourneyNode) { + o.Nodes = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumStaticSegmentJourneyQueryObject) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["nodes"] = o.Nodes + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumStaticSegmentJourneyQueryObject) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Nodes *[]RumStaticSegmentJourneyNode `json:"nodes"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Nodes == nil { + return fmt.Errorf("required field nodes missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"nodes"}) + } else { + return err + } + o.Nodes = *all.Nodes + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_rum_static_segment_request_type.go b/api/datadogV2/model_rum_static_segment_request_type.go new file mode 100644 index 00000000000..fae7996fc77 --- /dev/null +++ b/api/datadogV2/model_rum_static_segment_request_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumStaticSegmentRequestType Type of the static segment creation request resource. +type RumStaticSegmentRequestType string + +// List of RumStaticSegmentRequestType. +const ( + RUMSTATICSEGMENTREQUESTTYPE_CREATE_STATIC_SEGMENT_REQUEST RumStaticSegmentRequestType = "create_static_segment_request" +) + +var allowedRumStaticSegmentRequestTypeEnumValues = []RumStaticSegmentRequestType{ + RUMSTATICSEGMENTREQUESTTYPE_CREATE_STATIC_SEGMENT_REQUEST, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *RumStaticSegmentRequestType) GetAllowedValues() []RumStaticSegmentRequestType { + return allowedRumStaticSegmentRequestTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *RumStaticSegmentRequestType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = RumStaticSegmentRequestType(value) + return nil +} + +// NewRumStaticSegmentRequestTypeFromValue returns a pointer to a valid RumStaticSegmentRequestType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewRumStaticSegmentRequestTypeFromValue(v string) (*RumStaticSegmentRequestType, error) { + ev := RumStaticSegmentRequestType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for RumStaticSegmentRequestType: valid values are %v", v, allowedRumStaticSegmentRequestTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v RumStaticSegmentRequestType) IsValid() bool { + for _, existing := range allowedRumStaticSegmentRequestTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to RumStaticSegmentRequestType value. +func (v RumStaticSegmentRequestType) Ptr() *RumStaticSegmentRequestType { + return &v +} diff --git a/examples/v2/rum-user-segments/CreateRumSegment.go b/examples/v2/rum-user-segments/CreateRumSegment.go new file mode 100644 index 00000000000..bd3e03de2de --- /dev/null +++ b/examples/v2/rum-user-segments/CreateRumSegment.go @@ -0,0 +1,95 @@ +// Create a RUM segment returns "Created" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.RumSegmentCreateRequest{ + Data: datadogV2.RumSegmentCreateData{ + Attributes: datadogV2.RumSegmentCreateAttributes{ + DataQuery: datadogV2.RumSegmentDataQuery{ + Combination: datadog.PtrString("(logs && apm_home) && NOT(apm_trace)"), + EventPlatforms: []datadogV2.RumSegmentEventPlatform{ + { + Facet: "@usr.id", + From: datadog.PtrInt64(1709888355000), + Name: "logs", + Query: "@type:view @view.url_path:/logs", + To: datadog.PtrInt64(1710493155000), + }, + }, + Journeys: []datadogV2.RumSegmentJourney{ + { + ConversionType: datadog.PtrString("any"), + GroupBy: datadog.PtrString("@usr.id"), + Name: datadog.PtrString("my_journey"), + Search: datadog.PtrString("@type:view"), + }, + }, + ReferenceTables: []datadogV2.RumSegmentReferenceTable{ + { + Columns: []datadogV2.RumSegmentReferenceTableColumn{ + { + Name: "user_id", + }, + }, + FilterQuery: datadog.PtrString(""), + JoinCondition: datadogV2.RumSegmentReferenceTableJoinCondition{ + ColumnName: "user_id", + Facet: "@usr.id", + }, + Name: "my_ref_table", + TableName: "my_table", + }, + }, + Static: []datadogV2.RumSegmentStaticEntry{ + { + Id: "static-list-1", + Name: "My Static List", + UserCount: 500, + }, + }, + Templates: []datadogV2.RumSegmentTemplateInstance{ + { + From: datadog.PtrInt64(1709888355000), + Parameters: map[string]string{ + "threshold": "5", + }, + TemplateId: "stickiness-v1", + To: datadog.PtrInt64(1710493155000), + }, + }, + }, + Description: datadog.PtrString("Users who visited the homepage."), + Name: "My Segment", + Tags: []string{ + "team:frontend", + }, + }, + Type: datadogV2.RUMSEGMENTRESOURCETYPE_SEGMENT, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.CreateRumSegment", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewRUMUserSegmentsApi(apiClient) + resp, r, err := api.CreateRumSegment(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RUMUserSegmentsApi.CreateRumSegment`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `RUMUserSegmentsApi.CreateRumSegment`:\n%s\n", responseContent) +} diff --git a/examples/v2/rum-user-segments/CreateRumStaticSegment.go b/examples/v2/rum-user-segments/CreateRumStaticSegment.go new file mode 100644 index 00000000000..9496a41d343 --- /dev/null +++ b/examples/v2/rum-user-segments/CreateRumStaticSegment.go @@ -0,0 +1,54 @@ +// Create a static RUM segment returns "Created" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.RumStaticSegmentCreateRequest{ + Data: datadogV2.RumStaticSegmentCreateData{ + Attributes: datadogV2.RumStaticSegmentCreateAttributes{ + Description: "Users from a specific journey.", + JourneyQueryObject: datadogV2.RumStaticSegmentJourneyQueryObject{ + Nodes: []datadogV2.RumStaticSegmentJourneyNode{ + { + Filters: []datadogV2.RumStaticSegmentJourneyFilter{ + { + Attribute: "@type", + Value: "view", + }, + }, + }, + }, + }, + Name: "My Static Segment", + Tags: []string{ + "team:frontend", + }, + }, + Type: datadogV2.RUMSTATICSEGMENTREQUESTTYPE_CREATE_STATIC_SEGMENT_REQUEST, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.CreateRumStaticSegment", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewRUMUserSegmentsApi(apiClient) + resp, r, err := api.CreateRumStaticSegment(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RUMUserSegmentsApi.CreateRumStaticSegment`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `RUMUserSegmentsApi.CreateRumStaticSegment`:\n%s\n", responseContent) +} diff --git a/examples/v2/rum-user-segments/DeleteRumSegment.go b/examples/v2/rum-user-segments/DeleteRumSegment.go new file mode 100644 index 00000000000..a8edb4264ec --- /dev/null +++ b/examples/v2/rum-user-segments/DeleteRumSegment.go @@ -0,0 +1,30 @@ +// Delete a RUM segment returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.DeleteRumSegment", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewRUMUserSegmentsApi(apiClient) + resp, r, err := api.DeleteRumSegment(ctx, "a1b2c3d4-1234-5678-9abc-123456789abc") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RUMUserSegmentsApi.DeleteRumSegment`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `RUMUserSegmentsApi.DeleteRumSegment`:\n%s\n", responseContent) +} diff --git a/examples/v2/rum-user-segments/GetRumSegment.go b/examples/v2/rum-user-segments/GetRumSegment.go new file mode 100644 index 00000000000..6ddbca5a8c5 --- /dev/null +++ b/examples/v2/rum-user-segments/GetRumSegment.go @@ -0,0 +1,30 @@ +// Get a RUM segment returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.GetRumSegment", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewRUMUserSegmentsApi(apiClient) + resp, r, err := api.GetRumSegment(ctx, "a1b2c3d4-1234-5678-9abc-123456789abc") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RUMUserSegmentsApi.GetRumSegment`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `RUMUserSegmentsApi.GetRumSegment`:\n%s\n", responseContent) +} diff --git a/examples/v2/rum-user-segments/InitializeRumSegments.go b/examples/v2/rum-user-segments/InitializeRumSegments.go new file mode 100644 index 00000000000..6972d3ab443 --- /dev/null +++ b/examples/v2/rum-user-segments/InitializeRumSegments.go @@ -0,0 +1,26 @@ +// Initialize RUM segments returns "OK" response + +package main + +import ( + "context" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.InitializeRumSegments", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewRUMUserSegmentsApi(apiClient) + r, err := api.InitializeRumSegments(ctx) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RUMUserSegmentsApi.InitializeRumSegments`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/examples/v2/rum-user-segments/ListRumSegmentTemplates.go b/examples/v2/rum-user-segments/ListRumSegmentTemplates.go new file mode 100644 index 00000000000..ebd17e916d4 --- /dev/null +++ b/examples/v2/rum-user-segments/ListRumSegmentTemplates.go @@ -0,0 +1,30 @@ +// List RUM segment templates returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.ListRumSegmentTemplates", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewRUMUserSegmentsApi(apiClient) + resp, r, err := api.ListRumSegmentTemplates(ctx) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RUMUserSegmentsApi.ListRumSegmentTemplates`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `RUMUserSegmentsApi.ListRumSegmentTemplates`:\n%s\n", responseContent) +} diff --git a/examples/v2/rum-user-segments/ListRumSegments.go b/examples/v2/rum-user-segments/ListRumSegments.go new file mode 100644 index 00000000000..52a04f48851 --- /dev/null +++ b/examples/v2/rum-user-segments/ListRumSegments.go @@ -0,0 +1,30 @@ +// List all RUM segments returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.ListRumSegments", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewRUMUserSegmentsApi(apiClient) + resp, r, err := api.ListRumSegments(ctx, *datadogV2.NewListRumSegmentsOptionalParameters()) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RUMUserSegmentsApi.ListRumSegments`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `RUMUserSegmentsApi.ListRumSegments`:\n%s\n", responseContent) +} diff --git a/examples/v2/rum-user-segments/UpdateRumSegment.go b/examples/v2/rum-user-segments/UpdateRumSegment.go new file mode 100644 index 00000000000..b6a2aabe3f0 --- /dev/null +++ b/examples/v2/rum-user-segments/UpdateRumSegment.go @@ -0,0 +1,92 @@ +// Update a RUM segment returns "No Content" response + +package main + +import ( + "context" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.RumSegmentUpdateRequest{ + Data: datadogV2.RumSegmentUpdateData{ + Attributes: datadogV2.RumSegmentUpdateAttributes{ + DataQuery: &datadogV2.RumSegmentDataQuery{ + Combination: datadog.PtrString("(logs && apm_home) && NOT(apm_trace)"), + EventPlatforms: []datadogV2.RumSegmentEventPlatform{ + { + Facet: "@usr.id", + From: datadog.PtrInt64(1709888355000), + Name: "logs", + Query: "@type:view @view.url_path:/logs", + To: datadog.PtrInt64(1710493155000), + }, + }, + Journeys: []datadogV2.RumSegmentJourney{ + { + ConversionType: datadog.PtrString("any"), + GroupBy: datadog.PtrString("@usr.id"), + Name: datadog.PtrString("my_journey"), + Search: datadog.PtrString("@type:view"), + }, + }, + ReferenceTables: []datadogV2.RumSegmentReferenceTable{ + { + Columns: []datadogV2.RumSegmentReferenceTableColumn{ + { + Name: "user_id", + }, + }, + FilterQuery: datadog.PtrString(""), + JoinCondition: datadogV2.RumSegmentReferenceTableJoinCondition{ + ColumnName: "user_id", + Facet: "@usr.id", + }, + Name: "my_ref_table", + TableName: "my_table", + }, + }, + Static: []datadogV2.RumSegmentStaticEntry{ + { + Id: "static-list-1", + Name: "My Static List", + UserCount: 500, + }, + }, + Templates: []datadogV2.RumSegmentTemplateInstance{ + { + From: datadog.PtrInt64(1709888355000), + Parameters: map[string]string{ + "threshold": "5", + }, + TemplateId: "stickiness-v1", + To: datadog.PtrInt64(1710493155000), + }, + }, + }, + Description: datadog.PtrString("Updated description."), + Name: datadog.PtrString("Updated Segment Name"), + Tags: []string{ + "team:backend", + }, + }, + Id: "a1b2c3d4-1234-5678-9abc-123456789abc", + Type: datadogV2.RUMSEGMENTRESOURCETYPE_SEGMENT, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.UpdateRumSegment", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewRUMUserSegmentsApi(apiClient) + r, err := api.UpdateRumSegment(ctx, "a1b2c3d4-1234-5678-9abc-123456789abc", body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RUMUserSegmentsApi.UpdateRumSegment`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/tests/scenarios/api_mappings.go b/tests/scenarios/api_mappings.go index 6c2b569a95e..36b21c4ff96 100644 --- a/tests/scenarios/api_mappings.go +++ b/tests/scenarios/api_mappings.go @@ -125,6 +125,7 @@ var apiMappings = map[string]map[string]reflect.Value{ "RumReplayPlaylistsApi": reflect.ValueOf(datadogV2.NewRumReplayPlaylistsApi), "RumReplaySessionsApi": reflect.ValueOf(datadogV2.NewRumReplaySessionsApi), "RumReplayViewershipApi": reflect.ValueOf(datadogV2.NewRumReplayViewershipApi), + "RUMUserSegmentsApi": reflect.ValueOf(datadogV2.NewRUMUserSegmentsApi), "ServiceScorecardsApi": reflect.ValueOf(datadogV2.NewServiceScorecardsApi), "SeatsApi": reflect.ValueOf(datadogV2.NewSeatsApi), "EntityRiskScoresApi": reflect.ValueOf(datadogV2.NewEntityRiskScoresApi), diff --git a/tests/scenarios/features/v2/rum_user_segments.feature b/tests/scenarios/features/v2/rum_user_segments.feature new file mode 100644 index 00000000000..7a6305c6e00 --- /dev/null +++ b/tests/scenarios/features/v2/rum_user_segments.feature @@ -0,0 +1,167 @@ +@endpoint(rum-user-segments) @endpoint(rum-user-segments-v2) +Feature: RUM User Segments + Manage RUM user segments for audience targeting and analysis. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "RUMUserSegments" API + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Create a RUM segment returns "Bad Request" response + Given operation "CreateRumSegment" enabled + And new "CreateRumSegment" request + And body with value {"data": {"attributes": {"data_query": {"combination": "(logs && apm_home) && NOT(apm_trace)", "event_platforms": [{"facet": "@usr.id", "from": 1709888355000, "name": "logs", "query": "@type:view @view.url_path:/logs", "to": 1710493155000}], "journeys": [{"conversion_type": "any", "group_by": "@usr.id", "name": "my_journey", "search": "@type:view"}], "reference_tables": [{"columns": [{"name": "user_id"}], "filter_query": "", "join_condition": {"column_name": "user_id", "facet": "@usr.id"}, "name": "my_ref_table", "table_name": "my_table"}], "static": [{"id": "static-list-1", "name": "My Static List", "user_count": 500}], "templates": [{"from": 1709888355000, "parameters": {"threshold": "5"}, "template_id": "stickiness-v1", "to": 1710493155000}]}, "description": "Users who visited the homepage.", "name": "My Segment", "tags": ["team:frontend"]}, "type": "segment"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Create a RUM segment returns "Conflict" response + Given operation "CreateRumSegment" enabled + And new "CreateRumSegment" request + And body with value {"data": {"attributes": {"data_query": {"combination": "(logs && apm_home) && NOT(apm_trace)", "event_platforms": [{"facet": "@usr.id", "from": 1709888355000, "name": "logs", "query": "@type:view @view.url_path:/logs", "to": 1710493155000}], "journeys": [{"conversion_type": "any", "group_by": "@usr.id", "name": "my_journey", "search": "@type:view"}], "reference_tables": [{"columns": [{"name": "user_id"}], "filter_query": "", "join_condition": {"column_name": "user_id", "facet": "@usr.id"}, "name": "my_ref_table", "table_name": "my_table"}], "static": [{"id": "static-list-1", "name": "My Static List", "user_count": 500}], "templates": [{"from": 1709888355000, "parameters": {"threshold": "5"}, "template_id": "stickiness-v1", "to": 1710493155000}]}, "description": "Users who visited the homepage.", "name": "My Segment", "tags": ["team:frontend"]}, "type": "segment"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Create a RUM segment returns "Created" response + Given operation "CreateRumSegment" enabled + And new "CreateRumSegment" request + And body with value {"data": {"attributes": {"data_query": {"combination": "(logs && apm_home) && NOT(apm_trace)", "event_platforms": [{"facet": "@usr.id", "from": 1709888355000, "name": "logs", "query": "@type:view @view.url_path:/logs", "to": 1710493155000}], "journeys": [{"conversion_type": "any", "group_by": "@usr.id", "name": "my_journey", "search": "@type:view"}], "reference_tables": [{"columns": [{"name": "user_id"}], "filter_query": "", "join_condition": {"column_name": "user_id", "facet": "@usr.id"}, "name": "my_ref_table", "table_name": "my_table"}], "static": [{"id": "static-list-1", "name": "My Static List", "user_count": 500}], "templates": [{"from": 1709888355000, "parameters": {"threshold": "5"}, "template_id": "stickiness-v1", "to": 1710493155000}]}, "description": "Users who visited the homepage.", "name": "My Segment", "tags": ["team:frontend"]}, "type": "segment"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Create a static RUM segment returns "Bad Request" response + Given operation "CreateRumStaticSegment" enabled + And new "CreateRumStaticSegment" request + And body with value {"data": {"attributes": {"description": "Users from a specific journey.", "journey_query_object": {"nodes": [{"filters": [{"attribute": "@type", "value": "view"}]}]}, "name": "My Static Segment", "tags": ["team:frontend"]}, "type": "create_static_segment_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Create a static RUM segment returns "Conflict" response + Given operation "CreateRumStaticSegment" enabled + And new "CreateRumStaticSegment" request + And body with value {"data": {"attributes": {"description": "Users from a specific journey.", "journey_query_object": {"nodes": [{"filters": [{"attribute": "@type", "value": "view"}]}]}, "name": "My Static Segment", "tags": ["team:frontend"]}, "type": "create_static_segment_request"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Create a static RUM segment returns "Created" response + Given operation "CreateRumStaticSegment" enabled + And new "CreateRumStaticSegment" request + And body with value {"data": {"attributes": {"description": "Users from a specific journey.", "journey_query_object": {"nodes": [{"filters": [{"attribute": "@type", "value": "view"}]}]}, "name": "My Static Segment", "tags": ["team:frontend"]}, "type": "create_static_segment_request"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Delete a RUM segment returns "Not Found" response + Given operation "DeleteRumSegment" enabled + And new "DeleteRumSegment" request + And request contains "segment_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Delete a RUM segment returns "OK" response + Given operation "DeleteRumSegment" enabled + And new "DeleteRumSegment" request + And request contains "segment_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Get a RUM segment returns "Bad Request" response + Given operation "GetRumSegment" enabled + And new "GetRumSegment" request + And request contains "segment_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Get a RUM segment returns "Not Found" response + Given operation "GetRumSegment" enabled + And new "GetRumSegment" request + And request contains "segment_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Get a RUM segment returns "OK" response + Given operation "GetRumSegment" enabled + And new "GetRumSegment" request + And request contains "segment_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Initialize RUM segments returns "OK" response + Given operation "InitializeRumSegments" enabled + And new "InitializeRumSegments" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: List RUM segment templates returns "Bad Request" response + Given operation "ListRumSegmentTemplates" enabled + And new "ListRumSegmentTemplates" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: List RUM segment templates returns "OK" response + Given operation "ListRumSegmentTemplates" enabled + And new "ListRumSegmentTemplates" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: List all RUM segments returns "Bad Request" response + Given operation "ListRumSegments" enabled + And new "ListRumSegments" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: List all RUM segments returns "OK" response + Given operation "ListRumSegments" enabled + And new "ListRumSegments" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Update a RUM segment returns "Bad Request" response + Given operation "UpdateRumSegment" enabled + And new "UpdateRumSegment" request + And request contains "segment_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"data_query": {"combination": "(logs && apm_home) && NOT(apm_trace)", "event_platforms": [{"facet": "@usr.id", "from": 1709888355000, "name": "logs", "query": "@type:view @view.url_path:/logs", "to": 1710493155000}], "journeys": [{"conversion_type": "any", "group_by": "@usr.id", "name": "my_journey", "search": "@type:view"}], "reference_tables": [{"columns": [{"name": "user_id"}], "filter_query": "", "join_condition": {"column_name": "user_id", "facet": "@usr.id"}, "name": "my_ref_table", "table_name": "my_table"}], "static": [{"id": "static-list-1", "name": "My Static List", "user_count": 500}], "templates": [{"from": 1709888355000, "parameters": {"threshold": "5"}, "template_id": "stickiness-v1", "to": 1710493155000}]}, "description": "Updated description.", "name": "Updated Segment Name", "tags": ["team:backend"]}, "id": "a1b2c3d4-1234-5678-9abc-123456789abc", "type": "segment"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Update a RUM segment returns "Conflict" response + Given operation "UpdateRumSegment" enabled + And new "UpdateRumSegment" request + And request contains "segment_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"data_query": {"combination": "(logs && apm_home) && NOT(apm_trace)", "event_platforms": [{"facet": "@usr.id", "from": 1709888355000, "name": "logs", "query": "@type:view @view.url_path:/logs", "to": 1710493155000}], "journeys": [{"conversion_type": "any", "group_by": "@usr.id", "name": "my_journey", "search": "@type:view"}], "reference_tables": [{"columns": [{"name": "user_id"}], "filter_query": "", "join_condition": {"column_name": "user_id", "facet": "@usr.id"}, "name": "my_ref_table", "table_name": "my_table"}], "static": [{"id": "static-list-1", "name": "My Static List", "user_count": 500}], "templates": [{"from": 1709888355000, "parameters": {"threshold": "5"}, "template_id": "stickiness-v1", "to": 1710493155000}]}, "description": "Updated description.", "name": "Updated Segment Name", "tags": ["team:backend"]}, "id": "a1b2c3d4-1234-5678-9abc-123456789abc", "type": "segment"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Update a RUM segment returns "No Content" response + Given operation "UpdateRumSegment" enabled + And new "UpdateRumSegment" request + And request contains "segment_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"data_query": {"combination": "(logs && apm_home) && NOT(apm_trace)", "event_platforms": [{"facet": "@usr.id", "from": 1709888355000, "name": "logs", "query": "@type:view @view.url_path:/logs", "to": 1710493155000}], "journeys": [{"conversion_type": "any", "group_by": "@usr.id", "name": "my_journey", "search": "@type:view"}], "reference_tables": [{"columns": [{"name": "user_id"}], "filter_query": "", "join_condition": {"column_name": "user_id", "facet": "@usr.id"}, "name": "my_ref_table", "table_name": "my_table"}], "static": [{"id": "static-list-1", "name": "My Static List", "user_count": 500}], "templates": [{"from": 1709888355000, "parameters": {"threshold": "5"}, "template_id": "stickiness-v1", "to": 1710493155000}]}, "description": "Updated description.", "name": "Updated Segment Name", "tags": ["team:backend"]}, "id": "a1b2c3d4-1234-5678-9abc-123456789abc", "type": "segment"}} + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Update a RUM segment returns "Not Found" response + Given operation "UpdateRumSegment" enabled + And new "UpdateRumSegment" request + And request contains "segment_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"data_query": {"combination": "(logs && apm_home) && NOT(apm_trace)", "event_platforms": [{"facet": "@usr.id", "from": 1709888355000, "name": "logs", "query": "@type:view @view.url_path:/logs", "to": 1710493155000}], "journeys": [{"conversion_type": "any", "group_by": "@usr.id", "name": "my_journey", "search": "@type:view"}], "reference_tables": [{"columns": [{"name": "user_id"}], "filter_query": "", "join_condition": {"column_name": "user_id", "facet": "@usr.id"}, "name": "my_ref_table", "table_name": "my_table"}], "static": [{"id": "static-list-1", "name": "My Static List", "user_count": 500}], "templates": [{"from": 1709888355000, "parameters": {"threshold": "5"}, "template_id": "stickiness-v1", "to": 1710493155000}]}, "description": "Updated description.", "name": "Updated Segment Name", "tags": ["team:backend"]}, "id": "a1b2c3d4-1234-5678-9abc-123456789abc", "type": "segment"}} + When the request is sent + Then the response status is 404 Not Found diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 2f0af9dca77..6514777da20 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -4249,6 +4249,68 @@ "type": "safe" } }, + "ListRumSegments": { + "tag": "RUM User Segments", + "undo": { + "type": "safe" + } + }, + "CreateRumSegment": { + "tag": "RUM User Segments", + "undo": { + "operationId": "DeleteRumSegment", + "parameters": [ + { + "name": "segment_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "InitializeRumSegments": { + "tag": "RUM User Segments", + "undo": { + "type": "idempotent" + } + }, + "CreateRumStaticSegment": { + "tag": "RUM User Segments", + "undo": { + "operationId": "DeleteRumSegment", + "parameters": [ + { + "name": "segment_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "ListRumSegmentTemplates": { + "tag": "RUM User Segments", + "undo": { + "type": "safe" + } + }, + "DeleteRumSegment": { + "tag": "RUM User Segments", + "undo": { + "type": "idempotent" + } + }, + "GetRumSegment": { + "tag": "RUM User Segments", + "undo": { + "type": "safe" + } + }, + "UpdateRumSegment": { + "tag": "RUM User Segments", + "undo": { + "type": "idempotent" + } + }, "UploadIdPMetadata": { "tag": "Organizations", "undo": {