diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 901b7a23247..28271e348a4 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -3579,6 +3579,1008 @@ components: - id - base_severity type: object + AggregatedHighFrozenFrameRate: + description: Aggregated high frozen frame rate detection at view level. + properties: + avg_frozen_frame_rate: + description: Average frozen frame rate as a fraction of total frames. + example: 0.15 + format: double + type: number + avg_segment_duration: + description: Average segment duration in nanoseconds. + example: 3000000000 + format: int64 + type: integer + avg_total_frozen_duration: + description: Average total frozen duration in nanoseconds. + example: 500000000 + format: int64 + type: integer + fingerprint: + description: Unique fingerprint identifying this detection group. + example: v1$mno345 + type: string + impact_score: + description: Impact score for this detection. + example: 14.0 + format: double + type: number + view_occurrences: + description: Number of sampled views where this detection occurred. + example: 5 + format: int32 + maximum: 2147483647 + type: integer + required: + - fingerprint + - view_occurrences + - avg_frozen_frame_rate + - avg_total_frozen_duration + - avg_segment_duration + - impact_score + type: object + AggregatedHighScriptEval: + description: Aggregated high script evaluation detection grouped by source. + properties: + avg_duration: + description: Average script evaluation duration in nanoseconds. + example: 300000000 + format: int64 + type: integer + avg_forced_style_layout: + description: Average forced style/layout duration in nanoseconds. + example: 0 + format: int64 + type: integer + fingerprint: + description: Unique fingerprint identifying this detection group. + example: v1$7766a8c2180aa153f5526ba8868999f8 + type: string + impact_score: + description: Impact score combining view frequency and duration severity. + example: 30.0 + format: double + type: number + instance_count: + description: Total number of detection instances across sampled views. + example: 3 + format: int32 + maximum: 2147483647 + type: integer + invoker_type: + description: Type of invoker that triggered the script evaluation. + example: user-callback + type: string + source_category: + description: Category of the script source. + example: third-party + nullable: true + type: string + source_function_name: + description: Name of the function that triggered the high script evaluation. + example: handleClick + type: string + source_url: + description: URL of the script that triggered the high script evaluation. + example: https://cdn.example.com/app.js + nullable: true + type: string + view_occurrences: + description: Number of sampled views where this detection occurred. + example: 3 + format: int32 + maximum: 2147483647 + type: integer + required: + - fingerprint + - source_url + - source_function_name + - source_category + - invoker_type + - view_occurrences + - instance_count + - avg_duration + - avg_forced_style_layout + - impact_score + type: object + AggregatedLongTasksByInvokerType: + description: Aggregated long task statistics for a single invoker type. + properties: + criteria_view_occurrences: + description: Number of sampled views where this invoker type had long tasks contributing to the criteria metric. + example: 40 + format: int32 + maximum: 2147483647 + type: integer + impact_score: + description: Rank-product impact score combining view frequency and blocking time severity. + example: 0.4 + format: double + type: number + invoker_type: + description: Category of the long task invoker (for example, resolve-promise, user-callback). + example: resolve-promise + type: string + stats_per_view: + $ref: "#/components/schemas/LongTaskStatsPerView" + top_invokers: + description: Top invokers within this invoker type, sorted by impact score descending. + items: + $ref: "#/components/schemas/TopLongTaskInvoker" + type: array + view_occurrences: + description: Number of sampled views where this invoker type had any long tasks. + example: 68 + format: int32 + maximum: 2147483647 + type: integer + required: + - invoker_type + - view_occurrences + - stats_per_view + - top_invokers + type: object + AggregatedLongTasksRequest: + description: Request body for the aggregated long tasks endpoint. + properties: + data: + $ref: "#/components/schemas/AggregatedLongTasksRequestData" + required: + - data + type: object + AggregatedLongTasksRequestAttributes: + description: Attributes for an aggregated long tasks query. + properties: + application_id: + description: The RUM application ID to analyze. + example: ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b + type: string + criteria: + $ref: "#/components/schemas/AggregatedWaterfallPerformanceCriteria" + filter: + description: RUM query string to filter events (for example, @session.type:user @geo.country:US). + example: "@session.type:user" + type: string + from: + description: Start of the time range as a Unix timestamp in seconds. + example: 1762437564 + format: int64 + type: integer + sample_size: + description: Number of view instances to sample, between 1 and 500. + example: 20 + format: int32 + maximum: 500 + minimum: 1 + type: integer + to: + description: End of the time range as a Unix timestamp in seconds. + example: 1762523964 + format: int64 + type: integer + view_name: + description: The RUM view name to analyze (for example, /account/login). + example: /account/login(/:type) + type: string + required: + - application_id + - view_name + - from + - to + - sample_size + type: object + AggregatedLongTasksRequestData: + description: Data envelope for an aggregated long tasks request. + properties: + attributes: + $ref: "#/components/schemas/AggregatedLongTasksRequestAttributes" + type: + $ref: "#/components/schemas/AggregatedLongTasksRequestType" + required: + - type + - attributes + type: object + AggregatedLongTasksRequestType: + description: The JSON:API type for aggregated long tasks requests. + enum: + - aggregated_long_tasks + example: aggregated_long_tasks + type: string + x-enum-varnames: + - AggregatedLongTasks + AggregatedLongTasksResponse: + description: Response body for the aggregated long tasks endpoint. + properties: + data: + $ref: "#/components/schemas/AggregatedLongTasksResponseData" + required: + - data + type: object + AggregatedLongTasksResponseAttributes: + description: Attributes of an aggregated long tasks response. + properties: + application_id: + description: The RUM application ID that was analyzed. + example: ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b + type: string + criteria: + $ref: "#/components/schemas/AggregatedWaterfallPerformanceCriteria" + from: + description: Start of the analyzed time range as a Unix timestamp in seconds. + example: 1762437564 + format: int64 + type: integer + long_tasks_by_invoker_type: + description: Long task statistics grouped by invoker type, sorted by impact score descending. + items: + $ref: "#/components/schemas/AggregatedLongTasksByInvokerType" + type: array + sampled_view_ids: + description: List of RUM view IDs sampled for this aggregation, capped at 50. + example: + - 6fbf69b6-9455-436a-b894-a6bf64126d40 + items: + type: string + type: array + to: + description: End of the analyzed time range as a Unix timestamp in seconds. + example: 1762523964 + format: int64 + type: integer + view_count: + description: Number of view instances included in the analysis. + example: 50 + format: int32 + maximum: 2147483647 + type: integer + view_name: + description: The RUM view name that was analyzed. + example: /account/login(/:type) + type: string + required: + - view_name + - application_id + - view_count + - from + - to + - sampled_view_ids + - long_tasks_by_invoker_type + type: object + AggregatedLongTasksResponseData: + description: Data envelope for an aggregated long tasks response. + properties: + attributes: + $ref: "#/components/schemas/AggregatedLongTasksResponseAttributes" + id: + description: Hash-based unique identifier for this aggregation. + example: 2f0b3455 + type: string + type: + $ref: "#/components/schemas/AggregatedLongTasksRequestType" + required: + - id + - type + - attributes + type: object + AggregatedLowCacheHitRate: + description: Aggregated low cache hit rate detection at view level. + properties: + avg_cache_hit_rate: + description: Average cache hit rate across affected views. + example: 0.15 + format: double + type: number + avg_resource_download_size_bytes: + description: Average total download size of uncached resources in bytes. + example: 1048576 + format: int64 + type: integer + fingerprint: + description: Unique fingerprint identifying this detection group. + example: v1$abc123 + type: string + impact_score: + description: Impact score for this detection. + example: 20.0 + format: double + type: number + view_occurrences: + description: Number of sampled views where this detection occurred. + example: 5 + format: int32 + maximum: 2147483647 + type: integer + required: + - fingerprint + - view_occurrences + - avg_cache_hit_rate + - avg_resource_download_size_bytes + - impact_score + type: object + AggregatedMobileScrollFriction: + description: Aggregated mobile scroll friction detection at view level. + properties: + avg_scroll_frozen_frame_count: + description: Average number of frozen frames during scroll interactions. + example: 3 + format: int32 + maximum: 2147483647 + type: integer + fingerprint: + description: Unique fingerprint identifying this detection group. + example: v1$ghi789 + type: string + impact_score: + description: Impact score for this detection. + example: 12.0 + format: double + type: number + view_occurrences: + description: Number of sampled views where this detection occurred. + example: 6 + format: int32 + maximum: 2147483647 + type: integer + required: + - fingerprint + - view_occurrences + - avg_scroll_frozen_frame_count + - impact_score + type: object + AggregatedResource: + description: Aggregated performance statistics for a single network resource across sampled view instances. + properties: + avg_duration_ms: + description: Average total duration in milliseconds. + example: 839.1 + format: double + type: number + avg_start_time_ms: + description: Average start time relative to view start in milliseconds. + example: 1486.3 + format: double + type: number + cache_hit_rate_pct: + description: Cache hit rate as a percentage. + example: 100.0 + format: double + type: number + cached_count: + description: Number of requests served from cache. + example: 27 + format: int32 + maximum: 2147483647 + type: integer + downloaded_count: + description: Number of requests downloaded from the network. + example: 0 + format: int32 + maximum: 2147483647 + type: integer + global_p75_duration_ms: + description: 75th percentile duration across all view names in the application, present when include_global_appearance is true. + example: 500.0 + format: double + type: number + global_view_name_count: + description: Number of distinct view names in the application that load this resource, present when include_global_appearance is true. + example: 3 + format: int32 + maximum: 2147483647 + type: integer + global_view_name_pct: + description: Percentage of distinct view names in the application that load this resource, present when include_global_appearance is true. + example: 30.0 + format: double + type: number + http_method: + description: HTTP method for the resource request. + example: GET + nullable: true + type: string + load_frequency_pct: + description: Percentage of sampled view instances that loaded this resource. + example: 54.0 + format: double + type: number + max_duration_ms: + description: Maximum duration in milliseconds. + example: 945.6 + format: double + type: number + median_duration_ms: + description: Median duration in milliseconds. + example: 836.2 + format: double + type: number + min_duration_ms: + description: Minimum duration in milliseconds. + example: 812.7 + format: double + type: number + p75_duration_ms: + description: 75th percentile duration in milliseconds. + example: 844.1 + format: double + type: number + p95_duration_ms: + description: 95th percentile duration in milliseconds. + example: 861.8 + format: double + type: number + resource_type: + description: Resource type (JS, CSS, image, fetch, XHR, document, and so on). + example: fetch + nullable: true + type: string + resource_url_path_group: + description: URL path group used to aggregate similar resources. + example: /api/gallery + type: string + timing_breakdown: + $ref: "#/components/schemas/AggregatedResourceTimingBreakdown" + total_requests: + description: Total number of requests for this resource across all sampled views. + example: 27 + format: int32 + maximum: 2147483647 + type: integer + views_with_resource: + description: Number of sampled view instances that loaded this resource. + example: 27 + format: int32 + maximum: 2147483647 + type: integer + required: + - resource_url_path_group + - resource_type + - http_method + - avg_start_time_ms + - avg_duration_ms + - p95_duration_ms + - p75_duration_ms + - median_duration_ms + - min_duration_ms + - max_duration_ms + - timing_breakdown + - total_requests + - views_with_resource + - load_frequency_pct + - cached_count + - downloaded_count + - cache_hit_rate_pct + type: object + AggregatedResourceTimingBreakdown: + description: Average timing breakdown per network phase for a resource. + properties: + avg_connect_ms: + description: Average TCP connect duration in milliseconds. + example: 20.0 + format: double + type: number + avg_dns_ms: + description: Average DNS resolution duration in milliseconds. + example: 10.0 + format: double + type: number + avg_download_ms: + description: Average download phase duration in milliseconds. + example: 135.0 + format: double + type: number + avg_first_byte_ms: + description: Average time to first byte in milliseconds. + example: 30.0 + format: double + type: number + avg_redirect_ms: + description: Average redirect phase duration in milliseconds. + example: 0.0 + format: double + type: number + avg_ssl_ms: + description: Average SSL handshake duration in milliseconds. + example: 5.0 + format: double + type: number + required: + - avg_redirect_ms + - avg_dns_ms + - avg_connect_ms + - avg_ssl_ms + - avg_first_byte_ms + - avg_download_ms + type: object + AggregatedSignalsProblemsRequest: + description: Request body for the aggregated signals and problems endpoint. + properties: + data: + $ref: "#/components/schemas/AggregatedSignalsProblemsRequestData" + required: + - data + type: object + AggregatedSignalsProblemsRequestAttributes: + description: Attributes for an aggregated signals and problems query. + properties: + application_id: + description: The RUM application ID to analyze. + example: ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b + type: string + criteria: + $ref: "#/components/schemas/AggregatedWaterfallPerformanceCriteria" + detection_types: + description: List of detection types to include in the response. When omitted, all types are returned. + example: + - high_script_evaluations + - uncompressed_resources + items: + type: string + type: array + filter: + description: RUM query string to filter events (for example, @session.type:user @geo.country:US). + example: "@session.type:user" + type: string + from: + description: Start of the time range as a Unix timestamp in seconds. + example: 1762437564 + format: int64 + type: integer + sample_size: + description: Number of view instances to sample, between 1 and 50. + example: 30 + format: int32 + maximum: 50 + minimum: 1 + type: integer + to: + description: End of the time range as a Unix timestamp in seconds. + example: 1762523964 + format: int64 + type: integer + view_name: + description: The RUM view name to analyze (for example, /account/login). + example: /account/login(/:type) + type: string + required: + - application_id + - view_name + - from + - to + - sample_size + type: object + AggregatedSignalsProblemsRequestData: + description: Data envelope for an aggregated signals and problems request. + properties: + attributes: + $ref: "#/components/schemas/AggregatedSignalsProblemsRequestAttributes" + type: + $ref: "#/components/schemas/AggregatedSignalsProblemsRequestType" + required: + - type + - attributes + type: object + AggregatedSignalsProblemsRequestType: + description: The JSON:API type for aggregated signals and problems requests. + enum: + - aggregated_signals_problems + example: aggregated_signals_problems + type: string + x-enum-varnames: + - AggregatedSignalsProblems + AggregatedSignalsProblemsResponse: + description: Response body for the aggregated signals and problems endpoint. + properties: + data: + $ref: "#/components/schemas/AggregatedSignalsProblemsResponseData" + required: + - data + type: object + AggregatedSignalsProblemsResponseAttributes: + description: Attributes of an aggregated signals and problems response. + properties: + application_id: + description: The RUM application ID that was analyzed. + example: ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b + type: string + criteria: + $ref: "#/components/schemas/AggregatedWaterfallPerformanceCriteria" + from: + description: Start of the analyzed time range as a Unix timestamp in seconds. + example: 1710000000 + format: int64 + type: integer + problem_detections: + $ref: "#/components/schemas/SignalsProblemsDetections" + sample_metadata: + $ref: "#/components/schemas/SignalsProblemsSampleMetadata" + to: + description: End of the analyzed time range as a Unix timestamp in seconds. + example: 1710003600 + format: int64 + type: integer + view_name: + description: The RUM view name that was analyzed. + example: /checkout + type: string + required: + - view_name + - application_id + - from + - to + - sample_metadata + - problem_detections + type: object + AggregatedSignalsProblemsResponseData: + description: Data envelope for an aggregated signals and problems response. + properties: + attributes: + $ref: "#/components/schemas/AggregatedSignalsProblemsResponseAttributes" + id: + description: Hash-based unique identifier for this aggregation. + example: 2f0b3455 + type: string + type: + $ref: "#/components/schemas/AggregatedSignalsProblemsRequestType" + required: + - id + - type + - attributes + type: object + AggregatedSlowFCPHighBytes: + description: Aggregated slow first contentful paint with high byte count detection. + properties: + avg_bytes_before_fcp_bytes: + description: Average total bytes loaded before first contentful paint. + example: 2097152 + format: int64 + type: integer + avg_first_contentful_paint_ms: + description: Average first contentful paint time in milliseconds. + example: 3500 + format: int64 + type: integer + avg_resource_count_before_fcp: + description: Average number of resources loaded before first contentful paint. + example: 25 + format: int64 + type: integer + fingerprint: + description: Unique fingerprint identifying this detection group. + example: v1$def456 + type: string + impact_score: + description: Impact score for this detection. + example: 18.0 + format: double + type: number + platform: + description: Platform identifier for the affected views. + example: browser + type: string + view_occurrences: + description: Number of sampled views where this detection occurred. + example: 4 + format: int32 + maximum: 2147483647 + type: integer + required: + - fingerprint + - view_occurrences + - avg_first_contentful_paint_ms + - avg_bytes_before_fcp_bytes + - avg_resource_count_before_fcp + - platform + - impact_score + type: object + AggregatedSlowInteractionLongTask: + description: Aggregated slow interaction with long task detection grouped by action and selector. + properties: + action_type: + description: Type of user interaction that triggered the slow response. + example: click + type: string + avg_blocking_duration: + description: Average long task blocking duration in nanoseconds. + example: 250000000 + format: int64 + type: integer + avg_duration: + description: Average total interaction duration in nanoseconds. + example: 320000000 + format: int64 + type: integer + fingerprint: + description: Unique fingerprint identifying this detection group. + example: v1$jkl012 + type: string + impact_score: + description: Impact score combining view frequency and blocking severity. + example: 22.0 + format: double + type: number + instance_count: + description: Total number of detection instances across sampled views. + example: 9 + format: int32 + maximum: 2147483647 + type: integer + selector: + description: CSS selector of the element that was interacted with. + example: "#submit-button" + nullable: true + type: string + selector_normalized: + description: Normalized CSS selector with dynamic parts replaced. + example: button[data-action] + nullable: true + type: string + view_occurrences: + description: Number of sampled views where this detection occurred. + example: 7 + format: int32 + maximum: 2147483647 + type: integer + required: + - fingerprint + - action_type + - selector + - selector_normalized + - view_occurrences + - instance_count + - avg_blocking_duration + - avg_duration + - impact_score + type: object + AggregatedUncompressedResource: + description: Aggregated uncompressed resource detection grouped by URL path. + properties: + avg_body_size: + description: Average uncompressed body size in bytes. + example: 524288 + format: int64 + type: integer + avg_duration: + description: Average resource loading duration in nanoseconds. + example: 0 + format: int64 + type: integer + fingerprint: + description: Unique fingerprint identifying this detection group. + example: v1$65e268e25cab3a1f6230405ccf011a68 + type: string + impact_score: + description: Impact score combining view frequency and resource size. + example: 16.67 + format: double + type: number + instance_count: + description: Total number of detection instances across sampled views. + example: 1 + format: int32 + maximum: 2147483647 + type: integer + provider_type: + description: CDN or hosting provider type for the resource. + example: cloudfront + nullable: true + type: string + render_blocking: + description: Whether the resource is render-blocking. + example: blocking + nullable: true + type: string + resource_type: + description: Type of the resource (JS, CSS, image, fetch, and so on). + example: image + type: string + url_path_group: + description: Normalized URL path pattern for the uncompressed resource. + example: /cdn/hero.jpg + type: string + view_occurrences: + description: Number of sampled views where this detection occurred. + example: 1 + format: int32 + maximum: 2147483647 + type: integer + required: + - fingerprint + - url_path_group + - resource_type + - render_blocking + - provider_type + - view_occurrences + - instance_count + - avg_body_size + - avg_duration + - impact_score + type: object + AggregatedWaterfallPerformanceCriteria: + description: Performance criteria to filter view instances by a metric threshold. + properties: + max: + description: Maximum threshold in seconds (inclusive). + example: 5.0 + format: double + type: number + metric: + $ref: "#/components/schemas/AggregatedWaterfallPerformanceCriteriaMetric" + min: + description: Minimum threshold in seconds (inclusive). + example: 2.5 + format: double + type: number + required: + - metric + type: object + AggregatedWaterfallPerformanceCriteriaMetric: + description: Performance metric used to filter view instances by threshold. + enum: + - loading_time + - largest_contentful_paint + - first_contentful_paint + - interaction_to_next_paint + example: largest_contentful_paint + type: string + x-enum-varnames: + - LoadingTime + - LargestContentfulPaint + - FirstContentfulPaint + - InteractionToNextPaint + AggregatedWaterfallRequest: + description: Request body for the aggregated waterfall endpoint. + properties: + data: + $ref: "#/components/schemas/AggregatedWaterfallRequestData" + required: + - data + type: object + AggregatedWaterfallRequestAttributes: + description: Attributes for an aggregated waterfall query. + properties: + application_id: + description: The RUM application ID to analyze. + example: ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b + type: string + criteria: + $ref: "#/components/schemas/AggregatedWaterfallPerformanceCriteria" + filter: + description: RUM query string to filter events (for example, @session.type:user @geo.country:US). + example: "@session.type:user" + type: string + from: + description: Start of the time range as a Unix timestamp in seconds. + example: 1762437564 + format: int64 + type: integer + include_global_appearance: + description: When true, enriches each resource with cross-view appearance statistics. + example: false + type: boolean + sample_size: + description: Number of view instances to sample, between 1 and 500. + example: 20 + format: int32 + maximum: 500 + minimum: 1 + type: integer + to: + description: End of the time range as a Unix timestamp in seconds. + example: 1762523964 + format: int64 + type: integer + view_name: + description: The RUM view name to analyze (for example, /account/login). + example: /account/login(/:type) + type: string + required: + - application_id + - view_name + - from + - to + - sample_size + type: object + AggregatedWaterfallRequestData: + description: Data envelope for an aggregated waterfall request. + properties: + attributes: + $ref: "#/components/schemas/AggregatedWaterfallRequestAttributes" + type: + $ref: "#/components/schemas/AggregatedWaterfallRequestType" + required: + - type + - attributes + type: object + AggregatedWaterfallRequestType: + description: The JSON:API type for aggregated waterfall requests. + enum: + - aggregated_waterfall + example: aggregated_waterfall + type: string + x-enum-varnames: + - AggregatedWaterfall + AggregatedWaterfallResponse: + description: Response body for the aggregated waterfall endpoint. + properties: + data: + $ref: "#/components/schemas/AggregatedWaterfallResponseData" + required: + - data + type: object + AggregatedWaterfallResponseAttributes: + description: Attributes of an aggregated waterfall response. + properties: + application_id: + description: The RUM application ID that was analyzed. + example: ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b + type: string + criteria: + $ref: "#/components/schemas/AggregatedWaterfallPerformanceCriteria" + from: + description: Start of the analyzed time range as a Unix timestamp in seconds. + example: 1762437564 + format: int64 + type: integer + resources: + description: Network resources in chronological waterfall order. + items: + $ref: "#/components/schemas/AggregatedResource" + type: array + sampled_view_ids: + description: List of RUM view IDs sampled for this aggregation, capped at 50. + example: + - 6fbf69b6-9455-436a-b894-a6bf64126d40 + - dfe318df-4ae5-44b8-9fe2-4107885e1a46 + items: + type: string + type: array + to: + description: End of the analyzed time range as a Unix timestamp in seconds. + example: 1762523964 + format: int64 + type: integer + total_cache_hit_rate_pct: + description: Overall cache hit rate across all sampled views. + example: 0.677 + format: double + type: number + view_count: + description: Number of view instances included in the analysis. + example: 50 + format: int32 + maximum: 2147483647 + type: integer + view_name: + description: The RUM view name that was analyzed. + example: /account/login(/:type) + type: string + required: + - view_name + - application_id + - view_count + - from + - to + - sampled_view_ids + - total_cache_hit_rate_pct + - resources + type: object + AggregatedWaterfallResponseData: + description: Data envelope for an aggregated waterfall response. + properties: + attributes: + $ref: "#/components/schemas/AggregatedWaterfallResponseAttributes" + id: + description: Hash-based unique identifier for this aggregation. + example: 2f0b3455 + type: string + type: + $ref: "#/components/schemas/AggregatedWaterfallRequestType" + required: + - id + - type + - attributes + type: object AlertEventAttributes: description: Alert event attributes. properties: @@ -46817,6 +47819,53 @@ components: example: "One or several indexes are missing or invalid, results hold data from the other indexes" type: string type: object + LongTaskMetricStats: + description: Statistical distribution (average, min, max) of a long task metric across sampled views. + properties: + average: + description: Average value across sampled views. + example: 3504.1 + format: double + type: number + max: + description: Maximum value across sampled views. + example: 3517.8 + format: double + type: number + min: + description: Minimum value across sampled views. + example: 3500.1 + format: double + type: number + required: + - average + - min + - max + type: object + LongTaskStatsPerView: + description: Statistical distributions of long task metrics computed per view across sampled views. + properties: + fcp_blocking_time_ms: + $ref: "#/components/schemas/LongTaskMetricStats" + fcp_count: + $ref: "#/components/schemas/LongTaskMetricStats" + inp_overlap_blocking_time_ms: + $ref: "#/components/schemas/LongTaskMetricStats" + inp_overlap_count: + $ref: "#/components/schemas/LongTaskMetricStats" + lcp_blocking_time_ms: + $ref: "#/components/schemas/LongTaskMetricStats" + lcp_count: + $ref: "#/components/schemas/LongTaskMetricStats" + loading_time_blocking_time_ms: + $ref: "#/components/schemas/LongTaskMetricStats" + loading_time_count: + $ref: "#/components/schemas/LongTaskMetricStats" + total_blocking_time_ms: + $ref: "#/components/schemas/LongTaskMetricStats" + total_count: + $ref: "#/components/schemas/LongTaskMetricStats" + type: object MSTeamsIntegrationMetadata: description: Incident integration metadata for the Microsoft Teams integration. properties: @@ -75122,6 +76171,85 @@ components: description: Included data for shift operations. oneOf: - $ref: "#/components/schemas/ScheduleUser" + SignalsProblemsDetections: + description: Grouped detection results by detection type. + properties: + high_frozen_frame_rates: + description: Detected high frozen frame rate issues. + items: + $ref: "#/components/schemas/AggregatedHighFrozenFrameRate" + type: array + high_script_evaluations: + description: Detected high script evaluation issues. + items: + $ref: "#/components/schemas/AggregatedHighScriptEval" + type: array + low_cache_hit_rates: + description: Detected low cache hit rate issues. + items: + $ref: "#/components/schemas/AggregatedLowCacheHitRate" + type: array + mobile_scroll_frictions: + description: Detected mobile scroll friction issues. + items: + $ref: "#/components/schemas/AggregatedMobileScrollFriction" + type: array + slow_fcp_high_bytes: + description: Detected slow first contentful paint with high byte count issues. + items: + $ref: "#/components/schemas/AggregatedSlowFCPHighBytes" + type: array + slow_interaction_long_tasks: + description: Detected slow interaction with long task issues. + items: + $ref: "#/components/schemas/AggregatedSlowInteractionLongTask" + type: array + uncompressed_resources: + description: Detected uncompressed resource issues. + items: + $ref: "#/components/schemas/AggregatedUncompressedResource" + type: array + type: object + SignalsProblemsSampleMetadata: + description: Metadata about the sampling quality for a signals and problems query. + properties: + failed: + description: Number of view instances that failed to process. + example: 2 + format: int32 + maximum: 2147483647 + type: integer + requested: + description: Number of view instances requested for sampling. + example: 30 + format: int32 + maximum: 2147483647 + type: integer + sampled_view_ids: + description: List of RUM view IDs that were sampled. + example: + - 6fbf69b6-9455-436a-b894-a6bf64126d40 + items: + type: string + type: array + succeeded: + description: Number of view instances successfully processed. + example: 28 + format: int32 + maximum: 2147483647 + type: integer + success_rate: + description: Ratio of successfully processed views to requested views. + example: 0.93 + format: double + type: number + required: + - requested + - succeeded + - failed + - success_rate + - sampled_view_ids + type: object SimpleMonitorUserTemplate: description: A simplified version of a monitor user template. properties: @@ -84965,6 +86093,43 @@ components: type: string x-enum-varnames: - SECRET + TopLongTaskInvoker: + description: A top long task invoker within an invoker type. + properties: + criteria_view_occurrences: + description: Number of sampled views where this invoker had long tasks contributing to the criteria metric. + example: 40 + format: int32 + maximum: 2147483647 + type: integer + file: + description: Cleaned source file path for the invoker script. + example: src/pages/Gallery.tsx + nullable: true + type: string + impact_score: + description: Rank-product impact score combining view frequency and blocking time severity. + example: 0.67 + format: double + type: number + invoker: + description: Name of the invoker function or script. + example: Response.json.then + type: string + stats_per_view: + $ref: "#/components/schemas/LongTaskStatsPerView" + view_occurrences: + description: Number of sampled views where this invoker had any long tasks. + example: 68 + format: int32 + maximum: 2147483647 + type: integer + required: + - invoker + - file + - view_occurrences + - stats_per_view + type: object Trigger: description: "One of the triggers that can start the execution of a workflow." oneOf: @@ -137142,6 +138307,265 @@ paths: operator: OR permissions: - rum_apps_read + /api/v2/rum/query/insight/aggregated_long_tasks: + post: + description: |- + Get aggregated long task data for a RUM view, grouped by invoker type and sampled across multiple view instances. + operationId: QueryAggregatedLongTasks + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + application_id: ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b + from: 1762437564 + sample_size: 20 + to: 1762523964 + view_name: /account/login(/:type) + type: aggregated_long_tasks + schema: + $ref: "#/components/schemas/AggregatedLongTasksRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + application_id: ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b + from: 1762437564 + long_tasks_by_invoker_type: + - impact_score: 0.4 + invoker_type: resolve-promise + stats_per_view: + total_blocking_time_ms: + average: 3504.1 + max: 3517.8 + min: 3500.1 + total_count: + average: 1.0 + max: 1.0 + min: 1.0 + top_invokers: + - file: src/pages/Gallery.tsx + impact_score: 0.67 + invoker: Response.json.then + stats_per_view: + total_count: + average: 1.0 + max: 1.0 + min: 1.0 + view_occurrences: 68 + view_occurrences: 68 + sampled_view_ids: + - 6fbf69b6-9455-436a-b894-a6bf64126d40 + to: 1762523964 + view_count: 20 + view_name: /account/login(/:type) + id: 2f0b3455 + type: aggregated_long_tasks + schema: + $ref: "#/components/schemas/AggregatedLongTasksResponse" + description: Successful response + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Query aggregated long tasks + tags: ["RUM"] + x-permission: + operator: OR + permissions: + - rum_apps_read + /api/v2/rum/query/insight/aggregated_signals_problems: + post: + description: |- + Get aggregated performance signals and problem detections for a RUM view, sampled across multiple view instances. + operationId: QueryAggregatedSignalsProblems + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + application_id: ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b + from: 1762437564 + sample_size: 30 + to: 1762523964 + view_name: /account/login(/:type) + type: aggregated_signals_problems + schema: + $ref: "#/components/schemas/AggregatedSignalsProblemsRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + application_id: ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b + from: 1710000000 + problem_detections: + high_script_evaluations: + - avg_duration: 300000000 + avg_forced_style_layout: 0 + fingerprint: v1$7766a8c2180aa153f5526ba8868999f8 + impact_score: 30.0 + instance_count: 3 + invoker_type: user-callback + source_category: + source_function_name: handleClick + source_url: https://cdn.example.com/app.js + view_occurrences: 3 + sample_metadata: + failed: 2 + requested: 30 + sampled_view_ids: + - 6fbf69b6-9455-436a-b894-a6bf64126d40 + succeeded: 28 + success_rate: 0.93 + to: 1710003600 + view_name: /checkout + id: 2f0b3455 + type: aggregated_signals_problems + schema: + $ref: "#/components/schemas/AggregatedSignalsProblemsResponse" + description: Successful response + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Query aggregated signals and problems + tags: ["RUM"] + x-permission: + operator: OR + permissions: + - rum_apps_read + /api/v2/rum/query/insight/aggregated_waterfall: + post: + description: |- + Get aggregated network resource waterfall data for a RUM view, sampled across multiple view instances. + operationId: QueryAggregatedWaterfall + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + application_id: ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b + criteria: + metric: largest_contentful_paint + min: 0.3 + from: 1762437564 + sample_size: 20 + to: 1762523964 + view_name: /account/login(/:type) + type: aggregated_waterfall + schema: + $ref: "#/components/schemas/AggregatedWaterfallRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + application_id: ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b + criteria: + metric: largest_contentful_paint + min: 0.3 + from: 1762437564 + resources: + - avg_duration_ms: 839.1 + avg_start_time_ms: 1486.3 + cache_hit_rate_pct: 100.0 + cached_count: 27 + downloaded_count: 0 + http_method: GET + load_frequency_pct: 54.0 + max_duration_ms: 945.6 + median_duration_ms: 836.2 + min_duration_ms: 812.7 + p75_duration_ms: 844.1 + p95_duration_ms: 861.8 + resource_type: fetch + resource_url_path_group: /api/gallery + timing_breakdown: + avg_connect_ms: 0.0 + avg_dns_ms: 0.0 + avg_download_ms: 0.6 + avg_first_byte_ms: 59.9 + avg_redirect_ms: 0.0 + avg_ssl_ms: 0.0 + total_requests: 27 + views_with_resource: 27 + sampled_view_ids: + - 6fbf69b6-9455-436a-b894-a6bf64126d40 + to: 1762523964 + total_cache_hit_rate_pct: 0.5 + view_count: 20 + view_name: /account/login(/:type) + id: 2f0b3455 + type: aggregated_waterfall + schema: + $ref: "#/components/schemas/AggregatedWaterfallResponse" + description: Successful response + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Query aggregated waterfall + tags: ["RUM"] + x-permission: + operator: OR + permissions: + - rum_apps_read /api/v2/rum/replay/playlists: get: description: List playlists. diff --git a/api/datadogV2/api_rum.go b/api/datadogV2/api_rum.go index ab7293f6cc3..af3b13db7d5 100644 --- a/api/datadogV2/api_rum.go +++ b/api/datadogV2/api_rum.go @@ -617,6 +617,273 @@ func (a *RUMApi) ListRUMEventsWithPagination(ctx _context.Context, o ...ListRUME return items, cancel } +// QueryAggregatedLongTasks Query aggregated long tasks. +// Get aggregated long task data for a RUM view, grouped by invoker type and sampled across multiple view instances. +func (a *RUMApi) QueryAggregatedLongTasks(ctx _context.Context, body AggregatedLongTasksRequest) (AggregatedLongTasksResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue AggregatedLongTasksResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.RUMApi.QueryAggregatedLongTasks") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/rum/query/insight/aggregated_long_tasks" + + 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 == 401 { + 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 +} + +// QueryAggregatedSignalsProblems Query aggregated signals and problems. +// Get aggregated performance signals and problem detections for a RUM view, sampled across multiple view instances. +func (a *RUMApi) QueryAggregatedSignalsProblems(ctx _context.Context, body AggregatedSignalsProblemsRequest) (AggregatedSignalsProblemsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue AggregatedSignalsProblemsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.RUMApi.QueryAggregatedSignalsProblems") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/rum/query/insight/aggregated_signals_problems" + + 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 == 401 { + 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 +} + +// QueryAggregatedWaterfall Query aggregated waterfall. +// Get aggregated network resource waterfall data for a RUM view, sampled across multiple view instances. +func (a *RUMApi) QueryAggregatedWaterfall(ctx _context.Context, body AggregatedWaterfallRequest) (AggregatedWaterfallResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue AggregatedWaterfallResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.RUMApi.QueryAggregatedWaterfall") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/rum/query/insight/aggregated_waterfall" + + 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 == 401 { + 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 +} + // SearchRUMEvents Search RUM events. // List endpoint returns RUM events that match a RUM search query. // [Results are paginated][1]. diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index ad3897671c2..9780f2676e4 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -738,6 +738,9 @@ // - [RUMApi.GetRUMApplication] // - [RUMApi.GetRUMApplications] // - [RUMApi.ListRUMEvents] +// - [RUMApi.QueryAggregatedLongTasks] +// - [RUMApi.QueryAggregatedSignalsProblems] +// - [RUMApi.QueryAggregatedWaterfall] // - [RUMApi.SearchRUMEvents] // - [RUMApi.UpdateRUMApplication] // - [ReferenceTablesApi.BatchRowsQuery] diff --git a/api/datadogV2/model_aggregated_high_frozen_frame_rate.go b/api/datadogV2/model_aggregated_high_frozen_frame_rate.go new file mode 100644 index 00000000000..83aceb8661b --- /dev/null +++ b/api/datadogV2/model_aggregated_high_frozen_frame_rate.go @@ -0,0 +1,261 @@ +// Unless explicitly stated otherwise all files in this repository 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" +) + +// AggregatedHighFrozenFrameRate Aggregated high frozen frame rate detection at view level. +type AggregatedHighFrozenFrameRate struct { + // Average frozen frame rate as a fraction of total frames. + AvgFrozenFrameRate float64 `json:"avg_frozen_frame_rate"` + // Average segment duration in nanoseconds. + AvgSegmentDuration int64 `json:"avg_segment_duration"` + // Average total frozen duration in nanoseconds. + AvgTotalFrozenDuration int64 `json:"avg_total_frozen_duration"` + // Unique fingerprint identifying this detection group. + Fingerprint string `json:"fingerprint"` + // Impact score for this detection. + ImpactScore float64 `json:"impact_score"` + // Number of sampled views where this detection occurred. + ViewOccurrences int32 `json:"view_occurrences"` + // 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:"-"` +} + +// NewAggregatedHighFrozenFrameRate instantiates a new AggregatedHighFrozenFrameRate 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 NewAggregatedHighFrozenFrameRate(avgFrozenFrameRate float64, avgSegmentDuration int64, avgTotalFrozenDuration int64, fingerprint string, impactScore float64, viewOccurrences int32) *AggregatedHighFrozenFrameRate { + this := AggregatedHighFrozenFrameRate{} + this.AvgFrozenFrameRate = avgFrozenFrameRate + this.AvgSegmentDuration = avgSegmentDuration + this.AvgTotalFrozenDuration = avgTotalFrozenDuration + this.Fingerprint = fingerprint + this.ImpactScore = impactScore + this.ViewOccurrences = viewOccurrences + return &this +} + +// NewAggregatedHighFrozenFrameRateWithDefaults instantiates a new AggregatedHighFrozenFrameRate 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 NewAggregatedHighFrozenFrameRateWithDefaults() *AggregatedHighFrozenFrameRate { + this := AggregatedHighFrozenFrameRate{} + return &this +} + +// GetAvgFrozenFrameRate returns the AvgFrozenFrameRate field value. +func (o *AggregatedHighFrozenFrameRate) GetAvgFrozenFrameRate() float64 { + if o == nil { + var ret float64 + return ret + } + return o.AvgFrozenFrameRate +} + +// GetAvgFrozenFrameRateOk returns a tuple with the AvgFrozenFrameRate field value +// and a boolean to check if the value has been set. +func (o *AggregatedHighFrozenFrameRate) GetAvgFrozenFrameRateOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.AvgFrozenFrameRate, true +} + +// SetAvgFrozenFrameRate sets field value. +func (o *AggregatedHighFrozenFrameRate) SetAvgFrozenFrameRate(v float64) { + o.AvgFrozenFrameRate = v +} + +// GetAvgSegmentDuration returns the AvgSegmentDuration field value. +func (o *AggregatedHighFrozenFrameRate) GetAvgSegmentDuration() int64 { + if o == nil { + var ret int64 + return ret + } + return o.AvgSegmentDuration +} + +// GetAvgSegmentDurationOk returns a tuple with the AvgSegmentDuration field value +// and a boolean to check if the value has been set. +func (o *AggregatedHighFrozenFrameRate) GetAvgSegmentDurationOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.AvgSegmentDuration, true +} + +// SetAvgSegmentDuration sets field value. +func (o *AggregatedHighFrozenFrameRate) SetAvgSegmentDuration(v int64) { + o.AvgSegmentDuration = v +} + +// GetAvgTotalFrozenDuration returns the AvgTotalFrozenDuration field value. +func (o *AggregatedHighFrozenFrameRate) GetAvgTotalFrozenDuration() int64 { + if o == nil { + var ret int64 + return ret + } + return o.AvgTotalFrozenDuration +} + +// GetAvgTotalFrozenDurationOk returns a tuple with the AvgTotalFrozenDuration field value +// and a boolean to check if the value has been set. +func (o *AggregatedHighFrozenFrameRate) GetAvgTotalFrozenDurationOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.AvgTotalFrozenDuration, true +} + +// SetAvgTotalFrozenDuration sets field value. +func (o *AggregatedHighFrozenFrameRate) SetAvgTotalFrozenDuration(v int64) { + o.AvgTotalFrozenDuration = v +} + +// GetFingerprint returns the Fingerprint field value. +func (o *AggregatedHighFrozenFrameRate) GetFingerprint() string { + if o == nil { + var ret string + return ret + } + return o.Fingerprint +} + +// GetFingerprintOk returns a tuple with the Fingerprint field value +// and a boolean to check if the value has been set. +func (o *AggregatedHighFrozenFrameRate) GetFingerprintOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Fingerprint, true +} + +// SetFingerprint sets field value. +func (o *AggregatedHighFrozenFrameRate) SetFingerprint(v string) { + o.Fingerprint = v +} + +// GetImpactScore returns the ImpactScore field value. +func (o *AggregatedHighFrozenFrameRate) GetImpactScore() float64 { + if o == nil { + var ret float64 + return ret + } + return o.ImpactScore +} + +// GetImpactScoreOk returns a tuple with the ImpactScore field value +// and a boolean to check if the value has been set. +func (o *AggregatedHighFrozenFrameRate) GetImpactScoreOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.ImpactScore, true +} + +// SetImpactScore sets field value. +func (o *AggregatedHighFrozenFrameRate) SetImpactScore(v float64) { + o.ImpactScore = v +} + +// GetViewOccurrences returns the ViewOccurrences field value. +func (o *AggregatedHighFrozenFrameRate) GetViewOccurrences() int32 { + if o == nil { + var ret int32 + return ret + } + return o.ViewOccurrences +} + +// GetViewOccurrencesOk returns a tuple with the ViewOccurrences field value +// and a boolean to check if the value has been set. +func (o *AggregatedHighFrozenFrameRate) GetViewOccurrencesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.ViewOccurrences, true +} + +// SetViewOccurrences sets field value. +func (o *AggregatedHighFrozenFrameRate) SetViewOccurrences(v int32) { + o.ViewOccurrences = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedHighFrozenFrameRate) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["avg_frozen_frame_rate"] = o.AvgFrozenFrameRate + toSerialize["avg_segment_duration"] = o.AvgSegmentDuration + toSerialize["avg_total_frozen_duration"] = o.AvgTotalFrozenDuration + toSerialize["fingerprint"] = o.Fingerprint + toSerialize["impact_score"] = o.ImpactScore + toSerialize["view_occurrences"] = o.ViewOccurrences + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AggregatedHighFrozenFrameRate) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AvgFrozenFrameRate *float64 `json:"avg_frozen_frame_rate"` + AvgSegmentDuration *int64 `json:"avg_segment_duration"` + AvgTotalFrozenDuration *int64 `json:"avg_total_frozen_duration"` + Fingerprint *string `json:"fingerprint"` + ImpactScore *float64 `json:"impact_score"` + ViewOccurrences *int32 `json:"view_occurrences"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.AvgFrozenFrameRate == nil { + return fmt.Errorf("required field avg_frozen_frame_rate missing") + } + if all.AvgSegmentDuration == nil { + return fmt.Errorf("required field avg_segment_duration missing") + } + if all.AvgTotalFrozenDuration == nil { + return fmt.Errorf("required field avg_total_frozen_duration missing") + } + if all.Fingerprint == nil { + return fmt.Errorf("required field fingerprint missing") + } + if all.ImpactScore == nil { + return fmt.Errorf("required field impact_score missing") + } + if all.ViewOccurrences == nil { + return fmt.Errorf("required field view_occurrences missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"avg_frozen_frame_rate", "avg_segment_duration", "avg_total_frozen_duration", "fingerprint", "impact_score", "view_occurrences"}) + } else { + return err + } + o.AvgFrozenFrameRate = *all.AvgFrozenFrameRate + o.AvgSegmentDuration = *all.AvgSegmentDuration + o.AvgTotalFrozenDuration = *all.AvgTotalFrozenDuration + o.Fingerprint = *all.Fingerprint + o.ImpactScore = *all.ImpactScore + o.ViewOccurrences = *all.ViewOccurrences + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aggregated_high_script_eval.go b/api/datadogV2/model_aggregated_high_script_eval.go new file mode 100644 index 00000000000..a1b49ed95e7 --- /dev/null +++ b/api/datadogV2/model_aggregated_high_script_eval.go @@ -0,0 +1,393 @@ +// Unless explicitly stated otherwise all files in this repository 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" +) + +// AggregatedHighScriptEval Aggregated high script evaluation detection grouped by source. +type AggregatedHighScriptEval struct { + // Average script evaluation duration in nanoseconds. + AvgDuration int64 `json:"avg_duration"` + // Average forced style/layout duration in nanoseconds. + AvgForcedStyleLayout int64 `json:"avg_forced_style_layout"` + // Unique fingerprint identifying this detection group. + Fingerprint string `json:"fingerprint"` + // Impact score combining view frequency and duration severity. + ImpactScore float64 `json:"impact_score"` + // Total number of detection instances across sampled views. + InstanceCount int32 `json:"instance_count"` + // Type of invoker that triggered the script evaluation. + InvokerType string `json:"invoker_type"` + // Category of the script source. + SourceCategory datadog.NullableString `json:"source_category"` + // Name of the function that triggered the high script evaluation. + SourceFunctionName string `json:"source_function_name"` + // URL of the script that triggered the high script evaluation. + SourceUrl datadog.NullableString `json:"source_url"` + // Number of sampled views where this detection occurred. + ViewOccurrences int32 `json:"view_occurrences"` + // 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:"-"` +} + +// NewAggregatedHighScriptEval instantiates a new AggregatedHighScriptEval 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 NewAggregatedHighScriptEval(avgDuration int64, avgForcedStyleLayout int64, fingerprint string, impactScore float64, instanceCount int32, invokerType string, sourceCategory datadog.NullableString, sourceFunctionName string, sourceUrl datadog.NullableString, viewOccurrences int32) *AggregatedHighScriptEval { + this := AggregatedHighScriptEval{} + this.AvgDuration = avgDuration + this.AvgForcedStyleLayout = avgForcedStyleLayout + this.Fingerprint = fingerprint + this.ImpactScore = impactScore + this.InstanceCount = instanceCount + this.InvokerType = invokerType + this.SourceCategory = sourceCategory + this.SourceFunctionName = sourceFunctionName + this.SourceUrl = sourceUrl + this.ViewOccurrences = viewOccurrences + return &this +} + +// NewAggregatedHighScriptEvalWithDefaults instantiates a new AggregatedHighScriptEval 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 NewAggregatedHighScriptEvalWithDefaults() *AggregatedHighScriptEval { + this := AggregatedHighScriptEval{} + return &this +} + +// GetAvgDuration returns the AvgDuration field value. +func (o *AggregatedHighScriptEval) GetAvgDuration() int64 { + if o == nil { + var ret int64 + return ret + } + return o.AvgDuration +} + +// GetAvgDurationOk returns a tuple with the AvgDuration field value +// and a boolean to check if the value has been set. +func (o *AggregatedHighScriptEval) GetAvgDurationOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.AvgDuration, true +} + +// SetAvgDuration sets field value. +func (o *AggregatedHighScriptEval) SetAvgDuration(v int64) { + o.AvgDuration = v +} + +// GetAvgForcedStyleLayout returns the AvgForcedStyleLayout field value. +func (o *AggregatedHighScriptEval) GetAvgForcedStyleLayout() int64 { + if o == nil { + var ret int64 + return ret + } + return o.AvgForcedStyleLayout +} + +// GetAvgForcedStyleLayoutOk returns a tuple with the AvgForcedStyleLayout field value +// and a boolean to check if the value has been set. +func (o *AggregatedHighScriptEval) GetAvgForcedStyleLayoutOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.AvgForcedStyleLayout, true +} + +// SetAvgForcedStyleLayout sets field value. +func (o *AggregatedHighScriptEval) SetAvgForcedStyleLayout(v int64) { + o.AvgForcedStyleLayout = v +} + +// GetFingerprint returns the Fingerprint field value. +func (o *AggregatedHighScriptEval) GetFingerprint() string { + if o == nil { + var ret string + return ret + } + return o.Fingerprint +} + +// GetFingerprintOk returns a tuple with the Fingerprint field value +// and a boolean to check if the value has been set. +func (o *AggregatedHighScriptEval) GetFingerprintOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Fingerprint, true +} + +// SetFingerprint sets field value. +func (o *AggregatedHighScriptEval) SetFingerprint(v string) { + o.Fingerprint = v +} + +// GetImpactScore returns the ImpactScore field value. +func (o *AggregatedHighScriptEval) GetImpactScore() float64 { + if o == nil { + var ret float64 + return ret + } + return o.ImpactScore +} + +// GetImpactScoreOk returns a tuple with the ImpactScore field value +// and a boolean to check if the value has been set. +func (o *AggregatedHighScriptEval) GetImpactScoreOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.ImpactScore, true +} + +// SetImpactScore sets field value. +func (o *AggregatedHighScriptEval) SetImpactScore(v float64) { + o.ImpactScore = v +} + +// GetInstanceCount returns the InstanceCount field value. +func (o *AggregatedHighScriptEval) GetInstanceCount() int32 { + if o == nil { + var ret int32 + return ret + } + return o.InstanceCount +} + +// GetInstanceCountOk returns a tuple with the InstanceCount field value +// and a boolean to check if the value has been set. +func (o *AggregatedHighScriptEval) GetInstanceCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.InstanceCount, true +} + +// SetInstanceCount sets field value. +func (o *AggregatedHighScriptEval) SetInstanceCount(v int32) { + o.InstanceCount = v +} + +// GetInvokerType returns the InvokerType field value. +func (o *AggregatedHighScriptEval) GetInvokerType() string { + if o == nil { + var ret string + return ret + } + return o.InvokerType +} + +// GetInvokerTypeOk returns a tuple with the InvokerType field value +// and a boolean to check if the value has been set. +func (o *AggregatedHighScriptEval) GetInvokerTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.InvokerType, true +} + +// SetInvokerType sets field value. +func (o *AggregatedHighScriptEval) SetInvokerType(v string) { + o.InvokerType = v +} + +// GetSourceCategory returns the SourceCategory field value. +// If the value is explicit nil, the zero value for string will be returned. +func (o *AggregatedHighScriptEval) GetSourceCategory() string { + if o == nil || o.SourceCategory.Get() == nil { + var ret string + return ret + } + return *o.SourceCategory.Get() +} + +// GetSourceCategoryOk returns a tuple with the SourceCategory field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *AggregatedHighScriptEval) GetSourceCategoryOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.SourceCategory.Get(), o.SourceCategory.IsSet() +} + +// SetSourceCategory sets field value. +func (o *AggregatedHighScriptEval) SetSourceCategory(v string) { + o.SourceCategory.Set(&v) +} + +// GetSourceFunctionName returns the SourceFunctionName field value. +func (o *AggregatedHighScriptEval) GetSourceFunctionName() string { + if o == nil { + var ret string + return ret + } + return o.SourceFunctionName +} + +// GetSourceFunctionNameOk returns a tuple with the SourceFunctionName field value +// and a boolean to check if the value has been set. +func (o *AggregatedHighScriptEval) GetSourceFunctionNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SourceFunctionName, true +} + +// SetSourceFunctionName sets field value. +func (o *AggregatedHighScriptEval) SetSourceFunctionName(v string) { + o.SourceFunctionName = v +} + +// GetSourceUrl returns the SourceUrl field value. +// If the value is explicit nil, the zero value for string will be returned. +func (o *AggregatedHighScriptEval) GetSourceUrl() string { + if o == nil || o.SourceUrl.Get() == nil { + var ret string + return ret + } + return *o.SourceUrl.Get() +} + +// GetSourceUrlOk returns a tuple with the SourceUrl field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *AggregatedHighScriptEval) GetSourceUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.SourceUrl.Get(), o.SourceUrl.IsSet() +} + +// SetSourceUrl sets field value. +func (o *AggregatedHighScriptEval) SetSourceUrl(v string) { + o.SourceUrl.Set(&v) +} + +// GetViewOccurrences returns the ViewOccurrences field value. +func (o *AggregatedHighScriptEval) GetViewOccurrences() int32 { + if o == nil { + var ret int32 + return ret + } + return o.ViewOccurrences +} + +// GetViewOccurrencesOk returns a tuple with the ViewOccurrences field value +// and a boolean to check if the value has been set. +func (o *AggregatedHighScriptEval) GetViewOccurrencesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.ViewOccurrences, true +} + +// SetViewOccurrences sets field value. +func (o *AggregatedHighScriptEval) SetViewOccurrences(v int32) { + o.ViewOccurrences = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedHighScriptEval) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["avg_duration"] = o.AvgDuration + toSerialize["avg_forced_style_layout"] = o.AvgForcedStyleLayout + toSerialize["fingerprint"] = o.Fingerprint + toSerialize["impact_score"] = o.ImpactScore + toSerialize["instance_count"] = o.InstanceCount + toSerialize["invoker_type"] = o.InvokerType + toSerialize["source_category"] = o.SourceCategory.Get() + toSerialize["source_function_name"] = o.SourceFunctionName + toSerialize["source_url"] = o.SourceUrl.Get() + toSerialize["view_occurrences"] = o.ViewOccurrences + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AggregatedHighScriptEval) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AvgDuration *int64 `json:"avg_duration"` + AvgForcedStyleLayout *int64 `json:"avg_forced_style_layout"` + Fingerprint *string `json:"fingerprint"` + ImpactScore *float64 `json:"impact_score"` + InstanceCount *int32 `json:"instance_count"` + InvokerType *string `json:"invoker_type"` + SourceCategory datadog.NullableString `json:"source_category"` + SourceFunctionName *string `json:"source_function_name"` + SourceUrl datadog.NullableString `json:"source_url"` + ViewOccurrences *int32 `json:"view_occurrences"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.AvgDuration == nil { + return fmt.Errorf("required field avg_duration missing") + } + if all.AvgForcedStyleLayout == nil { + return fmt.Errorf("required field avg_forced_style_layout missing") + } + if all.Fingerprint == nil { + return fmt.Errorf("required field fingerprint missing") + } + if all.ImpactScore == nil { + return fmt.Errorf("required field impact_score missing") + } + if all.InstanceCount == nil { + return fmt.Errorf("required field instance_count missing") + } + if all.InvokerType == nil { + return fmt.Errorf("required field invoker_type missing") + } + if !all.SourceCategory.IsSet() { + return fmt.Errorf("required field source_category missing") + } + if all.SourceFunctionName == nil { + return fmt.Errorf("required field source_function_name missing") + } + if !all.SourceUrl.IsSet() { + return fmt.Errorf("required field source_url missing") + } + if all.ViewOccurrences == nil { + return fmt.Errorf("required field view_occurrences missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"avg_duration", "avg_forced_style_layout", "fingerprint", "impact_score", "instance_count", "invoker_type", "source_category", "source_function_name", "source_url", "view_occurrences"}) + } else { + return err + } + o.AvgDuration = *all.AvgDuration + o.AvgForcedStyleLayout = *all.AvgForcedStyleLayout + o.Fingerprint = *all.Fingerprint + o.ImpactScore = *all.ImpactScore + o.InstanceCount = *all.InstanceCount + o.InvokerType = *all.InvokerType + o.SourceCategory = all.SourceCategory + o.SourceFunctionName = *all.SourceFunctionName + o.SourceUrl = all.SourceUrl + o.ViewOccurrences = *all.ViewOccurrences + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aggregated_long_tasks_by_invoker_type.go b/api/datadogV2/model_aggregated_long_tasks_by_invoker_type.go new file mode 100644 index 00000000000..243026fe11d --- /dev/null +++ b/api/datadogV2/model_aggregated_long_tasks_by_invoker_type.go @@ -0,0 +1,276 @@ +// Unless explicitly stated otherwise all files in this repository 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" +) + +// AggregatedLongTasksByInvokerType Aggregated long task statistics for a single invoker type. +type AggregatedLongTasksByInvokerType struct { + // Number of sampled views where this invoker type had long tasks contributing to the criteria metric. + CriteriaViewOccurrences *int32 `json:"criteria_view_occurrences,omitempty"` + // Rank-product impact score combining view frequency and blocking time severity. + ImpactScore *float64 `json:"impact_score,omitempty"` + // Category of the long task invoker (for example, resolve-promise, user-callback). + InvokerType string `json:"invoker_type"` + // Statistical distributions of long task metrics computed per view across sampled views. + StatsPerView LongTaskStatsPerView `json:"stats_per_view"` + // Top invokers within this invoker type, sorted by impact score descending. + TopInvokers []TopLongTaskInvoker `json:"top_invokers"` + // Number of sampled views where this invoker type had any long tasks. + ViewOccurrences int32 `json:"view_occurrences"` + // 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:"-"` +} + +// NewAggregatedLongTasksByInvokerType instantiates a new AggregatedLongTasksByInvokerType 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 NewAggregatedLongTasksByInvokerType(invokerType string, statsPerView LongTaskStatsPerView, topInvokers []TopLongTaskInvoker, viewOccurrences int32) *AggregatedLongTasksByInvokerType { + this := AggregatedLongTasksByInvokerType{} + this.InvokerType = invokerType + this.StatsPerView = statsPerView + this.TopInvokers = topInvokers + this.ViewOccurrences = viewOccurrences + return &this +} + +// NewAggregatedLongTasksByInvokerTypeWithDefaults instantiates a new AggregatedLongTasksByInvokerType 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 NewAggregatedLongTasksByInvokerTypeWithDefaults() *AggregatedLongTasksByInvokerType { + this := AggregatedLongTasksByInvokerType{} + return &this +} + +// GetCriteriaViewOccurrences returns the CriteriaViewOccurrences field value if set, zero value otherwise. +func (o *AggregatedLongTasksByInvokerType) GetCriteriaViewOccurrences() int32 { + if o == nil || o.CriteriaViewOccurrences == nil { + var ret int32 + return ret + } + return *o.CriteriaViewOccurrences +} + +// GetCriteriaViewOccurrencesOk returns a tuple with the CriteriaViewOccurrences field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AggregatedLongTasksByInvokerType) GetCriteriaViewOccurrencesOk() (*int32, bool) { + if o == nil || o.CriteriaViewOccurrences == nil { + return nil, false + } + return o.CriteriaViewOccurrences, true +} + +// HasCriteriaViewOccurrences returns a boolean if a field has been set. +func (o *AggregatedLongTasksByInvokerType) HasCriteriaViewOccurrences() bool { + return o != nil && o.CriteriaViewOccurrences != nil +} + +// SetCriteriaViewOccurrences gets a reference to the given int32 and assigns it to the CriteriaViewOccurrences field. +func (o *AggregatedLongTasksByInvokerType) SetCriteriaViewOccurrences(v int32) { + o.CriteriaViewOccurrences = &v +} + +// GetImpactScore returns the ImpactScore field value if set, zero value otherwise. +func (o *AggregatedLongTasksByInvokerType) GetImpactScore() float64 { + if o == nil || o.ImpactScore == nil { + var ret float64 + return ret + } + return *o.ImpactScore +} + +// GetImpactScoreOk returns a tuple with the ImpactScore field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AggregatedLongTasksByInvokerType) GetImpactScoreOk() (*float64, bool) { + if o == nil || o.ImpactScore == nil { + return nil, false + } + return o.ImpactScore, true +} + +// HasImpactScore returns a boolean if a field has been set. +func (o *AggregatedLongTasksByInvokerType) HasImpactScore() bool { + return o != nil && o.ImpactScore != nil +} + +// SetImpactScore gets a reference to the given float64 and assigns it to the ImpactScore field. +func (o *AggregatedLongTasksByInvokerType) SetImpactScore(v float64) { + o.ImpactScore = &v +} + +// GetInvokerType returns the InvokerType field value. +func (o *AggregatedLongTasksByInvokerType) GetInvokerType() string { + if o == nil { + var ret string + return ret + } + return o.InvokerType +} + +// GetInvokerTypeOk returns a tuple with the InvokerType field value +// and a boolean to check if the value has been set. +func (o *AggregatedLongTasksByInvokerType) GetInvokerTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.InvokerType, true +} + +// SetInvokerType sets field value. +func (o *AggregatedLongTasksByInvokerType) SetInvokerType(v string) { + o.InvokerType = v +} + +// GetStatsPerView returns the StatsPerView field value. +func (o *AggregatedLongTasksByInvokerType) GetStatsPerView() LongTaskStatsPerView { + if o == nil { + var ret LongTaskStatsPerView + return ret + } + return o.StatsPerView +} + +// GetStatsPerViewOk returns a tuple with the StatsPerView field value +// and a boolean to check if the value has been set. +func (o *AggregatedLongTasksByInvokerType) GetStatsPerViewOk() (*LongTaskStatsPerView, bool) { + if o == nil { + return nil, false + } + return &o.StatsPerView, true +} + +// SetStatsPerView sets field value. +func (o *AggregatedLongTasksByInvokerType) SetStatsPerView(v LongTaskStatsPerView) { + o.StatsPerView = v +} + +// GetTopInvokers returns the TopInvokers field value. +func (o *AggregatedLongTasksByInvokerType) GetTopInvokers() []TopLongTaskInvoker { + if o == nil { + var ret []TopLongTaskInvoker + return ret + } + return o.TopInvokers +} + +// GetTopInvokersOk returns a tuple with the TopInvokers field value +// and a boolean to check if the value has been set. +func (o *AggregatedLongTasksByInvokerType) GetTopInvokersOk() (*[]TopLongTaskInvoker, bool) { + if o == nil { + return nil, false + } + return &o.TopInvokers, true +} + +// SetTopInvokers sets field value. +func (o *AggregatedLongTasksByInvokerType) SetTopInvokers(v []TopLongTaskInvoker) { + o.TopInvokers = v +} + +// GetViewOccurrences returns the ViewOccurrences field value. +func (o *AggregatedLongTasksByInvokerType) GetViewOccurrences() int32 { + if o == nil { + var ret int32 + return ret + } + return o.ViewOccurrences +} + +// GetViewOccurrencesOk returns a tuple with the ViewOccurrences field value +// and a boolean to check if the value has been set. +func (o *AggregatedLongTasksByInvokerType) GetViewOccurrencesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.ViewOccurrences, true +} + +// SetViewOccurrences sets field value. +func (o *AggregatedLongTasksByInvokerType) SetViewOccurrences(v int32) { + o.ViewOccurrences = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedLongTasksByInvokerType) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CriteriaViewOccurrences != nil { + toSerialize["criteria_view_occurrences"] = o.CriteriaViewOccurrences + } + if o.ImpactScore != nil { + toSerialize["impact_score"] = o.ImpactScore + } + toSerialize["invoker_type"] = o.InvokerType + toSerialize["stats_per_view"] = o.StatsPerView + toSerialize["top_invokers"] = o.TopInvokers + toSerialize["view_occurrences"] = o.ViewOccurrences + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AggregatedLongTasksByInvokerType) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CriteriaViewOccurrences *int32 `json:"criteria_view_occurrences,omitempty"` + ImpactScore *float64 `json:"impact_score,omitempty"` + InvokerType *string `json:"invoker_type"` + StatsPerView *LongTaskStatsPerView `json:"stats_per_view"` + TopInvokers *[]TopLongTaskInvoker `json:"top_invokers"` + ViewOccurrences *int32 `json:"view_occurrences"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.InvokerType == nil { + return fmt.Errorf("required field invoker_type missing") + } + if all.StatsPerView == nil { + return fmt.Errorf("required field stats_per_view missing") + } + if all.TopInvokers == nil { + return fmt.Errorf("required field top_invokers missing") + } + if all.ViewOccurrences == nil { + return fmt.Errorf("required field view_occurrences missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"criteria_view_occurrences", "impact_score", "invoker_type", "stats_per_view", "top_invokers", "view_occurrences"}) + } else { + return err + } + + hasInvalidField := false + o.CriteriaViewOccurrences = all.CriteriaViewOccurrences + o.ImpactScore = all.ImpactScore + o.InvokerType = *all.InvokerType + if all.StatsPerView.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.StatsPerView = *all.StatsPerView + o.TopInvokers = *all.TopInvokers + o.ViewOccurrences = *all.ViewOccurrences + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_aggregated_long_tasks_request.go b/api/datadogV2/model_aggregated_long_tasks_request.go new file mode 100644 index 00000000000..1cfb96e77f9 --- /dev/null +++ b/api/datadogV2/model_aggregated_long_tasks_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" +) + +// AggregatedLongTasksRequest Request body for the aggregated long tasks endpoint. +type AggregatedLongTasksRequest struct { + // Data envelope for an aggregated long tasks request. + Data AggregatedLongTasksRequestData `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:"-"` +} + +// NewAggregatedLongTasksRequest instantiates a new AggregatedLongTasksRequest 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 NewAggregatedLongTasksRequest(data AggregatedLongTasksRequestData) *AggregatedLongTasksRequest { + this := AggregatedLongTasksRequest{} + this.Data = data + return &this +} + +// NewAggregatedLongTasksRequestWithDefaults instantiates a new AggregatedLongTasksRequest 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 NewAggregatedLongTasksRequestWithDefaults() *AggregatedLongTasksRequest { + this := AggregatedLongTasksRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *AggregatedLongTasksRequest) GetData() AggregatedLongTasksRequestData { + if o == nil { + var ret AggregatedLongTasksRequestData + 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 *AggregatedLongTasksRequest) GetDataOk() (*AggregatedLongTasksRequestData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *AggregatedLongTasksRequest) SetData(v AggregatedLongTasksRequestData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedLongTasksRequest) 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 *AggregatedLongTasksRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *AggregatedLongTasksRequestData `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_aggregated_long_tasks_request_attributes.go b/api/datadogV2/model_aggregated_long_tasks_request_attributes.go new file mode 100644 index 00000000000..ee6276aeb22 --- /dev/null +++ b/api/datadogV2/model_aggregated_long_tasks_request_attributes.go @@ -0,0 +1,308 @@ +// Unless explicitly stated otherwise all files in this repository 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" +) + +// AggregatedLongTasksRequestAttributes Attributes for an aggregated long tasks query. +type AggregatedLongTasksRequestAttributes struct { + // The RUM application ID to analyze. + ApplicationId string `json:"application_id"` + // Performance criteria to filter view instances by a metric threshold. + Criteria *AggregatedWaterfallPerformanceCriteria `json:"criteria,omitempty"` + // RUM query string to filter events (for example, @session.type:user @geo.country:US). + Filter *string `json:"filter,omitempty"` + // Start of the time range as a Unix timestamp in seconds. + From int64 `json:"from"` + // Number of view instances to sample, between 1 and 500. + SampleSize int32 `json:"sample_size"` + // End of the time range as a Unix timestamp in seconds. + To int64 `json:"to"` + // The RUM view name to analyze (for example, /account/login). + ViewName string `json:"view_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:"-"` +} + +// NewAggregatedLongTasksRequestAttributes instantiates a new AggregatedLongTasksRequestAttributes 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 NewAggregatedLongTasksRequestAttributes(applicationId string, from int64, sampleSize int32, to int64, viewName string) *AggregatedLongTasksRequestAttributes { + this := AggregatedLongTasksRequestAttributes{} + this.ApplicationId = applicationId + this.From = from + this.SampleSize = sampleSize + this.To = to + this.ViewName = viewName + return &this +} + +// NewAggregatedLongTasksRequestAttributesWithDefaults instantiates a new AggregatedLongTasksRequestAttributes 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 NewAggregatedLongTasksRequestAttributesWithDefaults() *AggregatedLongTasksRequestAttributes { + this := AggregatedLongTasksRequestAttributes{} + return &this +} + +// GetApplicationId returns the ApplicationId field value. +func (o *AggregatedLongTasksRequestAttributes) GetApplicationId() string { + if o == nil { + var ret string + return ret + } + return o.ApplicationId +} + +// GetApplicationIdOk returns a tuple with the ApplicationId field value +// and a boolean to check if the value has been set. +func (o *AggregatedLongTasksRequestAttributes) GetApplicationIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ApplicationId, true +} + +// SetApplicationId sets field value. +func (o *AggregatedLongTasksRequestAttributes) SetApplicationId(v string) { + o.ApplicationId = v +} + +// GetCriteria returns the Criteria field value if set, zero value otherwise. +func (o *AggregatedLongTasksRequestAttributes) GetCriteria() AggregatedWaterfallPerformanceCriteria { + if o == nil || o.Criteria == nil { + var ret AggregatedWaterfallPerformanceCriteria + return ret + } + return *o.Criteria +} + +// GetCriteriaOk returns a tuple with the Criteria field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AggregatedLongTasksRequestAttributes) GetCriteriaOk() (*AggregatedWaterfallPerformanceCriteria, bool) { + if o == nil || o.Criteria == nil { + return nil, false + } + return o.Criteria, true +} + +// HasCriteria returns a boolean if a field has been set. +func (o *AggregatedLongTasksRequestAttributes) HasCriteria() bool { + return o != nil && o.Criteria != nil +} + +// SetCriteria gets a reference to the given AggregatedWaterfallPerformanceCriteria and assigns it to the Criteria field. +func (o *AggregatedLongTasksRequestAttributes) SetCriteria(v AggregatedWaterfallPerformanceCriteria) { + o.Criteria = &v +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *AggregatedLongTasksRequestAttributes) GetFilter() string { + if o == nil || o.Filter == nil { + var ret string + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AggregatedLongTasksRequestAttributes) GetFilterOk() (*string, bool) { + if o == nil || o.Filter == nil { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *AggregatedLongTasksRequestAttributes) HasFilter() bool { + return o != nil && o.Filter != nil +} + +// SetFilter gets a reference to the given string and assigns it to the Filter field. +func (o *AggregatedLongTasksRequestAttributes) SetFilter(v string) { + o.Filter = &v +} + +// GetFrom returns the From field value. +func (o *AggregatedLongTasksRequestAttributes) GetFrom() int64 { + if o == nil { + var ret int64 + return ret + } + return o.From +} + +// GetFromOk returns a tuple with the From field value +// and a boolean to check if the value has been set. +func (o *AggregatedLongTasksRequestAttributes) GetFromOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.From, true +} + +// SetFrom sets field value. +func (o *AggregatedLongTasksRequestAttributes) SetFrom(v int64) { + o.From = v +} + +// GetSampleSize returns the SampleSize field value. +func (o *AggregatedLongTasksRequestAttributes) GetSampleSize() int32 { + if o == nil { + var ret int32 + return ret + } + return o.SampleSize +} + +// GetSampleSizeOk returns a tuple with the SampleSize field value +// and a boolean to check if the value has been set. +func (o *AggregatedLongTasksRequestAttributes) GetSampleSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.SampleSize, true +} + +// SetSampleSize sets field value. +func (o *AggregatedLongTasksRequestAttributes) SetSampleSize(v int32) { + o.SampleSize = v +} + +// GetTo returns the To field value. +func (o *AggregatedLongTasksRequestAttributes) GetTo() int64 { + if o == nil { + var ret int64 + return ret + } + return o.To +} + +// GetToOk returns a tuple with the To field value +// and a boolean to check if the value has been set. +func (o *AggregatedLongTasksRequestAttributes) GetToOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.To, true +} + +// SetTo sets field value. +func (o *AggregatedLongTasksRequestAttributes) SetTo(v int64) { + o.To = v +} + +// GetViewName returns the ViewName field value. +func (o *AggregatedLongTasksRequestAttributes) GetViewName() string { + if o == nil { + var ret string + return ret + } + return o.ViewName +} + +// GetViewNameOk returns a tuple with the ViewName field value +// and a boolean to check if the value has been set. +func (o *AggregatedLongTasksRequestAttributes) GetViewNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ViewName, true +} + +// SetViewName sets field value. +func (o *AggregatedLongTasksRequestAttributes) SetViewName(v string) { + o.ViewName = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedLongTasksRequestAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["application_id"] = o.ApplicationId + if o.Criteria != nil { + toSerialize["criteria"] = o.Criteria + } + if o.Filter != nil { + toSerialize["filter"] = o.Filter + } + toSerialize["from"] = o.From + toSerialize["sample_size"] = o.SampleSize + toSerialize["to"] = o.To + toSerialize["view_name"] = o.ViewName + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AggregatedLongTasksRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ApplicationId *string `json:"application_id"` + Criteria *AggregatedWaterfallPerformanceCriteria `json:"criteria,omitempty"` + Filter *string `json:"filter,omitempty"` + From *int64 `json:"from"` + SampleSize *int32 `json:"sample_size"` + To *int64 `json:"to"` + ViewName *string `json:"view_name"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.ApplicationId == nil { + return fmt.Errorf("required field application_id missing") + } + if all.From == nil { + return fmt.Errorf("required field from missing") + } + if all.SampleSize == nil { + return fmt.Errorf("required field sample_size missing") + } + if all.To == nil { + return fmt.Errorf("required field to missing") + } + if all.ViewName == nil { + return fmt.Errorf("required field view_name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"application_id", "criteria", "filter", "from", "sample_size", "to", "view_name"}) + } else { + return err + } + + hasInvalidField := false + o.ApplicationId = *all.ApplicationId + if all.Criteria != nil && all.Criteria.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Criteria = all.Criteria + o.Filter = all.Filter + o.From = *all.From + o.SampleSize = *all.SampleSize + o.To = *all.To + o.ViewName = *all.ViewName + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_aggregated_long_tasks_request_data.go b/api/datadogV2/model_aggregated_long_tasks_request_data.go new file mode 100644 index 00000000000..5471c58e282 --- /dev/null +++ b/api/datadogV2/model_aggregated_long_tasks_request_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" +) + +// AggregatedLongTasksRequestData Data envelope for an aggregated long tasks request. +type AggregatedLongTasksRequestData struct { + // Attributes for an aggregated long tasks query. + Attributes AggregatedLongTasksRequestAttributes `json:"attributes"` + // The JSON:API type for aggregated long tasks requests. + Type AggregatedLongTasksRequestType `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:"-"` +} + +// NewAggregatedLongTasksRequestData instantiates a new AggregatedLongTasksRequestData 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 NewAggregatedLongTasksRequestData(attributes AggregatedLongTasksRequestAttributes, typeVar AggregatedLongTasksRequestType) *AggregatedLongTasksRequestData { + this := AggregatedLongTasksRequestData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewAggregatedLongTasksRequestDataWithDefaults instantiates a new AggregatedLongTasksRequestData 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 NewAggregatedLongTasksRequestDataWithDefaults() *AggregatedLongTasksRequestData { + this := AggregatedLongTasksRequestData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *AggregatedLongTasksRequestData) GetAttributes() AggregatedLongTasksRequestAttributes { + if o == nil { + var ret AggregatedLongTasksRequestAttributes + 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 *AggregatedLongTasksRequestData) GetAttributesOk() (*AggregatedLongTasksRequestAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *AggregatedLongTasksRequestData) SetAttributes(v AggregatedLongTasksRequestAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *AggregatedLongTasksRequestData) GetType() AggregatedLongTasksRequestType { + if o == nil { + var ret AggregatedLongTasksRequestType + 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 *AggregatedLongTasksRequestData) GetTypeOk() (*AggregatedLongTasksRequestType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AggregatedLongTasksRequestData) SetType(v AggregatedLongTasksRequestType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedLongTasksRequestData) 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 *AggregatedLongTasksRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AggregatedLongTasksRequestAttributes `json:"attributes"` + Type *AggregatedLongTasksRequestType `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_aggregated_long_tasks_request_type.go b/api/datadogV2/model_aggregated_long_tasks_request_type.go new file mode 100644 index 00000000000..7426b533034 --- /dev/null +++ b/api/datadogV2/model_aggregated_long_tasks_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" +) + +// AggregatedLongTasksRequestType The JSON:API type for aggregated long tasks requests. +type AggregatedLongTasksRequestType string + +// List of AggregatedLongTasksRequestType. +const ( + AGGREGATEDLONGTASKSREQUESTTYPE_AggregatedLongTasks AggregatedLongTasksRequestType = "aggregated_long_tasks" +) + +var allowedAggregatedLongTasksRequestTypeEnumValues = []AggregatedLongTasksRequestType{ + AGGREGATEDLONGTASKSREQUESTTYPE_AggregatedLongTasks, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *AggregatedLongTasksRequestType) GetAllowedValues() []AggregatedLongTasksRequestType { + return allowedAggregatedLongTasksRequestTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *AggregatedLongTasksRequestType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = AggregatedLongTasksRequestType(value) + return nil +} + +// NewAggregatedLongTasksRequestTypeFromValue returns a pointer to a valid AggregatedLongTasksRequestType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewAggregatedLongTasksRequestTypeFromValue(v string) (*AggregatedLongTasksRequestType, error) { + ev := AggregatedLongTasksRequestType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for AggregatedLongTasksRequestType: valid values are %v", v, allowedAggregatedLongTasksRequestTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v AggregatedLongTasksRequestType) IsValid() bool { + for _, existing := range allowedAggregatedLongTasksRequestTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AggregatedLongTasksRequestType value. +func (v AggregatedLongTasksRequestType) Ptr() *AggregatedLongTasksRequestType { + return &v +} diff --git a/api/datadogV2/model_aggregated_long_tasks_response.go b/api/datadogV2/model_aggregated_long_tasks_response.go new file mode 100644 index 00000000000..c67597b1f11 --- /dev/null +++ b/api/datadogV2/model_aggregated_long_tasks_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" +) + +// AggregatedLongTasksResponse Response body for the aggregated long tasks endpoint. +type AggregatedLongTasksResponse struct { + // Data envelope for an aggregated long tasks response. + Data AggregatedLongTasksResponseData `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:"-"` +} + +// NewAggregatedLongTasksResponse instantiates a new AggregatedLongTasksResponse 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 NewAggregatedLongTasksResponse(data AggregatedLongTasksResponseData) *AggregatedLongTasksResponse { + this := AggregatedLongTasksResponse{} + this.Data = data + return &this +} + +// NewAggregatedLongTasksResponseWithDefaults instantiates a new AggregatedLongTasksResponse 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 NewAggregatedLongTasksResponseWithDefaults() *AggregatedLongTasksResponse { + this := AggregatedLongTasksResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *AggregatedLongTasksResponse) GetData() AggregatedLongTasksResponseData { + if o == nil { + var ret AggregatedLongTasksResponseData + 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 *AggregatedLongTasksResponse) GetDataOk() (*AggregatedLongTasksResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *AggregatedLongTasksResponse) SetData(v AggregatedLongTasksResponseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedLongTasksResponse) 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 *AggregatedLongTasksResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *AggregatedLongTasksResponseData `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_aggregated_long_tasks_response_attributes.go b/api/datadogV2/model_aggregated_long_tasks_response_attributes.go new file mode 100644 index 00000000000..c0612697c00 --- /dev/null +++ b/api/datadogV2/model_aggregated_long_tasks_response_attributes.go @@ -0,0 +1,337 @@ +// Unless explicitly stated otherwise all files in this repository 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" +) + +// AggregatedLongTasksResponseAttributes Attributes of an aggregated long tasks response. +type AggregatedLongTasksResponseAttributes struct { + // The RUM application ID that was analyzed. + ApplicationId string `json:"application_id"` + // Performance criteria to filter view instances by a metric threshold. + Criteria *AggregatedWaterfallPerformanceCriteria `json:"criteria,omitempty"` + // Start of the analyzed time range as a Unix timestamp in seconds. + From int64 `json:"from"` + // Long task statistics grouped by invoker type, sorted by impact score descending. + LongTasksByInvokerType []AggregatedLongTasksByInvokerType `json:"long_tasks_by_invoker_type"` + // List of RUM view IDs sampled for this aggregation, capped at 50. + SampledViewIds []string `json:"sampled_view_ids"` + // End of the analyzed time range as a Unix timestamp in seconds. + To int64 `json:"to"` + // Number of view instances included in the analysis. + ViewCount int32 `json:"view_count"` + // The RUM view name that was analyzed. + ViewName string `json:"view_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:"-"` +} + +// NewAggregatedLongTasksResponseAttributes instantiates a new AggregatedLongTasksResponseAttributes 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 NewAggregatedLongTasksResponseAttributes(applicationId string, from int64, longTasksByInvokerType []AggregatedLongTasksByInvokerType, sampledViewIds []string, to int64, viewCount int32, viewName string) *AggregatedLongTasksResponseAttributes { + this := AggregatedLongTasksResponseAttributes{} + this.ApplicationId = applicationId + this.From = from + this.LongTasksByInvokerType = longTasksByInvokerType + this.SampledViewIds = sampledViewIds + this.To = to + this.ViewCount = viewCount + this.ViewName = viewName + return &this +} + +// NewAggregatedLongTasksResponseAttributesWithDefaults instantiates a new AggregatedLongTasksResponseAttributes 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 NewAggregatedLongTasksResponseAttributesWithDefaults() *AggregatedLongTasksResponseAttributes { + this := AggregatedLongTasksResponseAttributes{} + return &this +} + +// GetApplicationId returns the ApplicationId field value. +func (o *AggregatedLongTasksResponseAttributes) GetApplicationId() string { + if o == nil { + var ret string + return ret + } + return o.ApplicationId +} + +// GetApplicationIdOk returns a tuple with the ApplicationId field value +// and a boolean to check if the value has been set. +func (o *AggregatedLongTasksResponseAttributes) GetApplicationIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ApplicationId, true +} + +// SetApplicationId sets field value. +func (o *AggregatedLongTasksResponseAttributes) SetApplicationId(v string) { + o.ApplicationId = v +} + +// GetCriteria returns the Criteria field value if set, zero value otherwise. +func (o *AggregatedLongTasksResponseAttributes) GetCriteria() AggregatedWaterfallPerformanceCriteria { + if o == nil || o.Criteria == nil { + var ret AggregatedWaterfallPerformanceCriteria + return ret + } + return *o.Criteria +} + +// GetCriteriaOk returns a tuple with the Criteria field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AggregatedLongTasksResponseAttributes) GetCriteriaOk() (*AggregatedWaterfallPerformanceCriteria, bool) { + if o == nil || o.Criteria == nil { + return nil, false + } + return o.Criteria, true +} + +// HasCriteria returns a boolean if a field has been set. +func (o *AggregatedLongTasksResponseAttributes) HasCriteria() bool { + return o != nil && o.Criteria != nil +} + +// SetCriteria gets a reference to the given AggregatedWaterfallPerformanceCriteria and assigns it to the Criteria field. +func (o *AggregatedLongTasksResponseAttributes) SetCriteria(v AggregatedWaterfallPerformanceCriteria) { + o.Criteria = &v +} + +// GetFrom returns the From field value. +func (o *AggregatedLongTasksResponseAttributes) GetFrom() int64 { + if o == nil { + var ret int64 + return ret + } + return o.From +} + +// GetFromOk returns a tuple with the From field value +// and a boolean to check if the value has been set. +func (o *AggregatedLongTasksResponseAttributes) GetFromOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.From, true +} + +// SetFrom sets field value. +func (o *AggregatedLongTasksResponseAttributes) SetFrom(v int64) { + o.From = v +} + +// GetLongTasksByInvokerType returns the LongTasksByInvokerType field value. +func (o *AggregatedLongTasksResponseAttributes) GetLongTasksByInvokerType() []AggregatedLongTasksByInvokerType { + if o == nil { + var ret []AggregatedLongTasksByInvokerType + return ret + } + return o.LongTasksByInvokerType +} + +// GetLongTasksByInvokerTypeOk returns a tuple with the LongTasksByInvokerType field value +// and a boolean to check if the value has been set. +func (o *AggregatedLongTasksResponseAttributes) GetLongTasksByInvokerTypeOk() (*[]AggregatedLongTasksByInvokerType, bool) { + if o == nil { + return nil, false + } + return &o.LongTasksByInvokerType, true +} + +// SetLongTasksByInvokerType sets field value. +func (o *AggregatedLongTasksResponseAttributes) SetLongTasksByInvokerType(v []AggregatedLongTasksByInvokerType) { + o.LongTasksByInvokerType = v +} + +// GetSampledViewIds returns the SampledViewIds field value. +func (o *AggregatedLongTasksResponseAttributes) GetSampledViewIds() []string { + if o == nil { + var ret []string + return ret + } + return o.SampledViewIds +} + +// GetSampledViewIdsOk returns a tuple with the SampledViewIds field value +// and a boolean to check if the value has been set. +func (o *AggregatedLongTasksResponseAttributes) GetSampledViewIdsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.SampledViewIds, true +} + +// SetSampledViewIds sets field value. +func (o *AggregatedLongTasksResponseAttributes) SetSampledViewIds(v []string) { + o.SampledViewIds = v +} + +// GetTo returns the To field value. +func (o *AggregatedLongTasksResponseAttributes) GetTo() int64 { + if o == nil { + var ret int64 + return ret + } + return o.To +} + +// GetToOk returns a tuple with the To field value +// and a boolean to check if the value has been set. +func (o *AggregatedLongTasksResponseAttributes) GetToOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.To, true +} + +// SetTo sets field value. +func (o *AggregatedLongTasksResponseAttributes) SetTo(v int64) { + o.To = v +} + +// GetViewCount returns the ViewCount field value. +func (o *AggregatedLongTasksResponseAttributes) GetViewCount() int32 { + if o == nil { + var ret int32 + return ret + } + return o.ViewCount +} + +// GetViewCountOk returns a tuple with the ViewCount field value +// and a boolean to check if the value has been set. +func (o *AggregatedLongTasksResponseAttributes) GetViewCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.ViewCount, true +} + +// SetViewCount sets field value. +func (o *AggregatedLongTasksResponseAttributes) SetViewCount(v int32) { + o.ViewCount = v +} + +// GetViewName returns the ViewName field value. +func (o *AggregatedLongTasksResponseAttributes) GetViewName() string { + if o == nil { + var ret string + return ret + } + return o.ViewName +} + +// GetViewNameOk returns a tuple with the ViewName field value +// and a boolean to check if the value has been set. +func (o *AggregatedLongTasksResponseAttributes) GetViewNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ViewName, true +} + +// SetViewName sets field value. +func (o *AggregatedLongTasksResponseAttributes) SetViewName(v string) { + o.ViewName = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedLongTasksResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["application_id"] = o.ApplicationId + if o.Criteria != nil { + toSerialize["criteria"] = o.Criteria + } + toSerialize["from"] = o.From + toSerialize["long_tasks_by_invoker_type"] = o.LongTasksByInvokerType + toSerialize["sampled_view_ids"] = o.SampledViewIds + toSerialize["to"] = o.To + toSerialize["view_count"] = o.ViewCount + toSerialize["view_name"] = o.ViewName + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AggregatedLongTasksResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ApplicationId *string `json:"application_id"` + Criteria *AggregatedWaterfallPerformanceCriteria `json:"criteria,omitempty"` + From *int64 `json:"from"` + LongTasksByInvokerType *[]AggregatedLongTasksByInvokerType `json:"long_tasks_by_invoker_type"` + SampledViewIds *[]string `json:"sampled_view_ids"` + To *int64 `json:"to"` + ViewCount *int32 `json:"view_count"` + ViewName *string `json:"view_name"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.ApplicationId == nil { + return fmt.Errorf("required field application_id missing") + } + if all.From == nil { + return fmt.Errorf("required field from missing") + } + if all.LongTasksByInvokerType == nil { + return fmt.Errorf("required field long_tasks_by_invoker_type missing") + } + if all.SampledViewIds == nil { + return fmt.Errorf("required field sampled_view_ids missing") + } + if all.To == nil { + return fmt.Errorf("required field to missing") + } + if all.ViewCount == nil { + return fmt.Errorf("required field view_count missing") + } + if all.ViewName == nil { + return fmt.Errorf("required field view_name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"application_id", "criteria", "from", "long_tasks_by_invoker_type", "sampled_view_ids", "to", "view_count", "view_name"}) + } else { + return err + } + + hasInvalidField := false + o.ApplicationId = *all.ApplicationId + if all.Criteria != nil && all.Criteria.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Criteria = all.Criteria + o.From = *all.From + o.LongTasksByInvokerType = *all.LongTasksByInvokerType + o.SampledViewIds = *all.SampledViewIds + o.To = *all.To + o.ViewCount = *all.ViewCount + o.ViewName = *all.ViewName + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_aggregated_long_tasks_response_data.go b/api/datadogV2/model_aggregated_long_tasks_response_data.go new file mode 100644 index 00000000000..eef182e9abf --- /dev/null +++ b/api/datadogV2/model_aggregated_long_tasks_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" +) + +// AggregatedLongTasksResponseData Data envelope for an aggregated long tasks response. +type AggregatedLongTasksResponseData struct { + // Attributes of an aggregated long tasks response. + Attributes AggregatedLongTasksResponseAttributes `json:"attributes"` + // Hash-based unique identifier for this aggregation. + Id string `json:"id"` + // The JSON:API type for aggregated long tasks requests. + Type AggregatedLongTasksRequestType `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:"-"` +} + +// NewAggregatedLongTasksResponseData instantiates a new AggregatedLongTasksResponseData 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 NewAggregatedLongTasksResponseData(attributes AggregatedLongTasksResponseAttributes, id string, typeVar AggregatedLongTasksRequestType) *AggregatedLongTasksResponseData { + this := AggregatedLongTasksResponseData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewAggregatedLongTasksResponseDataWithDefaults instantiates a new AggregatedLongTasksResponseData 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 NewAggregatedLongTasksResponseDataWithDefaults() *AggregatedLongTasksResponseData { + this := AggregatedLongTasksResponseData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *AggregatedLongTasksResponseData) GetAttributes() AggregatedLongTasksResponseAttributes { + if o == nil { + var ret AggregatedLongTasksResponseAttributes + 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 *AggregatedLongTasksResponseData) GetAttributesOk() (*AggregatedLongTasksResponseAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *AggregatedLongTasksResponseData) SetAttributes(v AggregatedLongTasksResponseAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *AggregatedLongTasksResponseData) 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 *AggregatedLongTasksResponseData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *AggregatedLongTasksResponseData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *AggregatedLongTasksResponseData) GetType() AggregatedLongTasksRequestType { + if o == nil { + var ret AggregatedLongTasksRequestType + 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 *AggregatedLongTasksResponseData) GetTypeOk() (*AggregatedLongTasksRequestType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AggregatedLongTasksResponseData) SetType(v AggregatedLongTasksRequestType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedLongTasksResponseData) 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 *AggregatedLongTasksResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AggregatedLongTasksResponseAttributes `json:"attributes"` + Id *string `json:"id"` + Type *AggregatedLongTasksRequestType `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_aggregated_low_cache_hit_rate.go b/api/datadogV2/model_aggregated_low_cache_hit_rate.go new file mode 100644 index 00000000000..0845090c82e --- /dev/null +++ b/api/datadogV2/model_aggregated_low_cache_hit_rate.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" +) + +// AggregatedLowCacheHitRate Aggregated low cache hit rate detection at view level. +type AggregatedLowCacheHitRate struct { + // Average cache hit rate across affected views. + AvgCacheHitRate float64 `json:"avg_cache_hit_rate"` + // Average total download size of uncached resources in bytes. + AvgResourceDownloadSizeBytes int64 `json:"avg_resource_download_size_bytes"` + // Unique fingerprint identifying this detection group. + Fingerprint string `json:"fingerprint"` + // Impact score for this detection. + ImpactScore float64 `json:"impact_score"` + // Number of sampled views where this detection occurred. + ViewOccurrences int32 `json:"view_occurrences"` + // 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:"-"` +} + +// NewAggregatedLowCacheHitRate instantiates a new AggregatedLowCacheHitRate 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 NewAggregatedLowCacheHitRate(avgCacheHitRate float64, avgResourceDownloadSizeBytes int64, fingerprint string, impactScore float64, viewOccurrences int32) *AggregatedLowCacheHitRate { + this := AggregatedLowCacheHitRate{} + this.AvgCacheHitRate = avgCacheHitRate + this.AvgResourceDownloadSizeBytes = avgResourceDownloadSizeBytes + this.Fingerprint = fingerprint + this.ImpactScore = impactScore + this.ViewOccurrences = viewOccurrences + return &this +} + +// NewAggregatedLowCacheHitRateWithDefaults instantiates a new AggregatedLowCacheHitRate 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 NewAggregatedLowCacheHitRateWithDefaults() *AggregatedLowCacheHitRate { + this := AggregatedLowCacheHitRate{} + return &this +} + +// GetAvgCacheHitRate returns the AvgCacheHitRate field value. +func (o *AggregatedLowCacheHitRate) GetAvgCacheHitRate() float64 { + if o == nil { + var ret float64 + return ret + } + return o.AvgCacheHitRate +} + +// GetAvgCacheHitRateOk returns a tuple with the AvgCacheHitRate field value +// and a boolean to check if the value has been set. +func (o *AggregatedLowCacheHitRate) GetAvgCacheHitRateOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.AvgCacheHitRate, true +} + +// SetAvgCacheHitRate sets field value. +func (o *AggregatedLowCacheHitRate) SetAvgCacheHitRate(v float64) { + o.AvgCacheHitRate = v +} + +// GetAvgResourceDownloadSizeBytes returns the AvgResourceDownloadSizeBytes field value. +func (o *AggregatedLowCacheHitRate) GetAvgResourceDownloadSizeBytes() int64 { + if o == nil { + var ret int64 + return ret + } + return o.AvgResourceDownloadSizeBytes +} + +// GetAvgResourceDownloadSizeBytesOk returns a tuple with the AvgResourceDownloadSizeBytes field value +// and a boolean to check if the value has been set. +func (o *AggregatedLowCacheHitRate) GetAvgResourceDownloadSizeBytesOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.AvgResourceDownloadSizeBytes, true +} + +// SetAvgResourceDownloadSizeBytes sets field value. +func (o *AggregatedLowCacheHitRate) SetAvgResourceDownloadSizeBytes(v int64) { + o.AvgResourceDownloadSizeBytes = v +} + +// GetFingerprint returns the Fingerprint field value. +func (o *AggregatedLowCacheHitRate) GetFingerprint() string { + if o == nil { + var ret string + return ret + } + return o.Fingerprint +} + +// GetFingerprintOk returns a tuple with the Fingerprint field value +// and a boolean to check if the value has been set. +func (o *AggregatedLowCacheHitRate) GetFingerprintOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Fingerprint, true +} + +// SetFingerprint sets field value. +func (o *AggregatedLowCacheHitRate) SetFingerprint(v string) { + o.Fingerprint = v +} + +// GetImpactScore returns the ImpactScore field value. +func (o *AggregatedLowCacheHitRate) GetImpactScore() float64 { + if o == nil { + var ret float64 + return ret + } + return o.ImpactScore +} + +// GetImpactScoreOk returns a tuple with the ImpactScore field value +// and a boolean to check if the value has been set. +func (o *AggregatedLowCacheHitRate) GetImpactScoreOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.ImpactScore, true +} + +// SetImpactScore sets field value. +func (o *AggregatedLowCacheHitRate) SetImpactScore(v float64) { + o.ImpactScore = v +} + +// GetViewOccurrences returns the ViewOccurrences field value. +func (o *AggregatedLowCacheHitRate) GetViewOccurrences() int32 { + if o == nil { + var ret int32 + return ret + } + return o.ViewOccurrences +} + +// GetViewOccurrencesOk returns a tuple with the ViewOccurrences field value +// and a boolean to check if the value has been set. +func (o *AggregatedLowCacheHitRate) GetViewOccurrencesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.ViewOccurrences, true +} + +// SetViewOccurrences sets field value. +func (o *AggregatedLowCacheHitRate) SetViewOccurrences(v int32) { + o.ViewOccurrences = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedLowCacheHitRate) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["avg_cache_hit_rate"] = o.AvgCacheHitRate + toSerialize["avg_resource_download_size_bytes"] = o.AvgResourceDownloadSizeBytes + toSerialize["fingerprint"] = o.Fingerprint + toSerialize["impact_score"] = o.ImpactScore + toSerialize["view_occurrences"] = o.ViewOccurrences + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AggregatedLowCacheHitRate) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AvgCacheHitRate *float64 `json:"avg_cache_hit_rate"` + AvgResourceDownloadSizeBytes *int64 `json:"avg_resource_download_size_bytes"` + Fingerprint *string `json:"fingerprint"` + ImpactScore *float64 `json:"impact_score"` + ViewOccurrences *int32 `json:"view_occurrences"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.AvgCacheHitRate == nil { + return fmt.Errorf("required field avg_cache_hit_rate missing") + } + if all.AvgResourceDownloadSizeBytes == nil { + return fmt.Errorf("required field avg_resource_download_size_bytes missing") + } + if all.Fingerprint == nil { + return fmt.Errorf("required field fingerprint missing") + } + if all.ImpactScore == nil { + return fmt.Errorf("required field impact_score missing") + } + if all.ViewOccurrences == nil { + return fmt.Errorf("required field view_occurrences missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"avg_cache_hit_rate", "avg_resource_download_size_bytes", "fingerprint", "impact_score", "view_occurrences"}) + } else { + return err + } + o.AvgCacheHitRate = *all.AvgCacheHitRate + o.AvgResourceDownloadSizeBytes = *all.AvgResourceDownloadSizeBytes + o.Fingerprint = *all.Fingerprint + o.ImpactScore = *all.ImpactScore + o.ViewOccurrences = *all.ViewOccurrences + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aggregated_mobile_scroll_friction.go b/api/datadogV2/model_aggregated_mobile_scroll_friction.go new file mode 100644 index 00000000000..8450df2f687 --- /dev/null +++ b/api/datadogV2/model_aggregated_mobile_scroll_friction.go @@ -0,0 +1,197 @@ +// Unless explicitly stated otherwise all files in this repository 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" +) + +// AggregatedMobileScrollFriction Aggregated mobile scroll friction detection at view level. +type AggregatedMobileScrollFriction struct { + // Average number of frozen frames during scroll interactions. + AvgScrollFrozenFrameCount int32 `json:"avg_scroll_frozen_frame_count"` + // Unique fingerprint identifying this detection group. + Fingerprint string `json:"fingerprint"` + // Impact score for this detection. + ImpactScore float64 `json:"impact_score"` + // Number of sampled views where this detection occurred. + ViewOccurrences int32 `json:"view_occurrences"` + // 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:"-"` +} + +// NewAggregatedMobileScrollFriction instantiates a new AggregatedMobileScrollFriction 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 NewAggregatedMobileScrollFriction(avgScrollFrozenFrameCount int32, fingerprint string, impactScore float64, viewOccurrences int32) *AggregatedMobileScrollFriction { + this := AggregatedMobileScrollFriction{} + this.AvgScrollFrozenFrameCount = avgScrollFrozenFrameCount + this.Fingerprint = fingerprint + this.ImpactScore = impactScore + this.ViewOccurrences = viewOccurrences + return &this +} + +// NewAggregatedMobileScrollFrictionWithDefaults instantiates a new AggregatedMobileScrollFriction 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 NewAggregatedMobileScrollFrictionWithDefaults() *AggregatedMobileScrollFriction { + this := AggregatedMobileScrollFriction{} + return &this +} + +// GetAvgScrollFrozenFrameCount returns the AvgScrollFrozenFrameCount field value. +func (o *AggregatedMobileScrollFriction) GetAvgScrollFrozenFrameCount() int32 { + if o == nil { + var ret int32 + return ret + } + return o.AvgScrollFrozenFrameCount +} + +// GetAvgScrollFrozenFrameCountOk returns a tuple with the AvgScrollFrozenFrameCount field value +// and a boolean to check if the value has been set. +func (o *AggregatedMobileScrollFriction) GetAvgScrollFrozenFrameCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.AvgScrollFrozenFrameCount, true +} + +// SetAvgScrollFrozenFrameCount sets field value. +func (o *AggregatedMobileScrollFriction) SetAvgScrollFrozenFrameCount(v int32) { + o.AvgScrollFrozenFrameCount = v +} + +// GetFingerprint returns the Fingerprint field value. +func (o *AggregatedMobileScrollFriction) GetFingerprint() string { + if o == nil { + var ret string + return ret + } + return o.Fingerprint +} + +// GetFingerprintOk returns a tuple with the Fingerprint field value +// and a boolean to check if the value has been set. +func (o *AggregatedMobileScrollFriction) GetFingerprintOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Fingerprint, true +} + +// SetFingerprint sets field value. +func (o *AggregatedMobileScrollFriction) SetFingerprint(v string) { + o.Fingerprint = v +} + +// GetImpactScore returns the ImpactScore field value. +func (o *AggregatedMobileScrollFriction) GetImpactScore() float64 { + if o == nil { + var ret float64 + return ret + } + return o.ImpactScore +} + +// GetImpactScoreOk returns a tuple with the ImpactScore field value +// and a boolean to check if the value has been set. +func (o *AggregatedMobileScrollFriction) GetImpactScoreOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.ImpactScore, true +} + +// SetImpactScore sets field value. +func (o *AggregatedMobileScrollFriction) SetImpactScore(v float64) { + o.ImpactScore = v +} + +// GetViewOccurrences returns the ViewOccurrences field value. +func (o *AggregatedMobileScrollFriction) GetViewOccurrences() int32 { + if o == nil { + var ret int32 + return ret + } + return o.ViewOccurrences +} + +// GetViewOccurrencesOk returns a tuple with the ViewOccurrences field value +// and a boolean to check if the value has been set. +func (o *AggregatedMobileScrollFriction) GetViewOccurrencesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.ViewOccurrences, true +} + +// SetViewOccurrences sets field value. +func (o *AggregatedMobileScrollFriction) SetViewOccurrences(v int32) { + o.ViewOccurrences = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedMobileScrollFriction) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["avg_scroll_frozen_frame_count"] = o.AvgScrollFrozenFrameCount + toSerialize["fingerprint"] = o.Fingerprint + toSerialize["impact_score"] = o.ImpactScore + toSerialize["view_occurrences"] = o.ViewOccurrences + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AggregatedMobileScrollFriction) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AvgScrollFrozenFrameCount *int32 `json:"avg_scroll_frozen_frame_count"` + Fingerprint *string `json:"fingerprint"` + ImpactScore *float64 `json:"impact_score"` + ViewOccurrences *int32 `json:"view_occurrences"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.AvgScrollFrozenFrameCount == nil { + return fmt.Errorf("required field avg_scroll_frozen_frame_count missing") + } + if all.Fingerprint == nil { + return fmt.Errorf("required field fingerprint missing") + } + if all.ImpactScore == nil { + return fmt.Errorf("required field impact_score missing") + } + if all.ViewOccurrences == nil { + return fmt.Errorf("required field view_occurrences missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"avg_scroll_frozen_frame_count", "fingerprint", "impact_score", "view_occurrences"}) + } else { + return err + } + o.AvgScrollFrozenFrameCount = *all.AvgScrollFrozenFrameCount + o.Fingerprint = *all.Fingerprint + o.ImpactScore = *all.ImpactScore + o.ViewOccurrences = *all.ViewOccurrences + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aggregated_resource.go b/api/datadogV2/model_aggregated_resource.go new file mode 100644 index 00000000000..2e98572df69 --- /dev/null +++ b/api/datadogV2/model_aggregated_resource.go @@ -0,0 +1,731 @@ +// Unless explicitly stated otherwise all files in this repository 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" +) + +// AggregatedResource Aggregated performance statistics for a single network resource across sampled view instances. +type AggregatedResource struct { + // Average total duration in milliseconds. + AvgDurationMs float64 `json:"avg_duration_ms"` + // Average start time relative to view start in milliseconds. + AvgStartTimeMs float64 `json:"avg_start_time_ms"` + // Cache hit rate as a percentage. + CacheHitRatePct float64 `json:"cache_hit_rate_pct"` + // Number of requests served from cache. + CachedCount int32 `json:"cached_count"` + // Number of requests downloaded from the network. + DownloadedCount int32 `json:"downloaded_count"` + // 75th percentile duration across all view names in the application, present when include_global_appearance is true. + GlobalP75DurationMs *float64 `json:"global_p75_duration_ms,omitempty"` + // Number of distinct view names in the application that load this resource, present when include_global_appearance is true. + GlobalViewNameCount *int32 `json:"global_view_name_count,omitempty"` + // Percentage of distinct view names in the application that load this resource, present when include_global_appearance is true. + GlobalViewNamePct *float64 `json:"global_view_name_pct,omitempty"` + // HTTP method for the resource request. + HttpMethod datadog.NullableString `json:"http_method"` + // Percentage of sampled view instances that loaded this resource. + LoadFrequencyPct float64 `json:"load_frequency_pct"` + // Maximum duration in milliseconds. + MaxDurationMs float64 `json:"max_duration_ms"` + // Median duration in milliseconds. + MedianDurationMs float64 `json:"median_duration_ms"` + // Minimum duration in milliseconds. + MinDurationMs float64 `json:"min_duration_ms"` + // 75th percentile duration in milliseconds. + P75DurationMs float64 `json:"p75_duration_ms"` + // 95th percentile duration in milliseconds. + P95DurationMs float64 `json:"p95_duration_ms"` + // Resource type (JS, CSS, image, fetch, XHR, document, and so on). + ResourceType datadog.NullableString `json:"resource_type"` + // URL path group used to aggregate similar resources. + ResourceUrlPathGroup string `json:"resource_url_path_group"` + // Average timing breakdown per network phase for a resource. + TimingBreakdown AggregatedResourceTimingBreakdown `json:"timing_breakdown"` + // Total number of requests for this resource across all sampled views. + TotalRequests int32 `json:"total_requests"` + // Number of sampled view instances that loaded this resource. + ViewsWithResource int32 `json:"views_with_resource"` + // 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:"-"` +} + +// NewAggregatedResource instantiates a new AggregatedResource 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 NewAggregatedResource(avgDurationMs float64, avgStartTimeMs float64, cacheHitRatePct float64, cachedCount int32, downloadedCount int32, httpMethod datadog.NullableString, loadFrequencyPct float64, maxDurationMs float64, medianDurationMs float64, minDurationMs float64, p75DurationMs float64, p95DurationMs float64, resourceType datadog.NullableString, resourceUrlPathGroup string, timingBreakdown AggregatedResourceTimingBreakdown, totalRequests int32, viewsWithResource int32) *AggregatedResource { + this := AggregatedResource{} + this.AvgDurationMs = avgDurationMs + this.AvgStartTimeMs = avgStartTimeMs + this.CacheHitRatePct = cacheHitRatePct + this.CachedCount = cachedCount + this.DownloadedCount = downloadedCount + this.HttpMethod = httpMethod + this.LoadFrequencyPct = loadFrequencyPct + this.MaxDurationMs = maxDurationMs + this.MedianDurationMs = medianDurationMs + this.MinDurationMs = minDurationMs + this.P75DurationMs = p75DurationMs + this.P95DurationMs = p95DurationMs + this.ResourceType = resourceType + this.ResourceUrlPathGroup = resourceUrlPathGroup + this.TimingBreakdown = timingBreakdown + this.TotalRequests = totalRequests + this.ViewsWithResource = viewsWithResource + return &this +} + +// NewAggregatedResourceWithDefaults instantiates a new AggregatedResource 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 NewAggregatedResourceWithDefaults() *AggregatedResource { + this := AggregatedResource{} + return &this +} + +// GetAvgDurationMs returns the AvgDurationMs field value. +func (o *AggregatedResource) GetAvgDurationMs() float64 { + if o == nil { + var ret float64 + return ret + } + return o.AvgDurationMs +} + +// GetAvgDurationMsOk returns a tuple with the AvgDurationMs field value +// and a boolean to check if the value has been set. +func (o *AggregatedResource) GetAvgDurationMsOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.AvgDurationMs, true +} + +// SetAvgDurationMs sets field value. +func (o *AggregatedResource) SetAvgDurationMs(v float64) { + o.AvgDurationMs = v +} + +// GetAvgStartTimeMs returns the AvgStartTimeMs field value. +func (o *AggregatedResource) GetAvgStartTimeMs() float64 { + if o == nil { + var ret float64 + return ret + } + return o.AvgStartTimeMs +} + +// GetAvgStartTimeMsOk returns a tuple with the AvgStartTimeMs field value +// and a boolean to check if the value has been set. +func (o *AggregatedResource) GetAvgStartTimeMsOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.AvgStartTimeMs, true +} + +// SetAvgStartTimeMs sets field value. +func (o *AggregatedResource) SetAvgStartTimeMs(v float64) { + o.AvgStartTimeMs = v +} + +// GetCacheHitRatePct returns the CacheHitRatePct field value. +func (o *AggregatedResource) GetCacheHitRatePct() float64 { + if o == nil { + var ret float64 + return ret + } + return o.CacheHitRatePct +} + +// GetCacheHitRatePctOk returns a tuple with the CacheHitRatePct field value +// and a boolean to check if the value has been set. +func (o *AggregatedResource) GetCacheHitRatePctOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.CacheHitRatePct, true +} + +// SetCacheHitRatePct sets field value. +func (o *AggregatedResource) SetCacheHitRatePct(v float64) { + o.CacheHitRatePct = v +} + +// GetCachedCount returns the CachedCount field value. +func (o *AggregatedResource) GetCachedCount() int32 { + if o == nil { + var ret int32 + return ret + } + return o.CachedCount +} + +// GetCachedCountOk returns a tuple with the CachedCount field value +// and a boolean to check if the value has been set. +func (o *AggregatedResource) GetCachedCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.CachedCount, true +} + +// SetCachedCount sets field value. +func (o *AggregatedResource) SetCachedCount(v int32) { + o.CachedCount = v +} + +// GetDownloadedCount returns the DownloadedCount field value. +func (o *AggregatedResource) GetDownloadedCount() int32 { + if o == nil { + var ret int32 + return ret + } + return o.DownloadedCount +} + +// GetDownloadedCountOk returns a tuple with the DownloadedCount field value +// and a boolean to check if the value has been set. +func (o *AggregatedResource) GetDownloadedCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.DownloadedCount, true +} + +// SetDownloadedCount sets field value. +func (o *AggregatedResource) SetDownloadedCount(v int32) { + o.DownloadedCount = v +} + +// GetGlobalP75DurationMs returns the GlobalP75DurationMs field value if set, zero value otherwise. +func (o *AggregatedResource) GetGlobalP75DurationMs() float64 { + if o == nil || o.GlobalP75DurationMs == nil { + var ret float64 + return ret + } + return *o.GlobalP75DurationMs +} + +// GetGlobalP75DurationMsOk returns a tuple with the GlobalP75DurationMs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AggregatedResource) GetGlobalP75DurationMsOk() (*float64, bool) { + if o == nil || o.GlobalP75DurationMs == nil { + return nil, false + } + return o.GlobalP75DurationMs, true +} + +// HasGlobalP75DurationMs returns a boolean if a field has been set. +func (o *AggregatedResource) HasGlobalP75DurationMs() bool { + return o != nil && o.GlobalP75DurationMs != nil +} + +// SetGlobalP75DurationMs gets a reference to the given float64 and assigns it to the GlobalP75DurationMs field. +func (o *AggregatedResource) SetGlobalP75DurationMs(v float64) { + o.GlobalP75DurationMs = &v +} + +// GetGlobalViewNameCount returns the GlobalViewNameCount field value if set, zero value otherwise. +func (o *AggregatedResource) GetGlobalViewNameCount() int32 { + if o == nil || o.GlobalViewNameCount == nil { + var ret int32 + return ret + } + return *o.GlobalViewNameCount +} + +// GetGlobalViewNameCountOk returns a tuple with the GlobalViewNameCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AggregatedResource) GetGlobalViewNameCountOk() (*int32, bool) { + if o == nil || o.GlobalViewNameCount == nil { + return nil, false + } + return o.GlobalViewNameCount, true +} + +// HasGlobalViewNameCount returns a boolean if a field has been set. +func (o *AggregatedResource) HasGlobalViewNameCount() bool { + return o != nil && o.GlobalViewNameCount != nil +} + +// SetGlobalViewNameCount gets a reference to the given int32 and assigns it to the GlobalViewNameCount field. +func (o *AggregatedResource) SetGlobalViewNameCount(v int32) { + o.GlobalViewNameCount = &v +} + +// GetGlobalViewNamePct returns the GlobalViewNamePct field value if set, zero value otherwise. +func (o *AggregatedResource) GetGlobalViewNamePct() float64 { + if o == nil || o.GlobalViewNamePct == nil { + var ret float64 + return ret + } + return *o.GlobalViewNamePct +} + +// GetGlobalViewNamePctOk returns a tuple with the GlobalViewNamePct field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AggregatedResource) GetGlobalViewNamePctOk() (*float64, bool) { + if o == nil || o.GlobalViewNamePct == nil { + return nil, false + } + return o.GlobalViewNamePct, true +} + +// HasGlobalViewNamePct returns a boolean if a field has been set. +func (o *AggregatedResource) HasGlobalViewNamePct() bool { + return o != nil && o.GlobalViewNamePct != nil +} + +// SetGlobalViewNamePct gets a reference to the given float64 and assigns it to the GlobalViewNamePct field. +func (o *AggregatedResource) SetGlobalViewNamePct(v float64) { + o.GlobalViewNamePct = &v +} + +// GetHttpMethod returns the HttpMethod field value. +// If the value is explicit nil, the zero value for string will be returned. +func (o *AggregatedResource) GetHttpMethod() string { + if o == nil || o.HttpMethod.Get() == nil { + var ret string + return ret + } + return *o.HttpMethod.Get() +} + +// GetHttpMethodOk returns a tuple with the HttpMethod field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *AggregatedResource) GetHttpMethodOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.HttpMethod.Get(), o.HttpMethod.IsSet() +} + +// SetHttpMethod sets field value. +func (o *AggregatedResource) SetHttpMethod(v string) { + o.HttpMethod.Set(&v) +} + +// GetLoadFrequencyPct returns the LoadFrequencyPct field value. +func (o *AggregatedResource) GetLoadFrequencyPct() float64 { + if o == nil { + var ret float64 + return ret + } + return o.LoadFrequencyPct +} + +// GetLoadFrequencyPctOk returns a tuple with the LoadFrequencyPct field value +// and a boolean to check if the value has been set. +func (o *AggregatedResource) GetLoadFrequencyPctOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.LoadFrequencyPct, true +} + +// SetLoadFrequencyPct sets field value. +func (o *AggregatedResource) SetLoadFrequencyPct(v float64) { + o.LoadFrequencyPct = v +} + +// GetMaxDurationMs returns the MaxDurationMs field value. +func (o *AggregatedResource) GetMaxDurationMs() float64 { + if o == nil { + var ret float64 + return ret + } + return o.MaxDurationMs +} + +// GetMaxDurationMsOk returns a tuple with the MaxDurationMs field value +// and a boolean to check if the value has been set. +func (o *AggregatedResource) GetMaxDurationMsOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.MaxDurationMs, true +} + +// SetMaxDurationMs sets field value. +func (o *AggregatedResource) SetMaxDurationMs(v float64) { + o.MaxDurationMs = v +} + +// GetMedianDurationMs returns the MedianDurationMs field value. +func (o *AggregatedResource) GetMedianDurationMs() float64 { + if o == nil { + var ret float64 + return ret + } + return o.MedianDurationMs +} + +// GetMedianDurationMsOk returns a tuple with the MedianDurationMs field value +// and a boolean to check if the value has been set. +func (o *AggregatedResource) GetMedianDurationMsOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.MedianDurationMs, true +} + +// SetMedianDurationMs sets field value. +func (o *AggregatedResource) SetMedianDurationMs(v float64) { + o.MedianDurationMs = v +} + +// GetMinDurationMs returns the MinDurationMs field value. +func (o *AggregatedResource) GetMinDurationMs() float64 { + if o == nil { + var ret float64 + return ret + } + return o.MinDurationMs +} + +// GetMinDurationMsOk returns a tuple with the MinDurationMs field value +// and a boolean to check if the value has been set. +func (o *AggregatedResource) GetMinDurationMsOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.MinDurationMs, true +} + +// SetMinDurationMs sets field value. +func (o *AggregatedResource) SetMinDurationMs(v float64) { + o.MinDurationMs = v +} + +// GetP75DurationMs returns the P75DurationMs field value. +func (o *AggregatedResource) GetP75DurationMs() float64 { + if o == nil { + var ret float64 + return ret + } + return o.P75DurationMs +} + +// GetP75DurationMsOk returns a tuple with the P75DurationMs field value +// and a boolean to check if the value has been set. +func (o *AggregatedResource) GetP75DurationMsOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.P75DurationMs, true +} + +// SetP75DurationMs sets field value. +func (o *AggregatedResource) SetP75DurationMs(v float64) { + o.P75DurationMs = v +} + +// GetP95DurationMs returns the P95DurationMs field value. +func (o *AggregatedResource) GetP95DurationMs() float64 { + if o == nil { + var ret float64 + return ret + } + return o.P95DurationMs +} + +// GetP95DurationMsOk returns a tuple with the P95DurationMs field value +// and a boolean to check if the value has been set. +func (o *AggregatedResource) GetP95DurationMsOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.P95DurationMs, true +} + +// SetP95DurationMs sets field value. +func (o *AggregatedResource) SetP95DurationMs(v float64) { + o.P95DurationMs = v +} + +// GetResourceType returns the ResourceType field value. +// If the value is explicit nil, the zero value for string will be returned. +func (o *AggregatedResource) GetResourceType() string { + if o == nil || o.ResourceType.Get() == nil { + var ret string + return ret + } + return *o.ResourceType.Get() +} + +// GetResourceTypeOk returns a tuple with the ResourceType field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *AggregatedResource) GetResourceTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ResourceType.Get(), o.ResourceType.IsSet() +} + +// SetResourceType sets field value. +func (o *AggregatedResource) SetResourceType(v string) { + o.ResourceType.Set(&v) +} + +// GetResourceUrlPathGroup returns the ResourceUrlPathGroup field value. +func (o *AggregatedResource) GetResourceUrlPathGroup() string { + if o == nil { + var ret string + return ret + } + return o.ResourceUrlPathGroup +} + +// GetResourceUrlPathGroupOk returns a tuple with the ResourceUrlPathGroup field value +// and a boolean to check if the value has been set. +func (o *AggregatedResource) GetResourceUrlPathGroupOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ResourceUrlPathGroup, true +} + +// SetResourceUrlPathGroup sets field value. +func (o *AggregatedResource) SetResourceUrlPathGroup(v string) { + o.ResourceUrlPathGroup = v +} + +// GetTimingBreakdown returns the TimingBreakdown field value. +func (o *AggregatedResource) GetTimingBreakdown() AggregatedResourceTimingBreakdown { + if o == nil { + var ret AggregatedResourceTimingBreakdown + return ret + } + return o.TimingBreakdown +} + +// GetTimingBreakdownOk returns a tuple with the TimingBreakdown field value +// and a boolean to check if the value has been set. +func (o *AggregatedResource) GetTimingBreakdownOk() (*AggregatedResourceTimingBreakdown, bool) { + if o == nil { + return nil, false + } + return &o.TimingBreakdown, true +} + +// SetTimingBreakdown sets field value. +func (o *AggregatedResource) SetTimingBreakdown(v AggregatedResourceTimingBreakdown) { + o.TimingBreakdown = v +} + +// GetTotalRequests returns the TotalRequests field value. +func (o *AggregatedResource) GetTotalRequests() int32 { + if o == nil { + var ret int32 + return ret + } + return o.TotalRequests +} + +// GetTotalRequestsOk returns a tuple with the TotalRequests field value +// and a boolean to check if the value has been set. +func (o *AggregatedResource) GetTotalRequestsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.TotalRequests, true +} + +// SetTotalRequests sets field value. +func (o *AggregatedResource) SetTotalRequests(v int32) { + o.TotalRequests = v +} + +// GetViewsWithResource returns the ViewsWithResource field value. +func (o *AggregatedResource) GetViewsWithResource() int32 { + if o == nil { + var ret int32 + return ret + } + return o.ViewsWithResource +} + +// GetViewsWithResourceOk returns a tuple with the ViewsWithResource field value +// and a boolean to check if the value has been set. +func (o *AggregatedResource) GetViewsWithResourceOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.ViewsWithResource, true +} + +// SetViewsWithResource sets field value. +func (o *AggregatedResource) SetViewsWithResource(v int32) { + o.ViewsWithResource = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedResource) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["avg_duration_ms"] = o.AvgDurationMs + toSerialize["avg_start_time_ms"] = o.AvgStartTimeMs + toSerialize["cache_hit_rate_pct"] = o.CacheHitRatePct + toSerialize["cached_count"] = o.CachedCount + toSerialize["downloaded_count"] = o.DownloadedCount + if o.GlobalP75DurationMs != nil { + toSerialize["global_p75_duration_ms"] = o.GlobalP75DurationMs + } + if o.GlobalViewNameCount != nil { + toSerialize["global_view_name_count"] = o.GlobalViewNameCount + } + if o.GlobalViewNamePct != nil { + toSerialize["global_view_name_pct"] = o.GlobalViewNamePct + } + toSerialize["http_method"] = o.HttpMethod.Get() + toSerialize["load_frequency_pct"] = o.LoadFrequencyPct + toSerialize["max_duration_ms"] = o.MaxDurationMs + toSerialize["median_duration_ms"] = o.MedianDurationMs + toSerialize["min_duration_ms"] = o.MinDurationMs + toSerialize["p75_duration_ms"] = o.P75DurationMs + toSerialize["p95_duration_ms"] = o.P95DurationMs + toSerialize["resource_type"] = o.ResourceType.Get() + toSerialize["resource_url_path_group"] = o.ResourceUrlPathGroup + toSerialize["timing_breakdown"] = o.TimingBreakdown + toSerialize["total_requests"] = o.TotalRequests + toSerialize["views_with_resource"] = o.ViewsWithResource + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AggregatedResource) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AvgDurationMs *float64 `json:"avg_duration_ms"` + AvgStartTimeMs *float64 `json:"avg_start_time_ms"` + CacheHitRatePct *float64 `json:"cache_hit_rate_pct"` + CachedCount *int32 `json:"cached_count"` + DownloadedCount *int32 `json:"downloaded_count"` + GlobalP75DurationMs *float64 `json:"global_p75_duration_ms,omitempty"` + GlobalViewNameCount *int32 `json:"global_view_name_count,omitempty"` + GlobalViewNamePct *float64 `json:"global_view_name_pct,omitempty"` + HttpMethod datadog.NullableString `json:"http_method"` + LoadFrequencyPct *float64 `json:"load_frequency_pct"` + MaxDurationMs *float64 `json:"max_duration_ms"` + MedianDurationMs *float64 `json:"median_duration_ms"` + MinDurationMs *float64 `json:"min_duration_ms"` + P75DurationMs *float64 `json:"p75_duration_ms"` + P95DurationMs *float64 `json:"p95_duration_ms"` + ResourceType datadog.NullableString `json:"resource_type"` + ResourceUrlPathGroup *string `json:"resource_url_path_group"` + TimingBreakdown *AggregatedResourceTimingBreakdown `json:"timing_breakdown"` + TotalRequests *int32 `json:"total_requests"` + ViewsWithResource *int32 `json:"views_with_resource"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.AvgDurationMs == nil { + return fmt.Errorf("required field avg_duration_ms missing") + } + if all.AvgStartTimeMs == nil { + return fmt.Errorf("required field avg_start_time_ms missing") + } + if all.CacheHitRatePct == nil { + return fmt.Errorf("required field cache_hit_rate_pct missing") + } + if all.CachedCount == nil { + return fmt.Errorf("required field cached_count missing") + } + if all.DownloadedCount == nil { + return fmt.Errorf("required field downloaded_count missing") + } + if !all.HttpMethod.IsSet() { + return fmt.Errorf("required field http_method missing") + } + if all.LoadFrequencyPct == nil { + return fmt.Errorf("required field load_frequency_pct missing") + } + if all.MaxDurationMs == nil { + return fmt.Errorf("required field max_duration_ms missing") + } + if all.MedianDurationMs == nil { + return fmt.Errorf("required field median_duration_ms missing") + } + if all.MinDurationMs == nil { + return fmt.Errorf("required field min_duration_ms missing") + } + if all.P75DurationMs == nil { + return fmt.Errorf("required field p75_duration_ms missing") + } + if all.P95DurationMs == nil { + return fmt.Errorf("required field p95_duration_ms missing") + } + if !all.ResourceType.IsSet() { + return fmt.Errorf("required field resource_type missing") + } + if all.ResourceUrlPathGroup == nil { + return fmt.Errorf("required field resource_url_path_group missing") + } + if all.TimingBreakdown == nil { + return fmt.Errorf("required field timing_breakdown missing") + } + if all.TotalRequests == nil { + return fmt.Errorf("required field total_requests missing") + } + if all.ViewsWithResource == nil { + return fmt.Errorf("required field views_with_resource missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"avg_duration_ms", "avg_start_time_ms", "cache_hit_rate_pct", "cached_count", "downloaded_count", "global_p75_duration_ms", "global_view_name_count", "global_view_name_pct", "http_method", "load_frequency_pct", "max_duration_ms", "median_duration_ms", "min_duration_ms", "p75_duration_ms", "p95_duration_ms", "resource_type", "resource_url_path_group", "timing_breakdown", "total_requests", "views_with_resource"}) + } else { + return err + } + + hasInvalidField := false + o.AvgDurationMs = *all.AvgDurationMs + o.AvgStartTimeMs = *all.AvgStartTimeMs + o.CacheHitRatePct = *all.CacheHitRatePct + o.CachedCount = *all.CachedCount + o.DownloadedCount = *all.DownloadedCount + o.GlobalP75DurationMs = all.GlobalP75DurationMs + o.GlobalViewNameCount = all.GlobalViewNameCount + o.GlobalViewNamePct = all.GlobalViewNamePct + o.HttpMethod = all.HttpMethod + o.LoadFrequencyPct = *all.LoadFrequencyPct + o.MaxDurationMs = *all.MaxDurationMs + o.MedianDurationMs = *all.MedianDurationMs + o.MinDurationMs = *all.MinDurationMs + o.P75DurationMs = *all.P75DurationMs + o.P95DurationMs = *all.P95DurationMs + o.ResourceType = all.ResourceType + o.ResourceUrlPathGroup = *all.ResourceUrlPathGroup + if all.TimingBreakdown.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.TimingBreakdown = *all.TimingBreakdown + o.TotalRequests = *all.TotalRequests + o.ViewsWithResource = *all.ViewsWithResource + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_aggregated_resource_timing_breakdown.go b/api/datadogV2/model_aggregated_resource_timing_breakdown.go new file mode 100644 index 00000000000..06df948aa65 --- /dev/null +++ b/api/datadogV2/model_aggregated_resource_timing_breakdown.go @@ -0,0 +1,261 @@ +// Unless explicitly stated otherwise all files in this repository 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" +) + +// AggregatedResourceTimingBreakdown Average timing breakdown per network phase for a resource. +type AggregatedResourceTimingBreakdown struct { + // Average TCP connect duration in milliseconds. + AvgConnectMs float64 `json:"avg_connect_ms"` + // Average DNS resolution duration in milliseconds. + AvgDnsMs float64 `json:"avg_dns_ms"` + // Average download phase duration in milliseconds. + AvgDownloadMs float64 `json:"avg_download_ms"` + // Average time to first byte in milliseconds. + AvgFirstByteMs float64 `json:"avg_first_byte_ms"` + // Average redirect phase duration in milliseconds. + AvgRedirectMs float64 `json:"avg_redirect_ms"` + // Average SSL handshake duration in milliseconds. + AvgSslMs float64 `json:"avg_ssl_ms"` + // 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:"-"` +} + +// NewAggregatedResourceTimingBreakdown instantiates a new AggregatedResourceTimingBreakdown 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 NewAggregatedResourceTimingBreakdown(avgConnectMs float64, avgDnsMs float64, avgDownloadMs float64, avgFirstByteMs float64, avgRedirectMs float64, avgSslMs float64) *AggregatedResourceTimingBreakdown { + this := AggregatedResourceTimingBreakdown{} + this.AvgConnectMs = avgConnectMs + this.AvgDnsMs = avgDnsMs + this.AvgDownloadMs = avgDownloadMs + this.AvgFirstByteMs = avgFirstByteMs + this.AvgRedirectMs = avgRedirectMs + this.AvgSslMs = avgSslMs + return &this +} + +// NewAggregatedResourceTimingBreakdownWithDefaults instantiates a new AggregatedResourceTimingBreakdown 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 NewAggregatedResourceTimingBreakdownWithDefaults() *AggregatedResourceTimingBreakdown { + this := AggregatedResourceTimingBreakdown{} + return &this +} + +// GetAvgConnectMs returns the AvgConnectMs field value. +func (o *AggregatedResourceTimingBreakdown) GetAvgConnectMs() float64 { + if o == nil { + var ret float64 + return ret + } + return o.AvgConnectMs +} + +// GetAvgConnectMsOk returns a tuple with the AvgConnectMs field value +// and a boolean to check if the value has been set. +func (o *AggregatedResourceTimingBreakdown) GetAvgConnectMsOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.AvgConnectMs, true +} + +// SetAvgConnectMs sets field value. +func (o *AggregatedResourceTimingBreakdown) SetAvgConnectMs(v float64) { + o.AvgConnectMs = v +} + +// GetAvgDnsMs returns the AvgDnsMs field value. +func (o *AggregatedResourceTimingBreakdown) GetAvgDnsMs() float64 { + if o == nil { + var ret float64 + return ret + } + return o.AvgDnsMs +} + +// GetAvgDnsMsOk returns a tuple with the AvgDnsMs field value +// and a boolean to check if the value has been set. +func (o *AggregatedResourceTimingBreakdown) GetAvgDnsMsOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.AvgDnsMs, true +} + +// SetAvgDnsMs sets field value. +func (o *AggregatedResourceTimingBreakdown) SetAvgDnsMs(v float64) { + o.AvgDnsMs = v +} + +// GetAvgDownloadMs returns the AvgDownloadMs field value. +func (o *AggregatedResourceTimingBreakdown) GetAvgDownloadMs() float64 { + if o == nil { + var ret float64 + return ret + } + return o.AvgDownloadMs +} + +// GetAvgDownloadMsOk returns a tuple with the AvgDownloadMs field value +// and a boolean to check if the value has been set. +func (o *AggregatedResourceTimingBreakdown) GetAvgDownloadMsOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.AvgDownloadMs, true +} + +// SetAvgDownloadMs sets field value. +func (o *AggregatedResourceTimingBreakdown) SetAvgDownloadMs(v float64) { + o.AvgDownloadMs = v +} + +// GetAvgFirstByteMs returns the AvgFirstByteMs field value. +func (o *AggregatedResourceTimingBreakdown) GetAvgFirstByteMs() float64 { + if o == nil { + var ret float64 + return ret + } + return o.AvgFirstByteMs +} + +// GetAvgFirstByteMsOk returns a tuple with the AvgFirstByteMs field value +// and a boolean to check if the value has been set. +func (o *AggregatedResourceTimingBreakdown) GetAvgFirstByteMsOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.AvgFirstByteMs, true +} + +// SetAvgFirstByteMs sets field value. +func (o *AggregatedResourceTimingBreakdown) SetAvgFirstByteMs(v float64) { + o.AvgFirstByteMs = v +} + +// GetAvgRedirectMs returns the AvgRedirectMs field value. +func (o *AggregatedResourceTimingBreakdown) GetAvgRedirectMs() float64 { + if o == nil { + var ret float64 + return ret + } + return o.AvgRedirectMs +} + +// GetAvgRedirectMsOk returns a tuple with the AvgRedirectMs field value +// and a boolean to check if the value has been set. +func (o *AggregatedResourceTimingBreakdown) GetAvgRedirectMsOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.AvgRedirectMs, true +} + +// SetAvgRedirectMs sets field value. +func (o *AggregatedResourceTimingBreakdown) SetAvgRedirectMs(v float64) { + o.AvgRedirectMs = v +} + +// GetAvgSslMs returns the AvgSslMs field value. +func (o *AggregatedResourceTimingBreakdown) GetAvgSslMs() float64 { + if o == nil { + var ret float64 + return ret + } + return o.AvgSslMs +} + +// GetAvgSslMsOk returns a tuple with the AvgSslMs field value +// and a boolean to check if the value has been set. +func (o *AggregatedResourceTimingBreakdown) GetAvgSslMsOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.AvgSslMs, true +} + +// SetAvgSslMs sets field value. +func (o *AggregatedResourceTimingBreakdown) SetAvgSslMs(v float64) { + o.AvgSslMs = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedResourceTimingBreakdown) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["avg_connect_ms"] = o.AvgConnectMs + toSerialize["avg_dns_ms"] = o.AvgDnsMs + toSerialize["avg_download_ms"] = o.AvgDownloadMs + toSerialize["avg_first_byte_ms"] = o.AvgFirstByteMs + toSerialize["avg_redirect_ms"] = o.AvgRedirectMs + toSerialize["avg_ssl_ms"] = o.AvgSslMs + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AggregatedResourceTimingBreakdown) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AvgConnectMs *float64 `json:"avg_connect_ms"` + AvgDnsMs *float64 `json:"avg_dns_ms"` + AvgDownloadMs *float64 `json:"avg_download_ms"` + AvgFirstByteMs *float64 `json:"avg_first_byte_ms"` + AvgRedirectMs *float64 `json:"avg_redirect_ms"` + AvgSslMs *float64 `json:"avg_ssl_ms"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.AvgConnectMs == nil { + return fmt.Errorf("required field avg_connect_ms missing") + } + if all.AvgDnsMs == nil { + return fmt.Errorf("required field avg_dns_ms missing") + } + if all.AvgDownloadMs == nil { + return fmt.Errorf("required field avg_download_ms missing") + } + if all.AvgFirstByteMs == nil { + return fmt.Errorf("required field avg_first_byte_ms missing") + } + if all.AvgRedirectMs == nil { + return fmt.Errorf("required field avg_redirect_ms missing") + } + if all.AvgSslMs == nil { + return fmt.Errorf("required field avg_ssl_ms missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"avg_connect_ms", "avg_dns_ms", "avg_download_ms", "avg_first_byte_ms", "avg_redirect_ms", "avg_ssl_ms"}) + } else { + return err + } + o.AvgConnectMs = *all.AvgConnectMs + o.AvgDnsMs = *all.AvgDnsMs + o.AvgDownloadMs = *all.AvgDownloadMs + o.AvgFirstByteMs = *all.AvgFirstByteMs + o.AvgRedirectMs = *all.AvgRedirectMs + o.AvgSslMs = *all.AvgSslMs + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aggregated_signals_problems_request.go b/api/datadogV2/model_aggregated_signals_problems_request.go new file mode 100644 index 00000000000..903c37eb58d --- /dev/null +++ b/api/datadogV2/model_aggregated_signals_problems_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" +) + +// AggregatedSignalsProblemsRequest Request body for the aggregated signals and problems endpoint. +type AggregatedSignalsProblemsRequest struct { + // Data envelope for an aggregated signals and problems request. + Data AggregatedSignalsProblemsRequestData `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:"-"` +} + +// NewAggregatedSignalsProblemsRequest instantiates a new AggregatedSignalsProblemsRequest 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 NewAggregatedSignalsProblemsRequest(data AggregatedSignalsProblemsRequestData) *AggregatedSignalsProblemsRequest { + this := AggregatedSignalsProblemsRequest{} + this.Data = data + return &this +} + +// NewAggregatedSignalsProblemsRequestWithDefaults instantiates a new AggregatedSignalsProblemsRequest 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 NewAggregatedSignalsProblemsRequestWithDefaults() *AggregatedSignalsProblemsRequest { + this := AggregatedSignalsProblemsRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *AggregatedSignalsProblemsRequest) GetData() AggregatedSignalsProblemsRequestData { + if o == nil { + var ret AggregatedSignalsProblemsRequestData + 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 *AggregatedSignalsProblemsRequest) GetDataOk() (*AggregatedSignalsProblemsRequestData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *AggregatedSignalsProblemsRequest) SetData(v AggregatedSignalsProblemsRequestData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedSignalsProblemsRequest) 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 *AggregatedSignalsProblemsRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *AggregatedSignalsProblemsRequestData `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_aggregated_signals_problems_request_attributes.go b/api/datadogV2/model_aggregated_signals_problems_request_attributes.go new file mode 100644 index 00000000000..d413676c656 --- /dev/null +++ b/api/datadogV2/model_aggregated_signals_problems_request_attributes.go @@ -0,0 +1,343 @@ +// Unless explicitly stated otherwise all files in this repository 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" +) + +// AggregatedSignalsProblemsRequestAttributes Attributes for an aggregated signals and problems query. +type AggregatedSignalsProblemsRequestAttributes struct { + // The RUM application ID to analyze. + ApplicationId string `json:"application_id"` + // Performance criteria to filter view instances by a metric threshold. + Criteria *AggregatedWaterfallPerformanceCriteria `json:"criteria,omitempty"` + // List of detection types to include in the response. When omitted, all types are returned. + DetectionTypes []string `json:"detection_types,omitempty"` + // RUM query string to filter events (for example, @session.type:user @geo.country:US). + Filter *string `json:"filter,omitempty"` + // Start of the time range as a Unix timestamp in seconds. + From int64 `json:"from"` + // Number of view instances to sample, between 1 and 50. + SampleSize int32 `json:"sample_size"` + // End of the time range as a Unix timestamp in seconds. + To int64 `json:"to"` + // The RUM view name to analyze (for example, /account/login). + ViewName string `json:"view_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:"-"` +} + +// NewAggregatedSignalsProblemsRequestAttributes instantiates a new AggregatedSignalsProblemsRequestAttributes 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 NewAggregatedSignalsProblemsRequestAttributes(applicationId string, from int64, sampleSize int32, to int64, viewName string) *AggregatedSignalsProblemsRequestAttributes { + this := AggregatedSignalsProblemsRequestAttributes{} + this.ApplicationId = applicationId + this.From = from + this.SampleSize = sampleSize + this.To = to + this.ViewName = viewName + return &this +} + +// NewAggregatedSignalsProblemsRequestAttributesWithDefaults instantiates a new AggregatedSignalsProblemsRequestAttributes 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 NewAggregatedSignalsProblemsRequestAttributesWithDefaults() *AggregatedSignalsProblemsRequestAttributes { + this := AggregatedSignalsProblemsRequestAttributes{} + return &this +} + +// GetApplicationId returns the ApplicationId field value. +func (o *AggregatedSignalsProblemsRequestAttributes) GetApplicationId() string { + if o == nil { + var ret string + return ret + } + return o.ApplicationId +} + +// GetApplicationIdOk returns a tuple with the ApplicationId field value +// and a boolean to check if the value has been set. +func (o *AggregatedSignalsProblemsRequestAttributes) GetApplicationIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ApplicationId, true +} + +// SetApplicationId sets field value. +func (o *AggregatedSignalsProblemsRequestAttributes) SetApplicationId(v string) { + o.ApplicationId = v +} + +// GetCriteria returns the Criteria field value if set, zero value otherwise. +func (o *AggregatedSignalsProblemsRequestAttributes) GetCriteria() AggregatedWaterfallPerformanceCriteria { + if o == nil || o.Criteria == nil { + var ret AggregatedWaterfallPerformanceCriteria + return ret + } + return *o.Criteria +} + +// GetCriteriaOk returns a tuple with the Criteria field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AggregatedSignalsProblemsRequestAttributes) GetCriteriaOk() (*AggregatedWaterfallPerformanceCriteria, bool) { + if o == nil || o.Criteria == nil { + return nil, false + } + return o.Criteria, true +} + +// HasCriteria returns a boolean if a field has been set. +func (o *AggregatedSignalsProblemsRequestAttributes) HasCriteria() bool { + return o != nil && o.Criteria != nil +} + +// SetCriteria gets a reference to the given AggregatedWaterfallPerformanceCriteria and assigns it to the Criteria field. +func (o *AggregatedSignalsProblemsRequestAttributes) SetCriteria(v AggregatedWaterfallPerformanceCriteria) { + o.Criteria = &v +} + +// GetDetectionTypes returns the DetectionTypes field value if set, zero value otherwise. +func (o *AggregatedSignalsProblemsRequestAttributes) GetDetectionTypes() []string { + if o == nil || o.DetectionTypes == nil { + var ret []string + return ret + } + return o.DetectionTypes +} + +// GetDetectionTypesOk returns a tuple with the DetectionTypes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AggregatedSignalsProblemsRequestAttributes) GetDetectionTypesOk() (*[]string, bool) { + if o == nil || o.DetectionTypes == nil { + return nil, false + } + return &o.DetectionTypes, true +} + +// HasDetectionTypes returns a boolean if a field has been set. +func (o *AggregatedSignalsProblemsRequestAttributes) HasDetectionTypes() bool { + return o != nil && o.DetectionTypes != nil +} + +// SetDetectionTypes gets a reference to the given []string and assigns it to the DetectionTypes field. +func (o *AggregatedSignalsProblemsRequestAttributes) SetDetectionTypes(v []string) { + o.DetectionTypes = v +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *AggregatedSignalsProblemsRequestAttributes) GetFilter() string { + if o == nil || o.Filter == nil { + var ret string + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AggregatedSignalsProblemsRequestAttributes) GetFilterOk() (*string, bool) { + if o == nil || o.Filter == nil { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *AggregatedSignalsProblemsRequestAttributes) HasFilter() bool { + return o != nil && o.Filter != nil +} + +// SetFilter gets a reference to the given string and assigns it to the Filter field. +func (o *AggregatedSignalsProblemsRequestAttributes) SetFilter(v string) { + o.Filter = &v +} + +// GetFrom returns the From field value. +func (o *AggregatedSignalsProblemsRequestAttributes) GetFrom() int64 { + if o == nil { + var ret int64 + return ret + } + return o.From +} + +// GetFromOk returns a tuple with the From field value +// and a boolean to check if the value has been set. +func (o *AggregatedSignalsProblemsRequestAttributes) GetFromOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.From, true +} + +// SetFrom sets field value. +func (o *AggregatedSignalsProblemsRequestAttributes) SetFrom(v int64) { + o.From = v +} + +// GetSampleSize returns the SampleSize field value. +func (o *AggregatedSignalsProblemsRequestAttributes) GetSampleSize() int32 { + if o == nil { + var ret int32 + return ret + } + return o.SampleSize +} + +// GetSampleSizeOk returns a tuple with the SampleSize field value +// and a boolean to check if the value has been set. +func (o *AggregatedSignalsProblemsRequestAttributes) GetSampleSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.SampleSize, true +} + +// SetSampleSize sets field value. +func (o *AggregatedSignalsProblemsRequestAttributes) SetSampleSize(v int32) { + o.SampleSize = v +} + +// GetTo returns the To field value. +func (o *AggregatedSignalsProblemsRequestAttributes) GetTo() int64 { + if o == nil { + var ret int64 + return ret + } + return o.To +} + +// GetToOk returns a tuple with the To field value +// and a boolean to check if the value has been set. +func (o *AggregatedSignalsProblemsRequestAttributes) GetToOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.To, true +} + +// SetTo sets field value. +func (o *AggregatedSignalsProblemsRequestAttributes) SetTo(v int64) { + o.To = v +} + +// GetViewName returns the ViewName field value. +func (o *AggregatedSignalsProblemsRequestAttributes) GetViewName() string { + if o == nil { + var ret string + return ret + } + return o.ViewName +} + +// GetViewNameOk returns a tuple with the ViewName field value +// and a boolean to check if the value has been set. +func (o *AggregatedSignalsProblemsRequestAttributes) GetViewNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ViewName, true +} + +// SetViewName sets field value. +func (o *AggregatedSignalsProblemsRequestAttributes) SetViewName(v string) { + o.ViewName = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedSignalsProblemsRequestAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["application_id"] = o.ApplicationId + if o.Criteria != nil { + toSerialize["criteria"] = o.Criteria + } + if o.DetectionTypes != nil { + toSerialize["detection_types"] = o.DetectionTypes + } + if o.Filter != nil { + toSerialize["filter"] = o.Filter + } + toSerialize["from"] = o.From + toSerialize["sample_size"] = o.SampleSize + toSerialize["to"] = o.To + toSerialize["view_name"] = o.ViewName + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AggregatedSignalsProblemsRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ApplicationId *string `json:"application_id"` + Criteria *AggregatedWaterfallPerformanceCriteria `json:"criteria,omitempty"` + DetectionTypes []string `json:"detection_types,omitempty"` + Filter *string `json:"filter,omitempty"` + From *int64 `json:"from"` + SampleSize *int32 `json:"sample_size"` + To *int64 `json:"to"` + ViewName *string `json:"view_name"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.ApplicationId == nil { + return fmt.Errorf("required field application_id missing") + } + if all.From == nil { + return fmt.Errorf("required field from missing") + } + if all.SampleSize == nil { + return fmt.Errorf("required field sample_size missing") + } + if all.To == nil { + return fmt.Errorf("required field to missing") + } + if all.ViewName == nil { + return fmt.Errorf("required field view_name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"application_id", "criteria", "detection_types", "filter", "from", "sample_size", "to", "view_name"}) + } else { + return err + } + + hasInvalidField := false + o.ApplicationId = *all.ApplicationId + if all.Criteria != nil && all.Criteria.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Criteria = all.Criteria + o.DetectionTypes = all.DetectionTypes + o.Filter = all.Filter + o.From = *all.From + o.SampleSize = *all.SampleSize + o.To = *all.To + o.ViewName = *all.ViewName + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_aggregated_signals_problems_request_data.go b/api/datadogV2/model_aggregated_signals_problems_request_data.go new file mode 100644 index 00000000000..b9e9ce48d0e --- /dev/null +++ b/api/datadogV2/model_aggregated_signals_problems_request_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" +) + +// AggregatedSignalsProblemsRequestData Data envelope for an aggregated signals and problems request. +type AggregatedSignalsProblemsRequestData struct { + // Attributes for an aggregated signals and problems query. + Attributes AggregatedSignalsProblemsRequestAttributes `json:"attributes"` + // The JSON:API type for aggregated signals and problems requests. + Type AggregatedSignalsProblemsRequestType `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:"-"` +} + +// NewAggregatedSignalsProblemsRequestData instantiates a new AggregatedSignalsProblemsRequestData 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 NewAggregatedSignalsProblemsRequestData(attributes AggregatedSignalsProblemsRequestAttributes, typeVar AggregatedSignalsProblemsRequestType) *AggregatedSignalsProblemsRequestData { + this := AggregatedSignalsProblemsRequestData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewAggregatedSignalsProblemsRequestDataWithDefaults instantiates a new AggregatedSignalsProblemsRequestData 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 NewAggregatedSignalsProblemsRequestDataWithDefaults() *AggregatedSignalsProblemsRequestData { + this := AggregatedSignalsProblemsRequestData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *AggregatedSignalsProblemsRequestData) GetAttributes() AggregatedSignalsProblemsRequestAttributes { + if o == nil { + var ret AggregatedSignalsProblemsRequestAttributes + 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 *AggregatedSignalsProblemsRequestData) GetAttributesOk() (*AggregatedSignalsProblemsRequestAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *AggregatedSignalsProblemsRequestData) SetAttributes(v AggregatedSignalsProblemsRequestAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *AggregatedSignalsProblemsRequestData) GetType() AggregatedSignalsProblemsRequestType { + if o == nil { + var ret AggregatedSignalsProblemsRequestType + 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 *AggregatedSignalsProblemsRequestData) GetTypeOk() (*AggregatedSignalsProblemsRequestType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AggregatedSignalsProblemsRequestData) SetType(v AggregatedSignalsProblemsRequestType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedSignalsProblemsRequestData) 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 *AggregatedSignalsProblemsRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AggregatedSignalsProblemsRequestAttributes `json:"attributes"` + Type *AggregatedSignalsProblemsRequestType `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_aggregated_signals_problems_request_type.go b/api/datadogV2/model_aggregated_signals_problems_request_type.go new file mode 100644 index 00000000000..799237e78c1 --- /dev/null +++ b/api/datadogV2/model_aggregated_signals_problems_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" +) + +// AggregatedSignalsProblemsRequestType The JSON:API type for aggregated signals and problems requests. +type AggregatedSignalsProblemsRequestType string + +// List of AggregatedSignalsProblemsRequestType. +const ( + AGGREGATEDSIGNALSPROBLEMSREQUESTTYPE_AggregatedSignalsProblems AggregatedSignalsProblemsRequestType = "aggregated_signals_problems" +) + +var allowedAggregatedSignalsProblemsRequestTypeEnumValues = []AggregatedSignalsProblemsRequestType{ + AGGREGATEDSIGNALSPROBLEMSREQUESTTYPE_AggregatedSignalsProblems, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *AggregatedSignalsProblemsRequestType) GetAllowedValues() []AggregatedSignalsProblemsRequestType { + return allowedAggregatedSignalsProblemsRequestTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *AggregatedSignalsProblemsRequestType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = AggregatedSignalsProblemsRequestType(value) + return nil +} + +// NewAggregatedSignalsProblemsRequestTypeFromValue returns a pointer to a valid AggregatedSignalsProblemsRequestType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewAggregatedSignalsProblemsRequestTypeFromValue(v string) (*AggregatedSignalsProblemsRequestType, error) { + ev := AggregatedSignalsProblemsRequestType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for AggregatedSignalsProblemsRequestType: valid values are %v", v, allowedAggregatedSignalsProblemsRequestTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v AggregatedSignalsProblemsRequestType) IsValid() bool { + for _, existing := range allowedAggregatedSignalsProblemsRequestTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AggregatedSignalsProblemsRequestType value. +func (v AggregatedSignalsProblemsRequestType) Ptr() *AggregatedSignalsProblemsRequestType { + return &v +} diff --git a/api/datadogV2/model_aggregated_signals_problems_response.go b/api/datadogV2/model_aggregated_signals_problems_response.go new file mode 100644 index 00000000000..3155652d694 --- /dev/null +++ b/api/datadogV2/model_aggregated_signals_problems_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" +) + +// AggregatedSignalsProblemsResponse Response body for the aggregated signals and problems endpoint. +type AggregatedSignalsProblemsResponse struct { + // Data envelope for an aggregated signals and problems response. + Data AggregatedSignalsProblemsResponseData `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:"-"` +} + +// NewAggregatedSignalsProblemsResponse instantiates a new AggregatedSignalsProblemsResponse 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 NewAggregatedSignalsProblemsResponse(data AggregatedSignalsProblemsResponseData) *AggregatedSignalsProblemsResponse { + this := AggregatedSignalsProblemsResponse{} + this.Data = data + return &this +} + +// NewAggregatedSignalsProblemsResponseWithDefaults instantiates a new AggregatedSignalsProblemsResponse 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 NewAggregatedSignalsProblemsResponseWithDefaults() *AggregatedSignalsProblemsResponse { + this := AggregatedSignalsProblemsResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *AggregatedSignalsProblemsResponse) GetData() AggregatedSignalsProblemsResponseData { + if o == nil { + var ret AggregatedSignalsProblemsResponseData + 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 *AggregatedSignalsProblemsResponse) GetDataOk() (*AggregatedSignalsProblemsResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *AggregatedSignalsProblemsResponse) SetData(v AggregatedSignalsProblemsResponseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedSignalsProblemsResponse) 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 *AggregatedSignalsProblemsResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *AggregatedSignalsProblemsResponseData `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_aggregated_signals_problems_response_attributes.go b/api/datadogV2/model_aggregated_signals_problems_response_attributes.go new file mode 100644 index 00000000000..3324be5309f --- /dev/null +++ b/api/datadogV2/model_aggregated_signals_problems_response_attributes.go @@ -0,0 +1,311 @@ +// Unless explicitly stated otherwise all files in this repository 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" +) + +// AggregatedSignalsProblemsResponseAttributes Attributes of an aggregated signals and problems response. +type AggregatedSignalsProblemsResponseAttributes struct { + // The RUM application ID that was analyzed. + ApplicationId string `json:"application_id"` + // Performance criteria to filter view instances by a metric threshold. + Criteria *AggregatedWaterfallPerformanceCriteria `json:"criteria,omitempty"` + // Start of the analyzed time range as a Unix timestamp in seconds. + From int64 `json:"from"` + // Grouped detection results by detection type. + ProblemDetections SignalsProblemsDetections `json:"problem_detections"` + // Metadata about the sampling quality for a signals and problems query. + SampleMetadata SignalsProblemsSampleMetadata `json:"sample_metadata"` + // End of the analyzed time range as a Unix timestamp in seconds. + To int64 `json:"to"` + // The RUM view name that was analyzed. + ViewName string `json:"view_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:"-"` +} + +// NewAggregatedSignalsProblemsResponseAttributes instantiates a new AggregatedSignalsProblemsResponseAttributes 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 NewAggregatedSignalsProblemsResponseAttributes(applicationId string, from int64, problemDetections SignalsProblemsDetections, sampleMetadata SignalsProblemsSampleMetadata, to int64, viewName string) *AggregatedSignalsProblemsResponseAttributes { + this := AggregatedSignalsProblemsResponseAttributes{} + this.ApplicationId = applicationId + this.From = from + this.ProblemDetections = problemDetections + this.SampleMetadata = sampleMetadata + this.To = to + this.ViewName = viewName + return &this +} + +// NewAggregatedSignalsProblemsResponseAttributesWithDefaults instantiates a new AggregatedSignalsProblemsResponseAttributes 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 NewAggregatedSignalsProblemsResponseAttributesWithDefaults() *AggregatedSignalsProblemsResponseAttributes { + this := AggregatedSignalsProblemsResponseAttributes{} + return &this +} + +// GetApplicationId returns the ApplicationId field value. +func (o *AggregatedSignalsProblemsResponseAttributes) GetApplicationId() string { + if o == nil { + var ret string + return ret + } + return o.ApplicationId +} + +// GetApplicationIdOk returns a tuple with the ApplicationId field value +// and a boolean to check if the value has been set. +func (o *AggregatedSignalsProblemsResponseAttributes) GetApplicationIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ApplicationId, true +} + +// SetApplicationId sets field value. +func (o *AggregatedSignalsProblemsResponseAttributes) SetApplicationId(v string) { + o.ApplicationId = v +} + +// GetCriteria returns the Criteria field value if set, zero value otherwise. +func (o *AggregatedSignalsProblemsResponseAttributes) GetCriteria() AggregatedWaterfallPerformanceCriteria { + if o == nil || o.Criteria == nil { + var ret AggregatedWaterfallPerformanceCriteria + return ret + } + return *o.Criteria +} + +// GetCriteriaOk returns a tuple with the Criteria field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AggregatedSignalsProblemsResponseAttributes) GetCriteriaOk() (*AggregatedWaterfallPerformanceCriteria, bool) { + if o == nil || o.Criteria == nil { + return nil, false + } + return o.Criteria, true +} + +// HasCriteria returns a boolean if a field has been set. +func (o *AggregatedSignalsProblemsResponseAttributes) HasCriteria() bool { + return o != nil && o.Criteria != nil +} + +// SetCriteria gets a reference to the given AggregatedWaterfallPerformanceCriteria and assigns it to the Criteria field. +func (o *AggregatedSignalsProblemsResponseAttributes) SetCriteria(v AggregatedWaterfallPerformanceCriteria) { + o.Criteria = &v +} + +// GetFrom returns the From field value. +func (o *AggregatedSignalsProblemsResponseAttributes) GetFrom() int64 { + if o == nil { + var ret int64 + return ret + } + return o.From +} + +// GetFromOk returns a tuple with the From field value +// and a boolean to check if the value has been set. +func (o *AggregatedSignalsProblemsResponseAttributes) GetFromOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.From, true +} + +// SetFrom sets field value. +func (o *AggregatedSignalsProblemsResponseAttributes) SetFrom(v int64) { + o.From = v +} + +// GetProblemDetections returns the ProblemDetections field value. +func (o *AggregatedSignalsProblemsResponseAttributes) GetProblemDetections() SignalsProblemsDetections { + if o == nil { + var ret SignalsProblemsDetections + return ret + } + return o.ProblemDetections +} + +// GetProblemDetectionsOk returns a tuple with the ProblemDetections field value +// and a boolean to check if the value has been set. +func (o *AggregatedSignalsProblemsResponseAttributes) GetProblemDetectionsOk() (*SignalsProblemsDetections, bool) { + if o == nil { + return nil, false + } + return &o.ProblemDetections, true +} + +// SetProblemDetections sets field value. +func (o *AggregatedSignalsProblemsResponseAttributes) SetProblemDetections(v SignalsProblemsDetections) { + o.ProblemDetections = v +} + +// GetSampleMetadata returns the SampleMetadata field value. +func (o *AggregatedSignalsProblemsResponseAttributes) GetSampleMetadata() SignalsProblemsSampleMetadata { + if o == nil { + var ret SignalsProblemsSampleMetadata + return ret + } + return o.SampleMetadata +} + +// GetSampleMetadataOk returns a tuple with the SampleMetadata field value +// and a boolean to check if the value has been set. +func (o *AggregatedSignalsProblemsResponseAttributes) GetSampleMetadataOk() (*SignalsProblemsSampleMetadata, bool) { + if o == nil { + return nil, false + } + return &o.SampleMetadata, true +} + +// SetSampleMetadata sets field value. +func (o *AggregatedSignalsProblemsResponseAttributes) SetSampleMetadata(v SignalsProblemsSampleMetadata) { + o.SampleMetadata = v +} + +// GetTo returns the To field value. +func (o *AggregatedSignalsProblemsResponseAttributes) GetTo() int64 { + if o == nil { + var ret int64 + return ret + } + return o.To +} + +// GetToOk returns a tuple with the To field value +// and a boolean to check if the value has been set. +func (o *AggregatedSignalsProblemsResponseAttributes) GetToOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.To, true +} + +// SetTo sets field value. +func (o *AggregatedSignalsProblemsResponseAttributes) SetTo(v int64) { + o.To = v +} + +// GetViewName returns the ViewName field value. +func (o *AggregatedSignalsProblemsResponseAttributes) GetViewName() string { + if o == nil { + var ret string + return ret + } + return o.ViewName +} + +// GetViewNameOk returns a tuple with the ViewName field value +// and a boolean to check if the value has been set. +func (o *AggregatedSignalsProblemsResponseAttributes) GetViewNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ViewName, true +} + +// SetViewName sets field value. +func (o *AggregatedSignalsProblemsResponseAttributes) SetViewName(v string) { + o.ViewName = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedSignalsProblemsResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["application_id"] = o.ApplicationId + if o.Criteria != nil { + toSerialize["criteria"] = o.Criteria + } + toSerialize["from"] = o.From + toSerialize["problem_detections"] = o.ProblemDetections + toSerialize["sample_metadata"] = o.SampleMetadata + toSerialize["to"] = o.To + toSerialize["view_name"] = o.ViewName + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AggregatedSignalsProblemsResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ApplicationId *string `json:"application_id"` + Criteria *AggregatedWaterfallPerformanceCriteria `json:"criteria,omitempty"` + From *int64 `json:"from"` + ProblemDetections *SignalsProblemsDetections `json:"problem_detections"` + SampleMetadata *SignalsProblemsSampleMetadata `json:"sample_metadata"` + To *int64 `json:"to"` + ViewName *string `json:"view_name"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.ApplicationId == nil { + return fmt.Errorf("required field application_id missing") + } + if all.From == nil { + return fmt.Errorf("required field from missing") + } + if all.ProblemDetections == nil { + return fmt.Errorf("required field problem_detections missing") + } + if all.SampleMetadata == nil { + return fmt.Errorf("required field sample_metadata missing") + } + if all.To == nil { + return fmt.Errorf("required field to missing") + } + if all.ViewName == nil { + return fmt.Errorf("required field view_name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"application_id", "criteria", "from", "problem_detections", "sample_metadata", "to", "view_name"}) + } else { + return err + } + + hasInvalidField := false + o.ApplicationId = *all.ApplicationId + if all.Criteria != nil && all.Criteria.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Criteria = all.Criteria + o.From = *all.From + if all.ProblemDetections.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ProblemDetections = *all.ProblemDetections + if all.SampleMetadata.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.SampleMetadata = *all.SampleMetadata + o.To = *all.To + o.ViewName = *all.ViewName + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_aggregated_signals_problems_response_data.go b/api/datadogV2/model_aggregated_signals_problems_response_data.go new file mode 100644 index 00000000000..fd9cb1e3d8f --- /dev/null +++ b/api/datadogV2/model_aggregated_signals_problems_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" +) + +// AggregatedSignalsProblemsResponseData Data envelope for an aggregated signals and problems response. +type AggregatedSignalsProblemsResponseData struct { + // Attributes of an aggregated signals and problems response. + Attributes AggregatedSignalsProblemsResponseAttributes `json:"attributes"` + // Hash-based unique identifier for this aggregation. + Id string `json:"id"` + // The JSON:API type for aggregated signals and problems requests. + Type AggregatedSignalsProblemsRequestType `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:"-"` +} + +// NewAggregatedSignalsProblemsResponseData instantiates a new AggregatedSignalsProblemsResponseData 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 NewAggregatedSignalsProblemsResponseData(attributes AggregatedSignalsProblemsResponseAttributes, id string, typeVar AggregatedSignalsProblemsRequestType) *AggregatedSignalsProblemsResponseData { + this := AggregatedSignalsProblemsResponseData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewAggregatedSignalsProblemsResponseDataWithDefaults instantiates a new AggregatedSignalsProblemsResponseData 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 NewAggregatedSignalsProblemsResponseDataWithDefaults() *AggregatedSignalsProblemsResponseData { + this := AggregatedSignalsProblemsResponseData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *AggregatedSignalsProblemsResponseData) GetAttributes() AggregatedSignalsProblemsResponseAttributes { + if o == nil { + var ret AggregatedSignalsProblemsResponseAttributes + 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 *AggregatedSignalsProblemsResponseData) GetAttributesOk() (*AggregatedSignalsProblemsResponseAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *AggregatedSignalsProblemsResponseData) SetAttributes(v AggregatedSignalsProblemsResponseAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *AggregatedSignalsProblemsResponseData) 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 *AggregatedSignalsProblemsResponseData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *AggregatedSignalsProblemsResponseData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *AggregatedSignalsProblemsResponseData) GetType() AggregatedSignalsProblemsRequestType { + if o == nil { + var ret AggregatedSignalsProblemsRequestType + 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 *AggregatedSignalsProblemsResponseData) GetTypeOk() (*AggregatedSignalsProblemsRequestType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AggregatedSignalsProblemsResponseData) SetType(v AggregatedSignalsProblemsRequestType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedSignalsProblemsResponseData) 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 *AggregatedSignalsProblemsResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AggregatedSignalsProblemsResponseAttributes `json:"attributes"` + Id *string `json:"id"` + Type *AggregatedSignalsProblemsRequestType `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_aggregated_slow_fcp_high_bytes.go b/api/datadogV2/model_aggregated_slow_fcp_high_bytes.go new file mode 100644 index 00000000000..226e5312b13 --- /dev/null +++ b/api/datadogV2/model_aggregated_slow_fcp_high_bytes.go @@ -0,0 +1,293 @@ +// Unless explicitly stated otherwise all files in this repository 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" +) + +// AggregatedSlowFCPHighBytes Aggregated slow first contentful paint with high byte count detection. +type AggregatedSlowFCPHighBytes struct { + // Average total bytes loaded before first contentful paint. + AvgBytesBeforeFcpBytes int64 `json:"avg_bytes_before_fcp_bytes"` + // Average first contentful paint time in milliseconds. + AvgFirstContentfulPaintMs int64 `json:"avg_first_contentful_paint_ms"` + // Average number of resources loaded before first contentful paint. + AvgResourceCountBeforeFcp int64 `json:"avg_resource_count_before_fcp"` + // Unique fingerprint identifying this detection group. + Fingerprint string `json:"fingerprint"` + // Impact score for this detection. + ImpactScore float64 `json:"impact_score"` + // Platform identifier for the affected views. + Platform string `json:"platform"` + // Number of sampled views where this detection occurred. + ViewOccurrences int32 `json:"view_occurrences"` + // 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:"-"` +} + +// NewAggregatedSlowFCPHighBytes instantiates a new AggregatedSlowFCPHighBytes 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 NewAggregatedSlowFCPHighBytes(avgBytesBeforeFcpBytes int64, avgFirstContentfulPaintMs int64, avgResourceCountBeforeFcp int64, fingerprint string, impactScore float64, platform string, viewOccurrences int32) *AggregatedSlowFCPHighBytes { + this := AggregatedSlowFCPHighBytes{} + this.AvgBytesBeforeFcpBytes = avgBytesBeforeFcpBytes + this.AvgFirstContentfulPaintMs = avgFirstContentfulPaintMs + this.AvgResourceCountBeforeFcp = avgResourceCountBeforeFcp + this.Fingerprint = fingerprint + this.ImpactScore = impactScore + this.Platform = platform + this.ViewOccurrences = viewOccurrences + return &this +} + +// NewAggregatedSlowFCPHighBytesWithDefaults instantiates a new AggregatedSlowFCPHighBytes 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 NewAggregatedSlowFCPHighBytesWithDefaults() *AggregatedSlowFCPHighBytes { + this := AggregatedSlowFCPHighBytes{} + return &this +} + +// GetAvgBytesBeforeFcpBytes returns the AvgBytesBeforeFcpBytes field value. +func (o *AggregatedSlowFCPHighBytes) GetAvgBytesBeforeFcpBytes() int64 { + if o == nil { + var ret int64 + return ret + } + return o.AvgBytesBeforeFcpBytes +} + +// GetAvgBytesBeforeFcpBytesOk returns a tuple with the AvgBytesBeforeFcpBytes field value +// and a boolean to check if the value has been set. +func (o *AggregatedSlowFCPHighBytes) GetAvgBytesBeforeFcpBytesOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.AvgBytesBeforeFcpBytes, true +} + +// SetAvgBytesBeforeFcpBytes sets field value. +func (o *AggregatedSlowFCPHighBytes) SetAvgBytesBeforeFcpBytes(v int64) { + o.AvgBytesBeforeFcpBytes = v +} + +// GetAvgFirstContentfulPaintMs returns the AvgFirstContentfulPaintMs field value. +func (o *AggregatedSlowFCPHighBytes) GetAvgFirstContentfulPaintMs() int64 { + if o == nil { + var ret int64 + return ret + } + return o.AvgFirstContentfulPaintMs +} + +// GetAvgFirstContentfulPaintMsOk returns a tuple with the AvgFirstContentfulPaintMs field value +// and a boolean to check if the value has been set. +func (o *AggregatedSlowFCPHighBytes) GetAvgFirstContentfulPaintMsOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.AvgFirstContentfulPaintMs, true +} + +// SetAvgFirstContentfulPaintMs sets field value. +func (o *AggregatedSlowFCPHighBytes) SetAvgFirstContentfulPaintMs(v int64) { + o.AvgFirstContentfulPaintMs = v +} + +// GetAvgResourceCountBeforeFcp returns the AvgResourceCountBeforeFcp field value. +func (o *AggregatedSlowFCPHighBytes) GetAvgResourceCountBeforeFcp() int64 { + if o == nil { + var ret int64 + return ret + } + return o.AvgResourceCountBeforeFcp +} + +// GetAvgResourceCountBeforeFcpOk returns a tuple with the AvgResourceCountBeforeFcp field value +// and a boolean to check if the value has been set. +func (o *AggregatedSlowFCPHighBytes) GetAvgResourceCountBeforeFcpOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.AvgResourceCountBeforeFcp, true +} + +// SetAvgResourceCountBeforeFcp sets field value. +func (o *AggregatedSlowFCPHighBytes) SetAvgResourceCountBeforeFcp(v int64) { + o.AvgResourceCountBeforeFcp = v +} + +// GetFingerprint returns the Fingerprint field value. +func (o *AggregatedSlowFCPHighBytes) GetFingerprint() string { + if o == nil { + var ret string + return ret + } + return o.Fingerprint +} + +// GetFingerprintOk returns a tuple with the Fingerprint field value +// and a boolean to check if the value has been set. +func (o *AggregatedSlowFCPHighBytes) GetFingerprintOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Fingerprint, true +} + +// SetFingerprint sets field value. +func (o *AggregatedSlowFCPHighBytes) SetFingerprint(v string) { + o.Fingerprint = v +} + +// GetImpactScore returns the ImpactScore field value. +func (o *AggregatedSlowFCPHighBytes) GetImpactScore() float64 { + if o == nil { + var ret float64 + return ret + } + return o.ImpactScore +} + +// GetImpactScoreOk returns a tuple with the ImpactScore field value +// and a boolean to check if the value has been set. +func (o *AggregatedSlowFCPHighBytes) GetImpactScoreOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.ImpactScore, true +} + +// SetImpactScore sets field value. +func (o *AggregatedSlowFCPHighBytes) SetImpactScore(v float64) { + o.ImpactScore = v +} + +// GetPlatform returns the Platform field value. +func (o *AggregatedSlowFCPHighBytes) GetPlatform() string { + if o == nil { + var ret string + return ret + } + return o.Platform +} + +// GetPlatformOk returns a tuple with the Platform field value +// and a boolean to check if the value has been set. +func (o *AggregatedSlowFCPHighBytes) GetPlatformOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Platform, true +} + +// SetPlatform sets field value. +func (o *AggregatedSlowFCPHighBytes) SetPlatform(v string) { + o.Platform = v +} + +// GetViewOccurrences returns the ViewOccurrences field value. +func (o *AggregatedSlowFCPHighBytes) GetViewOccurrences() int32 { + if o == nil { + var ret int32 + return ret + } + return o.ViewOccurrences +} + +// GetViewOccurrencesOk returns a tuple with the ViewOccurrences field value +// and a boolean to check if the value has been set. +func (o *AggregatedSlowFCPHighBytes) GetViewOccurrencesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.ViewOccurrences, true +} + +// SetViewOccurrences sets field value. +func (o *AggregatedSlowFCPHighBytes) SetViewOccurrences(v int32) { + o.ViewOccurrences = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedSlowFCPHighBytes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["avg_bytes_before_fcp_bytes"] = o.AvgBytesBeforeFcpBytes + toSerialize["avg_first_contentful_paint_ms"] = o.AvgFirstContentfulPaintMs + toSerialize["avg_resource_count_before_fcp"] = o.AvgResourceCountBeforeFcp + toSerialize["fingerprint"] = o.Fingerprint + toSerialize["impact_score"] = o.ImpactScore + toSerialize["platform"] = o.Platform + toSerialize["view_occurrences"] = o.ViewOccurrences + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AggregatedSlowFCPHighBytes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AvgBytesBeforeFcpBytes *int64 `json:"avg_bytes_before_fcp_bytes"` + AvgFirstContentfulPaintMs *int64 `json:"avg_first_contentful_paint_ms"` + AvgResourceCountBeforeFcp *int64 `json:"avg_resource_count_before_fcp"` + Fingerprint *string `json:"fingerprint"` + ImpactScore *float64 `json:"impact_score"` + Platform *string `json:"platform"` + ViewOccurrences *int32 `json:"view_occurrences"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.AvgBytesBeforeFcpBytes == nil { + return fmt.Errorf("required field avg_bytes_before_fcp_bytes missing") + } + if all.AvgFirstContentfulPaintMs == nil { + return fmt.Errorf("required field avg_first_contentful_paint_ms missing") + } + if all.AvgResourceCountBeforeFcp == nil { + return fmt.Errorf("required field avg_resource_count_before_fcp missing") + } + if all.Fingerprint == nil { + return fmt.Errorf("required field fingerprint missing") + } + if all.ImpactScore == nil { + return fmt.Errorf("required field impact_score missing") + } + if all.Platform == nil { + return fmt.Errorf("required field platform missing") + } + if all.ViewOccurrences == nil { + return fmt.Errorf("required field view_occurrences missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"avg_bytes_before_fcp_bytes", "avg_first_contentful_paint_ms", "avg_resource_count_before_fcp", "fingerprint", "impact_score", "platform", "view_occurrences"}) + } else { + return err + } + o.AvgBytesBeforeFcpBytes = *all.AvgBytesBeforeFcpBytes + o.AvgFirstContentfulPaintMs = *all.AvgFirstContentfulPaintMs + o.AvgResourceCountBeforeFcp = *all.AvgResourceCountBeforeFcp + o.Fingerprint = *all.Fingerprint + o.ImpactScore = *all.ImpactScore + o.Platform = *all.Platform + o.ViewOccurrences = *all.ViewOccurrences + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aggregated_slow_interaction_long_task.go b/api/datadogV2/model_aggregated_slow_interaction_long_task.go new file mode 100644 index 00000000000..6e9d7ced281 --- /dev/null +++ b/api/datadogV2/model_aggregated_slow_interaction_long_task.go @@ -0,0 +1,361 @@ +// Unless explicitly stated otherwise all files in this repository 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" +) + +// AggregatedSlowInteractionLongTask Aggregated slow interaction with long task detection grouped by action and selector. +type AggregatedSlowInteractionLongTask struct { + // Type of user interaction that triggered the slow response. + ActionType string `json:"action_type"` + // Average long task blocking duration in nanoseconds. + AvgBlockingDuration int64 `json:"avg_blocking_duration"` + // Average total interaction duration in nanoseconds. + AvgDuration int64 `json:"avg_duration"` + // Unique fingerprint identifying this detection group. + Fingerprint string `json:"fingerprint"` + // Impact score combining view frequency and blocking severity. + ImpactScore float64 `json:"impact_score"` + // Total number of detection instances across sampled views. + InstanceCount int32 `json:"instance_count"` + // CSS selector of the element that was interacted with. + Selector datadog.NullableString `json:"selector"` + // Normalized CSS selector with dynamic parts replaced. + SelectorNormalized datadog.NullableString `json:"selector_normalized"` + // Number of sampled views where this detection occurred. + ViewOccurrences int32 `json:"view_occurrences"` + // 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:"-"` +} + +// NewAggregatedSlowInteractionLongTask instantiates a new AggregatedSlowInteractionLongTask 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 NewAggregatedSlowInteractionLongTask(actionType string, avgBlockingDuration int64, avgDuration int64, fingerprint string, impactScore float64, instanceCount int32, selector datadog.NullableString, selectorNormalized datadog.NullableString, viewOccurrences int32) *AggregatedSlowInteractionLongTask { + this := AggregatedSlowInteractionLongTask{} + this.ActionType = actionType + this.AvgBlockingDuration = avgBlockingDuration + this.AvgDuration = avgDuration + this.Fingerprint = fingerprint + this.ImpactScore = impactScore + this.InstanceCount = instanceCount + this.Selector = selector + this.SelectorNormalized = selectorNormalized + this.ViewOccurrences = viewOccurrences + return &this +} + +// NewAggregatedSlowInteractionLongTaskWithDefaults instantiates a new AggregatedSlowInteractionLongTask 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 NewAggregatedSlowInteractionLongTaskWithDefaults() *AggregatedSlowInteractionLongTask { + this := AggregatedSlowInteractionLongTask{} + return &this +} + +// GetActionType returns the ActionType field value. +func (o *AggregatedSlowInteractionLongTask) GetActionType() string { + if o == nil { + var ret string + return ret + } + return o.ActionType +} + +// GetActionTypeOk returns a tuple with the ActionType field value +// and a boolean to check if the value has been set. +func (o *AggregatedSlowInteractionLongTask) GetActionTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ActionType, true +} + +// SetActionType sets field value. +func (o *AggregatedSlowInteractionLongTask) SetActionType(v string) { + o.ActionType = v +} + +// GetAvgBlockingDuration returns the AvgBlockingDuration field value. +func (o *AggregatedSlowInteractionLongTask) GetAvgBlockingDuration() int64 { + if o == nil { + var ret int64 + return ret + } + return o.AvgBlockingDuration +} + +// GetAvgBlockingDurationOk returns a tuple with the AvgBlockingDuration field value +// and a boolean to check if the value has been set. +func (o *AggregatedSlowInteractionLongTask) GetAvgBlockingDurationOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.AvgBlockingDuration, true +} + +// SetAvgBlockingDuration sets field value. +func (o *AggregatedSlowInteractionLongTask) SetAvgBlockingDuration(v int64) { + o.AvgBlockingDuration = v +} + +// GetAvgDuration returns the AvgDuration field value. +func (o *AggregatedSlowInteractionLongTask) GetAvgDuration() int64 { + if o == nil { + var ret int64 + return ret + } + return o.AvgDuration +} + +// GetAvgDurationOk returns a tuple with the AvgDuration field value +// and a boolean to check if the value has been set. +func (o *AggregatedSlowInteractionLongTask) GetAvgDurationOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.AvgDuration, true +} + +// SetAvgDuration sets field value. +func (o *AggregatedSlowInteractionLongTask) SetAvgDuration(v int64) { + o.AvgDuration = v +} + +// GetFingerprint returns the Fingerprint field value. +func (o *AggregatedSlowInteractionLongTask) GetFingerprint() string { + if o == nil { + var ret string + return ret + } + return o.Fingerprint +} + +// GetFingerprintOk returns a tuple with the Fingerprint field value +// and a boolean to check if the value has been set. +func (o *AggregatedSlowInteractionLongTask) GetFingerprintOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Fingerprint, true +} + +// SetFingerprint sets field value. +func (o *AggregatedSlowInteractionLongTask) SetFingerprint(v string) { + o.Fingerprint = v +} + +// GetImpactScore returns the ImpactScore field value. +func (o *AggregatedSlowInteractionLongTask) GetImpactScore() float64 { + if o == nil { + var ret float64 + return ret + } + return o.ImpactScore +} + +// GetImpactScoreOk returns a tuple with the ImpactScore field value +// and a boolean to check if the value has been set. +func (o *AggregatedSlowInteractionLongTask) GetImpactScoreOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.ImpactScore, true +} + +// SetImpactScore sets field value. +func (o *AggregatedSlowInteractionLongTask) SetImpactScore(v float64) { + o.ImpactScore = v +} + +// GetInstanceCount returns the InstanceCount field value. +func (o *AggregatedSlowInteractionLongTask) GetInstanceCount() int32 { + if o == nil { + var ret int32 + return ret + } + return o.InstanceCount +} + +// GetInstanceCountOk returns a tuple with the InstanceCount field value +// and a boolean to check if the value has been set. +func (o *AggregatedSlowInteractionLongTask) GetInstanceCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.InstanceCount, true +} + +// SetInstanceCount sets field value. +func (o *AggregatedSlowInteractionLongTask) SetInstanceCount(v int32) { + o.InstanceCount = v +} + +// GetSelector returns the Selector field value. +// If the value is explicit nil, the zero value for string will be returned. +func (o *AggregatedSlowInteractionLongTask) GetSelector() string { + if o == nil || o.Selector.Get() == nil { + var ret string + return ret + } + return *o.Selector.Get() +} + +// GetSelectorOk returns a tuple with the Selector field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *AggregatedSlowInteractionLongTask) GetSelectorOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Selector.Get(), o.Selector.IsSet() +} + +// SetSelector sets field value. +func (o *AggregatedSlowInteractionLongTask) SetSelector(v string) { + o.Selector.Set(&v) +} + +// GetSelectorNormalized returns the SelectorNormalized field value. +// If the value is explicit nil, the zero value for string will be returned. +func (o *AggregatedSlowInteractionLongTask) GetSelectorNormalized() string { + if o == nil || o.SelectorNormalized.Get() == nil { + var ret string + return ret + } + return *o.SelectorNormalized.Get() +} + +// GetSelectorNormalizedOk returns a tuple with the SelectorNormalized field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *AggregatedSlowInteractionLongTask) GetSelectorNormalizedOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.SelectorNormalized.Get(), o.SelectorNormalized.IsSet() +} + +// SetSelectorNormalized sets field value. +func (o *AggregatedSlowInteractionLongTask) SetSelectorNormalized(v string) { + o.SelectorNormalized.Set(&v) +} + +// GetViewOccurrences returns the ViewOccurrences field value. +func (o *AggregatedSlowInteractionLongTask) GetViewOccurrences() int32 { + if o == nil { + var ret int32 + return ret + } + return o.ViewOccurrences +} + +// GetViewOccurrencesOk returns a tuple with the ViewOccurrences field value +// and a boolean to check if the value has been set. +func (o *AggregatedSlowInteractionLongTask) GetViewOccurrencesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.ViewOccurrences, true +} + +// SetViewOccurrences sets field value. +func (o *AggregatedSlowInteractionLongTask) SetViewOccurrences(v int32) { + o.ViewOccurrences = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedSlowInteractionLongTask) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["action_type"] = o.ActionType + toSerialize["avg_blocking_duration"] = o.AvgBlockingDuration + toSerialize["avg_duration"] = o.AvgDuration + toSerialize["fingerprint"] = o.Fingerprint + toSerialize["impact_score"] = o.ImpactScore + toSerialize["instance_count"] = o.InstanceCount + toSerialize["selector"] = o.Selector.Get() + toSerialize["selector_normalized"] = o.SelectorNormalized.Get() + toSerialize["view_occurrences"] = o.ViewOccurrences + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AggregatedSlowInteractionLongTask) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ActionType *string `json:"action_type"` + AvgBlockingDuration *int64 `json:"avg_blocking_duration"` + AvgDuration *int64 `json:"avg_duration"` + Fingerprint *string `json:"fingerprint"` + ImpactScore *float64 `json:"impact_score"` + InstanceCount *int32 `json:"instance_count"` + Selector datadog.NullableString `json:"selector"` + SelectorNormalized datadog.NullableString `json:"selector_normalized"` + ViewOccurrences *int32 `json:"view_occurrences"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.ActionType == nil { + return fmt.Errorf("required field action_type missing") + } + if all.AvgBlockingDuration == nil { + return fmt.Errorf("required field avg_blocking_duration missing") + } + if all.AvgDuration == nil { + return fmt.Errorf("required field avg_duration missing") + } + if all.Fingerprint == nil { + return fmt.Errorf("required field fingerprint missing") + } + if all.ImpactScore == nil { + return fmt.Errorf("required field impact_score missing") + } + if all.InstanceCount == nil { + return fmt.Errorf("required field instance_count missing") + } + if !all.Selector.IsSet() { + return fmt.Errorf("required field selector missing") + } + if !all.SelectorNormalized.IsSet() { + return fmt.Errorf("required field selector_normalized missing") + } + if all.ViewOccurrences == nil { + return fmt.Errorf("required field view_occurrences missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"action_type", "avg_blocking_duration", "avg_duration", "fingerprint", "impact_score", "instance_count", "selector", "selector_normalized", "view_occurrences"}) + } else { + return err + } + o.ActionType = *all.ActionType + o.AvgBlockingDuration = *all.AvgBlockingDuration + o.AvgDuration = *all.AvgDuration + o.Fingerprint = *all.Fingerprint + o.ImpactScore = *all.ImpactScore + o.InstanceCount = *all.InstanceCount + o.Selector = all.Selector + o.SelectorNormalized = all.SelectorNormalized + o.ViewOccurrences = *all.ViewOccurrences + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aggregated_uncompressed_resource.go b/api/datadogV2/model_aggregated_uncompressed_resource.go new file mode 100644 index 00000000000..09c090bafa2 --- /dev/null +++ b/api/datadogV2/model_aggregated_uncompressed_resource.go @@ -0,0 +1,393 @@ +// Unless explicitly stated otherwise all files in this repository 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" +) + +// AggregatedUncompressedResource Aggregated uncompressed resource detection grouped by URL path. +type AggregatedUncompressedResource struct { + // Average uncompressed body size in bytes. + AvgBodySize int64 `json:"avg_body_size"` + // Average resource loading duration in nanoseconds. + AvgDuration int64 `json:"avg_duration"` + // Unique fingerprint identifying this detection group. + Fingerprint string `json:"fingerprint"` + // Impact score combining view frequency and resource size. + ImpactScore float64 `json:"impact_score"` + // Total number of detection instances across sampled views. + InstanceCount int32 `json:"instance_count"` + // CDN or hosting provider type for the resource. + ProviderType datadog.NullableString `json:"provider_type"` + // Whether the resource is render-blocking. + RenderBlocking datadog.NullableString `json:"render_blocking"` + // Type of the resource (JS, CSS, image, fetch, and so on). + ResourceType string `json:"resource_type"` + // Normalized URL path pattern for the uncompressed resource. + UrlPathGroup string `json:"url_path_group"` + // Number of sampled views where this detection occurred. + ViewOccurrences int32 `json:"view_occurrences"` + // 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:"-"` +} + +// NewAggregatedUncompressedResource instantiates a new AggregatedUncompressedResource 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 NewAggregatedUncompressedResource(avgBodySize int64, avgDuration int64, fingerprint string, impactScore float64, instanceCount int32, providerType datadog.NullableString, renderBlocking datadog.NullableString, resourceType string, urlPathGroup string, viewOccurrences int32) *AggregatedUncompressedResource { + this := AggregatedUncompressedResource{} + this.AvgBodySize = avgBodySize + this.AvgDuration = avgDuration + this.Fingerprint = fingerprint + this.ImpactScore = impactScore + this.InstanceCount = instanceCount + this.ProviderType = providerType + this.RenderBlocking = renderBlocking + this.ResourceType = resourceType + this.UrlPathGroup = urlPathGroup + this.ViewOccurrences = viewOccurrences + return &this +} + +// NewAggregatedUncompressedResourceWithDefaults instantiates a new AggregatedUncompressedResource 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 NewAggregatedUncompressedResourceWithDefaults() *AggregatedUncompressedResource { + this := AggregatedUncompressedResource{} + return &this +} + +// GetAvgBodySize returns the AvgBodySize field value. +func (o *AggregatedUncompressedResource) GetAvgBodySize() int64 { + if o == nil { + var ret int64 + return ret + } + return o.AvgBodySize +} + +// GetAvgBodySizeOk returns a tuple with the AvgBodySize field value +// and a boolean to check if the value has been set. +func (o *AggregatedUncompressedResource) GetAvgBodySizeOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.AvgBodySize, true +} + +// SetAvgBodySize sets field value. +func (o *AggregatedUncompressedResource) SetAvgBodySize(v int64) { + o.AvgBodySize = v +} + +// GetAvgDuration returns the AvgDuration field value. +func (o *AggregatedUncompressedResource) GetAvgDuration() int64 { + if o == nil { + var ret int64 + return ret + } + return o.AvgDuration +} + +// GetAvgDurationOk returns a tuple with the AvgDuration field value +// and a boolean to check if the value has been set. +func (o *AggregatedUncompressedResource) GetAvgDurationOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.AvgDuration, true +} + +// SetAvgDuration sets field value. +func (o *AggregatedUncompressedResource) SetAvgDuration(v int64) { + o.AvgDuration = v +} + +// GetFingerprint returns the Fingerprint field value. +func (o *AggregatedUncompressedResource) GetFingerprint() string { + if o == nil { + var ret string + return ret + } + return o.Fingerprint +} + +// GetFingerprintOk returns a tuple with the Fingerprint field value +// and a boolean to check if the value has been set. +func (o *AggregatedUncompressedResource) GetFingerprintOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Fingerprint, true +} + +// SetFingerprint sets field value. +func (o *AggregatedUncompressedResource) SetFingerprint(v string) { + o.Fingerprint = v +} + +// GetImpactScore returns the ImpactScore field value. +func (o *AggregatedUncompressedResource) GetImpactScore() float64 { + if o == nil { + var ret float64 + return ret + } + return o.ImpactScore +} + +// GetImpactScoreOk returns a tuple with the ImpactScore field value +// and a boolean to check if the value has been set. +func (o *AggregatedUncompressedResource) GetImpactScoreOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.ImpactScore, true +} + +// SetImpactScore sets field value. +func (o *AggregatedUncompressedResource) SetImpactScore(v float64) { + o.ImpactScore = v +} + +// GetInstanceCount returns the InstanceCount field value. +func (o *AggregatedUncompressedResource) GetInstanceCount() int32 { + if o == nil { + var ret int32 + return ret + } + return o.InstanceCount +} + +// GetInstanceCountOk returns a tuple with the InstanceCount field value +// and a boolean to check if the value has been set. +func (o *AggregatedUncompressedResource) GetInstanceCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.InstanceCount, true +} + +// SetInstanceCount sets field value. +func (o *AggregatedUncompressedResource) SetInstanceCount(v int32) { + o.InstanceCount = v +} + +// GetProviderType returns the ProviderType field value. +// If the value is explicit nil, the zero value for string will be returned. +func (o *AggregatedUncompressedResource) GetProviderType() string { + if o == nil || o.ProviderType.Get() == nil { + var ret string + return ret + } + return *o.ProviderType.Get() +} + +// GetProviderTypeOk returns a tuple with the ProviderType field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *AggregatedUncompressedResource) GetProviderTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ProviderType.Get(), o.ProviderType.IsSet() +} + +// SetProviderType sets field value. +func (o *AggregatedUncompressedResource) SetProviderType(v string) { + o.ProviderType.Set(&v) +} + +// GetRenderBlocking returns the RenderBlocking field value. +// If the value is explicit nil, the zero value for string will be returned. +func (o *AggregatedUncompressedResource) GetRenderBlocking() string { + if o == nil || o.RenderBlocking.Get() == nil { + var ret string + return ret + } + return *o.RenderBlocking.Get() +} + +// GetRenderBlockingOk returns a tuple with the RenderBlocking field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *AggregatedUncompressedResource) GetRenderBlockingOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.RenderBlocking.Get(), o.RenderBlocking.IsSet() +} + +// SetRenderBlocking sets field value. +func (o *AggregatedUncompressedResource) SetRenderBlocking(v string) { + o.RenderBlocking.Set(&v) +} + +// GetResourceType returns the ResourceType field value. +func (o *AggregatedUncompressedResource) GetResourceType() string { + if o == nil { + var ret string + return ret + } + return o.ResourceType +} + +// GetResourceTypeOk returns a tuple with the ResourceType field value +// and a boolean to check if the value has been set. +func (o *AggregatedUncompressedResource) GetResourceTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ResourceType, true +} + +// SetResourceType sets field value. +func (o *AggregatedUncompressedResource) SetResourceType(v string) { + o.ResourceType = v +} + +// GetUrlPathGroup returns the UrlPathGroup field value. +func (o *AggregatedUncompressedResource) GetUrlPathGroup() string { + if o == nil { + var ret string + return ret + } + return o.UrlPathGroup +} + +// GetUrlPathGroupOk returns a tuple with the UrlPathGroup field value +// and a boolean to check if the value has been set. +func (o *AggregatedUncompressedResource) GetUrlPathGroupOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.UrlPathGroup, true +} + +// SetUrlPathGroup sets field value. +func (o *AggregatedUncompressedResource) SetUrlPathGroup(v string) { + o.UrlPathGroup = v +} + +// GetViewOccurrences returns the ViewOccurrences field value. +func (o *AggregatedUncompressedResource) GetViewOccurrences() int32 { + if o == nil { + var ret int32 + return ret + } + return o.ViewOccurrences +} + +// GetViewOccurrencesOk returns a tuple with the ViewOccurrences field value +// and a boolean to check if the value has been set. +func (o *AggregatedUncompressedResource) GetViewOccurrencesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.ViewOccurrences, true +} + +// SetViewOccurrences sets field value. +func (o *AggregatedUncompressedResource) SetViewOccurrences(v int32) { + o.ViewOccurrences = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedUncompressedResource) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["avg_body_size"] = o.AvgBodySize + toSerialize["avg_duration"] = o.AvgDuration + toSerialize["fingerprint"] = o.Fingerprint + toSerialize["impact_score"] = o.ImpactScore + toSerialize["instance_count"] = o.InstanceCount + toSerialize["provider_type"] = o.ProviderType.Get() + toSerialize["render_blocking"] = o.RenderBlocking.Get() + toSerialize["resource_type"] = o.ResourceType + toSerialize["url_path_group"] = o.UrlPathGroup + toSerialize["view_occurrences"] = o.ViewOccurrences + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AggregatedUncompressedResource) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AvgBodySize *int64 `json:"avg_body_size"` + AvgDuration *int64 `json:"avg_duration"` + Fingerprint *string `json:"fingerprint"` + ImpactScore *float64 `json:"impact_score"` + InstanceCount *int32 `json:"instance_count"` + ProviderType datadog.NullableString `json:"provider_type"` + RenderBlocking datadog.NullableString `json:"render_blocking"` + ResourceType *string `json:"resource_type"` + UrlPathGroup *string `json:"url_path_group"` + ViewOccurrences *int32 `json:"view_occurrences"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.AvgBodySize == nil { + return fmt.Errorf("required field avg_body_size missing") + } + if all.AvgDuration == nil { + return fmt.Errorf("required field avg_duration missing") + } + if all.Fingerprint == nil { + return fmt.Errorf("required field fingerprint missing") + } + if all.ImpactScore == nil { + return fmt.Errorf("required field impact_score missing") + } + if all.InstanceCount == nil { + return fmt.Errorf("required field instance_count missing") + } + if !all.ProviderType.IsSet() { + return fmt.Errorf("required field provider_type missing") + } + if !all.RenderBlocking.IsSet() { + return fmt.Errorf("required field render_blocking missing") + } + if all.ResourceType == nil { + return fmt.Errorf("required field resource_type missing") + } + if all.UrlPathGroup == nil { + return fmt.Errorf("required field url_path_group missing") + } + if all.ViewOccurrences == nil { + return fmt.Errorf("required field view_occurrences missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"avg_body_size", "avg_duration", "fingerprint", "impact_score", "instance_count", "provider_type", "render_blocking", "resource_type", "url_path_group", "view_occurrences"}) + } else { + return err + } + o.AvgBodySize = *all.AvgBodySize + o.AvgDuration = *all.AvgDuration + o.Fingerprint = *all.Fingerprint + o.ImpactScore = *all.ImpactScore + o.InstanceCount = *all.InstanceCount + o.ProviderType = all.ProviderType + o.RenderBlocking = all.RenderBlocking + o.ResourceType = *all.ResourceType + o.UrlPathGroup = *all.UrlPathGroup + o.ViewOccurrences = *all.ViewOccurrences + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aggregated_waterfall_performance_criteria.go b/api/datadogV2/model_aggregated_waterfall_performance_criteria.go new file mode 100644 index 00000000000..8fbfeb33a95 --- /dev/null +++ b/api/datadogV2/model_aggregated_waterfall_performance_criteria.go @@ -0,0 +1,181 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AggregatedWaterfallPerformanceCriteria Performance criteria to filter view instances by a metric threshold. +type AggregatedWaterfallPerformanceCriteria struct { + // Maximum threshold in seconds (inclusive). + Max *float64 `json:"max,omitempty"` + // Performance metric used to filter view instances by threshold. + Metric AggregatedWaterfallPerformanceCriteriaMetric `json:"metric"` + // Minimum threshold in seconds (inclusive). + Min *float64 `json:"min,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:"-"` +} + +// NewAggregatedWaterfallPerformanceCriteria instantiates a new AggregatedWaterfallPerformanceCriteria 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 NewAggregatedWaterfallPerformanceCriteria(metric AggregatedWaterfallPerformanceCriteriaMetric) *AggregatedWaterfallPerformanceCriteria { + this := AggregatedWaterfallPerformanceCriteria{} + this.Metric = metric + return &this +} + +// NewAggregatedWaterfallPerformanceCriteriaWithDefaults instantiates a new AggregatedWaterfallPerformanceCriteria 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 NewAggregatedWaterfallPerformanceCriteriaWithDefaults() *AggregatedWaterfallPerformanceCriteria { + this := AggregatedWaterfallPerformanceCriteria{} + return &this +} + +// GetMax returns the Max field value if set, zero value otherwise. +func (o *AggregatedWaterfallPerformanceCriteria) GetMax() float64 { + if o == nil || o.Max == nil { + var ret float64 + return ret + } + return *o.Max +} + +// GetMaxOk returns a tuple with the Max field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AggregatedWaterfallPerformanceCriteria) GetMaxOk() (*float64, bool) { + if o == nil || o.Max == nil { + return nil, false + } + return o.Max, true +} + +// HasMax returns a boolean if a field has been set. +func (o *AggregatedWaterfallPerformanceCriteria) HasMax() bool { + return o != nil && o.Max != nil +} + +// SetMax gets a reference to the given float64 and assigns it to the Max field. +func (o *AggregatedWaterfallPerformanceCriteria) SetMax(v float64) { + o.Max = &v +} + +// GetMetric returns the Metric field value. +func (o *AggregatedWaterfallPerformanceCriteria) GetMetric() AggregatedWaterfallPerformanceCriteriaMetric { + if o == nil { + var ret AggregatedWaterfallPerformanceCriteriaMetric + return ret + } + return o.Metric +} + +// GetMetricOk returns a tuple with the Metric field value +// and a boolean to check if the value has been set. +func (o *AggregatedWaterfallPerformanceCriteria) GetMetricOk() (*AggregatedWaterfallPerformanceCriteriaMetric, bool) { + if o == nil { + return nil, false + } + return &o.Metric, true +} + +// SetMetric sets field value. +func (o *AggregatedWaterfallPerformanceCriteria) SetMetric(v AggregatedWaterfallPerformanceCriteriaMetric) { + o.Metric = v +} + +// GetMin returns the Min field value if set, zero value otherwise. +func (o *AggregatedWaterfallPerformanceCriteria) GetMin() float64 { + if o == nil || o.Min == nil { + var ret float64 + return ret + } + return *o.Min +} + +// GetMinOk returns a tuple with the Min field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AggregatedWaterfallPerformanceCriteria) GetMinOk() (*float64, bool) { + if o == nil || o.Min == nil { + return nil, false + } + return o.Min, true +} + +// HasMin returns a boolean if a field has been set. +func (o *AggregatedWaterfallPerformanceCriteria) HasMin() bool { + return o != nil && o.Min != nil +} + +// SetMin gets a reference to the given float64 and assigns it to the Min field. +func (o *AggregatedWaterfallPerformanceCriteria) SetMin(v float64) { + o.Min = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedWaterfallPerformanceCriteria) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Max != nil { + toSerialize["max"] = o.Max + } + toSerialize["metric"] = o.Metric + if o.Min != nil { + toSerialize["min"] = o.Min + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AggregatedWaterfallPerformanceCriteria) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Max *float64 `json:"max,omitempty"` + Metric *AggregatedWaterfallPerformanceCriteriaMetric `json:"metric"` + Min *float64 `json:"min,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Metric == nil { + return fmt.Errorf("required field metric missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"max", "metric", "min"}) + } else { + return err + } + + hasInvalidField := false + o.Max = all.Max + if !all.Metric.IsValid() { + hasInvalidField = true + } else { + o.Metric = *all.Metric + } + o.Min = all.Min + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_aggregated_waterfall_performance_criteria_metric.go b/api/datadogV2/model_aggregated_waterfall_performance_criteria_metric.go new file mode 100644 index 00000000000..80dea27d204 --- /dev/null +++ b/api/datadogV2/model_aggregated_waterfall_performance_criteria_metric.go @@ -0,0 +1,70 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AggregatedWaterfallPerformanceCriteriaMetric Performance metric used to filter view instances by threshold. +type AggregatedWaterfallPerformanceCriteriaMetric string + +// List of AggregatedWaterfallPerformanceCriteriaMetric. +const ( + AGGREGATEDWATERFALLPERFORMANCECRITERIAMETRIC_LoadingTime AggregatedWaterfallPerformanceCriteriaMetric = "loading_time" + AGGREGATEDWATERFALLPERFORMANCECRITERIAMETRIC_LargestContentfulPaint AggregatedWaterfallPerformanceCriteriaMetric = "largest_contentful_paint" + AGGREGATEDWATERFALLPERFORMANCECRITERIAMETRIC_FirstContentfulPaint AggregatedWaterfallPerformanceCriteriaMetric = "first_contentful_paint" + AGGREGATEDWATERFALLPERFORMANCECRITERIAMETRIC_InteractionToNextPaint AggregatedWaterfallPerformanceCriteriaMetric = "interaction_to_next_paint" +) + +var allowedAggregatedWaterfallPerformanceCriteriaMetricEnumValues = []AggregatedWaterfallPerformanceCriteriaMetric{ + AGGREGATEDWATERFALLPERFORMANCECRITERIAMETRIC_LoadingTime, + AGGREGATEDWATERFALLPERFORMANCECRITERIAMETRIC_LargestContentfulPaint, + AGGREGATEDWATERFALLPERFORMANCECRITERIAMETRIC_FirstContentfulPaint, + AGGREGATEDWATERFALLPERFORMANCECRITERIAMETRIC_InteractionToNextPaint, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *AggregatedWaterfallPerformanceCriteriaMetric) GetAllowedValues() []AggregatedWaterfallPerformanceCriteriaMetric { + return allowedAggregatedWaterfallPerformanceCriteriaMetricEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *AggregatedWaterfallPerformanceCriteriaMetric) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = AggregatedWaterfallPerformanceCriteriaMetric(value) + return nil +} + +// NewAggregatedWaterfallPerformanceCriteriaMetricFromValue returns a pointer to a valid AggregatedWaterfallPerformanceCriteriaMetric +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewAggregatedWaterfallPerformanceCriteriaMetricFromValue(v string) (*AggregatedWaterfallPerformanceCriteriaMetric, error) { + ev := AggregatedWaterfallPerformanceCriteriaMetric(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for AggregatedWaterfallPerformanceCriteriaMetric: valid values are %v", v, allowedAggregatedWaterfallPerformanceCriteriaMetricEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v AggregatedWaterfallPerformanceCriteriaMetric) IsValid() bool { + for _, existing := range allowedAggregatedWaterfallPerformanceCriteriaMetricEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AggregatedWaterfallPerformanceCriteriaMetric value. +func (v AggregatedWaterfallPerformanceCriteriaMetric) Ptr() *AggregatedWaterfallPerformanceCriteriaMetric { + return &v +} diff --git a/api/datadogV2/model_aggregated_waterfall_request.go b/api/datadogV2/model_aggregated_waterfall_request.go new file mode 100644 index 00000000000..03893677f41 --- /dev/null +++ b/api/datadogV2/model_aggregated_waterfall_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" +) + +// AggregatedWaterfallRequest Request body for the aggregated waterfall endpoint. +type AggregatedWaterfallRequest struct { + // Data envelope for an aggregated waterfall request. + Data AggregatedWaterfallRequestData `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:"-"` +} + +// NewAggregatedWaterfallRequest instantiates a new AggregatedWaterfallRequest 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 NewAggregatedWaterfallRequest(data AggregatedWaterfallRequestData) *AggregatedWaterfallRequest { + this := AggregatedWaterfallRequest{} + this.Data = data + return &this +} + +// NewAggregatedWaterfallRequestWithDefaults instantiates a new AggregatedWaterfallRequest 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 NewAggregatedWaterfallRequestWithDefaults() *AggregatedWaterfallRequest { + this := AggregatedWaterfallRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *AggregatedWaterfallRequest) GetData() AggregatedWaterfallRequestData { + if o == nil { + var ret AggregatedWaterfallRequestData + 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 *AggregatedWaterfallRequest) GetDataOk() (*AggregatedWaterfallRequestData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *AggregatedWaterfallRequest) SetData(v AggregatedWaterfallRequestData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedWaterfallRequest) 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 *AggregatedWaterfallRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *AggregatedWaterfallRequestData `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_aggregated_waterfall_request_attributes.go b/api/datadogV2/model_aggregated_waterfall_request_attributes.go new file mode 100644 index 00000000000..3a14786fd8d --- /dev/null +++ b/api/datadogV2/model_aggregated_waterfall_request_attributes.go @@ -0,0 +1,343 @@ +// Unless explicitly stated otherwise all files in this repository 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" +) + +// AggregatedWaterfallRequestAttributes Attributes for an aggregated waterfall query. +type AggregatedWaterfallRequestAttributes struct { + // The RUM application ID to analyze. + ApplicationId string `json:"application_id"` + // Performance criteria to filter view instances by a metric threshold. + Criteria *AggregatedWaterfallPerformanceCriteria `json:"criteria,omitempty"` + // RUM query string to filter events (for example, @session.type:user @geo.country:US). + Filter *string `json:"filter,omitempty"` + // Start of the time range as a Unix timestamp in seconds. + From int64 `json:"from"` + // When true, enriches each resource with cross-view appearance statistics. + IncludeGlobalAppearance *bool `json:"include_global_appearance,omitempty"` + // Number of view instances to sample, between 1 and 500. + SampleSize int32 `json:"sample_size"` + // End of the time range as a Unix timestamp in seconds. + To int64 `json:"to"` + // The RUM view name to analyze (for example, /account/login). + ViewName string `json:"view_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:"-"` +} + +// NewAggregatedWaterfallRequestAttributes instantiates a new AggregatedWaterfallRequestAttributes 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 NewAggregatedWaterfallRequestAttributes(applicationId string, from int64, sampleSize int32, to int64, viewName string) *AggregatedWaterfallRequestAttributes { + this := AggregatedWaterfallRequestAttributes{} + this.ApplicationId = applicationId + this.From = from + this.SampleSize = sampleSize + this.To = to + this.ViewName = viewName + return &this +} + +// NewAggregatedWaterfallRequestAttributesWithDefaults instantiates a new AggregatedWaterfallRequestAttributes 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 NewAggregatedWaterfallRequestAttributesWithDefaults() *AggregatedWaterfallRequestAttributes { + this := AggregatedWaterfallRequestAttributes{} + return &this +} + +// GetApplicationId returns the ApplicationId field value. +func (o *AggregatedWaterfallRequestAttributes) GetApplicationId() string { + if o == nil { + var ret string + return ret + } + return o.ApplicationId +} + +// GetApplicationIdOk returns a tuple with the ApplicationId field value +// and a boolean to check if the value has been set. +func (o *AggregatedWaterfallRequestAttributes) GetApplicationIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ApplicationId, true +} + +// SetApplicationId sets field value. +func (o *AggregatedWaterfallRequestAttributes) SetApplicationId(v string) { + o.ApplicationId = v +} + +// GetCriteria returns the Criteria field value if set, zero value otherwise. +func (o *AggregatedWaterfallRequestAttributes) GetCriteria() AggregatedWaterfallPerformanceCriteria { + if o == nil || o.Criteria == nil { + var ret AggregatedWaterfallPerformanceCriteria + return ret + } + return *o.Criteria +} + +// GetCriteriaOk returns a tuple with the Criteria field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AggregatedWaterfallRequestAttributes) GetCriteriaOk() (*AggregatedWaterfallPerformanceCriteria, bool) { + if o == nil || o.Criteria == nil { + return nil, false + } + return o.Criteria, true +} + +// HasCriteria returns a boolean if a field has been set. +func (o *AggregatedWaterfallRequestAttributes) HasCriteria() bool { + return o != nil && o.Criteria != nil +} + +// SetCriteria gets a reference to the given AggregatedWaterfallPerformanceCriteria and assigns it to the Criteria field. +func (o *AggregatedWaterfallRequestAttributes) SetCriteria(v AggregatedWaterfallPerformanceCriteria) { + o.Criteria = &v +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *AggregatedWaterfallRequestAttributes) GetFilter() string { + if o == nil || o.Filter == nil { + var ret string + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AggregatedWaterfallRequestAttributes) GetFilterOk() (*string, bool) { + if o == nil || o.Filter == nil { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *AggregatedWaterfallRequestAttributes) HasFilter() bool { + return o != nil && o.Filter != nil +} + +// SetFilter gets a reference to the given string and assigns it to the Filter field. +func (o *AggregatedWaterfallRequestAttributes) SetFilter(v string) { + o.Filter = &v +} + +// GetFrom returns the From field value. +func (o *AggregatedWaterfallRequestAttributes) GetFrom() int64 { + if o == nil { + var ret int64 + return ret + } + return o.From +} + +// GetFromOk returns a tuple with the From field value +// and a boolean to check if the value has been set. +func (o *AggregatedWaterfallRequestAttributes) GetFromOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.From, true +} + +// SetFrom sets field value. +func (o *AggregatedWaterfallRequestAttributes) SetFrom(v int64) { + o.From = v +} + +// GetIncludeGlobalAppearance returns the IncludeGlobalAppearance field value if set, zero value otherwise. +func (o *AggregatedWaterfallRequestAttributes) GetIncludeGlobalAppearance() bool { + if o == nil || o.IncludeGlobalAppearance == nil { + var ret bool + return ret + } + return *o.IncludeGlobalAppearance +} + +// GetIncludeGlobalAppearanceOk returns a tuple with the IncludeGlobalAppearance field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AggregatedWaterfallRequestAttributes) GetIncludeGlobalAppearanceOk() (*bool, bool) { + if o == nil || o.IncludeGlobalAppearance == nil { + return nil, false + } + return o.IncludeGlobalAppearance, true +} + +// HasIncludeGlobalAppearance returns a boolean if a field has been set. +func (o *AggregatedWaterfallRequestAttributes) HasIncludeGlobalAppearance() bool { + return o != nil && o.IncludeGlobalAppearance != nil +} + +// SetIncludeGlobalAppearance gets a reference to the given bool and assigns it to the IncludeGlobalAppearance field. +func (o *AggregatedWaterfallRequestAttributes) SetIncludeGlobalAppearance(v bool) { + o.IncludeGlobalAppearance = &v +} + +// GetSampleSize returns the SampleSize field value. +func (o *AggregatedWaterfallRequestAttributes) GetSampleSize() int32 { + if o == nil { + var ret int32 + return ret + } + return o.SampleSize +} + +// GetSampleSizeOk returns a tuple with the SampleSize field value +// and a boolean to check if the value has been set. +func (o *AggregatedWaterfallRequestAttributes) GetSampleSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.SampleSize, true +} + +// SetSampleSize sets field value. +func (o *AggregatedWaterfallRequestAttributes) SetSampleSize(v int32) { + o.SampleSize = v +} + +// GetTo returns the To field value. +func (o *AggregatedWaterfallRequestAttributes) GetTo() int64 { + if o == nil { + var ret int64 + return ret + } + return o.To +} + +// GetToOk returns a tuple with the To field value +// and a boolean to check if the value has been set. +func (o *AggregatedWaterfallRequestAttributes) GetToOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.To, true +} + +// SetTo sets field value. +func (o *AggregatedWaterfallRequestAttributes) SetTo(v int64) { + o.To = v +} + +// GetViewName returns the ViewName field value. +func (o *AggregatedWaterfallRequestAttributes) GetViewName() string { + if o == nil { + var ret string + return ret + } + return o.ViewName +} + +// GetViewNameOk returns a tuple with the ViewName field value +// and a boolean to check if the value has been set. +func (o *AggregatedWaterfallRequestAttributes) GetViewNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ViewName, true +} + +// SetViewName sets field value. +func (o *AggregatedWaterfallRequestAttributes) SetViewName(v string) { + o.ViewName = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedWaterfallRequestAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["application_id"] = o.ApplicationId + if o.Criteria != nil { + toSerialize["criteria"] = o.Criteria + } + if o.Filter != nil { + toSerialize["filter"] = o.Filter + } + toSerialize["from"] = o.From + if o.IncludeGlobalAppearance != nil { + toSerialize["include_global_appearance"] = o.IncludeGlobalAppearance + } + toSerialize["sample_size"] = o.SampleSize + toSerialize["to"] = o.To + toSerialize["view_name"] = o.ViewName + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AggregatedWaterfallRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ApplicationId *string `json:"application_id"` + Criteria *AggregatedWaterfallPerformanceCriteria `json:"criteria,omitempty"` + Filter *string `json:"filter,omitempty"` + From *int64 `json:"from"` + IncludeGlobalAppearance *bool `json:"include_global_appearance,omitempty"` + SampleSize *int32 `json:"sample_size"` + To *int64 `json:"to"` + ViewName *string `json:"view_name"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.ApplicationId == nil { + return fmt.Errorf("required field application_id missing") + } + if all.From == nil { + return fmt.Errorf("required field from missing") + } + if all.SampleSize == nil { + return fmt.Errorf("required field sample_size missing") + } + if all.To == nil { + return fmt.Errorf("required field to missing") + } + if all.ViewName == nil { + return fmt.Errorf("required field view_name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"application_id", "criteria", "filter", "from", "include_global_appearance", "sample_size", "to", "view_name"}) + } else { + return err + } + + hasInvalidField := false + o.ApplicationId = *all.ApplicationId + if all.Criteria != nil && all.Criteria.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Criteria = all.Criteria + o.Filter = all.Filter + o.From = *all.From + o.IncludeGlobalAppearance = all.IncludeGlobalAppearance + o.SampleSize = *all.SampleSize + o.To = *all.To + o.ViewName = *all.ViewName + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_aggregated_waterfall_request_data.go b/api/datadogV2/model_aggregated_waterfall_request_data.go new file mode 100644 index 00000000000..a8e8ec02486 --- /dev/null +++ b/api/datadogV2/model_aggregated_waterfall_request_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" +) + +// AggregatedWaterfallRequestData Data envelope for an aggregated waterfall request. +type AggregatedWaterfallRequestData struct { + // Attributes for an aggregated waterfall query. + Attributes AggregatedWaterfallRequestAttributes `json:"attributes"` + // The JSON:API type for aggregated waterfall requests. + Type AggregatedWaterfallRequestType `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:"-"` +} + +// NewAggregatedWaterfallRequestData instantiates a new AggregatedWaterfallRequestData 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 NewAggregatedWaterfallRequestData(attributes AggregatedWaterfallRequestAttributes, typeVar AggregatedWaterfallRequestType) *AggregatedWaterfallRequestData { + this := AggregatedWaterfallRequestData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewAggregatedWaterfallRequestDataWithDefaults instantiates a new AggregatedWaterfallRequestData 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 NewAggregatedWaterfallRequestDataWithDefaults() *AggregatedWaterfallRequestData { + this := AggregatedWaterfallRequestData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *AggregatedWaterfallRequestData) GetAttributes() AggregatedWaterfallRequestAttributes { + if o == nil { + var ret AggregatedWaterfallRequestAttributes + 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 *AggregatedWaterfallRequestData) GetAttributesOk() (*AggregatedWaterfallRequestAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *AggregatedWaterfallRequestData) SetAttributes(v AggregatedWaterfallRequestAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *AggregatedWaterfallRequestData) GetType() AggregatedWaterfallRequestType { + if o == nil { + var ret AggregatedWaterfallRequestType + 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 *AggregatedWaterfallRequestData) GetTypeOk() (*AggregatedWaterfallRequestType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AggregatedWaterfallRequestData) SetType(v AggregatedWaterfallRequestType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedWaterfallRequestData) 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 *AggregatedWaterfallRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AggregatedWaterfallRequestAttributes `json:"attributes"` + Type *AggregatedWaterfallRequestType `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_aggregated_waterfall_request_type.go b/api/datadogV2/model_aggregated_waterfall_request_type.go new file mode 100644 index 00000000000..de2c70abfb3 --- /dev/null +++ b/api/datadogV2/model_aggregated_waterfall_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" +) + +// AggregatedWaterfallRequestType The JSON:API type for aggregated waterfall requests. +type AggregatedWaterfallRequestType string + +// List of AggregatedWaterfallRequestType. +const ( + AGGREGATEDWATERFALLREQUESTTYPE_AggregatedWaterfall AggregatedWaterfallRequestType = "aggregated_waterfall" +) + +var allowedAggregatedWaterfallRequestTypeEnumValues = []AggregatedWaterfallRequestType{ + AGGREGATEDWATERFALLREQUESTTYPE_AggregatedWaterfall, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *AggregatedWaterfallRequestType) GetAllowedValues() []AggregatedWaterfallRequestType { + return allowedAggregatedWaterfallRequestTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *AggregatedWaterfallRequestType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = AggregatedWaterfallRequestType(value) + return nil +} + +// NewAggregatedWaterfallRequestTypeFromValue returns a pointer to a valid AggregatedWaterfallRequestType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewAggregatedWaterfallRequestTypeFromValue(v string) (*AggregatedWaterfallRequestType, error) { + ev := AggregatedWaterfallRequestType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for AggregatedWaterfallRequestType: valid values are %v", v, allowedAggregatedWaterfallRequestTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v AggregatedWaterfallRequestType) IsValid() bool { + for _, existing := range allowedAggregatedWaterfallRequestTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AggregatedWaterfallRequestType value. +func (v AggregatedWaterfallRequestType) Ptr() *AggregatedWaterfallRequestType { + return &v +} diff --git a/api/datadogV2/model_aggregated_waterfall_response.go b/api/datadogV2/model_aggregated_waterfall_response.go new file mode 100644 index 00000000000..d972e353967 --- /dev/null +++ b/api/datadogV2/model_aggregated_waterfall_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" +) + +// AggregatedWaterfallResponse Response body for the aggregated waterfall endpoint. +type AggregatedWaterfallResponse struct { + // Data envelope for an aggregated waterfall response. + Data AggregatedWaterfallResponseData `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:"-"` +} + +// NewAggregatedWaterfallResponse instantiates a new AggregatedWaterfallResponse 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 NewAggregatedWaterfallResponse(data AggregatedWaterfallResponseData) *AggregatedWaterfallResponse { + this := AggregatedWaterfallResponse{} + this.Data = data + return &this +} + +// NewAggregatedWaterfallResponseWithDefaults instantiates a new AggregatedWaterfallResponse 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 NewAggregatedWaterfallResponseWithDefaults() *AggregatedWaterfallResponse { + this := AggregatedWaterfallResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *AggregatedWaterfallResponse) GetData() AggregatedWaterfallResponseData { + if o == nil { + var ret AggregatedWaterfallResponseData + 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 *AggregatedWaterfallResponse) GetDataOk() (*AggregatedWaterfallResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *AggregatedWaterfallResponse) SetData(v AggregatedWaterfallResponseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedWaterfallResponse) 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 *AggregatedWaterfallResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *AggregatedWaterfallResponseData `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_aggregated_waterfall_response_attributes.go b/api/datadogV2/model_aggregated_waterfall_response_attributes.go new file mode 100644 index 00000000000..e8cfbd56452 --- /dev/null +++ b/api/datadogV2/model_aggregated_waterfall_response_attributes.go @@ -0,0 +1,369 @@ +// Unless explicitly stated otherwise all files in this repository 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" +) + +// AggregatedWaterfallResponseAttributes Attributes of an aggregated waterfall response. +type AggregatedWaterfallResponseAttributes struct { + // The RUM application ID that was analyzed. + ApplicationId string `json:"application_id"` + // Performance criteria to filter view instances by a metric threshold. + Criteria *AggregatedWaterfallPerformanceCriteria `json:"criteria,omitempty"` + // Start of the analyzed time range as a Unix timestamp in seconds. + From int64 `json:"from"` + // Network resources in chronological waterfall order. + Resources []AggregatedResource `json:"resources"` + // List of RUM view IDs sampled for this aggregation, capped at 50. + SampledViewIds []string `json:"sampled_view_ids"` + // End of the analyzed time range as a Unix timestamp in seconds. + To int64 `json:"to"` + // Overall cache hit rate across all sampled views. + TotalCacheHitRatePct float64 `json:"total_cache_hit_rate_pct"` + // Number of view instances included in the analysis. + ViewCount int32 `json:"view_count"` + // The RUM view name that was analyzed. + ViewName string `json:"view_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:"-"` +} + +// NewAggregatedWaterfallResponseAttributes instantiates a new AggregatedWaterfallResponseAttributes 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 NewAggregatedWaterfallResponseAttributes(applicationId string, from int64, resources []AggregatedResource, sampledViewIds []string, to int64, totalCacheHitRatePct float64, viewCount int32, viewName string) *AggregatedWaterfallResponseAttributes { + this := AggregatedWaterfallResponseAttributes{} + this.ApplicationId = applicationId + this.From = from + this.Resources = resources + this.SampledViewIds = sampledViewIds + this.To = to + this.TotalCacheHitRatePct = totalCacheHitRatePct + this.ViewCount = viewCount + this.ViewName = viewName + return &this +} + +// NewAggregatedWaterfallResponseAttributesWithDefaults instantiates a new AggregatedWaterfallResponseAttributes 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 NewAggregatedWaterfallResponseAttributesWithDefaults() *AggregatedWaterfallResponseAttributes { + this := AggregatedWaterfallResponseAttributes{} + return &this +} + +// GetApplicationId returns the ApplicationId field value. +func (o *AggregatedWaterfallResponseAttributes) GetApplicationId() string { + if o == nil { + var ret string + return ret + } + return o.ApplicationId +} + +// GetApplicationIdOk returns a tuple with the ApplicationId field value +// and a boolean to check if the value has been set. +func (o *AggregatedWaterfallResponseAttributes) GetApplicationIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ApplicationId, true +} + +// SetApplicationId sets field value. +func (o *AggregatedWaterfallResponseAttributes) SetApplicationId(v string) { + o.ApplicationId = v +} + +// GetCriteria returns the Criteria field value if set, zero value otherwise. +func (o *AggregatedWaterfallResponseAttributes) GetCriteria() AggregatedWaterfallPerformanceCriteria { + if o == nil || o.Criteria == nil { + var ret AggregatedWaterfallPerformanceCriteria + return ret + } + return *o.Criteria +} + +// GetCriteriaOk returns a tuple with the Criteria field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AggregatedWaterfallResponseAttributes) GetCriteriaOk() (*AggregatedWaterfallPerformanceCriteria, bool) { + if o == nil || o.Criteria == nil { + return nil, false + } + return o.Criteria, true +} + +// HasCriteria returns a boolean if a field has been set. +func (o *AggregatedWaterfallResponseAttributes) HasCriteria() bool { + return o != nil && o.Criteria != nil +} + +// SetCriteria gets a reference to the given AggregatedWaterfallPerformanceCriteria and assigns it to the Criteria field. +func (o *AggregatedWaterfallResponseAttributes) SetCriteria(v AggregatedWaterfallPerformanceCriteria) { + o.Criteria = &v +} + +// GetFrom returns the From field value. +func (o *AggregatedWaterfallResponseAttributes) GetFrom() int64 { + if o == nil { + var ret int64 + return ret + } + return o.From +} + +// GetFromOk returns a tuple with the From field value +// and a boolean to check if the value has been set. +func (o *AggregatedWaterfallResponseAttributes) GetFromOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.From, true +} + +// SetFrom sets field value. +func (o *AggregatedWaterfallResponseAttributes) SetFrom(v int64) { + o.From = v +} + +// GetResources returns the Resources field value. +func (o *AggregatedWaterfallResponseAttributes) GetResources() []AggregatedResource { + if o == nil { + var ret []AggregatedResource + return ret + } + return o.Resources +} + +// GetResourcesOk returns a tuple with the Resources field value +// and a boolean to check if the value has been set. +func (o *AggregatedWaterfallResponseAttributes) GetResourcesOk() (*[]AggregatedResource, bool) { + if o == nil { + return nil, false + } + return &o.Resources, true +} + +// SetResources sets field value. +func (o *AggregatedWaterfallResponseAttributes) SetResources(v []AggregatedResource) { + o.Resources = v +} + +// GetSampledViewIds returns the SampledViewIds field value. +func (o *AggregatedWaterfallResponseAttributes) GetSampledViewIds() []string { + if o == nil { + var ret []string + return ret + } + return o.SampledViewIds +} + +// GetSampledViewIdsOk returns a tuple with the SampledViewIds field value +// and a boolean to check if the value has been set. +func (o *AggregatedWaterfallResponseAttributes) GetSampledViewIdsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.SampledViewIds, true +} + +// SetSampledViewIds sets field value. +func (o *AggregatedWaterfallResponseAttributes) SetSampledViewIds(v []string) { + o.SampledViewIds = v +} + +// GetTo returns the To field value. +func (o *AggregatedWaterfallResponseAttributes) GetTo() int64 { + if o == nil { + var ret int64 + return ret + } + return o.To +} + +// GetToOk returns a tuple with the To field value +// and a boolean to check if the value has been set. +func (o *AggregatedWaterfallResponseAttributes) GetToOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.To, true +} + +// SetTo sets field value. +func (o *AggregatedWaterfallResponseAttributes) SetTo(v int64) { + o.To = v +} + +// GetTotalCacheHitRatePct returns the TotalCacheHitRatePct field value. +func (o *AggregatedWaterfallResponseAttributes) GetTotalCacheHitRatePct() float64 { + if o == nil { + var ret float64 + return ret + } + return o.TotalCacheHitRatePct +} + +// GetTotalCacheHitRatePctOk returns a tuple with the TotalCacheHitRatePct field value +// and a boolean to check if the value has been set. +func (o *AggregatedWaterfallResponseAttributes) GetTotalCacheHitRatePctOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.TotalCacheHitRatePct, true +} + +// SetTotalCacheHitRatePct sets field value. +func (o *AggregatedWaterfallResponseAttributes) SetTotalCacheHitRatePct(v float64) { + o.TotalCacheHitRatePct = v +} + +// GetViewCount returns the ViewCount field value. +func (o *AggregatedWaterfallResponseAttributes) GetViewCount() int32 { + if o == nil { + var ret int32 + return ret + } + return o.ViewCount +} + +// GetViewCountOk returns a tuple with the ViewCount field value +// and a boolean to check if the value has been set. +func (o *AggregatedWaterfallResponseAttributes) GetViewCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.ViewCount, true +} + +// SetViewCount sets field value. +func (o *AggregatedWaterfallResponseAttributes) SetViewCount(v int32) { + o.ViewCount = v +} + +// GetViewName returns the ViewName field value. +func (o *AggregatedWaterfallResponseAttributes) GetViewName() string { + if o == nil { + var ret string + return ret + } + return o.ViewName +} + +// GetViewNameOk returns a tuple with the ViewName field value +// and a boolean to check if the value has been set. +func (o *AggregatedWaterfallResponseAttributes) GetViewNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ViewName, true +} + +// SetViewName sets field value. +func (o *AggregatedWaterfallResponseAttributes) SetViewName(v string) { + o.ViewName = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedWaterfallResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["application_id"] = o.ApplicationId + if o.Criteria != nil { + toSerialize["criteria"] = o.Criteria + } + toSerialize["from"] = o.From + toSerialize["resources"] = o.Resources + toSerialize["sampled_view_ids"] = o.SampledViewIds + toSerialize["to"] = o.To + toSerialize["total_cache_hit_rate_pct"] = o.TotalCacheHitRatePct + toSerialize["view_count"] = o.ViewCount + toSerialize["view_name"] = o.ViewName + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AggregatedWaterfallResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ApplicationId *string `json:"application_id"` + Criteria *AggregatedWaterfallPerformanceCriteria `json:"criteria,omitempty"` + From *int64 `json:"from"` + Resources *[]AggregatedResource `json:"resources"` + SampledViewIds *[]string `json:"sampled_view_ids"` + To *int64 `json:"to"` + TotalCacheHitRatePct *float64 `json:"total_cache_hit_rate_pct"` + ViewCount *int32 `json:"view_count"` + ViewName *string `json:"view_name"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.ApplicationId == nil { + return fmt.Errorf("required field application_id missing") + } + if all.From == nil { + return fmt.Errorf("required field from missing") + } + if all.Resources == nil { + return fmt.Errorf("required field resources missing") + } + if all.SampledViewIds == nil { + return fmt.Errorf("required field sampled_view_ids missing") + } + if all.To == nil { + return fmt.Errorf("required field to missing") + } + if all.TotalCacheHitRatePct == nil { + return fmt.Errorf("required field total_cache_hit_rate_pct missing") + } + if all.ViewCount == nil { + return fmt.Errorf("required field view_count missing") + } + if all.ViewName == nil { + return fmt.Errorf("required field view_name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"application_id", "criteria", "from", "resources", "sampled_view_ids", "to", "total_cache_hit_rate_pct", "view_count", "view_name"}) + } else { + return err + } + + hasInvalidField := false + o.ApplicationId = *all.ApplicationId + if all.Criteria != nil && all.Criteria.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Criteria = all.Criteria + o.From = *all.From + o.Resources = *all.Resources + o.SampledViewIds = *all.SampledViewIds + o.To = *all.To + o.TotalCacheHitRatePct = *all.TotalCacheHitRatePct + o.ViewCount = *all.ViewCount + o.ViewName = *all.ViewName + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_aggregated_waterfall_response_data.go b/api/datadogV2/model_aggregated_waterfall_response_data.go new file mode 100644 index 00000000000..707f4f6e3a6 --- /dev/null +++ b/api/datadogV2/model_aggregated_waterfall_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" +) + +// AggregatedWaterfallResponseData Data envelope for an aggregated waterfall response. +type AggregatedWaterfallResponseData struct { + // Attributes of an aggregated waterfall response. + Attributes AggregatedWaterfallResponseAttributes `json:"attributes"` + // Hash-based unique identifier for this aggregation. + Id string `json:"id"` + // The JSON:API type for aggregated waterfall requests. + Type AggregatedWaterfallRequestType `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:"-"` +} + +// NewAggregatedWaterfallResponseData instantiates a new AggregatedWaterfallResponseData 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 NewAggregatedWaterfallResponseData(attributes AggregatedWaterfallResponseAttributes, id string, typeVar AggregatedWaterfallRequestType) *AggregatedWaterfallResponseData { + this := AggregatedWaterfallResponseData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewAggregatedWaterfallResponseDataWithDefaults instantiates a new AggregatedWaterfallResponseData 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 NewAggregatedWaterfallResponseDataWithDefaults() *AggregatedWaterfallResponseData { + this := AggregatedWaterfallResponseData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *AggregatedWaterfallResponseData) GetAttributes() AggregatedWaterfallResponseAttributes { + if o == nil { + var ret AggregatedWaterfallResponseAttributes + 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 *AggregatedWaterfallResponseData) GetAttributesOk() (*AggregatedWaterfallResponseAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *AggregatedWaterfallResponseData) SetAttributes(v AggregatedWaterfallResponseAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *AggregatedWaterfallResponseData) 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 *AggregatedWaterfallResponseData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *AggregatedWaterfallResponseData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *AggregatedWaterfallResponseData) GetType() AggregatedWaterfallRequestType { + if o == nil { + var ret AggregatedWaterfallRequestType + 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 *AggregatedWaterfallResponseData) GetTypeOk() (*AggregatedWaterfallRequestType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AggregatedWaterfallResponseData) SetType(v AggregatedWaterfallRequestType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AggregatedWaterfallResponseData) 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 *AggregatedWaterfallResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AggregatedWaterfallResponseAttributes `json:"attributes"` + Id *string `json:"id"` + Type *AggregatedWaterfallRequestType `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_long_task_metric_stats.go b/api/datadogV2/model_long_task_metric_stats.go new file mode 100644 index 00000000000..673a82af389 --- /dev/null +++ b/api/datadogV2/model_long_task_metric_stats.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" +) + +// LongTaskMetricStats Statistical distribution (average, min, max) of a long task metric across sampled views. +type LongTaskMetricStats struct { + // Average value across sampled views. + Average float64 `json:"average"` + // Maximum value across sampled views. + Max float64 `json:"max"` + // Minimum value across sampled views. + Min float64 `json:"min"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewLongTaskMetricStats instantiates a new LongTaskMetricStats 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 NewLongTaskMetricStats(average float64, max float64, min float64) *LongTaskMetricStats { + this := LongTaskMetricStats{} + this.Average = average + this.Max = max + this.Min = min + return &this +} + +// NewLongTaskMetricStatsWithDefaults instantiates a new LongTaskMetricStats 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 NewLongTaskMetricStatsWithDefaults() *LongTaskMetricStats { + this := LongTaskMetricStats{} + return &this +} + +// GetAverage returns the Average field value. +func (o *LongTaskMetricStats) GetAverage() float64 { + if o == nil { + var ret float64 + return ret + } + return o.Average +} + +// GetAverageOk returns a tuple with the Average field value +// and a boolean to check if the value has been set. +func (o *LongTaskMetricStats) GetAverageOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.Average, true +} + +// SetAverage sets field value. +func (o *LongTaskMetricStats) SetAverage(v float64) { + o.Average = v +} + +// GetMax returns the Max field value. +func (o *LongTaskMetricStats) GetMax() float64 { + if o == nil { + var ret float64 + return ret + } + return o.Max +} + +// GetMaxOk returns a tuple with the Max field value +// and a boolean to check if the value has been set. +func (o *LongTaskMetricStats) GetMaxOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.Max, true +} + +// SetMax sets field value. +func (o *LongTaskMetricStats) SetMax(v float64) { + o.Max = v +} + +// GetMin returns the Min field value. +func (o *LongTaskMetricStats) GetMin() float64 { + if o == nil { + var ret float64 + return ret + } + return o.Min +} + +// GetMinOk returns a tuple with the Min field value +// and a boolean to check if the value has been set. +func (o *LongTaskMetricStats) GetMinOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.Min, true +} + +// SetMin sets field value. +func (o *LongTaskMetricStats) SetMin(v float64) { + o.Min = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LongTaskMetricStats) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["average"] = o.Average + toSerialize["max"] = o.Max + toSerialize["min"] = o.Min + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LongTaskMetricStats) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Average *float64 `json:"average"` + Max *float64 `json:"max"` + Min *float64 `json:"min"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Average == nil { + return fmt.Errorf("required field average missing") + } + if all.Max == nil { + return fmt.Errorf("required field max missing") + } + if all.Min == nil { + return fmt.Errorf("required field min missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"average", "max", "min"}) + } else { + return err + } + o.Average = *all.Average + o.Max = *all.Max + o.Min = *all.Min + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_long_task_stats_per_view.go b/api/datadogV2/model_long_task_stats_per_view.go new file mode 100644 index 00000000000..6af2f679850 --- /dev/null +++ b/api/datadogV2/model_long_task_stats_per_view.go @@ -0,0 +1,453 @@ +// Unless explicitly stated otherwise all files in this repository 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" +) + +// LongTaskStatsPerView Statistical distributions of long task metrics computed per view across sampled views. +type LongTaskStatsPerView struct { + // Statistical distribution (average, min, max) of a long task metric across sampled views. + FcpBlockingTimeMs *LongTaskMetricStats `json:"fcp_blocking_time_ms,omitempty"` + // Statistical distribution (average, min, max) of a long task metric across sampled views. + FcpCount *LongTaskMetricStats `json:"fcp_count,omitempty"` + // Statistical distribution (average, min, max) of a long task metric across sampled views. + InpOverlapBlockingTimeMs *LongTaskMetricStats `json:"inp_overlap_blocking_time_ms,omitempty"` + // Statistical distribution (average, min, max) of a long task metric across sampled views. + InpOverlapCount *LongTaskMetricStats `json:"inp_overlap_count,omitempty"` + // Statistical distribution (average, min, max) of a long task metric across sampled views. + LcpBlockingTimeMs *LongTaskMetricStats `json:"lcp_blocking_time_ms,omitempty"` + // Statistical distribution (average, min, max) of a long task metric across sampled views. + LcpCount *LongTaskMetricStats `json:"lcp_count,omitempty"` + // Statistical distribution (average, min, max) of a long task metric across sampled views. + LoadingTimeBlockingTimeMs *LongTaskMetricStats `json:"loading_time_blocking_time_ms,omitempty"` + // Statistical distribution (average, min, max) of a long task metric across sampled views. + LoadingTimeCount *LongTaskMetricStats `json:"loading_time_count,omitempty"` + // Statistical distribution (average, min, max) of a long task metric across sampled views. + TotalBlockingTimeMs *LongTaskMetricStats `json:"total_blocking_time_ms,omitempty"` + // Statistical distribution (average, min, max) of a long task metric across sampled views. + TotalCount *LongTaskMetricStats `json:"total_count,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewLongTaskStatsPerView instantiates a new LongTaskStatsPerView 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 NewLongTaskStatsPerView() *LongTaskStatsPerView { + this := LongTaskStatsPerView{} + return &this +} + +// NewLongTaskStatsPerViewWithDefaults instantiates a new LongTaskStatsPerView 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 NewLongTaskStatsPerViewWithDefaults() *LongTaskStatsPerView { + this := LongTaskStatsPerView{} + return &this +} + +// GetFcpBlockingTimeMs returns the FcpBlockingTimeMs field value if set, zero value otherwise. +func (o *LongTaskStatsPerView) GetFcpBlockingTimeMs() LongTaskMetricStats { + if o == nil || o.FcpBlockingTimeMs == nil { + var ret LongTaskMetricStats + return ret + } + return *o.FcpBlockingTimeMs +} + +// GetFcpBlockingTimeMsOk returns a tuple with the FcpBlockingTimeMs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LongTaskStatsPerView) GetFcpBlockingTimeMsOk() (*LongTaskMetricStats, bool) { + if o == nil || o.FcpBlockingTimeMs == nil { + return nil, false + } + return o.FcpBlockingTimeMs, true +} + +// HasFcpBlockingTimeMs returns a boolean if a field has been set. +func (o *LongTaskStatsPerView) HasFcpBlockingTimeMs() bool { + return o != nil && o.FcpBlockingTimeMs != nil +} + +// SetFcpBlockingTimeMs gets a reference to the given LongTaskMetricStats and assigns it to the FcpBlockingTimeMs field. +func (o *LongTaskStatsPerView) SetFcpBlockingTimeMs(v LongTaskMetricStats) { + o.FcpBlockingTimeMs = &v +} + +// GetFcpCount returns the FcpCount field value if set, zero value otherwise. +func (o *LongTaskStatsPerView) GetFcpCount() LongTaskMetricStats { + if o == nil || o.FcpCount == nil { + var ret LongTaskMetricStats + return ret + } + return *o.FcpCount +} + +// GetFcpCountOk returns a tuple with the FcpCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LongTaskStatsPerView) GetFcpCountOk() (*LongTaskMetricStats, bool) { + if o == nil || o.FcpCount == nil { + return nil, false + } + return o.FcpCount, true +} + +// HasFcpCount returns a boolean if a field has been set. +func (o *LongTaskStatsPerView) HasFcpCount() bool { + return o != nil && o.FcpCount != nil +} + +// SetFcpCount gets a reference to the given LongTaskMetricStats and assigns it to the FcpCount field. +func (o *LongTaskStatsPerView) SetFcpCount(v LongTaskMetricStats) { + o.FcpCount = &v +} + +// GetInpOverlapBlockingTimeMs returns the InpOverlapBlockingTimeMs field value if set, zero value otherwise. +func (o *LongTaskStatsPerView) GetInpOverlapBlockingTimeMs() LongTaskMetricStats { + if o == nil || o.InpOverlapBlockingTimeMs == nil { + var ret LongTaskMetricStats + return ret + } + return *o.InpOverlapBlockingTimeMs +} + +// GetInpOverlapBlockingTimeMsOk returns a tuple with the InpOverlapBlockingTimeMs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LongTaskStatsPerView) GetInpOverlapBlockingTimeMsOk() (*LongTaskMetricStats, bool) { + if o == nil || o.InpOverlapBlockingTimeMs == nil { + return nil, false + } + return o.InpOverlapBlockingTimeMs, true +} + +// HasInpOverlapBlockingTimeMs returns a boolean if a field has been set. +func (o *LongTaskStatsPerView) HasInpOverlapBlockingTimeMs() bool { + return o != nil && o.InpOverlapBlockingTimeMs != nil +} + +// SetInpOverlapBlockingTimeMs gets a reference to the given LongTaskMetricStats and assigns it to the InpOverlapBlockingTimeMs field. +func (o *LongTaskStatsPerView) SetInpOverlapBlockingTimeMs(v LongTaskMetricStats) { + o.InpOverlapBlockingTimeMs = &v +} + +// GetInpOverlapCount returns the InpOverlapCount field value if set, zero value otherwise. +func (o *LongTaskStatsPerView) GetInpOverlapCount() LongTaskMetricStats { + if o == nil || o.InpOverlapCount == nil { + var ret LongTaskMetricStats + return ret + } + return *o.InpOverlapCount +} + +// GetInpOverlapCountOk returns a tuple with the InpOverlapCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LongTaskStatsPerView) GetInpOverlapCountOk() (*LongTaskMetricStats, bool) { + if o == nil || o.InpOverlapCount == nil { + return nil, false + } + return o.InpOverlapCount, true +} + +// HasInpOverlapCount returns a boolean if a field has been set. +func (o *LongTaskStatsPerView) HasInpOverlapCount() bool { + return o != nil && o.InpOverlapCount != nil +} + +// SetInpOverlapCount gets a reference to the given LongTaskMetricStats and assigns it to the InpOverlapCount field. +func (o *LongTaskStatsPerView) SetInpOverlapCount(v LongTaskMetricStats) { + o.InpOverlapCount = &v +} + +// GetLcpBlockingTimeMs returns the LcpBlockingTimeMs field value if set, zero value otherwise. +func (o *LongTaskStatsPerView) GetLcpBlockingTimeMs() LongTaskMetricStats { + if o == nil || o.LcpBlockingTimeMs == nil { + var ret LongTaskMetricStats + return ret + } + return *o.LcpBlockingTimeMs +} + +// GetLcpBlockingTimeMsOk returns a tuple with the LcpBlockingTimeMs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LongTaskStatsPerView) GetLcpBlockingTimeMsOk() (*LongTaskMetricStats, bool) { + if o == nil || o.LcpBlockingTimeMs == nil { + return nil, false + } + return o.LcpBlockingTimeMs, true +} + +// HasLcpBlockingTimeMs returns a boolean if a field has been set. +func (o *LongTaskStatsPerView) HasLcpBlockingTimeMs() bool { + return o != nil && o.LcpBlockingTimeMs != nil +} + +// SetLcpBlockingTimeMs gets a reference to the given LongTaskMetricStats and assigns it to the LcpBlockingTimeMs field. +func (o *LongTaskStatsPerView) SetLcpBlockingTimeMs(v LongTaskMetricStats) { + o.LcpBlockingTimeMs = &v +} + +// GetLcpCount returns the LcpCount field value if set, zero value otherwise. +func (o *LongTaskStatsPerView) GetLcpCount() LongTaskMetricStats { + if o == nil || o.LcpCount == nil { + var ret LongTaskMetricStats + return ret + } + return *o.LcpCount +} + +// GetLcpCountOk returns a tuple with the LcpCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LongTaskStatsPerView) GetLcpCountOk() (*LongTaskMetricStats, bool) { + if o == nil || o.LcpCount == nil { + return nil, false + } + return o.LcpCount, true +} + +// HasLcpCount returns a boolean if a field has been set. +func (o *LongTaskStatsPerView) HasLcpCount() bool { + return o != nil && o.LcpCount != nil +} + +// SetLcpCount gets a reference to the given LongTaskMetricStats and assigns it to the LcpCount field. +func (o *LongTaskStatsPerView) SetLcpCount(v LongTaskMetricStats) { + o.LcpCount = &v +} + +// GetLoadingTimeBlockingTimeMs returns the LoadingTimeBlockingTimeMs field value if set, zero value otherwise. +func (o *LongTaskStatsPerView) GetLoadingTimeBlockingTimeMs() LongTaskMetricStats { + if o == nil || o.LoadingTimeBlockingTimeMs == nil { + var ret LongTaskMetricStats + return ret + } + return *o.LoadingTimeBlockingTimeMs +} + +// GetLoadingTimeBlockingTimeMsOk returns a tuple with the LoadingTimeBlockingTimeMs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LongTaskStatsPerView) GetLoadingTimeBlockingTimeMsOk() (*LongTaskMetricStats, bool) { + if o == nil || o.LoadingTimeBlockingTimeMs == nil { + return nil, false + } + return o.LoadingTimeBlockingTimeMs, true +} + +// HasLoadingTimeBlockingTimeMs returns a boolean if a field has been set. +func (o *LongTaskStatsPerView) HasLoadingTimeBlockingTimeMs() bool { + return o != nil && o.LoadingTimeBlockingTimeMs != nil +} + +// SetLoadingTimeBlockingTimeMs gets a reference to the given LongTaskMetricStats and assigns it to the LoadingTimeBlockingTimeMs field. +func (o *LongTaskStatsPerView) SetLoadingTimeBlockingTimeMs(v LongTaskMetricStats) { + o.LoadingTimeBlockingTimeMs = &v +} + +// GetLoadingTimeCount returns the LoadingTimeCount field value if set, zero value otherwise. +func (o *LongTaskStatsPerView) GetLoadingTimeCount() LongTaskMetricStats { + if o == nil || o.LoadingTimeCount == nil { + var ret LongTaskMetricStats + return ret + } + return *o.LoadingTimeCount +} + +// GetLoadingTimeCountOk returns a tuple with the LoadingTimeCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LongTaskStatsPerView) GetLoadingTimeCountOk() (*LongTaskMetricStats, bool) { + if o == nil || o.LoadingTimeCount == nil { + return nil, false + } + return o.LoadingTimeCount, true +} + +// HasLoadingTimeCount returns a boolean if a field has been set. +func (o *LongTaskStatsPerView) HasLoadingTimeCount() bool { + return o != nil && o.LoadingTimeCount != nil +} + +// SetLoadingTimeCount gets a reference to the given LongTaskMetricStats and assigns it to the LoadingTimeCount field. +func (o *LongTaskStatsPerView) SetLoadingTimeCount(v LongTaskMetricStats) { + o.LoadingTimeCount = &v +} + +// GetTotalBlockingTimeMs returns the TotalBlockingTimeMs field value if set, zero value otherwise. +func (o *LongTaskStatsPerView) GetTotalBlockingTimeMs() LongTaskMetricStats { + if o == nil || o.TotalBlockingTimeMs == nil { + var ret LongTaskMetricStats + return ret + } + return *o.TotalBlockingTimeMs +} + +// GetTotalBlockingTimeMsOk returns a tuple with the TotalBlockingTimeMs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LongTaskStatsPerView) GetTotalBlockingTimeMsOk() (*LongTaskMetricStats, bool) { + if o == nil || o.TotalBlockingTimeMs == nil { + return nil, false + } + return o.TotalBlockingTimeMs, true +} + +// HasTotalBlockingTimeMs returns a boolean if a field has been set. +func (o *LongTaskStatsPerView) HasTotalBlockingTimeMs() bool { + return o != nil && o.TotalBlockingTimeMs != nil +} + +// SetTotalBlockingTimeMs gets a reference to the given LongTaskMetricStats and assigns it to the TotalBlockingTimeMs field. +func (o *LongTaskStatsPerView) SetTotalBlockingTimeMs(v LongTaskMetricStats) { + o.TotalBlockingTimeMs = &v +} + +// GetTotalCount returns the TotalCount field value if set, zero value otherwise. +func (o *LongTaskStatsPerView) GetTotalCount() LongTaskMetricStats { + if o == nil || o.TotalCount == nil { + var ret LongTaskMetricStats + return ret + } + return *o.TotalCount +} + +// GetTotalCountOk returns a tuple with the TotalCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LongTaskStatsPerView) GetTotalCountOk() (*LongTaskMetricStats, bool) { + if o == nil || o.TotalCount == nil { + return nil, false + } + return o.TotalCount, true +} + +// HasTotalCount returns a boolean if a field has been set. +func (o *LongTaskStatsPerView) HasTotalCount() bool { + return o != nil && o.TotalCount != nil +} + +// SetTotalCount gets a reference to the given LongTaskMetricStats and assigns it to the TotalCount field. +func (o *LongTaskStatsPerView) SetTotalCount(v LongTaskMetricStats) { + o.TotalCount = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LongTaskStatsPerView) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.FcpBlockingTimeMs != nil { + toSerialize["fcp_blocking_time_ms"] = o.FcpBlockingTimeMs + } + if o.FcpCount != nil { + toSerialize["fcp_count"] = o.FcpCount + } + if o.InpOverlapBlockingTimeMs != nil { + toSerialize["inp_overlap_blocking_time_ms"] = o.InpOverlapBlockingTimeMs + } + if o.InpOverlapCount != nil { + toSerialize["inp_overlap_count"] = o.InpOverlapCount + } + if o.LcpBlockingTimeMs != nil { + toSerialize["lcp_blocking_time_ms"] = o.LcpBlockingTimeMs + } + if o.LcpCount != nil { + toSerialize["lcp_count"] = o.LcpCount + } + if o.LoadingTimeBlockingTimeMs != nil { + toSerialize["loading_time_blocking_time_ms"] = o.LoadingTimeBlockingTimeMs + } + if o.LoadingTimeCount != nil { + toSerialize["loading_time_count"] = o.LoadingTimeCount + } + if o.TotalBlockingTimeMs != nil { + toSerialize["total_blocking_time_ms"] = o.TotalBlockingTimeMs + } + if o.TotalCount != nil { + toSerialize["total_count"] = o.TotalCount + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LongTaskStatsPerView) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + FcpBlockingTimeMs *LongTaskMetricStats `json:"fcp_blocking_time_ms,omitempty"` + FcpCount *LongTaskMetricStats `json:"fcp_count,omitempty"` + InpOverlapBlockingTimeMs *LongTaskMetricStats `json:"inp_overlap_blocking_time_ms,omitempty"` + InpOverlapCount *LongTaskMetricStats `json:"inp_overlap_count,omitempty"` + LcpBlockingTimeMs *LongTaskMetricStats `json:"lcp_blocking_time_ms,omitempty"` + LcpCount *LongTaskMetricStats `json:"lcp_count,omitempty"` + LoadingTimeBlockingTimeMs *LongTaskMetricStats `json:"loading_time_blocking_time_ms,omitempty"` + LoadingTimeCount *LongTaskMetricStats `json:"loading_time_count,omitempty"` + TotalBlockingTimeMs *LongTaskMetricStats `json:"total_blocking_time_ms,omitempty"` + TotalCount *LongTaskMetricStats `json:"total_count,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"fcp_blocking_time_ms", "fcp_count", "inp_overlap_blocking_time_ms", "inp_overlap_count", "lcp_blocking_time_ms", "lcp_count", "loading_time_blocking_time_ms", "loading_time_count", "total_blocking_time_ms", "total_count"}) + } else { + return err + } + + hasInvalidField := false + if all.FcpBlockingTimeMs != nil && all.FcpBlockingTimeMs.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.FcpBlockingTimeMs = all.FcpBlockingTimeMs + if all.FcpCount != nil && all.FcpCount.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.FcpCount = all.FcpCount + if all.InpOverlapBlockingTimeMs != nil && all.InpOverlapBlockingTimeMs.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.InpOverlapBlockingTimeMs = all.InpOverlapBlockingTimeMs + if all.InpOverlapCount != nil && all.InpOverlapCount.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.InpOverlapCount = all.InpOverlapCount + if all.LcpBlockingTimeMs != nil && all.LcpBlockingTimeMs.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.LcpBlockingTimeMs = all.LcpBlockingTimeMs + if all.LcpCount != nil && all.LcpCount.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.LcpCount = all.LcpCount + if all.LoadingTimeBlockingTimeMs != nil && all.LoadingTimeBlockingTimeMs.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.LoadingTimeBlockingTimeMs = all.LoadingTimeBlockingTimeMs + if all.LoadingTimeCount != nil && all.LoadingTimeCount.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.LoadingTimeCount = all.LoadingTimeCount + if all.TotalBlockingTimeMs != nil && all.TotalBlockingTimeMs.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.TotalBlockingTimeMs = all.TotalBlockingTimeMs + if all.TotalCount != nil && all.TotalCount.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.TotalCount = all.TotalCount + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_signals_problems_detections.go b/api/datadogV2/model_signals_problems_detections.go new file mode 100644 index 00000000000..d35781db526 --- /dev/null +++ b/api/datadogV2/model_signals_problems_detections.go @@ -0,0 +1,312 @@ +// Unless explicitly stated otherwise all files in this repository 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" +) + +// SignalsProblemsDetections Grouped detection results by detection type. +type SignalsProblemsDetections struct { + // Detected high frozen frame rate issues. + HighFrozenFrameRates []AggregatedHighFrozenFrameRate `json:"high_frozen_frame_rates,omitempty"` + // Detected high script evaluation issues. + HighScriptEvaluations []AggregatedHighScriptEval `json:"high_script_evaluations,omitempty"` + // Detected low cache hit rate issues. + LowCacheHitRates []AggregatedLowCacheHitRate `json:"low_cache_hit_rates,omitempty"` + // Detected mobile scroll friction issues. + MobileScrollFrictions []AggregatedMobileScrollFriction `json:"mobile_scroll_frictions,omitempty"` + // Detected slow first contentful paint with high byte count issues. + SlowFcpHighBytes []AggregatedSlowFCPHighBytes `json:"slow_fcp_high_bytes,omitempty"` + // Detected slow interaction with long task issues. + SlowInteractionLongTasks []AggregatedSlowInteractionLongTask `json:"slow_interaction_long_tasks,omitempty"` + // Detected uncompressed resource issues. + UncompressedResources []AggregatedUncompressedResource `json:"uncompressed_resources,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:"-"` +} + +// NewSignalsProblemsDetections instantiates a new SignalsProblemsDetections 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 NewSignalsProblemsDetections() *SignalsProblemsDetections { + this := SignalsProblemsDetections{} + return &this +} + +// NewSignalsProblemsDetectionsWithDefaults instantiates a new SignalsProblemsDetections 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 NewSignalsProblemsDetectionsWithDefaults() *SignalsProblemsDetections { + this := SignalsProblemsDetections{} + return &this +} + +// GetHighFrozenFrameRates returns the HighFrozenFrameRates field value if set, zero value otherwise. +func (o *SignalsProblemsDetections) GetHighFrozenFrameRates() []AggregatedHighFrozenFrameRate { + if o == nil || o.HighFrozenFrameRates == nil { + var ret []AggregatedHighFrozenFrameRate + return ret + } + return o.HighFrozenFrameRates +} + +// GetHighFrozenFrameRatesOk returns a tuple with the HighFrozenFrameRates field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SignalsProblemsDetections) GetHighFrozenFrameRatesOk() (*[]AggregatedHighFrozenFrameRate, bool) { + if o == nil || o.HighFrozenFrameRates == nil { + return nil, false + } + return &o.HighFrozenFrameRates, true +} + +// HasHighFrozenFrameRates returns a boolean if a field has been set. +func (o *SignalsProblemsDetections) HasHighFrozenFrameRates() bool { + return o != nil && o.HighFrozenFrameRates != nil +} + +// SetHighFrozenFrameRates gets a reference to the given []AggregatedHighFrozenFrameRate and assigns it to the HighFrozenFrameRates field. +func (o *SignalsProblemsDetections) SetHighFrozenFrameRates(v []AggregatedHighFrozenFrameRate) { + o.HighFrozenFrameRates = v +} + +// GetHighScriptEvaluations returns the HighScriptEvaluations field value if set, zero value otherwise. +func (o *SignalsProblemsDetections) GetHighScriptEvaluations() []AggregatedHighScriptEval { + if o == nil || o.HighScriptEvaluations == nil { + var ret []AggregatedHighScriptEval + return ret + } + return o.HighScriptEvaluations +} + +// GetHighScriptEvaluationsOk returns a tuple with the HighScriptEvaluations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SignalsProblemsDetections) GetHighScriptEvaluationsOk() (*[]AggregatedHighScriptEval, bool) { + if o == nil || o.HighScriptEvaluations == nil { + return nil, false + } + return &o.HighScriptEvaluations, true +} + +// HasHighScriptEvaluations returns a boolean if a field has been set. +func (o *SignalsProblemsDetections) HasHighScriptEvaluations() bool { + return o != nil && o.HighScriptEvaluations != nil +} + +// SetHighScriptEvaluations gets a reference to the given []AggregatedHighScriptEval and assigns it to the HighScriptEvaluations field. +func (o *SignalsProblemsDetections) SetHighScriptEvaluations(v []AggregatedHighScriptEval) { + o.HighScriptEvaluations = v +} + +// GetLowCacheHitRates returns the LowCacheHitRates field value if set, zero value otherwise. +func (o *SignalsProblemsDetections) GetLowCacheHitRates() []AggregatedLowCacheHitRate { + if o == nil || o.LowCacheHitRates == nil { + var ret []AggregatedLowCacheHitRate + return ret + } + return o.LowCacheHitRates +} + +// GetLowCacheHitRatesOk returns a tuple with the LowCacheHitRates field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SignalsProblemsDetections) GetLowCacheHitRatesOk() (*[]AggregatedLowCacheHitRate, bool) { + if o == nil || o.LowCacheHitRates == nil { + return nil, false + } + return &o.LowCacheHitRates, true +} + +// HasLowCacheHitRates returns a boolean if a field has been set. +func (o *SignalsProblemsDetections) HasLowCacheHitRates() bool { + return o != nil && o.LowCacheHitRates != nil +} + +// SetLowCacheHitRates gets a reference to the given []AggregatedLowCacheHitRate and assigns it to the LowCacheHitRates field. +func (o *SignalsProblemsDetections) SetLowCacheHitRates(v []AggregatedLowCacheHitRate) { + o.LowCacheHitRates = v +} + +// GetMobileScrollFrictions returns the MobileScrollFrictions field value if set, zero value otherwise. +func (o *SignalsProblemsDetections) GetMobileScrollFrictions() []AggregatedMobileScrollFriction { + if o == nil || o.MobileScrollFrictions == nil { + var ret []AggregatedMobileScrollFriction + return ret + } + return o.MobileScrollFrictions +} + +// GetMobileScrollFrictionsOk returns a tuple with the MobileScrollFrictions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SignalsProblemsDetections) GetMobileScrollFrictionsOk() (*[]AggregatedMobileScrollFriction, bool) { + if o == nil || o.MobileScrollFrictions == nil { + return nil, false + } + return &o.MobileScrollFrictions, true +} + +// HasMobileScrollFrictions returns a boolean if a field has been set. +func (o *SignalsProblemsDetections) HasMobileScrollFrictions() bool { + return o != nil && o.MobileScrollFrictions != nil +} + +// SetMobileScrollFrictions gets a reference to the given []AggregatedMobileScrollFriction and assigns it to the MobileScrollFrictions field. +func (o *SignalsProblemsDetections) SetMobileScrollFrictions(v []AggregatedMobileScrollFriction) { + o.MobileScrollFrictions = v +} + +// GetSlowFcpHighBytes returns the SlowFcpHighBytes field value if set, zero value otherwise. +func (o *SignalsProblemsDetections) GetSlowFcpHighBytes() []AggregatedSlowFCPHighBytes { + if o == nil || o.SlowFcpHighBytes == nil { + var ret []AggregatedSlowFCPHighBytes + return ret + } + return o.SlowFcpHighBytes +} + +// GetSlowFcpHighBytesOk returns a tuple with the SlowFcpHighBytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SignalsProblemsDetections) GetSlowFcpHighBytesOk() (*[]AggregatedSlowFCPHighBytes, bool) { + if o == nil || o.SlowFcpHighBytes == nil { + return nil, false + } + return &o.SlowFcpHighBytes, true +} + +// HasSlowFcpHighBytes returns a boolean if a field has been set. +func (o *SignalsProblemsDetections) HasSlowFcpHighBytes() bool { + return o != nil && o.SlowFcpHighBytes != nil +} + +// SetSlowFcpHighBytes gets a reference to the given []AggregatedSlowFCPHighBytes and assigns it to the SlowFcpHighBytes field. +func (o *SignalsProblemsDetections) SetSlowFcpHighBytes(v []AggregatedSlowFCPHighBytes) { + o.SlowFcpHighBytes = v +} + +// GetSlowInteractionLongTasks returns the SlowInteractionLongTasks field value if set, zero value otherwise. +func (o *SignalsProblemsDetections) GetSlowInteractionLongTasks() []AggregatedSlowInteractionLongTask { + if o == nil || o.SlowInteractionLongTasks == nil { + var ret []AggregatedSlowInteractionLongTask + return ret + } + return o.SlowInteractionLongTasks +} + +// GetSlowInteractionLongTasksOk returns a tuple with the SlowInteractionLongTasks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SignalsProblemsDetections) GetSlowInteractionLongTasksOk() (*[]AggregatedSlowInteractionLongTask, bool) { + if o == nil || o.SlowInteractionLongTasks == nil { + return nil, false + } + return &o.SlowInteractionLongTasks, true +} + +// HasSlowInteractionLongTasks returns a boolean if a field has been set. +func (o *SignalsProblemsDetections) HasSlowInteractionLongTasks() bool { + return o != nil && o.SlowInteractionLongTasks != nil +} + +// SetSlowInteractionLongTasks gets a reference to the given []AggregatedSlowInteractionLongTask and assigns it to the SlowInteractionLongTasks field. +func (o *SignalsProblemsDetections) SetSlowInteractionLongTasks(v []AggregatedSlowInteractionLongTask) { + o.SlowInteractionLongTasks = v +} + +// GetUncompressedResources returns the UncompressedResources field value if set, zero value otherwise. +func (o *SignalsProblemsDetections) GetUncompressedResources() []AggregatedUncompressedResource { + if o == nil || o.UncompressedResources == nil { + var ret []AggregatedUncompressedResource + return ret + } + return o.UncompressedResources +} + +// GetUncompressedResourcesOk returns a tuple with the UncompressedResources field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SignalsProblemsDetections) GetUncompressedResourcesOk() (*[]AggregatedUncompressedResource, bool) { + if o == nil || o.UncompressedResources == nil { + return nil, false + } + return &o.UncompressedResources, true +} + +// HasUncompressedResources returns a boolean if a field has been set. +func (o *SignalsProblemsDetections) HasUncompressedResources() bool { + return o != nil && o.UncompressedResources != nil +} + +// SetUncompressedResources gets a reference to the given []AggregatedUncompressedResource and assigns it to the UncompressedResources field. +func (o *SignalsProblemsDetections) SetUncompressedResources(v []AggregatedUncompressedResource) { + o.UncompressedResources = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SignalsProblemsDetections) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.HighFrozenFrameRates != nil { + toSerialize["high_frozen_frame_rates"] = o.HighFrozenFrameRates + } + if o.HighScriptEvaluations != nil { + toSerialize["high_script_evaluations"] = o.HighScriptEvaluations + } + if o.LowCacheHitRates != nil { + toSerialize["low_cache_hit_rates"] = o.LowCacheHitRates + } + if o.MobileScrollFrictions != nil { + toSerialize["mobile_scroll_frictions"] = o.MobileScrollFrictions + } + if o.SlowFcpHighBytes != nil { + toSerialize["slow_fcp_high_bytes"] = o.SlowFcpHighBytes + } + if o.SlowInteractionLongTasks != nil { + toSerialize["slow_interaction_long_tasks"] = o.SlowInteractionLongTasks + } + if o.UncompressedResources != nil { + toSerialize["uncompressed_resources"] = o.UncompressedResources + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SignalsProblemsDetections) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + HighFrozenFrameRates []AggregatedHighFrozenFrameRate `json:"high_frozen_frame_rates,omitempty"` + HighScriptEvaluations []AggregatedHighScriptEval `json:"high_script_evaluations,omitempty"` + LowCacheHitRates []AggregatedLowCacheHitRate `json:"low_cache_hit_rates,omitempty"` + MobileScrollFrictions []AggregatedMobileScrollFriction `json:"mobile_scroll_frictions,omitempty"` + SlowFcpHighBytes []AggregatedSlowFCPHighBytes `json:"slow_fcp_high_bytes,omitempty"` + SlowInteractionLongTasks []AggregatedSlowInteractionLongTask `json:"slow_interaction_long_tasks,omitempty"` + UncompressedResources []AggregatedUncompressedResource `json:"uncompressed_resources,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{"high_frozen_frame_rates", "high_script_evaluations", "low_cache_hit_rates", "mobile_scroll_frictions", "slow_fcp_high_bytes", "slow_interaction_long_tasks", "uncompressed_resources"}) + } else { + return err + } + o.HighFrozenFrameRates = all.HighFrozenFrameRates + o.HighScriptEvaluations = all.HighScriptEvaluations + o.LowCacheHitRates = all.LowCacheHitRates + o.MobileScrollFrictions = all.MobileScrollFrictions + o.SlowFcpHighBytes = all.SlowFcpHighBytes + o.SlowInteractionLongTasks = all.SlowInteractionLongTasks + o.UncompressedResources = all.UncompressedResources + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_signals_problems_sample_metadata.go b/api/datadogV2/model_signals_problems_sample_metadata.go new file mode 100644 index 00000000000..8997c3c7e83 --- /dev/null +++ b/api/datadogV2/model_signals_problems_sample_metadata.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" +) + +// SignalsProblemsSampleMetadata Metadata about the sampling quality for a signals and problems query. +type SignalsProblemsSampleMetadata struct { + // Number of view instances that failed to process. + Failed int32 `json:"failed"` + // Number of view instances requested for sampling. + Requested int32 `json:"requested"` + // List of RUM view IDs that were sampled. + SampledViewIds []string `json:"sampled_view_ids"` + // Number of view instances successfully processed. + Succeeded int32 `json:"succeeded"` + // Ratio of successfully processed views to requested views. + SuccessRate float64 `json:"success_rate"` + // 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:"-"` +} + +// NewSignalsProblemsSampleMetadata instantiates a new SignalsProblemsSampleMetadata 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 NewSignalsProblemsSampleMetadata(failed int32, requested int32, sampledViewIds []string, succeeded int32, successRate float64) *SignalsProblemsSampleMetadata { + this := SignalsProblemsSampleMetadata{} + this.Failed = failed + this.Requested = requested + this.SampledViewIds = sampledViewIds + this.Succeeded = succeeded + this.SuccessRate = successRate + return &this +} + +// NewSignalsProblemsSampleMetadataWithDefaults instantiates a new SignalsProblemsSampleMetadata 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 NewSignalsProblemsSampleMetadataWithDefaults() *SignalsProblemsSampleMetadata { + this := SignalsProblemsSampleMetadata{} + return &this +} + +// GetFailed returns the Failed field value. +func (o *SignalsProblemsSampleMetadata) GetFailed() int32 { + if o == nil { + var ret int32 + return ret + } + return o.Failed +} + +// GetFailedOk returns a tuple with the Failed field value +// and a boolean to check if the value has been set. +func (o *SignalsProblemsSampleMetadata) GetFailedOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Failed, true +} + +// SetFailed sets field value. +func (o *SignalsProblemsSampleMetadata) SetFailed(v int32) { + o.Failed = v +} + +// GetRequested returns the Requested field value. +func (o *SignalsProblemsSampleMetadata) GetRequested() int32 { + if o == nil { + var ret int32 + return ret + } + return o.Requested +} + +// GetRequestedOk returns a tuple with the Requested field value +// and a boolean to check if the value has been set. +func (o *SignalsProblemsSampleMetadata) GetRequestedOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Requested, true +} + +// SetRequested sets field value. +func (o *SignalsProblemsSampleMetadata) SetRequested(v int32) { + o.Requested = v +} + +// GetSampledViewIds returns the SampledViewIds field value. +func (o *SignalsProblemsSampleMetadata) GetSampledViewIds() []string { + if o == nil { + var ret []string + return ret + } + return o.SampledViewIds +} + +// GetSampledViewIdsOk returns a tuple with the SampledViewIds field value +// and a boolean to check if the value has been set. +func (o *SignalsProblemsSampleMetadata) GetSampledViewIdsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.SampledViewIds, true +} + +// SetSampledViewIds sets field value. +func (o *SignalsProblemsSampleMetadata) SetSampledViewIds(v []string) { + o.SampledViewIds = v +} + +// GetSucceeded returns the Succeeded field value. +func (o *SignalsProblemsSampleMetadata) GetSucceeded() int32 { + if o == nil { + var ret int32 + return ret + } + return o.Succeeded +} + +// GetSucceededOk returns a tuple with the Succeeded field value +// and a boolean to check if the value has been set. +func (o *SignalsProblemsSampleMetadata) GetSucceededOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Succeeded, true +} + +// SetSucceeded sets field value. +func (o *SignalsProblemsSampleMetadata) SetSucceeded(v int32) { + o.Succeeded = v +} + +// GetSuccessRate returns the SuccessRate field value. +func (o *SignalsProblemsSampleMetadata) GetSuccessRate() float64 { + if o == nil { + var ret float64 + return ret + } + return o.SuccessRate +} + +// GetSuccessRateOk returns a tuple with the SuccessRate field value +// and a boolean to check if the value has been set. +func (o *SignalsProblemsSampleMetadata) GetSuccessRateOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.SuccessRate, true +} + +// SetSuccessRate sets field value. +func (o *SignalsProblemsSampleMetadata) SetSuccessRate(v float64) { + o.SuccessRate = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SignalsProblemsSampleMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["failed"] = o.Failed + toSerialize["requested"] = o.Requested + toSerialize["sampled_view_ids"] = o.SampledViewIds + toSerialize["succeeded"] = o.Succeeded + toSerialize["success_rate"] = o.SuccessRate + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SignalsProblemsSampleMetadata) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Failed *int32 `json:"failed"` + Requested *int32 `json:"requested"` + SampledViewIds *[]string `json:"sampled_view_ids"` + Succeeded *int32 `json:"succeeded"` + SuccessRate *float64 `json:"success_rate"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Failed == nil { + return fmt.Errorf("required field failed missing") + } + if all.Requested == nil { + return fmt.Errorf("required field requested missing") + } + if all.SampledViewIds == nil { + return fmt.Errorf("required field sampled_view_ids missing") + } + if all.Succeeded == nil { + return fmt.Errorf("required field succeeded missing") + } + if all.SuccessRate == nil { + return fmt.Errorf("required field success_rate missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"failed", "requested", "sampled_view_ids", "succeeded", "success_rate"}) + } else { + return err + } + o.Failed = *all.Failed + o.Requested = *all.Requested + o.SampledViewIds = *all.SampledViewIds + o.Succeeded = *all.Succeeded + o.SuccessRate = *all.SuccessRate + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_top_long_task_invoker.go b/api/datadogV2/model_top_long_task_invoker.go new file mode 100644 index 00000000000..dc404f0d133 --- /dev/null +++ b/api/datadogV2/model_top_long_task_invoker.go @@ -0,0 +1,278 @@ +// Unless explicitly stated otherwise all files in this repository 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" +) + +// TopLongTaskInvoker A top long task invoker within an invoker type. +type TopLongTaskInvoker struct { + // Number of sampled views where this invoker had long tasks contributing to the criteria metric. + CriteriaViewOccurrences *int32 `json:"criteria_view_occurrences,omitempty"` + // Cleaned source file path for the invoker script. + File datadog.NullableString `json:"file"` + // Rank-product impact score combining view frequency and blocking time severity. + ImpactScore *float64 `json:"impact_score,omitempty"` + // Name of the invoker function or script. + Invoker string `json:"invoker"` + // Statistical distributions of long task metrics computed per view across sampled views. + StatsPerView LongTaskStatsPerView `json:"stats_per_view"` + // Number of sampled views where this invoker had any long tasks. + ViewOccurrences int32 `json:"view_occurrences"` + // 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:"-"` +} + +// NewTopLongTaskInvoker instantiates a new TopLongTaskInvoker 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 NewTopLongTaskInvoker(file datadog.NullableString, invoker string, statsPerView LongTaskStatsPerView, viewOccurrences int32) *TopLongTaskInvoker { + this := TopLongTaskInvoker{} + this.File = file + this.Invoker = invoker + this.StatsPerView = statsPerView + this.ViewOccurrences = viewOccurrences + return &this +} + +// NewTopLongTaskInvokerWithDefaults instantiates a new TopLongTaskInvoker 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 NewTopLongTaskInvokerWithDefaults() *TopLongTaskInvoker { + this := TopLongTaskInvoker{} + return &this +} + +// GetCriteriaViewOccurrences returns the CriteriaViewOccurrences field value if set, zero value otherwise. +func (o *TopLongTaskInvoker) GetCriteriaViewOccurrences() int32 { + if o == nil || o.CriteriaViewOccurrences == nil { + var ret int32 + return ret + } + return *o.CriteriaViewOccurrences +} + +// GetCriteriaViewOccurrencesOk returns a tuple with the CriteriaViewOccurrences field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TopLongTaskInvoker) GetCriteriaViewOccurrencesOk() (*int32, bool) { + if o == nil || o.CriteriaViewOccurrences == nil { + return nil, false + } + return o.CriteriaViewOccurrences, true +} + +// HasCriteriaViewOccurrences returns a boolean if a field has been set. +func (o *TopLongTaskInvoker) HasCriteriaViewOccurrences() bool { + return o != nil && o.CriteriaViewOccurrences != nil +} + +// SetCriteriaViewOccurrences gets a reference to the given int32 and assigns it to the CriteriaViewOccurrences field. +func (o *TopLongTaskInvoker) SetCriteriaViewOccurrences(v int32) { + o.CriteriaViewOccurrences = &v +} + +// GetFile returns the File field value. +// If the value is explicit nil, the zero value for string will be returned. +func (o *TopLongTaskInvoker) GetFile() string { + if o == nil || o.File.Get() == nil { + var ret string + return ret + } + return *o.File.Get() +} + +// GetFileOk returns a tuple with the File field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *TopLongTaskInvoker) GetFileOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.File.Get(), o.File.IsSet() +} + +// SetFile sets field value. +func (o *TopLongTaskInvoker) SetFile(v string) { + o.File.Set(&v) +} + +// GetImpactScore returns the ImpactScore field value if set, zero value otherwise. +func (o *TopLongTaskInvoker) GetImpactScore() float64 { + if o == nil || o.ImpactScore == nil { + var ret float64 + return ret + } + return *o.ImpactScore +} + +// GetImpactScoreOk returns a tuple with the ImpactScore field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TopLongTaskInvoker) GetImpactScoreOk() (*float64, bool) { + if o == nil || o.ImpactScore == nil { + return nil, false + } + return o.ImpactScore, true +} + +// HasImpactScore returns a boolean if a field has been set. +func (o *TopLongTaskInvoker) HasImpactScore() bool { + return o != nil && o.ImpactScore != nil +} + +// SetImpactScore gets a reference to the given float64 and assigns it to the ImpactScore field. +func (o *TopLongTaskInvoker) SetImpactScore(v float64) { + o.ImpactScore = &v +} + +// GetInvoker returns the Invoker field value. +func (o *TopLongTaskInvoker) GetInvoker() string { + if o == nil { + var ret string + return ret + } + return o.Invoker +} + +// GetInvokerOk returns a tuple with the Invoker field value +// and a boolean to check if the value has been set. +func (o *TopLongTaskInvoker) GetInvokerOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Invoker, true +} + +// SetInvoker sets field value. +func (o *TopLongTaskInvoker) SetInvoker(v string) { + o.Invoker = v +} + +// GetStatsPerView returns the StatsPerView field value. +func (o *TopLongTaskInvoker) GetStatsPerView() LongTaskStatsPerView { + if o == nil { + var ret LongTaskStatsPerView + return ret + } + return o.StatsPerView +} + +// GetStatsPerViewOk returns a tuple with the StatsPerView field value +// and a boolean to check if the value has been set. +func (o *TopLongTaskInvoker) GetStatsPerViewOk() (*LongTaskStatsPerView, bool) { + if o == nil { + return nil, false + } + return &o.StatsPerView, true +} + +// SetStatsPerView sets field value. +func (o *TopLongTaskInvoker) SetStatsPerView(v LongTaskStatsPerView) { + o.StatsPerView = v +} + +// GetViewOccurrences returns the ViewOccurrences field value. +func (o *TopLongTaskInvoker) GetViewOccurrences() int32 { + if o == nil { + var ret int32 + return ret + } + return o.ViewOccurrences +} + +// GetViewOccurrencesOk returns a tuple with the ViewOccurrences field value +// and a boolean to check if the value has been set. +func (o *TopLongTaskInvoker) GetViewOccurrencesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.ViewOccurrences, true +} + +// SetViewOccurrences sets field value. +func (o *TopLongTaskInvoker) SetViewOccurrences(v int32) { + o.ViewOccurrences = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TopLongTaskInvoker) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CriteriaViewOccurrences != nil { + toSerialize["criteria_view_occurrences"] = o.CriteriaViewOccurrences + } + toSerialize["file"] = o.File.Get() + if o.ImpactScore != nil { + toSerialize["impact_score"] = o.ImpactScore + } + toSerialize["invoker"] = o.Invoker + toSerialize["stats_per_view"] = o.StatsPerView + toSerialize["view_occurrences"] = o.ViewOccurrences + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TopLongTaskInvoker) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CriteriaViewOccurrences *int32 `json:"criteria_view_occurrences,omitempty"` + File datadog.NullableString `json:"file"` + ImpactScore *float64 `json:"impact_score,omitempty"` + Invoker *string `json:"invoker"` + StatsPerView *LongTaskStatsPerView `json:"stats_per_view"` + ViewOccurrences *int32 `json:"view_occurrences"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if !all.File.IsSet() { + return fmt.Errorf("required field file missing") + } + if all.Invoker == nil { + return fmt.Errorf("required field invoker missing") + } + if all.StatsPerView == nil { + return fmt.Errorf("required field stats_per_view missing") + } + if all.ViewOccurrences == nil { + return fmt.Errorf("required field view_occurrences missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"criteria_view_occurrences", "file", "impact_score", "invoker", "stats_per_view", "view_occurrences"}) + } else { + return err + } + + hasInvalidField := false + o.CriteriaViewOccurrences = all.CriteriaViewOccurrences + o.File = all.File + o.ImpactScore = all.ImpactScore + o.Invoker = *all.Invoker + if all.StatsPerView.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.StatsPerView = *all.StatsPerView + o.ViewOccurrences = *all.ViewOccurrences + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/examples/v2/rum/QueryAggregatedLongTasks.go b/examples/v2/rum/QueryAggregatedLongTasks.go new file mode 100644 index 00000000000..2100d102a21 --- /dev/null +++ b/examples/v2/rum/QueryAggregatedLongTasks.go @@ -0,0 +1,47 @@ +// Query aggregated long tasks returns "Successful response" 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.AggregatedLongTasksRequest{ + Data: datadogV2.AggregatedLongTasksRequestData{ + Attributes: datadogV2.AggregatedLongTasksRequestAttributes{ + ApplicationId: "ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b", + Criteria: &datadogV2.AggregatedWaterfallPerformanceCriteria{ + Max: datadog.PtrFloat64(5.0), + Metric: datadogV2.AGGREGATEDWATERFALLPERFORMANCECRITERIAMETRIC_LargestContentfulPaint, + Min: datadog.PtrFloat64(2.5), + }, + Filter: datadog.PtrString("@session.type:user"), + From: 1762437564, + SampleSize: 20, + To: 1762523964, + ViewName: "/account/login(/:type)", + }, + Type: datadogV2.AGGREGATEDLONGTASKSREQUESTTYPE_AggregatedLongTasks, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewRUMApi(apiClient) + resp, r, err := api.QueryAggregatedLongTasks(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RUMApi.QueryAggregatedLongTasks`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `RUMApi.QueryAggregatedLongTasks`:\n%s\n", responseContent) +} diff --git a/examples/v2/rum/QueryAggregatedSignalsProblems.go b/examples/v2/rum/QueryAggregatedSignalsProblems.go new file mode 100644 index 00000000000..3cfc80788ee --- /dev/null +++ b/examples/v2/rum/QueryAggregatedSignalsProblems.go @@ -0,0 +1,51 @@ +// Query aggregated signals and problems returns "Successful response" 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.AggregatedSignalsProblemsRequest{ + Data: datadogV2.AggregatedSignalsProblemsRequestData{ + Attributes: datadogV2.AggregatedSignalsProblemsRequestAttributes{ + ApplicationId: "ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b", + Criteria: &datadogV2.AggregatedWaterfallPerformanceCriteria{ + Max: datadog.PtrFloat64(5.0), + Metric: datadogV2.AGGREGATEDWATERFALLPERFORMANCECRITERIAMETRIC_LargestContentfulPaint, + Min: datadog.PtrFloat64(2.5), + }, + DetectionTypes: []string{ + "high_script_evaluations", + "uncompressed_resources", + }, + Filter: datadog.PtrString("@session.type:user"), + From: 1762437564, + SampleSize: 30, + To: 1762523964, + ViewName: "/account/login(/:type)", + }, + Type: datadogV2.AGGREGATEDSIGNALSPROBLEMSREQUESTTYPE_AggregatedSignalsProblems, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewRUMApi(apiClient) + resp, r, err := api.QueryAggregatedSignalsProblems(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RUMApi.QueryAggregatedSignalsProblems`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `RUMApi.QueryAggregatedSignalsProblems`:\n%s\n", responseContent) +} diff --git a/examples/v2/rum/QueryAggregatedWaterfall.go b/examples/v2/rum/QueryAggregatedWaterfall.go new file mode 100644 index 00000000000..56639599f3a --- /dev/null +++ b/examples/v2/rum/QueryAggregatedWaterfall.go @@ -0,0 +1,48 @@ +// Query aggregated waterfall returns "Successful response" 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.AggregatedWaterfallRequest{ + Data: datadogV2.AggregatedWaterfallRequestData{ + Attributes: datadogV2.AggregatedWaterfallRequestAttributes{ + ApplicationId: "ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b", + Criteria: &datadogV2.AggregatedWaterfallPerformanceCriteria{ + Max: datadog.PtrFloat64(5.0), + Metric: datadogV2.AGGREGATEDWATERFALLPERFORMANCECRITERIAMETRIC_LargestContentfulPaint, + Min: datadog.PtrFloat64(2.5), + }, + Filter: datadog.PtrString("@session.type:user"), + From: 1762437564, + IncludeGlobalAppearance: datadog.PtrBool(false), + SampleSize: 20, + To: 1762523964, + ViewName: "/account/login(/:type)", + }, + Type: datadogV2.AGGREGATEDWATERFALLREQUESTTYPE_AggregatedWaterfall, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewRUMApi(apiClient) + resp, r, err := api.QueryAggregatedWaterfall(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RUMApi.QueryAggregatedWaterfall`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `RUMApi.QueryAggregatedWaterfall`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/features/v2/rum.feature b/tests/scenarios/features/v2/rum.feature index e25922fb48c..386fca68b45 100644 --- a/tests/scenarios/features/v2/rum.feature +++ b/tests/scenarios/features/v2/rum.feature @@ -130,6 +130,48 @@ Feature: RUM And the response "data" has item with field "attributes.product_scales.rum_event_processing_scale.state" with value "ALL" And the response "data" has item with field "attributes.product_scales.product_analytics_retention_scale.state" with value "NONE" + @generated @skip @team:DataDog/rum-backend + Scenario: Query aggregated long tasks returns "Bad Request" response + Given new "QueryAggregatedLongTasks" request + And body with value {"data": {"attributes": {"application_id": "ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b", "criteria": {"max": 5.0, "metric": "largest_contentful_paint", "min": 2.5}, "filter": "@session.type:user", "from": 1762437564, "sample_size": 20, "to": 1762523964, "view_name": "/account/login(/:type)"}, "type": "aggregated_long_tasks"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/rum-backend + Scenario: Query aggregated long tasks returns "Successful response" response + Given new "QueryAggregatedLongTasks" request + And body with value {"data": {"attributes": {"application_id": "ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b", "criteria": {"max": 5.0, "metric": "largest_contentful_paint", "min": 2.5}, "filter": "@session.type:user", "from": 1762437564, "sample_size": 20, "to": 1762523964, "view_name": "/account/login(/:type)"}, "type": "aggregated_long_tasks"}} + When the request is sent + Then the response status is 201 Successful response + + @generated @skip @team:DataDog/rum-backend + Scenario: Query aggregated signals and problems returns "Bad Request" response + Given new "QueryAggregatedSignalsProblems" request + And body with value {"data": {"attributes": {"application_id": "ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b", "criteria": {"max": 5.0, "metric": "largest_contentful_paint", "min": 2.5}, "detection_types": ["high_script_evaluations", "uncompressed_resources"], "filter": "@session.type:user", "from": 1762437564, "sample_size": 30, "to": 1762523964, "view_name": "/account/login(/:type)"}, "type": "aggregated_signals_problems"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/rum-backend + Scenario: Query aggregated signals and problems returns "Successful response" response + Given new "QueryAggregatedSignalsProblems" request + And body with value {"data": {"attributes": {"application_id": "ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b", "criteria": {"max": 5.0, "metric": "largest_contentful_paint", "min": 2.5}, "detection_types": ["high_script_evaluations", "uncompressed_resources"], "filter": "@session.type:user", "from": 1762437564, "sample_size": 30, "to": 1762523964, "view_name": "/account/login(/:type)"}, "type": "aggregated_signals_problems"}} + When the request is sent + Then the response status is 201 Successful response + + @generated @skip @team:DataDog/rum-backend + Scenario: Query aggregated waterfall returns "Bad Request" response + Given new "QueryAggregatedWaterfall" request + And body with value {"data": {"attributes": {"application_id": "ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b", "criteria": {"max": 5.0, "metric": "largest_contentful_paint", "min": 2.5}, "filter": "@session.type:user", "from": 1762437564, "include_global_appearance": false, "sample_size": 20, "to": 1762523964, "view_name": "/account/login(/:type)"}, "type": "aggregated_waterfall"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/rum-backend + Scenario: Query aggregated waterfall returns "Successful response" response + Given new "QueryAggregatedWaterfall" request + And body with value {"data": {"attributes": {"application_id": "ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b", "criteria": {"max": 5.0, "metric": "largest_contentful_paint", "min": 2.5}, "filter": "@session.type:user", "from": 1762437564, "include_global_appearance": false, "sample_size": 20, "to": 1762523964, "view_name": "/account/login(/:type)"}, "type": "aggregated_waterfall"}} + When the request is sent + Then the response status is 201 Successful response + @generated @skip @team:DataDog/rum-backend Scenario: Search RUM events returns "Bad Request" response Given new "SearchRUMEvents" request diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 1b8f5ec0b97..d962240081c 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -5666,6 +5666,24 @@ "type": "safe" } }, + "QueryAggregatedLongTasks": { + "tag": "RUM", + "undo": { + "type": "safe" + } + }, + "QueryAggregatedSignalsProblems": { + "tag": "RUM", + "undo": { + "type": "safe" + } + }, + "QueryAggregatedWaterfall": { + "tag": "RUM", + "undo": { + "type": "safe" + } + }, "ListRumReplayPlaylists": { "tag": "Rum Replay Playlists", "undo": {