From 941dd3feaa6c789c3681a3d0bd1c42d38e7e3d59 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 28 Jul 2026 16:07:33 +0000 Subject: [PATCH] Regenerate client from commit 73e3f8c of spec repo --- .generator/schemas/v2/openapi.yaml | 312 +++++++++++++- api/datadog/configuration.go | 5 +- api/datadogV2/api_ddsql.go | 20 - api/datadogV2/api_rum_config.go | 291 +++++++++++++ api/datadogV2/doc.go | 3 + .../model_ddsql_tabular_query_column.go | 14 +- api/datadogV2/model_rum_config_attributes.go | 391 ++++++++++++++++++ .../model_rum_config_create_attributes.go | 101 +++++ api/datadogV2/model_rum_config_create_data.go | 148 +++++++ .../model_rum_config_create_request.go | 110 +++++ api/datadogV2/model_rum_config_data.go | 180 ++++++++ api/datadogV2/model_rum_config_response.go | 110 +++++ api/datadogV2/model_rum_config_type.go | 64 +++ .../model_rum_config_update_attributes.go | 101 +++++ api/datadogV2/model_rum_config_update_data.go | 148 +++++++ .../model_rum_config_update_request.go | 110 +++++ examples/v2/rum-config/CreateRumConfig.go | 38 ++ examples/v2/rum-config/GetRumConfig.go | 30 ++ examples/v2/rum-config/UpdateRumConfig.go | 38 ++ tests/scenarios/api_mappings.go | 1 + .../scenarios/features/v2/rum_config.feature | 49 +++ tests/scenarios/features/v2/undo.json | 18 + 22 files changed, 2248 insertions(+), 34 deletions(-) create mode 100644 api/datadogV2/api_rum_config.go create mode 100644 api/datadogV2/model_rum_config_attributes.go create mode 100644 api/datadogV2/model_rum_config_create_attributes.go create mode 100644 api/datadogV2/model_rum_config_create_data.go create mode 100644 api/datadogV2/model_rum_config_create_request.go create mode 100644 api/datadogV2/model_rum_config_data.go create mode 100644 api/datadogV2/model_rum_config_response.go create mode 100644 api/datadogV2/model_rum_config_type.go create mode 100644 api/datadogV2/model_rum_config_update_attributes.go create mode 100644 api/datadogV2/model_rum_config_update_data.go create mode 100644 api/datadogV2/model_rum_config_update_request.go create mode 100644 examples/v2/rum-config/CreateRumConfig.go create mode 100644 examples/v2/rum-config/GetRumConfig.go create mode 100644 examples/v2/rum-config/UpdateRumConfig.go create mode 100644 tests/scenarios/features/v2/rum_config.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index acd63e70a66..63a5832b9f9 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -31063,9 +31063,17 @@ components: type: string values: description: |- - Column values in row order. The element type matches the column's `type`; - for example a `VARCHAR` column carries strings, a `TIMESTAMP` column carries - Unix-millisecond integers. `null` is allowed for missing values. + Column values in row order, one entry per result row. The element type + follows the column's `type`. The following serialization rules should be + taken into account: + + - `BIGINT` values are encoded as JSON numbers in the signed 64-bit integer range. + - `DECIMAL` values are encoded as JSON numbers with 64-bit double precision. + - `TIMESTAMP` and `DATE` values are encoded as Unix-millisecond integers; a + `DATE` resolves to midnight UTC. + - `JSON` values are returned as a JSON-encoded string. + + `null` is allowed for any column type where a value is missing. example: - web-store - checkout @@ -84510,6 +84518,144 @@ components: type: string x-enum-varnames: - RULESET_STATUS + RumConfigAttributes: + description: Attributes of the RUM configuration. + properties: + disabled: + description: Whether the RUM configuration is disabled for the organization. + example: false + type: boolean + enforced_application_tags: + description: Whether application tags are enforced for the RUM applications in the organization. + example: true + type: boolean + enforced_application_tags_updated_at: + description: Timestamp of when the enforced application tags setting was last updated. + example: "2024-01-15T09:30:00.000Z" + format: date-time + type: string + enforced_application_tags_updated_by: + description: Handle of the user who last updated the enforced application tags setting. + example: "user@example.com" + type: string + ootb_metrics_version: + description: Version of the out-of-the-box metrics installed for the organization. + example: 5 + format: int64 + type: integer + ootb_metrics_version_installed_at: + description: Timestamp of when the out-of-the-box metrics version was installed. + example: "2024-01-15T09:30:00.000Z" + format: date-time + type: string + retention_filters_enabled: + description: Whether retention filters are enabled for the organization. + example: true + type: boolean + retention_filters_enabled_updated_at: + description: Timestamp of when the retention filters setting was last updated. + example: "2024-01-15T09:30:00.000Z" + format: date-time + type: string + retention_filters_enabled_updated_by: + description: Handle of the user or job who last updated the retention filters setting. + example: "contract-update-job" + type: string + required: + - enforced_application_tags + - retention_filters_enabled + type: object + RumConfigCreateAttributes: + description: Attributes of the RUM configuration to create. + properties: + enforced_application_tags: + description: Whether application tags are enforced for the RUM applications in the organization. + example: true + type: boolean + required: + - enforced_application_tags + type: object + RumConfigCreateData: + description: Object describing the RUM configuration to create. + properties: + attributes: + $ref: "#/components/schemas/RumConfigCreateAttributes" + type: + $ref: "#/components/schemas/RumConfigType" + required: + - type + - attributes + type: object + RumConfigCreateRequest: + description: Request body for creating the RUM configuration. + properties: + data: + $ref: "#/components/schemas/RumConfigCreateData" + required: + - data + type: object + RumConfigData: + description: The RUM configuration data. + properties: + attributes: + $ref: "#/components/schemas/RumConfigAttributes" + id: + description: The organization ID associated with the RUM configuration. + example: "1234" + type: string + type: + $ref: "#/components/schemas/RumConfigType" + required: + - id + - type + - attributes + type: object + RumConfigResponse: + description: The RUM configuration object. + properties: + data: + $ref: "#/components/schemas/RumConfigData" + required: + - data + type: object + RumConfigType: + default: rum_config + description: The type of the resource. The value should always be `rum_config`. + enum: + - rum_config + example: rum_config + type: string + x-enum-varnames: + - RUM_CONFIG + RumConfigUpdateAttributes: + description: Attributes of the RUM configuration to update. + properties: + enforced_application_tags: + description: Whether application tags are enforced for the RUM applications in the organization. + example: true + type: boolean + required: + - enforced_application_tags + type: object + RumConfigUpdateData: + description: Object describing the RUM configuration to update. + properties: + attributes: + $ref: "#/components/schemas/RumConfigUpdateAttributes" + type: + $ref: "#/components/schemas/RumConfigType" + required: + - type + - attributes + type: object + RumConfigUpdateRequest: + description: Request body for updating the RUM configuration. + properties: + data: + $ref: "#/components/schemas/RumConfigUpdateData" + required: + - data + type: object RumCrossProductSampling: description: The configuration for cross-product retention filters. properties: @@ -135602,9 +135748,6 @@ paths: summary: Execute a tabular DDSQL query tags: - DDSQL - x-unstable: |- - **Note**: This endpoint is in preview and is subject to change. - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/ddsql/query/tabular/fetch: post: description: |- @@ -135713,9 +135856,6 @@ paths: summary: Fetch the result of a DDSQL query tags: - DDSQL - x-unstable: |- - **Note**: This endpoint is in preview and is subject to change. - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/deletion/data/{product}: post: description: Creates a data deletion request by providing a query and a timeframe targeting the proper data. @@ -175342,6 +175482,153 @@ paths: operator: OR permissions: - rum_apps_write + /api/v2/rum/config: + get: + description: Get the RUM configuration for your organization. + operationId: GetRumConfig + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + disabled: false + enforced_application_tags: true + enforced_application_tags_updated_at: "2024-01-15T09:30:00.000Z" + enforced_application_tags_updated_by: "user@example.com" + ootb_metrics_version: 5 + ootb_metrics_version_installed_at: "2024-01-15T09:30:00.000Z" + retention_filters_enabled: true + retention_filters_enabled_updated_at: "2024-01-15T09:30:00.000Z" + retention_filters_enabled_updated_by: "contract-update-job" + id: "1234" + type: rum_config + schema: + $ref: "#/components/schemas/RumConfigResponse" + description: OK + "403": + $ref: "#/components/responses/NotAuthorizedResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get the RUM configuration + tags: + - RUM Config + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + patch: + description: |- + Update the RUM configuration for your organization. + Returns the RUM configuration object from the request body when the request is successful. + operationId: UpdateRumConfig + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + enforced_application_tags: false + type: rum_config + schema: + $ref: "#/components/schemas/RumConfigUpdateRequest" + description: New definition of the RUM configuration. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + disabled: false + enforced_application_tags: false + enforced_application_tags_updated_at: "2024-01-15T09:30:00.000Z" + enforced_application_tags_updated_by: "user@example.com" + ootb_metrics_version: 5 + ootb_metrics_version_installed_at: "2024-01-15T09:30:00.000Z" + retention_filters_enabled: true + retention_filters_enabled_updated_at: "2024-01-15T09:30:00.000Z" + retention_filters_enabled_updated_by: "contract-update-job" + id: "1234" + type: rum_config + schema: + $ref: "#/components/schemas/RumConfigResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/NotAuthorizedResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Update the RUM configuration + tags: + - RUM Config + x-codegen-request-body-name: body + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + post: + description: |- + Create the RUM configuration for your organization. + Returns the RUM configuration object from the request body when the request is successful. + operationId: CreateRumConfig + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + enforced_application_tags: true + type: rum_config + schema: + $ref: "#/components/schemas/RumConfigCreateRequest" + description: The definition of the RUM configuration to create. + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + disabled: false + enforced_application_tags: true + enforced_application_tags_updated_at: "2024-01-15T09:30:00.000Z" + enforced_application_tags_updated_by: "user@example.com" + ootb_metrics_version: 5 + ootb_metrics_version_installed_at: "2024-01-15T09:30:00.000Z" + retention_filters_enabled: true + retention_filters_enabled_updated_at: "2024-01-15T09:30:00.000Z" + retention_filters_enabled_updated_by: "contract-update-job" + id: "1234" + type: rum_config + schema: + $ref: "#/components/schemas/RumConfigResponse" + description: Created + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/NotAuthorizedResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Create the RUM configuration + tags: + - RUM Config + x-codegen-request-body-name: body + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/rum/config/metrics: get: description: Get the list of configured RUM-based metrics with their definitions. @@ -204785,6 +205072,13 @@ tags: - description: |- Manage your Real User Monitoring (RUM) applications, and search or aggregate your RUM events over HTTP. See the [RUM & Session Replay page](https://docs.datadoghq.com/real_user_monitoring/) for more information name: RUM + - description: |- + Manage the [Real User Monitoring (RUM)](https://docs.datadoghq.com/real_user_monitoring/) + configuration for your organization. + externalDocs: + description: Find out more at + url: https://docs.datadoghq.com/real_user_monitoring/ + name: RUM Config - description: |- Get insights into the performance of your Real User Monitoring (RUM) applications over HTTP. See the [RUM & Session Replay page](https://docs.datadoghq.com/real_user_monitoring/) for more information name: RUM Insights diff --git a/api/datadog/configuration.go b/api/datadog/configuration.go index 6acbb10a2b1..332bf16ff8a 100644 --- a/api/datadog/configuration.go +++ b/api/datadog/configuration.go @@ -903,8 +903,6 @@ func NewConfiguration() *Configuration { "v2.GetAllDatasets": false, "v2.GetDataset": false, "v2.UpdateDataset": false, - "v2.ExecuteDdsqlTabularQuery": false, - "v2.FetchDdsqlTabularQuery": false, "v2.CancelDataDeletionRequest": false, "v2.CreateDataDeletionRequest": false, "v2.GetDataDeletionRequests": false, @@ -1109,6 +1107,9 @@ func NewConfiguration() *Configuration { "v2.GetSourcemaps": false, "v2.ListSourcemaps": false, "v2.RestoreSourcemaps": false, + "v2.CreateRumConfig": false, + "v2.GetRumConfig": false, + "v2.UpdateRumConfig": false, "v2.DeleteRumRateLimitConfig": false, "v2.GetRumRateLimitConfig": false, "v2.UpdateRumRateLimitConfig": false, diff --git a/api/datadogV2/api_ddsql.go b/api/datadogV2/api_ddsql.go index 0b73c797146..f712ed0725c 100644 --- a/api/datadogV2/api_ddsql.go +++ b/api/datadogV2/api_ddsql.go @@ -6,8 +6,6 @@ package datadogV2 import ( _context "context" - _fmt "fmt" - _log "log" _nethttp "net/http" _neturl "net/url" @@ -28,15 +26,6 @@ func (a *DDSQLApi) ExecuteDdsqlTabularQuery(ctx _context.Context, body DdsqlTabu localVarReturnValue DdsqlTabularQueryResponse ) - operationId := "v2.ExecuteDdsqlTabularQuery" - isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) - if !isOperationEnabled { - return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - if isOperationEnabled && a.Client.Cfg.Debug { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.DDSQLApi.ExecuteDdsqlTabularQuery") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} @@ -129,15 +118,6 @@ func (a *DDSQLApi) FetchDdsqlTabularQuery(ctx _context.Context, body DdsqlTabula localVarReturnValue DdsqlTabularQueryResponse ) - operationId := "v2.FetchDdsqlTabularQuery" - isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) - if !isOperationEnabled { - return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - if isOperationEnabled && a.Client.Cfg.Debug { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.DDSQLApi.FetchDdsqlTabularQuery") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} diff --git a/api/datadogV2/api_rum_config.go b/api/datadogV2/api_rum_config.go new file mode 100644 index 00000000000..a26c017c700 --- /dev/null +++ b/api/datadogV2/api_rum_config.go @@ -0,0 +1,291 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + _context "context" + _fmt "fmt" + _log "log" + _nethttp "net/http" + _neturl "net/url" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RUMConfigApi service type +type RUMConfigApi datadog.Service + +// CreateRumConfig Create the RUM configuration. +// Create the RUM configuration for your organization. +// Returns the RUM configuration object from the request body when the request is successful. +func (a *RUMConfigApi) CreateRumConfig(ctx _context.Context, body RumConfigCreateRequest) (RumConfigResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue RumConfigResponse + ) + + operationId := "v2.CreateRumConfig" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.RUMConfigApi.CreateRumConfig") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/rum/config" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 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 +} + +// GetRumConfig Get the RUM configuration. +// Get the RUM configuration for your organization. +func (a *RUMConfigApi) GetRumConfig(ctx _context.Context) (RumConfigResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue RumConfigResponse + ) + + operationId := "v2.GetRumConfig" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.RUMConfigApi.GetRumConfig") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/rum/config" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 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 +} + +// UpdateRumConfig Update the RUM configuration. +// Update the RUM configuration for your organization. +// Returns the RUM configuration object from the request body when the request is successful. +func (a *RUMConfigApi) UpdateRumConfig(ctx _context.Context, body RumConfigUpdateRequest) (RumConfigResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue RumConfigResponse + ) + + operationId := "v2.UpdateRumConfig" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.RUMConfigApi.UpdateRumConfig") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/rum/config" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 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 +} + +// NewRUMConfigApi Returns NewRUMConfigApi. +func NewRUMConfigApi(client *datadog.APIClient) *RUMConfigApi { + return &RUMConfigApi{ + Client: client, + } +} diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index 8a1266b8522..356848d2b75 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -906,6 +906,9 @@ // - [RUMApi.RestoreSourcemaps] // - [RUMApi.SearchRUMEvents] // - [RUMApi.UpdateRUMApplication] +// - [RUMConfigApi.CreateRumConfig] +// - [RUMConfigApi.GetRumConfig] +// - [RUMConfigApi.UpdateRumConfig] // - [RUMInsightsApi.QueryAggregatedLongTasks] // - [RUMInsightsApi.QueryAggregatedSignalsProblems] // - [RUMInsightsApi.QueryAggregatedWaterfall] diff --git a/api/datadogV2/model_ddsql_tabular_query_column.go b/api/datadogV2/model_ddsql_tabular_query_column.go index 330606f2679..238d1cefed4 100644 --- a/api/datadogV2/model_ddsql_tabular_query_column.go +++ b/api/datadogV2/model_ddsql_tabular_query_column.go @@ -20,9 +20,17 @@ type DdsqlTabularQueryColumn struct { // [DDSQL data-types reference](https://docs.datadoghq.com/ddsql_reference/#data-types) // for the full, up-to-date list. Type string `json:"type"` - // Column values in row order. The element type matches the column's `type`; - // for example a `VARCHAR` column carries strings, a `TIMESTAMP` column carries - // Unix-millisecond integers. `null` is allowed for missing values. + // Column values in row order, one entry per result row. The element type + // follows the column's `type`. The following serialization rules should be + // taken into account: + // + // - `BIGINT` values are encoded as JSON numbers in the signed 64-bit integer range. + // - `DECIMAL` values are encoded as JSON numbers with 64-bit double precision. + // - `TIMESTAMP` and `DATE` values are encoded as Unix-millisecond integers; a + // `DATE` resolves to midnight UTC. + // - `JSON` values are returned as a JSON-encoded string. + // + // `null` is allowed for any column type where a value is missing. Values []interface{} `json:"values"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` diff --git a/api/datadogV2/model_rum_config_attributes.go b/api/datadogV2/model_rum_config_attributes.go new file mode 100644 index 00000000000..7323a5fb2f6 --- /dev/null +++ b/api/datadogV2/model_rum_config_attributes.go @@ -0,0 +1,391 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumConfigAttributes Attributes of the RUM configuration. +type RumConfigAttributes struct { + // Whether the RUM configuration is disabled for the organization. + Disabled *bool `json:"disabled,omitempty"` + // Whether application tags are enforced for the RUM applications in the organization. + EnforcedApplicationTags bool `json:"enforced_application_tags"` + // Timestamp of when the enforced application tags setting was last updated. + EnforcedApplicationTagsUpdatedAt *time.Time `json:"enforced_application_tags_updated_at,omitempty"` + // Handle of the user who last updated the enforced application tags setting. + EnforcedApplicationTagsUpdatedBy *string `json:"enforced_application_tags_updated_by,omitempty"` + // Version of the out-of-the-box metrics installed for the organization. + OotbMetricsVersion *int64 `json:"ootb_metrics_version,omitempty"` + // Timestamp of when the out-of-the-box metrics version was installed. + OotbMetricsVersionInstalledAt *time.Time `json:"ootb_metrics_version_installed_at,omitempty"` + // Whether retention filters are enabled for the organization. + RetentionFiltersEnabled bool `json:"retention_filters_enabled"` + // Timestamp of when the retention filters setting was last updated. + RetentionFiltersEnabledUpdatedAt *time.Time `json:"retention_filters_enabled_updated_at,omitempty"` + // Handle of the user or job who last updated the retention filters setting. + RetentionFiltersEnabledUpdatedBy *string `json:"retention_filters_enabled_updated_by,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:"-"` +} + +// NewRumConfigAttributes instantiates a new RumConfigAttributes 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 NewRumConfigAttributes(enforcedApplicationTags bool, retentionFiltersEnabled bool) *RumConfigAttributes { + this := RumConfigAttributes{} + this.EnforcedApplicationTags = enforcedApplicationTags + this.RetentionFiltersEnabled = retentionFiltersEnabled + return &this +} + +// NewRumConfigAttributesWithDefaults instantiates a new RumConfigAttributes 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 NewRumConfigAttributesWithDefaults() *RumConfigAttributes { + this := RumConfigAttributes{} + return &this +} + +// GetDisabled returns the Disabled field value if set, zero value otherwise. +func (o *RumConfigAttributes) GetDisabled() bool { + if o == nil || o.Disabled == nil { + var ret bool + return ret + } + return *o.Disabled +} + +// GetDisabledOk returns a tuple with the Disabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumConfigAttributes) GetDisabledOk() (*bool, bool) { + if o == nil || o.Disabled == nil { + return nil, false + } + return o.Disabled, true +} + +// HasDisabled returns a boolean if a field has been set. +func (o *RumConfigAttributes) HasDisabled() bool { + return o != nil && o.Disabled != nil +} + +// SetDisabled gets a reference to the given bool and assigns it to the Disabled field. +func (o *RumConfigAttributes) SetDisabled(v bool) { + o.Disabled = &v +} + +// GetEnforcedApplicationTags returns the EnforcedApplicationTags field value. +func (o *RumConfigAttributes) GetEnforcedApplicationTags() bool { + if o == nil { + var ret bool + return ret + } + return o.EnforcedApplicationTags +} + +// GetEnforcedApplicationTagsOk returns a tuple with the EnforcedApplicationTags field value +// and a boolean to check if the value has been set. +func (o *RumConfigAttributes) GetEnforcedApplicationTagsOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.EnforcedApplicationTags, true +} + +// SetEnforcedApplicationTags sets field value. +func (o *RumConfigAttributes) SetEnforcedApplicationTags(v bool) { + o.EnforcedApplicationTags = v +} + +// GetEnforcedApplicationTagsUpdatedAt returns the EnforcedApplicationTagsUpdatedAt field value if set, zero value otherwise. +func (o *RumConfigAttributes) GetEnforcedApplicationTagsUpdatedAt() time.Time { + if o == nil || o.EnforcedApplicationTagsUpdatedAt == nil { + var ret time.Time + return ret + } + return *o.EnforcedApplicationTagsUpdatedAt +} + +// GetEnforcedApplicationTagsUpdatedAtOk returns a tuple with the EnforcedApplicationTagsUpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumConfigAttributes) GetEnforcedApplicationTagsUpdatedAtOk() (*time.Time, bool) { + if o == nil || o.EnforcedApplicationTagsUpdatedAt == nil { + return nil, false + } + return o.EnforcedApplicationTagsUpdatedAt, true +} + +// HasEnforcedApplicationTagsUpdatedAt returns a boolean if a field has been set. +func (o *RumConfigAttributes) HasEnforcedApplicationTagsUpdatedAt() bool { + return o != nil && o.EnforcedApplicationTagsUpdatedAt != nil +} + +// SetEnforcedApplicationTagsUpdatedAt gets a reference to the given time.Time and assigns it to the EnforcedApplicationTagsUpdatedAt field. +func (o *RumConfigAttributes) SetEnforcedApplicationTagsUpdatedAt(v time.Time) { + o.EnforcedApplicationTagsUpdatedAt = &v +} + +// GetEnforcedApplicationTagsUpdatedBy returns the EnforcedApplicationTagsUpdatedBy field value if set, zero value otherwise. +func (o *RumConfigAttributes) GetEnforcedApplicationTagsUpdatedBy() string { + if o == nil || o.EnforcedApplicationTagsUpdatedBy == nil { + var ret string + return ret + } + return *o.EnforcedApplicationTagsUpdatedBy +} + +// GetEnforcedApplicationTagsUpdatedByOk returns a tuple with the EnforcedApplicationTagsUpdatedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumConfigAttributes) GetEnforcedApplicationTagsUpdatedByOk() (*string, bool) { + if o == nil || o.EnforcedApplicationTagsUpdatedBy == nil { + return nil, false + } + return o.EnforcedApplicationTagsUpdatedBy, true +} + +// HasEnforcedApplicationTagsUpdatedBy returns a boolean if a field has been set. +func (o *RumConfigAttributes) HasEnforcedApplicationTagsUpdatedBy() bool { + return o != nil && o.EnforcedApplicationTagsUpdatedBy != nil +} + +// SetEnforcedApplicationTagsUpdatedBy gets a reference to the given string and assigns it to the EnforcedApplicationTagsUpdatedBy field. +func (o *RumConfigAttributes) SetEnforcedApplicationTagsUpdatedBy(v string) { + o.EnforcedApplicationTagsUpdatedBy = &v +} + +// GetOotbMetricsVersion returns the OotbMetricsVersion field value if set, zero value otherwise. +func (o *RumConfigAttributes) GetOotbMetricsVersion() int64 { + if o == nil || o.OotbMetricsVersion == nil { + var ret int64 + return ret + } + return *o.OotbMetricsVersion +} + +// GetOotbMetricsVersionOk returns a tuple with the OotbMetricsVersion field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumConfigAttributes) GetOotbMetricsVersionOk() (*int64, bool) { + if o == nil || o.OotbMetricsVersion == nil { + return nil, false + } + return o.OotbMetricsVersion, true +} + +// HasOotbMetricsVersion returns a boolean if a field has been set. +func (o *RumConfigAttributes) HasOotbMetricsVersion() bool { + return o != nil && o.OotbMetricsVersion != nil +} + +// SetOotbMetricsVersion gets a reference to the given int64 and assigns it to the OotbMetricsVersion field. +func (o *RumConfigAttributes) SetOotbMetricsVersion(v int64) { + o.OotbMetricsVersion = &v +} + +// GetOotbMetricsVersionInstalledAt returns the OotbMetricsVersionInstalledAt field value if set, zero value otherwise. +func (o *RumConfigAttributes) GetOotbMetricsVersionInstalledAt() time.Time { + if o == nil || o.OotbMetricsVersionInstalledAt == nil { + var ret time.Time + return ret + } + return *o.OotbMetricsVersionInstalledAt +} + +// GetOotbMetricsVersionInstalledAtOk returns a tuple with the OotbMetricsVersionInstalledAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumConfigAttributes) GetOotbMetricsVersionInstalledAtOk() (*time.Time, bool) { + if o == nil || o.OotbMetricsVersionInstalledAt == nil { + return nil, false + } + return o.OotbMetricsVersionInstalledAt, true +} + +// HasOotbMetricsVersionInstalledAt returns a boolean if a field has been set. +func (o *RumConfigAttributes) HasOotbMetricsVersionInstalledAt() bool { + return o != nil && o.OotbMetricsVersionInstalledAt != nil +} + +// SetOotbMetricsVersionInstalledAt gets a reference to the given time.Time and assigns it to the OotbMetricsVersionInstalledAt field. +func (o *RumConfigAttributes) SetOotbMetricsVersionInstalledAt(v time.Time) { + o.OotbMetricsVersionInstalledAt = &v +} + +// GetRetentionFiltersEnabled returns the RetentionFiltersEnabled field value. +func (o *RumConfigAttributes) GetRetentionFiltersEnabled() bool { + if o == nil { + var ret bool + return ret + } + return o.RetentionFiltersEnabled +} + +// GetRetentionFiltersEnabledOk returns a tuple with the RetentionFiltersEnabled field value +// and a boolean to check if the value has been set. +func (o *RumConfigAttributes) GetRetentionFiltersEnabledOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.RetentionFiltersEnabled, true +} + +// SetRetentionFiltersEnabled sets field value. +func (o *RumConfigAttributes) SetRetentionFiltersEnabled(v bool) { + o.RetentionFiltersEnabled = v +} + +// GetRetentionFiltersEnabledUpdatedAt returns the RetentionFiltersEnabledUpdatedAt field value if set, zero value otherwise. +func (o *RumConfigAttributes) GetRetentionFiltersEnabledUpdatedAt() time.Time { + if o == nil || o.RetentionFiltersEnabledUpdatedAt == nil { + var ret time.Time + return ret + } + return *o.RetentionFiltersEnabledUpdatedAt +} + +// GetRetentionFiltersEnabledUpdatedAtOk returns a tuple with the RetentionFiltersEnabledUpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumConfigAttributes) GetRetentionFiltersEnabledUpdatedAtOk() (*time.Time, bool) { + if o == nil || o.RetentionFiltersEnabledUpdatedAt == nil { + return nil, false + } + return o.RetentionFiltersEnabledUpdatedAt, true +} + +// HasRetentionFiltersEnabledUpdatedAt returns a boolean if a field has been set. +func (o *RumConfigAttributes) HasRetentionFiltersEnabledUpdatedAt() bool { + return o != nil && o.RetentionFiltersEnabledUpdatedAt != nil +} + +// SetRetentionFiltersEnabledUpdatedAt gets a reference to the given time.Time and assigns it to the RetentionFiltersEnabledUpdatedAt field. +func (o *RumConfigAttributes) SetRetentionFiltersEnabledUpdatedAt(v time.Time) { + o.RetentionFiltersEnabledUpdatedAt = &v +} + +// GetRetentionFiltersEnabledUpdatedBy returns the RetentionFiltersEnabledUpdatedBy field value if set, zero value otherwise. +func (o *RumConfigAttributes) GetRetentionFiltersEnabledUpdatedBy() string { + if o == nil || o.RetentionFiltersEnabledUpdatedBy == nil { + var ret string + return ret + } + return *o.RetentionFiltersEnabledUpdatedBy +} + +// GetRetentionFiltersEnabledUpdatedByOk returns a tuple with the RetentionFiltersEnabledUpdatedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RumConfigAttributes) GetRetentionFiltersEnabledUpdatedByOk() (*string, bool) { + if o == nil || o.RetentionFiltersEnabledUpdatedBy == nil { + return nil, false + } + return o.RetentionFiltersEnabledUpdatedBy, true +} + +// HasRetentionFiltersEnabledUpdatedBy returns a boolean if a field has been set. +func (o *RumConfigAttributes) HasRetentionFiltersEnabledUpdatedBy() bool { + return o != nil && o.RetentionFiltersEnabledUpdatedBy != nil +} + +// SetRetentionFiltersEnabledUpdatedBy gets a reference to the given string and assigns it to the RetentionFiltersEnabledUpdatedBy field. +func (o *RumConfigAttributes) SetRetentionFiltersEnabledUpdatedBy(v string) { + o.RetentionFiltersEnabledUpdatedBy = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumConfigAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Disabled != nil { + toSerialize["disabled"] = o.Disabled + } + toSerialize["enforced_application_tags"] = o.EnforcedApplicationTags + if o.EnforcedApplicationTagsUpdatedAt != nil { + if o.EnforcedApplicationTagsUpdatedAt.Nanosecond() == 0 { + toSerialize["enforced_application_tags_updated_at"] = o.EnforcedApplicationTagsUpdatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["enforced_application_tags_updated_at"] = o.EnforcedApplicationTagsUpdatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.EnforcedApplicationTagsUpdatedBy != nil { + toSerialize["enforced_application_tags_updated_by"] = o.EnforcedApplicationTagsUpdatedBy + } + if o.OotbMetricsVersion != nil { + toSerialize["ootb_metrics_version"] = o.OotbMetricsVersion + } + if o.OotbMetricsVersionInstalledAt != nil { + if o.OotbMetricsVersionInstalledAt.Nanosecond() == 0 { + toSerialize["ootb_metrics_version_installed_at"] = o.OotbMetricsVersionInstalledAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["ootb_metrics_version_installed_at"] = o.OotbMetricsVersionInstalledAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + toSerialize["retention_filters_enabled"] = o.RetentionFiltersEnabled + if o.RetentionFiltersEnabledUpdatedAt != nil { + if o.RetentionFiltersEnabledUpdatedAt.Nanosecond() == 0 { + toSerialize["retention_filters_enabled_updated_at"] = o.RetentionFiltersEnabledUpdatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["retention_filters_enabled_updated_at"] = o.RetentionFiltersEnabledUpdatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.RetentionFiltersEnabledUpdatedBy != nil { + toSerialize["retention_filters_enabled_updated_by"] = o.RetentionFiltersEnabledUpdatedBy + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumConfigAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Disabled *bool `json:"disabled,omitempty"` + EnforcedApplicationTags *bool `json:"enforced_application_tags"` + EnforcedApplicationTagsUpdatedAt *time.Time `json:"enforced_application_tags_updated_at,omitempty"` + EnforcedApplicationTagsUpdatedBy *string `json:"enforced_application_tags_updated_by,omitempty"` + OotbMetricsVersion *int64 `json:"ootb_metrics_version,omitempty"` + OotbMetricsVersionInstalledAt *time.Time `json:"ootb_metrics_version_installed_at,omitempty"` + RetentionFiltersEnabled *bool `json:"retention_filters_enabled"` + RetentionFiltersEnabledUpdatedAt *time.Time `json:"retention_filters_enabled_updated_at,omitempty"` + RetentionFiltersEnabledUpdatedBy *string `json:"retention_filters_enabled_updated_by,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.EnforcedApplicationTags == nil { + return fmt.Errorf("required field enforced_application_tags missing") + } + if all.RetentionFiltersEnabled == nil { + return fmt.Errorf("required field retention_filters_enabled missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"disabled", "enforced_application_tags", "enforced_application_tags_updated_at", "enforced_application_tags_updated_by", "ootb_metrics_version", "ootb_metrics_version_installed_at", "retention_filters_enabled", "retention_filters_enabled_updated_at", "retention_filters_enabled_updated_by"}) + } else { + return err + } + o.Disabled = all.Disabled + o.EnforcedApplicationTags = *all.EnforcedApplicationTags + o.EnforcedApplicationTagsUpdatedAt = all.EnforcedApplicationTagsUpdatedAt + o.EnforcedApplicationTagsUpdatedBy = all.EnforcedApplicationTagsUpdatedBy + o.OotbMetricsVersion = all.OotbMetricsVersion + o.OotbMetricsVersionInstalledAt = all.OotbMetricsVersionInstalledAt + o.RetentionFiltersEnabled = *all.RetentionFiltersEnabled + o.RetentionFiltersEnabledUpdatedAt = all.RetentionFiltersEnabledUpdatedAt + o.RetentionFiltersEnabledUpdatedBy = all.RetentionFiltersEnabledUpdatedBy + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_rum_config_create_attributes.go b/api/datadogV2/model_rum_config_create_attributes.go new file mode 100644 index 00000000000..6a7d868c9c3 --- /dev/null +++ b/api/datadogV2/model_rum_config_create_attributes.go @@ -0,0 +1,101 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumConfigCreateAttributes Attributes of the RUM configuration to create. +type RumConfigCreateAttributes struct { + // Whether application tags are enforced for the RUM applications in the organization. + EnforcedApplicationTags bool `json:"enforced_application_tags"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumConfigCreateAttributes instantiates a new RumConfigCreateAttributes 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 NewRumConfigCreateAttributes(enforcedApplicationTags bool) *RumConfigCreateAttributes { + this := RumConfigCreateAttributes{} + this.EnforcedApplicationTags = enforcedApplicationTags + return &this +} + +// NewRumConfigCreateAttributesWithDefaults instantiates a new RumConfigCreateAttributes 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 NewRumConfigCreateAttributesWithDefaults() *RumConfigCreateAttributes { + this := RumConfigCreateAttributes{} + return &this +} + +// GetEnforcedApplicationTags returns the EnforcedApplicationTags field value. +func (o *RumConfigCreateAttributes) GetEnforcedApplicationTags() bool { + if o == nil { + var ret bool + return ret + } + return o.EnforcedApplicationTags +} + +// GetEnforcedApplicationTagsOk returns a tuple with the EnforcedApplicationTags field value +// and a boolean to check if the value has been set. +func (o *RumConfigCreateAttributes) GetEnforcedApplicationTagsOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.EnforcedApplicationTags, true +} + +// SetEnforcedApplicationTags sets field value. +func (o *RumConfigCreateAttributes) SetEnforcedApplicationTags(v bool) { + o.EnforcedApplicationTags = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumConfigCreateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["enforced_application_tags"] = o.EnforcedApplicationTags + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumConfigCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + EnforcedApplicationTags *bool `json:"enforced_application_tags"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.EnforcedApplicationTags == nil { + return fmt.Errorf("required field enforced_application_tags missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"enforced_application_tags"}) + } else { + return err + } + o.EnforcedApplicationTags = *all.EnforcedApplicationTags + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_rum_config_create_data.go b/api/datadogV2/model_rum_config_create_data.go new file mode 100644 index 00000000000..945150764b4 --- /dev/null +++ b/api/datadogV2/model_rum_config_create_data.go @@ -0,0 +1,148 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumConfigCreateData Object describing the RUM configuration to create. +type RumConfigCreateData struct { + // Attributes of the RUM configuration to create. + Attributes RumConfigCreateAttributes `json:"attributes"` + // The type of the resource. The value should always be `rum_config`. + Type RumConfigType `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:"-"` +} + +// NewRumConfigCreateData instantiates a new RumConfigCreateData 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 NewRumConfigCreateData(attributes RumConfigCreateAttributes, typeVar RumConfigType) *RumConfigCreateData { + this := RumConfigCreateData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewRumConfigCreateDataWithDefaults instantiates a new RumConfigCreateData 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 NewRumConfigCreateDataWithDefaults() *RumConfigCreateData { + this := RumConfigCreateData{} + var typeVar RumConfigType = RUMCONFIGTYPE_RUM_CONFIG + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *RumConfigCreateData) GetAttributes() RumConfigCreateAttributes { + if o == nil { + var ret RumConfigCreateAttributes + 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 *RumConfigCreateData) GetAttributesOk() (*RumConfigCreateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *RumConfigCreateData) SetAttributes(v RumConfigCreateAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *RumConfigCreateData) GetType() RumConfigType { + if o == nil { + var ret RumConfigType + 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 *RumConfigCreateData) GetTypeOk() (*RumConfigType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *RumConfigCreateData) SetType(v RumConfigType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumConfigCreateData) 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 *RumConfigCreateData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *RumConfigCreateAttributes `json:"attributes"` + Type *RumConfigType `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.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_rum_config_create_request.go b/api/datadogV2/model_rum_config_create_request.go new file mode 100644 index 00000000000..fce5bb3d0fe --- /dev/null +++ b/api/datadogV2/model_rum_config_create_request.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumConfigCreateRequest Request body for creating the RUM configuration. +type RumConfigCreateRequest struct { + // Object describing the RUM configuration to create. + Data RumConfigCreateData `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:"-"` +} + +// NewRumConfigCreateRequest instantiates a new RumConfigCreateRequest 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 NewRumConfigCreateRequest(data RumConfigCreateData) *RumConfigCreateRequest { + this := RumConfigCreateRequest{} + this.Data = data + return &this +} + +// NewRumConfigCreateRequestWithDefaults instantiates a new RumConfigCreateRequest 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 NewRumConfigCreateRequestWithDefaults() *RumConfigCreateRequest { + this := RumConfigCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *RumConfigCreateRequest) GetData() RumConfigCreateData { + if o == nil { + var ret RumConfigCreateData + 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 *RumConfigCreateRequest) GetDataOk() (*RumConfigCreateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *RumConfigCreateRequest) SetData(v RumConfigCreateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumConfigCreateRequest) 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 *RumConfigCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *RumConfigCreateData `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.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_rum_config_data.go b/api/datadogV2/model_rum_config_data.go new file mode 100644 index 00000000000..b21cd07ad42 --- /dev/null +++ b/api/datadogV2/model_rum_config_data.go @@ -0,0 +1,180 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumConfigData The RUM configuration data. +type RumConfigData struct { + // Attributes of the RUM configuration. + Attributes RumConfigAttributes `json:"attributes"` + // The organization ID associated with the RUM configuration. + Id string `json:"id"` + // The type of the resource. The value should always be `rum_config`. + Type RumConfigType `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:"-"` +} + +// NewRumConfigData instantiates a new RumConfigData 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 NewRumConfigData(attributes RumConfigAttributes, id string, typeVar RumConfigType) *RumConfigData { + this := RumConfigData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewRumConfigDataWithDefaults instantiates a new RumConfigData 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 NewRumConfigDataWithDefaults() *RumConfigData { + this := RumConfigData{} + var typeVar RumConfigType = RUMCONFIGTYPE_RUM_CONFIG + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *RumConfigData) GetAttributes() RumConfigAttributes { + if o == nil { + var ret RumConfigAttributes + 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 *RumConfigData) GetAttributesOk() (*RumConfigAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *RumConfigData) SetAttributes(v RumConfigAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *RumConfigData) 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 *RumConfigData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *RumConfigData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *RumConfigData) GetType() RumConfigType { + if o == nil { + var ret RumConfigType + 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 *RumConfigData) GetTypeOk() (*RumConfigType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *RumConfigData) SetType(v RumConfigType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumConfigData) 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 *RumConfigData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *RumConfigAttributes `json:"attributes"` + Id *string `json:"id"` + Type *RumConfigType `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.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_rum_config_response.go b/api/datadogV2/model_rum_config_response.go new file mode 100644 index 00000000000..4205231f855 --- /dev/null +++ b/api/datadogV2/model_rum_config_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" +) + +// RumConfigResponse The RUM configuration object. +type RumConfigResponse struct { + // The RUM configuration data. + Data RumConfigData `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:"-"` +} + +// NewRumConfigResponse instantiates a new RumConfigResponse 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 NewRumConfigResponse(data RumConfigData) *RumConfigResponse { + this := RumConfigResponse{} + this.Data = data + return &this +} + +// NewRumConfigResponseWithDefaults instantiates a new RumConfigResponse 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 NewRumConfigResponseWithDefaults() *RumConfigResponse { + this := RumConfigResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *RumConfigResponse) GetData() RumConfigData { + if o == nil { + var ret RumConfigData + 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 *RumConfigResponse) GetDataOk() (*RumConfigData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *RumConfigResponse) SetData(v RumConfigData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumConfigResponse) 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 *RumConfigResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *RumConfigData `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.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_rum_config_type.go b/api/datadogV2/model_rum_config_type.go new file mode 100644 index 00000000000..30d83a03699 --- /dev/null +++ b/api/datadogV2/model_rum_config_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" +) + +// RumConfigType The type of the resource. The value should always be `rum_config`. +type RumConfigType string + +// List of RumConfigType. +const ( + RUMCONFIGTYPE_RUM_CONFIG RumConfigType = "rum_config" +) + +var allowedRumConfigTypeEnumValues = []RumConfigType{ + RUMCONFIGTYPE_RUM_CONFIG, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *RumConfigType) GetAllowedValues() []RumConfigType { + return allowedRumConfigTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *RumConfigType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = RumConfigType(value) + return nil +} + +// NewRumConfigTypeFromValue returns a pointer to a valid RumConfigType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewRumConfigTypeFromValue(v string) (*RumConfigType, error) { + ev := RumConfigType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for RumConfigType: valid values are %v", v, allowedRumConfigTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v RumConfigType) IsValid() bool { + for _, existing := range allowedRumConfigTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to RumConfigType value. +func (v RumConfigType) Ptr() *RumConfigType { + return &v +} diff --git a/api/datadogV2/model_rum_config_update_attributes.go b/api/datadogV2/model_rum_config_update_attributes.go new file mode 100644 index 00000000000..41f4a275c26 --- /dev/null +++ b/api/datadogV2/model_rum_config_update_attributes.go @@ -0,0 +1,101 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumConfigUpdateAttributes Attributes of the RUM configuration to update. +type RumConfigUpdateAttributes struct { + // Whether application tags are enforced for the RUM applications in the organization. + EnforcedApplicationTags bool `json:"enforced_application_tags"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewRumConfigUpdateAttributes instantiates a new RumConfigUpdateAttributes 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 NewRumConfigUpdateAttributes(enforcedApplicationTags bool) *RumConfigUpdateAttributes { + this := RumConfigUpdateAttributes{} + this.EnforcedApplicationTags = enforcedApplicationTags + return &this +} + +// NewRumConfigUpdateAttributesWithDefaults instantiates a new RumConfigUpdateAttributes 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 NewRumConfigUpdateAttributesWithDefaults() *RumConfigUpdateAttributes { + this := RumConfigUpdateAttributes{} + return &this +} + +// GetEnforcedApplicationTags returns the EnforcedApplicationTags field value. +func (o *RumConfigUpdateAttributes) GetEnforcedApplicationTags() bool { + if o == nil { + var ret bool + return ret + } + return o.EnforcedApplicationTags +} + +// GetEnforcedApplicationTagsOk returns a tuple with the EnforcedApplicationTags field value +// and a boolean to check if the value has been set. +func (o *RumConfigUpdateAttributes) GetEnforcedApplicationTagsOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.EnforcedApplicationTags, true +} + +// SetEnforcedApplicationTags sets field value. +func (o *RumConfigUpdateAttributes) SetEnforcedApplicationTags(v bool) { + o.EnforcedApplicationTags = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumConfigUpdateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["enforced_application_tags"] = o.EnforcedApplicationTags + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RumConfigUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + EnforcedApplicationTags *bool `json:"enforced_application_tags"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.EnforcedApplicationTags == nil { + return fmt.Errorf("required field enforced_application_tags missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"enforced_application_tags"}) + } else { + return err + } + o.EnforcedApplicationTags = *all.EnforcedApplicationTags + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_rum_config_update_data.go b/api/datadogV2/model_rum_config_update_data.go new file mode 100644 index 00000000000..7b727a2a416 --- /dev/null +++ b/api/datadogV2/model_rum_config_update_data.go @@ -0,0 +1,148 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumConfigUpdateData Object describing the RUM configuration to update. +type RumConfigUpdateData struct { + // Attributes of the RUM configuration to update. + Attributes RumConfigUpdateAttributes `json:"attributes"` + // The type of the resource. The value should always be `rum_config`. + Type RumConfigType `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:"-"` +} + +// NewRumConfigUpdateData instantiates a new RumConfigUpdateData 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 NewRumConfigUpdateData(attributes RumConfigUpdateAttributes, typeVar RumConfigType) *RumConfigUpdateData { + this := RumConfigUpdateData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewRumConfigUpdateDataWithDefaults instantiates a new RumConfigUpdateData 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 NewRumConfigUpdateDataWithDefaults() *RumConfigUpdateData { + this := RumConfigUpdateData{} + var typeVar RumConfigType = RUMCONFIGTYPE_RUM_CONFIG + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *RumConfigUpdateData) GetAttributes() RumConfigUpdateAttributes { + if o == nil { + var ret RumConfigUpdateAttributes + 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 *RumConfigUpdateData) GetAttributesOk() (*RumConfigUpdateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *RumConfigUpdateData) SetAttributes(v RumConfigUpdateAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *RumConfigUpdateData) GetType() RumConfigType { + if o == nil { + var ret RumConfigType + 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 *RumConfigUpdateData) GetTypeOk() (*RumConfigType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *RumConfigUpdateData) SetType(v RumConfigType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumConfigUpdateData) 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 *RumConfigUpdateData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *RumConfigUpdateAttributes `json:"attributes"` + Type *RumConfigType `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.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_rum_config_update_request.go b/api/datadogV2/model_rum_config_update_request.go new file mode 100644 index 00000000000..ef1fee9dda6 --- /dev/null +++ b/api/datadogV2/model_rum_config_update_request.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RumConfigUpdateRequest Request body for updating the RUM configuration. +type RumConfigUpdateRequest struct { + // Object describing the RUM configuration to update. + Data RumConfigUpdateData `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:"-"` +} + +// NewRumConfigUpdateRequest instantiates a new RumConfigUpdateRequest 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 NewRumConfigUpdateRequest(data RumConfigUpdateData) *RumConfigUpdateRequest { + this := RumConfigUpdateRequest{} + this.Data = data + return &this +} + +// NewRumConfigUpdateRequestWithDefaults instantiates a new RumConfigUpdateRequest 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 NewRumConfigUpdateRequestWithDefaults() *RumConfigUpdateRequest { + this := RumConfigUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *RumConfigUpdateRequest) GetData() RumConfigUpdateData { + if o == nil { + var ret RumConfigUpdateData + 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 *RumConfigUpdateRequest) GetDataOk() (*RumConfigUpdateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *RumConfigUpdateRequest) SetData(v RumConfigUpdateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RumConfigUpdateRequest) 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 *RumConfigUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *RumConfigUpdateData `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.UnmarshalUseNumber(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/examples/v2/rum-config/CreateRumConfig.go b/examples/v2/rum-config/CreateRumConfig.go new file mode 100644 index 00000000000..4f25c8eb223 --- /dev/null +++ b/examples/v2/rum-config/CreateRumConfig.go @@ -0,0 +1,38 @@ +// Create the RUM configuration returns "Created" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.RumConfigCreateRequest{ + Data: datadogV2.RumConfigCreateData{ + Attributes: datadogV2.RumConfigCreateAttributes{ + EnforcedApplicationTags: true, + }, + Type: datadogV2.RUMCONFIGTYPE_RUM_CONFIG, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.CreateRumConfig", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewRUMConfigApi(apiClient) + resp, r, err := api.CreateRumConfig(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RUMConfigApi.CreateRumConfig`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `RUMConfigApi.CreateRumConfig`:\n%s\n", responseContent) +} diff --git a/examples/v2/rum-config/GetRumConfig.go b/examples/v2/rum-config/GetRumConfig.go new file mode 100644 index 00000000000..994d48aba3c --- /dev/null +++ b/examples/v2/rum-config/GetRumConfig.go @@ -0,0 +1,30 @@ +// Get the RUM configuration returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.GetRumConfig", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewRUMConfigApi(apiClient) + resp, r, err := api.GetRumConfig(ctx) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RUMConfigApi.GetRumConfig`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `RUMConfigApi.GetRumConfig`:\n%s\n", responseContent) +} diff --git a/examples/v2/rum-config/UpdateRumConfig.go b/examples/v2/rum-config/UpdateRumConfig.go new file mode 100644 index 00000000000..9140d8e0453 --- /dev/null +++ b/examples/v2/rum-config/UpdateRumConfig.go @@ -0,0 +1,38 @@ +// Update the RUM configuration returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.RumConfigUpdateRequest{ + Data: datadogV2.RumConfigUpdateData{ + Attributes: datadogV2.RumConfigUpdateAttributes{ + EnforcedApplicationTags: true, + }, + Type: datadogV2.RUMCONFIGTYPE_RUM_CONFIG, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.UpdateRumConfig", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewRUMConfigApi(apiClient) + resp, r, err := api.UpdateRumConfig(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RUMConfigApi.UpdateRumConfig`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `RUMConfigApi.UpdateRumConfig`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/api_mappings.go b/tests/scenarios/api_mappings.go index cb4aa24f902..ffbbc8e15ff 100644 --- a/tests/scenarios/api_mappings.go +++ b/tests/scenarios/api_mappings.go @@ -157,6 +157,7 @@ var apiMappings = map[string]map[string]reflect.Value{ "RestrictionPoliciesApi": reflect.ValueOf(datadogV2.NewRestrictionPoliciesApi), "RUMApi": reflect.ValueOf(datadogV2.NewRUMApi), "RumRetentionFiltersApi": reflect.ValueOf(datadogV2.NewRumRetentionFiltersApi), + "RUMConfigApi": reflect.ValueOf(datadogV2.NewRUMConfigApi), "RumMetricsApi": reflect.ValueOf(datadogV2.NewRumMetricsApi), "RumRateLimitApi": reflect.ValueOf(datadogV2.NewRumRateLimitApi), "RUMInsightsApi": reflect.ValueOf(datadogV2.NewRUMInsightsApi), diff --git a/tests/scenarios/features/v2/rum_config.feature b/tests/scenarios/features/v2/rum_config.feature new file mode 100644 index 00000000000..8d9cc7dd05f --- /dev/null +++ b/tests/scenarios/features/v2/rum_config.feature @@ -0,0 +1,49 @@ +@endpoint(rum-config) @endpoint(rum-config-v2) +Feature: RUM Config + Manage the [Real User Monitoring + (RUM)](https://docs.datadoghq.com/real_user_monitoring/) configuration for + your organization. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "RUMConfig" API + + @generated @skip @team:DataDog/rum-backend + Scenario: Create the RUM configuration returns "Bad Request" response + Given operation "CreateRumConfig" enabled + And new "CreateRumConfig" request + And body with value {"data": {"attributes": {"enforced_application_tags": true}, "type": "rum_config"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/rum-backend + Scenario: Create the RUM configuration returns "Created" response + Given operation "CreateRumConfig" enabled + And new "CreateRumConfig" request + And body with value {"data": {"attributes": {"enforced_application_tags": true}, "type": "rum_config"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/rum-backend + Scenario: Get the RUM configuration returns "OK" response + Given operation "GetRumConfig" enabled + And new "GetRumConfig" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/rum-backend + Scenario: Update the RUM configuration returns "Bad Request" response + Given operation "UpdateRumConfig" enabled + And new "UpdateRumConfig" request + And body with value {"data": {"attributes": {"enforced_application_tags": true}, "type": "rum_config"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/rum-backend + Scenario: Update the RUM configuration returns "OK" response + Given operation "UpdateRumConfig" enabled + And new "UpdateRumConfig" request + And body with value {"data": {"attributes": {"enforced_application_tags": true}, "type": "rum_config"}} + When the request is sent + Then the response status is 200 OK diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 2a7fb64a0a9..033b6e8ad44 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -6899,6 +6899,24 @@ "type": "idempotent" } }, + "GetRumConfig": { + "tag": "RUM Config", + "undo": { + "type": "safe" + } + }, + "UpdateRumConfig": { + "tag": "RUM Config", + "undo": { + "type": "idempotent" + } + }, + "CreateRumConfig": { + "tag": "RUM Config", + "undo": { + "type": "idempotent" + } + }, "ListRumMetrics": { "tag": "Rum Metrics", "undo": {