diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 982af418809..62c3dcc984d 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1788,6 +1788,23 @@ components: required: true schema: type: string + RumRetentionQuotaScopeIDParameter: + description: |- + The identifier of the scope the retention quota configuration applies to. + For the `application` scope, this is the RUM application ID. + in: path + name: scope_id + required: true + schema: + example: cd73a516-a481-4af5-8352-9b577465c77b + type: string + RumRetentionQuotaScopeTypeParameter: + description: The type of scope the retention quota configuration applies to. + in: path + name: scope_type + required: true + schema: + $ref: "#/components/schemas/RumRetentionQuotaScopeType" SAMLConfigurationUUIDPathParameter: description: The UUID of the SAML configuration. in: path @@ -90311,6 +90328,180 @@ components: $ref: "#/components/schemas/RumRetentionFilterData" type: array type: object + RumRetentionQuotaAdaptiveConfig: + description: The configuration used when `mode` is `adaptive`. + properties: + max_retention_rate: + description: The maximum fraction of sessions to retain, in the range `(0, 1]`. + example: 0.5 + exclusiveMinimum: true + format: double + maximum: 1 + minimum: 0 + type: number + required: + - max_retention_rate + type: object + RumRetentionQuotaConfigAttributes: + description: The RUM retention quota configuration properties. + properties: + adaptive: + $ref: "#/components/schemas/RumRetentionQuotaAdaptiveConfig" + custom: + $ref: "#/components/schemas/RumRetentionQuotaCustomConfig" + mode: + $ref: "#/components/schemas/RumRetentionQuotaMode" + org_id: + description: The ID of the organization the retention quota configuration belongs to. + example: 2 + format: int64 + type: integer + updated_at: + description: The date the retention quota configuration was last updated. + example: "2026-03-04T15:37:54.951447Z" + format: date-time + type: string + updated_by: + description: The handle of the user who last updated the retention quota configuration. + example: test@example.com + type: string + required: + - mode + - org_id + type: object + RumRetentionQuotaConfigData: + description: The RUM retention quota configuration object. + properties: + attributes: + $ref: "#/components/schemas/RumRetentionQuotaConfigAttributes" + id: + description: The identifier of the scope the retention quota configuration applies to. + example: cd73a516-a481-4af5-8352-9b577465c77b + type: string + type: + $ref: "#/components/schemas/RumRetentionQuotaConfigType" + required: + - id + - type + - attributes + type: object + RumRetentionQuotaConfigResponse: + description: The RUM retention quota configuration response. + properties: + data: + $ref: "#/components/schemas/RumRetentionQuotaConfigData" + required: + - data + type: object + RumRetentionQuotaConfigType: + default: rum_quota_config + description: The type of the resource, always `rum_quota_config`. + enum: + - rum_quota_config + example: rum_quota_config + type: string + x-enum-varnames: ["RUM_QUOTA_CONFIG"] + RumRetentionQuotaConfigUpdateAttributes: + description: The RUM retention quota configuration properties to create or update. + properties: + adaptive: + $ref: "#/components/schemas/RumRetentionQuotaAdaptiveConfig" + custom: + $ref: "#/components/schemas/RumRetentionQuotaCustomConfig" + mode: + $ref: "#/components/schemas/RumRetentionQuotaMode" + required: + - mode + type: object + RumRetentionQuotaConfigUpdateData: + description: The RUM retention quota configuration to create or update. + properties: + attributes: + $ref: "#/components/schemas/RumRetentionQuotaConfigUpdateAttributes" + id: + description: |- + The identifier of the scope the retention quota configuration applies to. + Must match `scope_id` in the path. + example: cd73a516-a481-4af5-8352-9b577465c77b + type: string + type: + $ref: "#/components/schemas/RumRetentionQuotaConfigType" + required: + - id + - type + - attributes + type: object + RumRetentionQuotaConfigUpdateRequest: + description: The body of a request to create or update a RUM retention quota configuration. + properties: + data: + $ref: "#/components/schemas/RumRetentionQuotaConfigUpdateData" + required: + - data + type: object + RumRetentionQuotaCustomConfig: + description: The configuration used when `mode` is `custom`. + properties: + daily_reset_time: + description: The time of day when the daily quota resets, in `HH:MM` 24-hour format. + example: "08:00" + pattern: "^([01]\\d|2[0-3]):[0-5]\\d$" + type: string + daily_reset_timezone: + description: The timezone offset used for the daily reset time, in `±HH:MM` format. + example: "+09:00" + pattern: "^[+-](0\\d|1[0-4]):[0-5]\\d$" + type: string + quota_reached_action: + $ref: "#/components/schemas/RumRetentionQuotaReachedAction" + session_limit: + description: The maximum number of sessions allowed within the window. Must be at least `1000`. + example: 1000000 + format: int64 + minimum: 1000 + type: integer + window_type: + $ref: "#/components/schemas/RumRetentionQuotaWindowType" + required: + - window_type + - session_limit + - daily_reset_time + - daily_reset_timezone + - quota_reached_action + type: object + RumRetentionQuotaMode: + description: |- + The retention quota mode. `custom` enforces a fixed session limit, while + `adaptive` dynamically adjusts retention. + enum: + - custom + - adaptive + example: custom + type: string + x-enum-varnames: ["CUSTOM", "ADAPTIVE"] + RumRetentionQuotaReachedAction: + description: The action to take when the session quota is reached. + enum: + - stop + - slowdown + example: stop + type: string + x-enum-varnames: ["STOP", "SLOWDOWN"] + RumRetentionQuotaScopeType: + default: application + description: The type of scope the retention quota configuration applies to. + enum: + - application + example: application + type: string + x-enum-varnames: ["APPLICATION"] + RumRetentionQuotaWindowType: + description: The window type over which the session limit is enforced. + enum: + - daily + example: daily + type: string + x-enum-varnames: ["DAILY"] RumSdkConfigAllowedTracingUrlList: description: A list of URL configurations for distributed tracing. items: @@ -184026,6 +184217,199 @@ paths: tags: - Rum Metrics x-codegen-request-body-name: body + /api/v2/rum/config/retention-quota/{scope_type}/{scope_id}: + delete: + description: Delete the RUM retention quota configuration for a given scope. + operationId: DeleteRumQuotaConfig + parameters: + - $ref: "#/components/parameters/RumRetentionQuotaScopeTypeParameter" + - $ref: "#/components/parameters/RumRetentionQuotaScopeIDParameter" + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Delete a RUM retention quota configuration + tags: + - RUM Retention Quota + x-permission: + operator: OR + permissions: + - rum_retention_filters_write + get: + description: Get the RUM retention quota configuration for a given scope. + operationId: GetRumQuotaConfig + parameters: + - $ref: "#/components/parameters/RumRetentionQuotaScopeTypeParameter" + - $ref: "#/components/parameters/RumRetentionQuotaScopeIDParameter" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + custom: + daily_reset_time: "08:00" + daily_reset_timezone: "+09:00" + quota_reached_action: stop + session_limit: 1000000 + window_type: daily + mode: custom + org_id: 2 + updated_at: "2026-03-04T15:37:54.951447Z" + updated_by: test@example.com + id: cd73a516-a481-4af5-8352-9b577465c77b + type: rum_quota_config + schema: + $ref: "#/components/schemas/RumRetentionQuotaConfigResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get a RUM retention quota configuration + tags: + - RUM Retention Quota + x-permission: + operator: OR + permissions: + - rum_retention_filters_read + put: + description: |- + Create or update the RUM retention quota configuration for a given scope. + Returns the retention quota configuration object when the request is successful. + operationId: UpsertRumQuotaConfig + parameters: + - $ref: "#/components/parameters/RumRetentionQuotaScopeTypeParameter" + - $ref: "#/components/parameters/RumRetentionQuotaScopeIDParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + custom: + daily_reset_time: "08:00" + daily_reset_timezone: "+09:00" + quota_reached_action: stop + session_limit: 1000000 + window_type: daily + mode: custom + id: cd73a516-a481-4af5-8352-9b577465c77b + type: rum_quota_config + schema: + $ref: "#/components/schemas/RumRetentionQuotaConfigUpdateRequest" + description: The definition of the RUM retention quota configuration to create or update. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + custom: + daily_reset_time: "08:00" + daily_reset_timezone: "+09:00" + quota_reached_action: stop + session_limit: 1000000 + window_type: daily + mode: custom + org_id: 2 + updated_at: "2026-03-04T21:52:53.526022Z" + updated_by: test@example.com + id: cd73a516-a481-4af5-8352-9b577465c77b + type: rum_quota_config + schema: + $ref: "#/components/schemas/RumRetentionQuotaConfigResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Create or update a RUM retention quota config + tags: + - RUM Retention Quota + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - rum_retention_filters_write /api/v2/rum/events: get: description: |- @@ -214490,6 +214874,9 @@ tags: description: Find out more at url: https://docs.datadoghq.com/real_user_monitoring/ name: RUM Remote Config + - description: |- + Manage RUM retention quota configurations for your organization's RUM applications. + name: RUM Retention Quota - description: View and manage Reference Tables in your organization. name: Reference Tables - description: |- diff --git a/examples/v2/rum-retention-quota/DeleteRumQuotaConfig.java b/examples/v2/rum-retention-quota/DeleteRumQuotaConfig.java new file mode 100644 index 00000000000..b9b38b8728d --- /dev/null +++ b/examples/v2/rum-retention-quota/DeleteRumQuotaConfig.java @@ -0,0 +1,24 @@ +// Delete a RUM retention quota configuration returns "No Content" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.RumRetentionQuotaApi; +import com.datadog.api.client.v2.model.RumRetentionQuotaScopeType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + RumRetentionQuotaApi apiInstance = new RumRetentionQuotaApi(defaultClient); + + try { + apiInstance.deleteRumQuotaConfig( + RumRetentionQuotaScopeType.APPLICATION, "ced16651-97b6-4e67-8590-8caec3af0695"); + } catch (ApiException e) { + System.err.println("Exception when calling RumRetentionQuotaApi#deleteRumQuotaConfig"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/rum-retention-quota/GetRumQuotaConfig.java b/examples/v2/rum-retention-quota/GetRumQuotaConfig.java new file mode 100644 index 00000000000..c7703f89bc1 --- /dev/null +++ b/examples/v2/rum-retention-quota/GetRumQuotaConfig.java @@ -0,0 +1,27 @@ +// Get a RUM retention quota configuration returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.RumRetentionQuotaApi; +import com.datadog.api.client.v2.model.RumRetentionQuotaConfigResponse; +import com.datadog.api.client.v2.model.RumRetentionQuotaScopeType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + RumRetentionQuotaApi apiInstance = new RumRetentionQuotaApi(defaultClient); + + try { + RumRetentionQuotaConfigResponse result = + apiInstance.getRumQuotaConfig( + RumRetentionQuotaScopeType.APPLICATION, "ced16651-97b6-4e67-8590-8caec3af0695"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling RumRetentionQuotaApi#getRumQuotaConfig"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/rum-retention-quota/UpsertRumQuotaConfig.java b/examples/v2/rum-retention-quota/UpsertRumQuotaConfig.java new file mode 100644 index 00000000000..123adfd1e4b --- /dev/null +++ b/examples/v2/rum-retention-quota/UpsertRumQuotaConfig.java @@ -0,0 +1,54 @@ +// Create or update a RUM retention quota config returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.RumRetentionQuotaApi; +import com.datadog.api.client.v2.model.RumRetentionQuotaAdaptiveConfig; +import com.datadog.api.client.v2.model.RumRetentionQuotaConfigResponse; +import com.datadog.api.client.v2.model.RumRetentionQuotaConfigType; +import com.datadog.api.client.v2.model.RumRetentionQuotaConfigUpdateAttributes; +import com.datadog.api.client.v2.model.RumRetentionQuotaConfigUpdateData; +import com.datadog.api.client.v2.model.RumRetentionQuotaConfigUpdateRequest; +import com.datadog.api.client.v2.model.RumRetentionQuotaCustomConfig; +import com.datadog.api.client.v2.model.RumRetentionQuotaMode; +import com.datadog.api.client.v2.model.RumRetentionQuotaReachedAction; +import com.datadog.api.client.v2.model.RumRetentionQuotaScopeType; +import com.datadog.api.client.v2.model.RumRetentionQuotaWindowType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + RumRetentionQuotaApi apiInstance = new RumRetentionQuotaApi(defaultClient); + + RumRetentionQuotaConfigUpdateRequest body = + new RumRetentionQuotaConfigUpdateRequest() + .data( + new RumRetentionQuotaConfigUpdateData() + .attributes( + new RumRetentionQuotaConfigUpdateAttributes() + .adaptive(new RumRetentionQuotaAdaptiveConfig().maxRetentionRate(0.5)) + .custom( + new RumRetentionQuotaCustomConfig() + .dailyResetTime("08:00") + .dailyResetTimezone("+09:00") + .quotaReachedAction(RumRetentionQuotaReachedAction.STOP) + .sessionLimit(1000000L) + .windowType(RumRetentionQuotaWindowType.DAILY)) + .mode(RumRetentionQuotaMode.CUSTOM)) + .id("ced16651-97b6-4e67-8590-8caec3af0695") + .type(RumRetentionQuotaConfigType.RUM_QUOTA_CONFIG)); + + try { + RumRetentionQuotaConfigResponse result = + apiInstance.upsertRumQuotaConfig( + RumRetentionQuotaScopeType.APPLICATION, "ced16651-97b6-4e67-8590-8caec3af0695", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling RumRetentionQuotaApi#upsertRumQuotaConfig"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v2/api/RumRetentionQuotaApi.java b/src/main/java/com/datadog/api/client/v2/api/RumRetentionQuotaApi.java new file mode 100644 index 00000000000..0d0005c882d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/RumRetentionQuotaApi.java @@ -0,0 +1,586 @@ +package com.datadog.api.client.v2.api; + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.ApiResponse; +import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.RumRetentionQuotaConfigResponse; +import com.datadog.api.client.v2.model.RumRetentionQuotaConfigUpdateRequest; +import com.datadog.api.client.v2.model.RumRetentionQuotaScopeType; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RumRetentionQuotaApi { + private ApiClient apiClient; + + public RumRetentionQuotaApi() { + this(ApiClient.getDefaultApiClient()); + } + + public RumRetentionQuotaApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client. + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client. + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Delete a RUM retention quota configuration. + * + *

See {@link #deleteRumQuotaConfigWithHttpInfo}. + * + * @param scopeType The type of scope the retention quota configuration applies to. (required, + * default to "application") + * @param scopeId The identifier of the scope the retention quota configuration applies to. For + * the application scope, this is the RUM application ID. (required) + * @throws ApiException if fails to make API call + */ + public void deleteRumQuotaConfig(RumRetentionQuotaScopeType scopeType, String scopeId) + throws ApiException { + deleteRumQuotaConfigWithHttpInfo(scopeType, scopeId); + } + + /** + * Delete a RUM retention quota configuration. + * + *

See {@link #deleteRumQuotaConfigWithHttpInfoAsync}. + * + * @param scopeType The type of scope the retention quota configuration applies to. (required, + * default to "application") + * @param scopeId The identifier of the scope the retention quota configuration applies to. For + * the application scope, this is the RUM application ID. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteRumQuotaConfigAsync( + RumRetentionQuotaScopeType scopeType, String scopeId) { + return deleteRumQuotaConfigWithHttpInfoAsync(scopeType, scopeId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete the RUM retention quota configuration for a given scope. + * + * @param scopeType The type of scope the retention quota configuration applies to. (required) + * @param scopeId The identifier of the scope the retention quota configuration applies to. For + * the application scope, this is the RUM application ID. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse deleteRumQuotaConfigWithHttpInfo( + RumRetentionQuotaScopeType scopeType, String scopeId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'scopeType' is set + if (scopeType == null) { + throw new ApiException( + 400, "Missing the required parameter 'scopeType' when calling deleteRumQuotaConfig"); + } + + // verify the required parameter 'scopeId' is set + if (scopeId == null) { + throw new ApiException( + 400, "Missing the required parameter 'scopeId' when calling deleteRumQuotaConfig"); + } + // create path and map variables + String localVarPath = + "/api/v2/rum/config/retention-quota/{scope_type}/{scope_id}" + .replaceAll("\\{" + "scope_type" + "\\}", apiClient.escapeString(scopeType.toString())) + .replaceAll("\\{" + "scope_id" + "\\}", apiClient.escapeString(scopeId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.RumRetentionQuotaApi.deleteRumQuotaConfig", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete a RUM retention quota configuration. + * + *

See {@link #deleteRumQuotaConfigWithHttpInfo}. + * + * @param scopeType The type of scope the retention quota configuration applies to. (required) + * @param scopeId The identifier of the scope the retention quota configuration applies to. For + * the application scope, this is the RUM application ID. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteRumQuotaConfigWithHttpInfoAsync( + RumRetentionQuotaScopeType scopeType, String scopeId) { + Object localVarPostBody = null; + + // verify the required parameter 'scopeType' is set + if (scopeType == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'scopeType' when calling deleteRumQuotaConfig")); + return result; + } + + // verify the required parameter 'scopeId' is set + if (scopeId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'scopeId' when calling deleteRumQuotaConfig")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/rum/config/retention-quota/{scope_type}/{scope_id}" + .replaceAll("\\{" + "scope_type" + "\\}", apiClient.escapeString(scopeType.toString())) + .replaceAll("\\{" + "scope_id" + "\\}", apiClient.escapeString(scopeId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.RumRetentionQuotaApi.deleteRumQuotaConfig", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Get a RUM retention quota configuration. + * + *

See {@link #getRumQuotaConfigWithHttpInfo}. + * + * @param scopeType The type of scope the retention quota configuration applies to. (required, + * default to "application") + * @param scopeId The identifier of the scope the retention quota configuration applies to. For + * the application scope, this is the RUM application ID. (required) + * @return RumRetentionQuotaConfigResponse + * @throws ApiException if fails to make API call + */ + public RumRetentionQuotaConfigResponse getRumQuotaConfig( + RumRetentionQuotaScopeType scopeType, String scopeId) throws ApiException { + return getRumQuotaConfigWithHttpInfo(scopeType, scopeId).getData(); + } + + /** + * Get a RUM retention quota configuration. + * + *

See {@link #getRumQuotaConfigWithHttpInfoAsync}. + * + * @param scopeType The type of scope the retention quota configuration applies to. (required, + * default to "application") + * @param scopeId The identifier of the scope the retention quota configuration applies to. For + * the application scope, this is the RUM application ID. (required) + * @return CompletableFuture<RumRetentionQuotaConfigResponse> + */ + public CompletableFuture getRumQuotaConfigAsync( + RumRetentionQuotaScopeType scopeType, String scopeId) { + return getRumQuotaConfigWithHttpInfoAsync(scopeType, scopeId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get the RUM retention quota configuration for a given scope. + * + * @param scopeType The type of scope the retention quota configuration applies to. (required) + * @param scopeId The identifier of the scope the retention quota configuration applies to. For + * the application scope, this is the RUM application ID. (required) + * @return ApiResponse<RumRetentionQuotaConfigResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getRumQuotaConfigWithHttpInfo( + RumRetentionQuotaScopeType scopeType, String scopeId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'scopeType' is set + if (scopeType == null) { + throw new ApiException( + 400, "Missing the required parameter 'scopeType' when calling getRumQuotaConfig"); + } + + // verify the required parameter 'scopeId' is set + if (scopeId == null) { + throw new ApiException( + 400, "Missing the required parameter 'scopeId' when calling getRumQuotaConfig"); + } + // create path and map variables + String localVarPath = + "/api/v2/rum/config/retention-quota/{scope_type}/{scope_id}" + .replaceAll("\\{" + "scope_type" + "\\}", apiClient.escapeString(scopeType.toString())) + .replaceAll("\\{" + "scope_id" + "\\}", apiClient.escapeString(scopeId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.RumRetentionQuotaApi.getRumQuotaConfig", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a RUM retention quota configuration. + * + *

See {@link #getRumQuotaConfigWithHttpInfo}. + * + * @param scopeType The type of scope the retention quota configuration applies to. (required) + * @param scopeId The identifier of the scope the retention quota configuration applies to. For + * the application scope, this is the RUM application ID. (required) + * @return CompletableFuture<ApiResponse<RumRetentionQuotaConfigResponse>> + */ + public CompletableFuture> + getRumQuotaConfigWithHttpInfoAsync(RumRetentionQuotaScopeType scopeType, String scopeId) { + Object localVarPostBody = null; + + // verify the required parameter 'scopeType' is set + if (scopeType == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'scopeType' when calling getRumQuotaConfig")); + return result; + } + + // verify the required parameter 'scopeId' is set + if (scopeId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'scopeId' when calling getRumQuotaConfig")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/rum/config/retention-quota/{scope_type}/{scope_id}" + .replaceAll("\\{" + "scope_type" + "\\}", apiClient.escapeString(scopeType.toString())) + .replaceAll("\\{" + "scope_id" + "\\}", apiClient.escapeString(scopeId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.RumRetentionQuotaApi.getRumQuotaConfig", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create or update a RUM retention quota config. + * + *

See {@link #upsertRumQuotaConfigWithHttpInfo}. + * + * @param scopeType The type of scope the retention quota configuration applies to. (required, + * default to "application") + * @param scopeId The identifier of the scope the retention quota configuration applies to. For + * the application scope, this is the RUM application ID. (required) + * @param body The definition of the RUM retention quota configuration to create or update. + * (required) + * @return RumRetentionQuotaConfigResponse + * @throws ApiException if fails to make API call + */ + public RumRetentionQuotaConfigResponse upsertRumQuotaConfig( + RumRetentionQuotaScopeType scopeType, + String scopeId, + RumRetentionQuotaConfigUpdateRequest body) + throws ApiException { + return upsertRumQuotaConfigWithHttpInfo(scopeType, scopeId, body).getData(); + } + + /** + * Create or update a RUM retention quota config. + * + *

See {@link #upsertRumQuotaConfigWithHttpInfoAsync}. + * + * @param scopeType The type of scope the retention quota configuration applies to. (required, + * default to "application") + * @param scopeId The identifier of the scope the retention quota configuration applies to. For + * the application scope, this is the RUM application ID. (required) + * @param body The definition of the RUM retention quota configuration to create or update. + * (required) + * @return CompletableFuture<RumRetentionQuotaConfigResponse> + */ + public CompletableFuture upsertRumQuotaConfigAsync( + RumRetentionQuotaScopeType scopeType, + String scopeId, + RumRetentionQuotaConfigUpdateRequest body) { + return upsertRumQuotaConfigWithHttpInfoAsync(scopeType, scopeId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create or update the RUM retention quota configuration for a given scope. Returns the retention + * quota configuration object when the request is successful. + * + * @param scopeType The type of scope the retention quota configuration applies to. (required) + * @param scopeId The identifier of the scope the retention quota configuration applies to. For + * the application scope, this is the RUM application ID. (required) + * @param body The definition of the RUM retention quota configuration to create or update. + * (required) + * @return ApiResponse<RumRetentionQuotaConfigResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse upsertRumQuotaConfigWithHttpInfo( + RumRetentionQuotaScopeType scopeType, + String scopeId, + RumRetentionQuotaConfigUpdateRequest body) + throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'scopeType' is set + if (scopeType == null) { + throw new ApiException( + 400, "Missing the required parameter 'scopeType' when calling upsertRumQuotaConfig"); + } + + // verify the required parameter 'scopeId' is set + if (scopeId == null) { + throw new ApiException( + 400, "Missing the required parameter 'scopeId' when calling upsertRumQuotaConfig"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling upsertRumQuotaConfig"); + } + // create path and map variables + String localVarPath = + "/api/v2/rum/config/retention-quota/{scope_type}/{scope_id}" + .replaceAll("\\{" + "scope_type" + "\\}", apiClient.escapeString(scopeType.toString())) + .replaceAll("\\{" + "scope_id" + "\\}", apiClient.escapeString(scopeId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.RumRetentionQuotaApi.upsertRumQuotaConfig", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create or update a RUM retention quota config. + * + *

See {@link #upsertRumQuotaConfigWithHttpInfo}. + * + * @param scopeType The type of scope the retention quota configuration applies to. (required) + * @param scopeId The identifier of the scope the retention quota configuration applies to. For + * the application scope, this is the RUM application ID. (required) + * @param body The definition of the RUM retention quota configuration to create or update. + * (required) + * @return CompletableFuture<ApiResponse<RumRetentionQuotaConfigResponse>> + */ + public CompletableFuture> + upsertRumQuotaConfigWithHttpInfoAsync( + RumRetentionQuotaScopeType scopeType, + String scopeId, + RumRetentionQuotaConfigUpdateRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'scopeType' is set + if (scopeType == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'scopeType' when calling upsertRumQuotaConfig")); + return result; + } + + // verify the required parameter 'scopeId' is set + if (scopeId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'scopeId' when calling upsertRumQuotaConfig")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling upsertRumQuotaConfig")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/rum/config/retention-quota/{scope_type}/{scope_id}" + .replaceAll("\\{" + "scope_type" + "\\}", apiClient.escapeString(scopeType.toString())) + .replaceAll("\\{" + "scope_id" + "\\}", apiClient.escapeString(scopeId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.RumRetentionQuotaApi.upsertRumQuotaConfig", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaAdaptiveConfig.java b/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaAdaptiveConfig.java new file mode 100644 index 00000000000..7a6912ef35f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaAdaptiveConfig.java @@ -0,0 +1,147 @@ +/* + * Unless explicitly stated otherwise all files in this repository 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The configuration used when mode is adaptive. */ +@JsonPropertyOrder({RumRetentionQuotaAdaptiveConfig.JSON_PROPERTY_MAX_RETENTION_RATE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RumRetentionQuotaAdaptiveConfig { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_MAX_RETENTION_RATE = "max_retention_rate"; + private Double maxRetentionRate; + + public RumRetentionQuotaAdaptiveConfig() {} + + @JsonCreator + public RumRetentionQuotaAdaptiveConfig( + @JsonProperty(required = true, value = JSON_PROPERTY_MAX_RETENTION_RATE) + Double maxRetentionRate) { + this.maxRetentionRate = maxRetentionRate; + } + + public RumRetentionQuotaAdaptiveConfig maxRetentionRate(Double maxRetentionRate) { + this.maxRetentionRate = maxRetentionRate; + return this; + } + + /** + * The maximum fraction of sessions to retain, in the range (0, 1]. minimum: 0 + * maximum: 1 + * + * @return maxRetentionRate + */ + @JsonProperty(JSON_PROPERTY_MAX_RETENTION_RATE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Double getMaxRetentionRate() { + return maxRetentionRate; + } + + public void setMaxRetentionRate(Double maxRetentionRate) { + this.maxRetentionRate = maxRetentionRate; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RumRetentionQuotaAdaptiveConfig + */ + @JsonAnySetter + public RumRetentionQuotaAdaptiveConfig putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RumRetentionQuotaAdaptiveConfig object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RumRetentionQuotaAdaptiveConfig rumRetentionQuotaAdaptiveConfig = + (RumRetentionQuotaAdaptiveConfig) o; + return Objects.equals(this.maxRetentionRate, rumRetentionQuotaAdaptiveConfig.maxRetentionRate) + && Objects.equals( + this.additionalProperties, rumRetentionQuotaAdaptiveConfig.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(maxRetentionRate, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RumRetentionQuotaAdaptiveConfig {\n"); + sb.append(" maxRetentionRate: ").append(toIndentedString(maxRetentionRate)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaConfigAttributes.java b/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaConfigAttributes.java new file mode 100644 index 00000000000..f9b6b13b52f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaConfigAttributes.java @@ -0,0 +1,298 @@ +/* + * Unless explicitly stated otherwise all files in this repository 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The RUM retention quota configuration properties. */ +@JsonPropertyOrder({ + RumRetentionQuotaConfigAttributes.JSON_PROPERTY_ADAPTIVE, + RumRetentionQuotaConfigAttributes.JSON_PROPERTY_CUSTOM, + RumRetentionQuotaConfigAttributes.JSON_PROPERTY_MODE, + RumRetentionQuotaConfigAttributes.JSON_PROPERTY_ORG_ID, + RumRetentionQuotaConfigAttributes.JSON_PROPERTY_UPDATED_AT, + RumRetentionQuotaConfigAttributes.JSON_PROPERTY_UPDATED_BY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RumRetentionQuotaConfigAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ADAPTIVE = "adaptive"; + private RumRetentionQuotaAdaptiveConfig adaptive; + + public static final String JSON_PROPERTY_CUSTOM = "custom"; + private RumRetentionQuotaCustomConfig custom; + + public static final String JSON_PROPERTY_MODE = "mode"; + private RumRetentionQuotaMode mode; + + public static final String JSON_PROPERTY_ORG_ID = "org_id"; + private Long orgId; + + public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; + private OffsetDateTime updatedAt; + + public static final String JSON_PROPERTY_UPDATED_BY = "updated_by"; + private String updatedBy; + + public RumRetentionQuotaConfigAttributes() {} + + @JsonCreator + public RumRetentionQuotaConfigAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_MODE) RumRetentionQuotaMode mode, + @JsonProperty(required = true, value = JSON_PROPERTY_ORG_ID) Long orgId) { + this.mode = mode; + this.unparsed |= !mode.isValid(); + this.orgId = orgId; + } + + public RumRetentionQuotaConfigAttributes adaptive(RumRetentionQuotaAdaptiveConfig adaptive) { + this.adaptive = adaptive; + this.unparsed |= adaptive.unparsed; + return this; + } + + /** + * The configuration used when mode is adaptive. + * + * @return adaptive + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ADAPTIVE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RumRetentionQuotaAdaptiveConfig getAdaptive() { + return adaptive; + } + + public void setAdaptive(RumRetentionQuotaAdaptiveConfig adaptive) { + this.adaptive = adaptive; + if (adaptive != null) { + this.unparsed |= adaptive.unparsed; + } + } + + public RumRetentionQuotaConfigAttributes custom(RumRetentionQuotaCustomConfig custom) { + this.custom = custom; + this.unparsed |= custom.unparsed; + return this; + } + + /** + * The configuration used when mode is custom. + * + * @return custom + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CUSTOM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RumRetentionQuotaCustomConfig getCustom() { + return custom; + } + + public void setCustom(RumRetentionQuotaCustomConfig custom) { + this.custom = custom; + if (custom != null) { + this.unparsed |= custom.unparsed; + } + } + + public RumRetentionQuotaConfigAttributes mode(RumRetentionQuotaMode mode) { + this.mode = mode; + this.unparsed |= !mode.isValid(); + return this; + } + + /** + * The retention quota mode. custom enforces a fixed session limit, while + * adaptive dynamically adjusts retention. + * + * @return mode + */ + @JsonProperty(JSON_PROPERTY_MODE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RumRetentionQuotaMode getMode() { + return mode; + } + + public void setMode(RumRetentionQuotaMode mode) { + if (!mode.isValid()) { + this.unparsed = true; + } + this.mode = mode; + } + + public RumRetentionQuotaConfigAttributes orgId(Long orgId) { + this.orgId = orgId; + return this; + } + + /** + * The ID of the organization the retention quota configuration belongs to. + * + * @return orgId + */ + @JsonProperty(JSON_PROPERTY_ORG_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getOrgId() { + return orgId; + } + + public void setOrgId(Long orgId) { + this.orgId = orgId; + } + + public RumRetentionQuotaConfigAttributes updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The date the retention quota configuration was last updated. + * + * @return updatedAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + public RumRetentionQuotaConfigAttributes updatedBy(String updatedBy) { + this.updatedBy = updatedBy; + return this; + } + + /** + * The handle of the user who last updated the retention quota configuration. + * + * @return updatedBy + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_UPDATED_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RumRetentionQuotaConfigAttributes + */ + @JsonAnySetter + public RumRetentionQuotaConfigAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RumRetentionQuotaConfigAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RumRetentionQuotaConfigAttributes rumRetentionQuotaConfigAttributes = + (RumRetentionQuotaConfigAttributes) o; + return Objects.equals(this.adaptive, rumRetentionQuotaConfigAttributes.adaptive) + && Objects.equals(this.custom, rumRetentionQuotaConfigAttributes.custom) + && Objects.equals(this.mode, rumRetentionQuotaConfigAttributes.mode) + && Objects.equals(this.orgId, rumRetentionQuotaConfigAttributes.orgId) + && Objects.equals(this.updatedAt, rumRetentionQuotaConfigAttributes.updatedAt) + && Objects.equals(this.updatedBy, rumRetentionQuotaConfigAttributes.updatedBy) + && Objects.equals( + this.additionalProperties, rumRetentionQuotaConfigAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(adaptive, custom, mode, orgId, updatedAt, updatedBy, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RumRetentionQuotaConfigAttributes {\n"); + sb.append(" adaptive: ").append(toIndentedString(adaptive)).append("\n"); + sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); + sb.append(" mode: ").append(toIndentedString(mode)).append("\n"); + sb.append(" orgId: ").append(toIndentedString(orgId)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" updatedBy: ").append(toIndentedString(updatedBy)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaConfigData.java b/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaConfigData.java new file mode 100644 index 00000000000..849f6d9cbe6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaConfigData.java @@ -0,0 +1,213 @@ +/* + * Unless explicitly stated otherwise all files in this repository 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The RUM retention quota configuration object. */ +@JsonPropertyOrder({ + RumRetentionQuotaConfigData.JSON_PROPERTY_ATTRIBUTES, + RumRetentionQuotaConfigData.JSON_PROPERTY_ID, + RumRetentionQuotaConfigData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RumRetentionQuotaConfigData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private RumRetentionQuotaConfigAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private RumRetentionQuotaConfigType type = RumRetentionQuotaConfigType.RUM_QUOTA_CONFIG; + + public RumRetentionQuotaConfigData() {} + + @JsonCreator + public RumRetentionQuotaConfigData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + RumRetentionQuotaConfigAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) RumRetentionQuotaConfigType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public RumRetentionQuotaConfigData attributes(RumRetentionQuotaConfigAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The RUM retention quota configuration properties. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RumRetentionQuotaConfigAttributes getAttributes() { + return attributes; + } + + public void setAttributes(RumRetentionQuotaConfigAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public RumRetentionQuotaConfigData id(String id) { + this.id = id; + return this; + } + + /** + * The identifier of the scope the retention quota configuration applies to. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public RumRetentionQuotaConfigData type(RumRetentionQuotaConfigType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the resource, always rum_quota_config. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RumRetentionQuotaConfigType getType() { + return type; + } + + public void setType(RumRetentionQuotaConfigType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RumRetentionQuotaConfigData + */ + @JsonAnySetter + public RumRetentionQuotaConfigData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RumRetentionQuotaConfigData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RumRetentionQuotaConfigData rumRetentionQuotaConfigData = (RumRetentionQuotaConfigData) o; + return Objects.equals(this.attributes, rumRetentionQuotaConfigData.attributes) + && Objects.equals(this.id, rumRetentionQuotaConfigData.id) + && Objects.equals(this.type, rumRetentionQuotaConfigData.type) + && Objects.equals( + this.additionalProperties, rumRetentionQuotaConfigData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RumRetentionQuotaConfigData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaConfigResponse.java b/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaConfigResponse.java new file mode 100644 index 00000000000..3abfbae6809 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaConfigResponse.java @@ -0,0 +1,150 @@ +/* + * Unless explicitly stated otherwise all files in this repository 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The RUM retention quota configuration response. */ +@JsonPropertyOrder({RumRetentionQuotaConfigResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RumRetentionQuotaConfigResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private RumRetentionQuotaConfigData data; + + public RumRetentionQuotaConfigResponse() {} + + @JsonCreator + public RumRetentionQuotaConfigResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) RumRetentionQuotaConfigData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public RumRetentionQuotaConfigResponse data(RumRetentionQuotaConfigData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The RUM retention quota configuration object. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RumRetentionQuotaConfigData getData() { + return data; + } + + public void setData(RumRetentionQuotaConfigData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RumRetentionQuotaConfigResponse + */ + @JsonAnySetter + public RumRetentionQuotaConfigResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RumRetentionQuotaConfigResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RumRetentionQuotaConfigResponse rumRetentionQuotaConfigResponse = + (RumRetentionQuotaConfigResponse) o; + return Objects.equals(this.data, rumRetentionQuotaConfigResponse.data) + && Objects.equals( + this.additionalProperties, rumRetentionQuotaConfigResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RumRetentionQuotaConfigResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaConfigType.java b/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaConfigType.java new file mode 100644 index 00000000000..f70adc7d36e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaConfigType.java @@ -0,0 +1,57 @@ +/* + * Unless explicitly stated otherwise all files in this repository 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 com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The type of the resource, always rum_quota_config. */ +@JsonSerialize(using = RumRetentionQuotaConfigType.RumRetentionQuotaConfigTypeSerializer.class) +public class RumRetentionQuotaConfigType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("rum_quota_config")); + + public static final RumRetentionQuotaConfigType RUM_QUOTA_CONFIG = + new RumRetentionQuotaConfigType("rum_quota_config"); + + RumRetentionQuotaConfigType(String value) { + super(value, allowedValues); + } + + public static class RumRetentionQuotaConfigTypeSerializer + extends StdSerializer { + public RumRetentionQuotaConfigTypeSerializer(Class t) { + super(t); + } + + public RumRetentionQuotaConfigTypeSerializer() { + this(null); + } + + @Override + public void serialize( + RumRetentionQuotaConfigType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static RumRetentionQuotaConfigType fromValue(String value) { + return new RumRetentionQuotaConfigType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaConfigUpdateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaConfigUpdateAttributes.java new file mode 100644 index 00000000000..e71271ffa05 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaConfigUpdateAttributes.java @@ -0,0 +1,217 @@ +/* + * Unless explicitly stated otherwise all files in this repository 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The RUM retention quota configuration properties to create or update. */ +@JsonPropertyOrder({ + RumRetentionQuotaConfigUpdateAttributes.JSON_PROPERTY_ADAPTIVE, + RumRetentionQuotaConfigUpdateAttributes.JSON_PROPERTY_CUSTOM, + RumRetentionQuotaConfigUpdateAttributes.JSON_PROPERTY_MODE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RumRetentionQuotaConfigUpdateAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ADAPTIVE = "adaptive"; + private RumRetentionQuotaAdaptiveConfig adaptive; + + public static final String JSON_PROPERTY_CUSTOM = "custom"; + private RumRetentionQuotaCustomConfig custom; + + public static final String JSON_PROPERTY_MODE = "mode"; + private RumRetentionQuotaMode mode; + + public RumRetentionQuotaConfigUpdateAttributes() {} + + @JsonCreator + public RumRetentionQuotaConfigUpdateAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_MODE) RumRetentionQuotaMode mode) { + this.mode = mode; + this.unparsed |= !mode.isValid(); + } + + public RumRetentionQuotaConfigUpdateAttributes adaptive( + RumRetentionQuotaAdaptiveConfig adaptive) { + this.adaptive = adaptive; + this.unparsed |= adaptive.unparsed; + return this; + } + + /** + * The configuration used when mode is adaptive. + * + * @return adaptive + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ADAPTIVE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RumRetentionQuotaAdaptiveConfig getAdaptive() { + return adaptive; + } + + public void setAdaptive(RumRetentionQuotaAdaptiveConfig adaptive) { + this.adaptive = adaptive; + if (adaptive != null) { + this.unparsed |= adaptive.unparsed; + } + } + + public RumRetentionQuotaConfigUpdateAttributes custom(RumRetentionQuotaCustomConfig custom) { + this.custom = custom; + this.unparsed |= custom.unparsed; + return this; + } + + /** + * The configuration used when mode is custom. + * + * @return custom + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CUSTOM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RumRetentionQuotaCustomConfig getCustom() { + return custom; + } + + public void setCustom(RumRetentionQuotaCustomConfig custom) { + this.custom = custom; + if (custom != null) { + this.unparsed |= custom.unparsed; + } + } + + public RumRetentionQuotaConfigUpdateAttributes mode(RumRetentionQuotaMode mode) { + this.mode = mode; + this.unparsed |= !mode.isValid(); + return this; + } + + /** + * The retention quota mode. custom enforces a fixed session limit, while + * adaptive dynamically adjusts retention. + * + * @return mode + */ + @JsonProperty(JSON_PROPERTY_MODE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RumRetentionQuotaMode getMode() { + return mode; + } + + public void setMode(RumRetentionQuotaMode mode) { + if (!mode.isValid()) { + this.unparsed = true; + } + this.mode = mode; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RumRetentionQuotaConfigUpdateAttributes + */ + @JsonAnySetter + public RumRetentionQuotaConfigUpdateAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RumRetentionQuotaConfigUpdateAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RumRetentionQuotaConfigUpdateAttributes rumRetentionQuotaConfigUpdateAttributes = + (RumRetentionQuotaConfigUpdateAttributes) o; + return Objects.equals(this.adaptive, rumRetentionQuotaConfigUpdateAttributes.adaptive) + && Objects.equals(this.custom, rumRetentionQuotaConfigUpdateAttributes.custom) + && Objects.equals(this.mode, rumRetentionQuotaConfigUpdateAttributes.mode) + && Objects.equals( + this.additionalProperties, + rumRetentionQuotaConfigUpdateAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(adaptive, custom, mode, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RumRetentionQuotaConfigUpdateAttributes {\n"); + sb.append(" adaptive: ").append(toIndentedString(adaptive)).append("\n"); + sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); + sb.append(" mode: ").append(toIndentedString(mode)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaConfigUpdateData.java b/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaConfigUpdateData.java new file mode 100644 index 00000000000..ba0d3574f72 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaConfigUpdateData.java @@ -0,0 +1,216 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The RUM retention quota configuration to create or update. */ +@JsonPropertyOrder({ + RumRetentionQuotaConfigUpdateData.JSON_PROPERTY_ATTRIBUTES, + RumRetentionQuotaConfigUpdateData.JSON_PROPERTY_ID, + RumRetentionQuotaConfigUpdateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RumRetentionQuotaConfigUpdateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private RumRetentionQuotaConfigUpdateAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private RumRetentionQuotaConfigType type = RumRetentionQuotaConfigType.RUM_QUOTA_CONFIG; + + public RumRetentionQuotaConfigUpdateData() {} + + @JsonCreator + public RumRetentionQuotaConfigUpdateData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + RumRetentionQuotaConfigUpdateAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) RumRetentionQuotaConfigType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public RumRetentionQuotaConfigUpdateData attributes( + RumRetentionQuotaConfigUpdateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The RUM retention quota configuration properties to create or update. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RumRetentionQuotaConfigUpdateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(RumRetentionQuotaConfigUpdateAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public RumRetentionQuotaConfigUpdateData id(String id) { + this.id = id; + return this; + } + + /** + * The identifier of the scope the retention quota configuration applies to. Must match + * scope_id in the path. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public RumRetentionQuotaConfigUpdateData type(RumRetentionQuotaConfigType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the resource, always rum_quota_config. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RumRetentionQuotaConfigType getType() { + return type; + } + + public void setType(RumRetentionQuotaConfigType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RumRetentionQuotaConfigUpdateData + */ + @JsonAnySetter + public RumRetentionQuotaConfigUpdateData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RumRetentionQuotaConfigUpdateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RumRetentionQuotaConfigUpdateData rumRetentionQuotaConfigUpdateData = + (RumRetentionQuotaConfigUpdateData) o; + return Objects.equals(this.attributes, rumRetentionQuotaConfigUpdateData.attributes) + && Objects.equals(this.id, rumRetentionQuotaConfigUpdateData.id) + && Objects.equals(this.type, rumRetentionQuotaConfigUpdateData.type) + && Objects.equals( + this.additionalProperties, rumRetentionQuotaConfigUpdateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RumRetentionQuotaConfigUpdateData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaConfigUpdateRequest.java b/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaConfigUpdateRequest.java new file mode 100644 index 00000000000..bb5f05aebf8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaConfigUpdateRequest.java @@ -0,0 +1,151 @@ +/* + * Unless explicitly stated otherwise all files in this repository 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The body of a request to create or update a RUM retention quota configuration. */ +@JsonPropertyOrder({RumRetentionQuotaConfigUpdateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RumRetentionQuotaConfigUpdateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private RumRetentionQuotaConfigUpdateData data; + + public RumRetentionQuotaConfigUpdateRequest() {} + + @JsonCreator + public RumRetentionQuotaConfigUpdateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + RumRetentionQuotaConfigUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public RumRetentionQuotaConfigUpdateRequest data(RumRetentionQuotaConfigUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The RUM retention quota configuration to create or update. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RumRetentionQuotaConfigUpdateData getData() { + return data; + } + + public void setData(RumRetentionQuotaConfigUpdateData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RumRetentionQuotaConfigUpdateRequest + */ + @JsonAnySetter + public RumRetentionQuotaConfigUpdateRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RumRetentionQuotaConfigUpdateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RumRetentionQuotaConfigUpdateRequest rumRetentionQuotaConfigUpdateRequest = + (RumRetentionQuotaConfigUpdateRequest) o; + return Objects.equals(this.data, rumRetentionQuotaConfigUpdateRequest.data) + && Objects.equals( + this.additionalProperties, rumRetentionQuotaConfigUpdateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RumRetentionQuotaConfigUpdateRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaCustomConfig.java b/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaCustomConfig.java new file mode 100644 index 00000000000..52b7a360e6b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaCustomConfig.java @@ -0,0 +1,279 @@ +/* + * Unless explicitly stated otherwise all files in this repository 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The configuration used when mode is custom. */ +@JsonPropertyOrder({ + RumRetentionQuotaCustomConfig.JSON_PROPERTY_DAILY_RESET_TIME, + RumRetentionQuotaCustomConfig.JSON_PROPERTY_DAILY_RESET_TIMEZONE, + RumRetentionQuotaCustomConfig.JSON_PROPERTY_QUOTA_REACHED_ACTION, + RumRetentionQuotaCustomConfig.JSON_PROPERTY_SESSION_LIMIT, + RumRetentionQuotaCustomConfig.JSON_PROPERTY_WINDOW_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RumRetentionQuotaCustomConfig { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DAILY_RESET_TIME = "daily_reset_time"; + private String dailyResetTime; + + public static final String JSON_PROPERTY_DAILY_RESET_TIMEZONE = "daily_reset_timezone"; + private String dailyResetTimezone; + + public static final String JSON_PROPERTY_QUOTA_REACHED_ACTION = "quota_reached_action"; + private RumRetentionQuotaReachedAction quotaReachedAction; + + public static final String JSON_PROPERTY_SESSION_LIMIT = "session_limit"; + private Long sessionLimit; + + public static final String JSON_PROPERTY_WINDOW_TYPE = "window_type"; + private RumRetentionQuotaWindowType windowType; + + public RumRetentionQuotaCustomConfig() {} + + @JsonCreator + public RumRetentionQuotaCustomConfig( + @JsonProperty(required = true, value = JSON_PROPERTY_DAILY_RESET_TIME) String dailyResetTime, + @JsonProperty(required = true, value = JSON_PROPERTY_DAILY_RESET_TIMEZONE) + String dailyResetTimezone, + @JsonProperty(required = true, value = JSON_PROPERTY_QUOTA_REACHED_ACTION) + RumRetentionQuotaReachedAction quotaReachedAction, + @JsonProperty(required = true, value = JSON_PROPERTY_SESSION_LIMIT) Long sessionLimit, + @JsonProperty(required = true, value = JSON_PROPERTY_WINDOW_TYPE) + RumRetentionQuotaWindowType windowType) { + this.dailyResetTime = dailyResetTime; + this.dailyResetTimezone = dailyResetTimezone; + this.quotaReachedAction = quotaReachedAction; + this.unparsed |= !quotaReachedAction.isValid(); + this.sessionLimit = sessionLimit; + this.windowType = windowType; + this.unparsed |= !windowType.isValid(); + } + + public RumRetentionQuotaCustomConfig dailyResetTime(String dailyResetTime) { + this.dailyResetTime = dailyResetTime; + return this; + } + + /** + * The time of day when the daily quota resets, in HH:MM 24-hour format. + * + * @return dailyResetTime + */ + @JsonProperty(JSON_PROPERTY_DAILY_RESET_TIME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDailyResetTime() { + return dailyResetTime; + } + + public void setDailyResetTime(String dailyResetTime) { + this.dailyResetTime = dailyResetTime; + } + + public RumRetentionQuotaCustomConfig dailyResetTimezone(String dailyResetTimezone) { + this.dailyResetTimezone = dailyResetTimezone; + return this; + } + + /** + * The timezone offset used for the daily reset time, in ±HH:MM format. + * + * @return dailyResetTimezone + */ + @JsonProperty(JSON_PROPERTY_DAILY_RESET_TIMEZONE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDailyResetTimezone() { + return dailyResetTimezone; + } + + public void setDailyResetTimezone(String dailyResetTimezone) { + this.dailyResetTimezone = dailyResetTimezone; + } + + public RumRetentionQuotaCustomConfig quotaReachedAction( + RumRetentionQuotaReachedAction quotaReachedAction) { + this.quotaReachedAction = quotaReachedAction; + this.unparsed |= !quotaReachedAction.isValid(); + return this; + } + + /** + * The action to take when the session quota is reached. + * + * @return quotaReachedAction + */ + @JsonProperty(JSON_PROPERTY_QUOTA_REACHED_ACTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RumRetentionQuotaReachedAction getQuotaReachedAction() { + return quotaReachedAction; + } + + public void setQuotaReachedAction(RumRetentionQuotaReachedAction quotaReachedAction) { + if (!quotaReachedAction.isValid()) { + this.unparsed = true; + } + this.quotaReachedAction = quotaReachedAction; + } + + public RumRetentionQuotaCustomConfig sessionLimit(Long sessionLimit) { + this.sessionLimit = sessionLimit; + return this; + } + + /** + * The maximum number of sessions allowed within the window. Must be at least 1000. + * minimum: 1000 + * + * @return sessionLimit + */ + @JsonProperty(JSON_PROPERTY_SESSION_LIMIT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getSessionLimit() { + return sessionLimit; + } + + public void setSessionLimit(Long sessionLimit) { + this.sessionLimit = sessionLimit; + } + + public RumRetentionQuotaCustomConfig windowType(RumRetentionQuotaWindowType windowType) { + this.windowType = windowType; + this.unparsed |= !windowType.isValid(); + return this; + } + + /** + * The window type over which the session limit is enforced. + * + * @return windowType + */ + @JsonProperty(JSON_PROPERTY_WINDOW_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RumRetentionQuotaWindowType getWindowType() { + return windowType; + } + + public void setWindowType(RumRetentionQuotaWindowType windowType) { + if (!windowType.isValid()) { + this.unparsed = true; + } + this.windowType = windowType; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RumRetentionQuotaCustomConfig + */ + @JsonAnySetter + public RumRetentionQuotaCustomConfig putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RumRetentionQuotaCustomConfig object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RumRetentionQuotaCustomConfig rumRetentionQuotaCustomConfig = (RumRetentionQuotaCustomConfig) o; + return Objects.equals(this.dailyResetTime, rumRetentionQuotaCustomConfig.dailyResetTime) + && Objects.equals(this.dailyResetTimezone, rumRetentionQuotaCustomConfig.dailyResetTimezone) + && Objects.equals(this.quotaReachedAction, rumRetentionQuotaCustomConfig.quotaReachedAction) + && Objects.equals(this.sessionLimit, rumRetentionQuotaCustomConfig.sessionLimit) + && Objects.equals(this.windowType, rumRetentionQuotaCustomConfig.windowType) + && Objects.equals( + this.additionalProperties, rumRetentionQuotaCustomConfig.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + dailyResetTime, + dailyResetTimezone, + quotaReachedAction, + sessionLimit, + windowType, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RumRetentionQuotaCustomConfig {\n"); + sb.append(" dailyResetTime: ").append(toIndentedString(dailyResetTime)).append("\n"); + sb.append(" dailyResetTimezone: ").append(toIndentedString(dailyResetTimezone)).append("\n"); + sb.append(" quotaReachedAction: ").append(toIndentedString(quotaReachedAction)).append("\n"); + sb.append(" sessionLimit: ").append(toIndentedString(sessionLimit)).append("\n"); + sb.append(" windowType: ").append(toIndentedString(windowType)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaMode.java b/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaMode.java new file mode 100644 index 00000000000..aa973080dc2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaMode.java @@ -0,0 +1,59 @@ +/* + * Unless explicitly stated otherwise all files in this repository 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 com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * The retention quota mode. custom enforces a fixed session limit, while + * adaptive dynamically adjusts retention. + */ +@JsonSerialize(using = RumRetentionQuotaMode.RumRetentionQuotaModeSerializer.class) +public class RumRetentionQuotaMode extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("custom", "adaptive")); + + public static final RumRetentionQuotaMode CUSTOM = new RumRetentionQuotaMode("custom"); + public static final RumRetentionQuotaMode ADAPTIVE = new RumRetentionQuotaMode("adaptive"); + + RumRetentionQuotaMode(String value) { + super(value, allowedValues); + } + + public static class RumRetentionQuotaModeSerializer extends StdSerializer { + public RumRetentionQuotaModeSerializer(Class t) { + super(t); + } + + public RumRetentionQuotaModeSerializer() { + this(null); + } + + @Override + public void serialize( + RumRetentionQuotaMode value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static RumRetentionQuotaMode fromValue(String value) { + return new RumRetentionQuotaMode(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaReachedAction.java b/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaReachedAction.java new file mode 100644 index 00000000000..dec2a65f93b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaReachedAction.java @@ -0,0 +1,60 @@ +/* + * Unless explicitly stated otherwise all files in this repository 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 com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The action to take when the session quota is reached. */ +@JsonSerialize( + using = RumRetentionQuotaReachedAction.RumRetentionQuotaReachedActionSerializer.class) +public class RumRetentionQuotaReachedAction extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("stop", "slowdown")); + + public static final RumRetentionQuotaReachedAction STOP = + new RumRetentionQuotaReachedAction("stop"); + public static final RumRetentionQuotaReachedAction SLOWDOWN = + new RumRetentionQuotaReachedAction("slowdown"); + + RumRetentionQuotaReachedAction(String value) { + super(value, allowedValues); + } + + public static class RumRetentionQuotaReachedActionSerializer + extends StdSerializer { + public RumRetentionQuotaReachedActionSerializer(Class t) { + super(t); + } + + public RumRetentionQuotaReachedActionSerializer() { + this(null); + } + + @Override + public void serialize( + RumRetentionQuotaReachedAction value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static RumRetentionQuotaReachedAction fromValue(String value) { + return new RumRetentionQuotaReachedAction(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaScopeType.java b/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaScopeType.java new file mode 100644 index 00000000000..07cc3cd478f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaScopeType.java @@ -0,0 +1,57 @@ +/* + * Unless explicitly stated otherwise all files in this repository 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 com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The type of scope the retention quota configuration applies to. */ +@JsonSerialize(using = RumRetentionQuotaScopeType.RumRetentionQuotaScopeTypeSerializer.class) +public class RumRetentionQuotaScopeType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("application")); + + public static final RumRetentionQuotaScopeType APPLICATION = + new RumRetentionQuotaScopeType("application"); + + RumRetentionQuotaScopeType(String value) { + super(value, allowedValues); + } + + public static class RumRetentionQuotaScopeTypeSerializer + extends StdSerializer { + public RumRetentionQuotaScopeTypeSerializer(Class t) { + super(t); + } + + public RumRetentionQuotaScopeTypeSerializer() { + this(null); + } + + @Override + public void serialize( + RumRetentionQuotaScopeType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static RumRetentionQuotaScopeType fromValue(String value) { + return new RumRetentionQuotaScopeType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaWindowType.java b/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaWindowType.java new file mode 100644 index 00000000000..90cc91804e9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RumRetentionQuotaWindowType.java @@ -0,0 +1,55 @@ +/* + * Unless explicitly stated otherwise all files in this repository 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 com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The window type over which the session limit is enforced. */ +@JsonSerialize(using = RumRetentionQuotaWindowType.RumRetentionQuotaWindowTypeSerializer.class) +public class RumRetentionQuotaWindowType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("daily")); + + public static final RumRetentionQuotaWindowType DAILY = new RumRetentionQuotaWindowType("daily"); + + RumRetentionQuotaWindowType(String value) { + super(value, allowedValues); + } + + public static class RumRetentionQuotaWindowTypeSerializer + extends StdSerializer { + public RumRetentionQuotaWindowTypeSerializer(Class t) { + super(t); + } + + public RumRetentionQuotaWindowTypeSerializer() { + this(null); + } + + @Override + public void serialize( + RumRetentionQuotaWindowType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static RumRetentionQuotaWindowType fromValue(String value) { + return new RumRetentionQuotaWindowType(value); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/rum_retention_quota.feature b/src/test/resources/com/datadog/api/client/v2/api/rum_retention_quota.feature new file mode 100644 index 00000000000..527a1597d4d --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/rum_retention_quota.feature @@ -0,0 +1,100 @@ +@endpoint(rum-retention-quota) @endpoint(rum-retention-quota-v2) +Feature: RUM Retention Quota + Manage RUM retention quota configurations for your organization's RUM + applications. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "RUMRetentionQuota" API + + @skip @team:DataDog/rum-backend + Scenario: Create or update a RUM retention quota config returns "Bad Request" response + Given new "UpsertRumQuotaConfig" request + And request contains "scope_type" parameter with value "application" + And request contains "scope_id" parameter with value "invalid-scope-id" + And body with value {"data": {"attributes": {"adaptive": {"max_retention_rate": 0.5}, "custom": {"daily_reset_time": "08:00", "daily_reset_timezone": "+09:00", "quota_reached_action": "stop", "session_limit": 1000000, "window_type": "daily"}, "mode": "custom"}, "id": "cd73a516-a481-4af5-8352-9b577465c77b", "type": "rum_quota_config"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/rum-backend + Scenario: Create or update a RUM retention quota config returns "Not Found" response + Given new "UpsertRumQuotaConfig" request + And request contains "scope_type" parameter with value "application" + And request contains "scope_id" parameter with value "{{ unique }}" + And body with value {"data": {"attributes": {"adaptive": {"max_retention_rate": 0.5}, "custom": {"daily_reset_time": "08:00", "daily_reset_timezone": "+09:00", "quota_reached_action": "stop", "session_limit": 1000000, "window_type": "daily"}, "mode": "custom"}, "id": "{{ unique }}", "type": "rum_quota_config"}} + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/rum-backend + Scenario: Create or update a RUM retention quota config returns "OK" response + Given new "UpsertRumQuotaConfig" request + And request contains "scope_type" parameter with value "application" + And request contains "scope_id" parameter with value "ced16651-97b6-4e67-8590-8caec3af0695" + And body with value {"data": {"attributes": {"adaptive": {"max_retention_rate": 0.5}, "custom": {"daily_reset_time": "08:00", "daily_reset_timezone": "+09:00", "quota_reached_action": "stop", "session_limit": 1000000, "window_type": "daily"}, "mode": "custom"}, "id": "ced16651-97b6-4e67-8590-8caec3af0695", "type": "rum_quota_config"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/rum-backend + Scenario: Delete a RUM retention quota configuration returns "Bad Request" response + Given new "DeleteRumQuotaConfig" request + And request contains "scope_type" parameter from "REPLACE.ME" + And request contains "scope_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/rum-backend + Scenario: Delete a RUM retention quota configuration returns "No Content" response + Given new "DeleteRumQuotaConfig" request + And request contains "scope_type" parameter with value "application" + And request contains "scope_id" parameter with value "ced16651-97b6-4e67-8590-8caec3af0695" + When the request is sent + Then the response status is 204 No Content + + @skip @team:DataDog/rum-backend + Scenario: Delete a RUM retention quota configuration returns "Not Found" response + Given new "DeleteRumQuotaConfig" request + And request contains "scope_type" parameter with value "application" + And request contains "scope_id" parameter with value "{{ unique }}" + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/rum-backend + Scenario: Delete a RUM retention quota configuration returns "Not Found" response for an invalid scope_id + Given new "DeleteRumQuotaConfig" request + And request contains "scope_type" parameter with value "application" + And request contains "scope_id" parameter with value "invalid-scope-id" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/rum-backend + Scenario: Get a RUM retention quota configuration returns "Bad Request" response + Given new "GetRumQuotaConfig" request + And request contains "scope_type" parameter from "REPLACE.ME" + And request contains "scope_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/rum-backend + Scenario: Get a RUM retention quota configuration returns "Not Found" response + Given new "GetRumQuotaConfig" request + And request contains "scope_type" parameter with value "application" + And request contains "scope_id" parameter with value "1d4b9c34-7ac4-423a-91cf-9902d926e9b3" + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/rum-backend + Scenario: Get a RUM retention quota configuration returns "Not Found" response for an invalid scope_id + Given new "GetRumQuotaConfig" request + And request contains "scope_type" parameter with value "application" + And request contains "scope_id" parameter with value "invalid-scope-id" + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/rum-backend + Scenario: Get a RUM retention quota configuration returns "OK" response + Given new "GetRumQuotaConfig" request + And request contains "scope_type" parameter with value "application" + And request contains "scope_id" parameter with value "ced16651-97b6-4e67-8590-8caec3af0695" + When the request is sent + Then the response status is 200 OK diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 870f4e34a50..9d8e566f9ef 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -7086,6 +7086,24 @@ "type": "idempotent" } }, + "DeleteRumQuotaConfig": { + "tag": "RUM Retention Quota", + "undo": { + "type": "idempotent" + } + }, + "GetRumQuotaConfig": { + "tag": "RUM Retention Quota", + "undo": { + "type": "safe" + } + }, + "UpsertRumQuotaConfig": { + "tag": "RUM Retention Quota", + "undo": { + "type": "idempotent" + } + }, "ListRUMEvents": { "tag": "RUM", "undo": {