|
| 1 | +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. |
| 2 | +# This product includes software developed at Datadog (https://www.datadoghq.com/). |
| 3 | +# Copyright 2019-Present Datadog, Inc. |
| 4 | +from __future__ import annotations |
| 5 | + |
| 6 | +from typing import Any, Dict |
| 7 | + |
| 8 | +from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint |
| 9 | +from datadog_api_client.configuration import Configuration |
| 10 | +from datadog_api_client.v2.model.rum_hardcoded_retention_filters_response import RumHardcodedRetentionFiltersResponse |
| 11 | +from datadog_api_client.v2.model.rum_hardcoded_retention_filter_response import RumHardcodedRetentionFilterResponse |
| 12 | +from datadog_api_client.v2.model.rum_hardcoded_retention_filter_update_request import ( |
| 13 | + RumHardcodedRetentionFilterUpdateRequest, |
| 14 | +) |
| 15 | + |
| 16 | + |
| 17 | +class RUMRetentionFiltersHardcodedApi: |
| 18 | + """ |
| 19 | + Manage hardcoded retention filters through `Manage Applications <https://app.datadoghq.com/rum/list>`_ in RUM. |
| 20 | + """ |
| 21 | + |
| 22 | + def __init__(self, api_client=None): |
| 23 | + if api_client is None: |
| 24 | + api_client = ApiClient(Configuration()) |
| 25 | + self.api_client = api_client |
| 26 | + |
| 27 | + self._get_hardcoded_retention_filter_endpoint = _Endpoint( |
| 28 | + settings={ |
| 29 | + "response_type": (RumHardcodedRetentionFilterResponse,), |
| 30 | + "auth": ["apiKeyAuth", "appKeyAuth"], |
| 31 | + "endpoint_path": "/api/v2/rum/applications/{app_id}/hardcoded_retention_filters/{rf_id}", |
| 32 | + "operation_id": "get_hardcoded_retention_filter", |
| 33 | + "http_method": "GET", |
| 34 | + "version": "v2", |
| 35 | + }, |
| 36 | + params_map={ |
| 37 | + "app_id": { |
| 38 | + "required": True, |
| 39 | + "openapi_types": (str,), |
| 40 | + "attribute": "app_id", |
| 41 | + "location": "path", |
| 42 | + }, |
| 43 | + "rf_id": { |
| 44 | + "required": True, |
| 45 | + "openapi_types": (str,), |
| 46 | + "attribute": "rf_id", |
| 47 | + "location": "path", |
| 48 | + }, |
| 49 | + }, |
| 50 | + headers_map={ |
| 51 | + "accept": ["application/json"], |
| 52 | + }, |
| 53 | + api_client=api_client, |
| 54 | + ) |
| 55 | + |
| 56 | + self._list_hardcoded_retention_filters_endpoint = _Endpoint( |
| 57 | + settings={ |
| 58 | + "response_type": (RumHardcodedRetentionFiltersResponse,), |
| 59 | + "auth": ["apiKeyAuth", "appKeyAuth"], |
| 60 | + "endpoint_path": "/api/v2/rum/applications/{app_id}/hardcoded_retention_filters", |
| 61 | + "operation_id": "list_hardcoded_retention_filters", |
| 62 | + "http_method": "GET", |
| 63 | + "version": "v2", |
| 64 | + }, |
| 65 | + params_map={ |
| 66 | + "app_id": { |
| 67 | + "required": True, |
| 68 | + "openapi_types": (str,), |
| 69 | + "attribute": "app_id", |
| 70 | + "location": "path", |
| 71 | + }, |
| 72 | + }, |
| 73 | + headers_map={ |
| 74 | + "accept": ["application/json"], |
| 75 | + }, |
| 76 | + api_client=api_client, |
| 77 | + ) |
| 78 | + |
| 79 | + self._update_hardcoded_retention_filter_endpoint = _Endpoint( |
| 80 | + settings={ |
| 81 | + "response_type": (RumHardcodedRetentionFilterResponse,), |
| 82 | + "auth": ["apiKeyAuth", "appKeyAuth"], |
| 83 | + "endpoint_path": "/api/v2/rum/applications/{app_id}/hardcoded_retention_filters/{rf_id}", |
| 84 | + "operation_id": "update_hardcoded_retention_filter", |
| 85 | + "http_method": "PATCH", |
| 86 | + "version": "v2", |
| 87 | + }, |
| 88 | + params_map={ |
| 89 | + "app_id": { |
| 90 | + "required": True, |
| 91 | + "openapi_types": (str,), |
| 92 | + "attribute": "app_id", |
| 93 | + "location": "path", |
| 94 | + }, |
| 95 | + "rf_id": { |
| 96 | + "required": True, |
| 97 | + "openapi_types": (str,), |
| 98 | + "attribute": "rf_id", |
| 99 | + "location": "path", |
| 100 | + }, |
| 101 | + "body": { |
| 102 | + "required": True, |
| 103 | + "openapi_types": (RumHardcodedRetentionFilterUpdateRequest,), |
| 104 | + "location": "body", |
| 105 | + }, |
| 106 | + }, |
| 107 | + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, |
| 108 | + api_client=api_client, |
| 109 | + ) |
| 110 | + |
| 111 | + def get_hardcoded_retention_filter( |
| 112 | + self, |
| 113 | + app_id: str, |
| 114 | + rf_id: str, |
| 115 | + ) -> RumHardcodedRetentionFilterResponse: |
| 116 | + """Get a hardcoded retention filter. |
| 117 | +
|
| 118 | + Get a single hardcoded retention filter for a RUM application. |
| 119 | +
|
| 120 | + :param app_id: RUM application ID. |
| 121 | + :type app_id: str |
| 122 | + :param rf_id: Hardcoded retention filter ID. |
| 123 | + :type rf_id: str |
| 124 | + :rtype: RumHardcodedRetentionFilterResponse |
| 125 | + """ |
| 126 | + kwargs: Dict[str, Any] = {} |
| 127 | + kwargs["app_id"] = app_id |
| 128 | + |
| 129 | + kwargs["rf_id"] = rf_id |
| 130 | + |
| 131 | + return self._get_hardcoded_retention_filter_endpoint.call_with_http_info(**kwargs) |
| 132 | + |
| 133 | + def list_hardcoded_retention_filters( |
| 134 | + self, |
| 135 | + app_id: str, |
| 136 | + ) -> RumHardcodedRetentionFiltersResponse: |
| 137 | + """Get all hardcoded retention filters. |
| 138 | +
|
| 139 | + Get the list of hardcoded retention filters for a RUM application. |
| 140 | +
|
| 141 | + :param app_id: RUM application ID. |
| 142 | + :type app_id: str |
| 143 | + :rtype: RumHardcodedRetentionFiltersResponse |
| 144 | + """ |
| 145 | + kwargs: Dict[str, Any] = {} |
| 146 | + kwargs["app_id"] = app_id |
| 147 | + |
| 148 | + return self._list_hardcoded_retention_filters_endpoint.call_with_http_info(**kwargs) |
| 149 | + |
| 150 | + def update_hardcoded_retention_filter( |
| 151 | + self, |
| 152 | + app_id: str, |
| 153 | + rf_id: str, |
| 154 | + body: RumHardcodedRetentionFilterUpdateRequest, |
| 155 | + ) -> RumHardcodedRetentionFilterResponse: |
| 156 | + """Update a hardcoded retention filter. |
| 157 | +
|
| 158 | + Update the cross-product sample rates of a hardcoded retention filter for a RUM application. |
| 159 | + Only fields whose matching flag in ``cross_product_sampling_editability`` is ``true`` can be updated. |
| 160 | + Any other field is read-only and cannot be sent in the payload. |
| 161 | + Returns the updated hardcoded retention filter when the request is successful. |
| 162 | +
|
| 163 | + :param app_id: RUM application ID. |
| 164 | + :type app_id: str |
| 165 | + :param rf_id: Hardcoded retention filter ID. |
| 166 | + :type rf_id: str |
| 167 | + :param body: New cross-product sample rates for the hardcoded retention filter. |
| 168 | + :type body: RumHardcodedRetentionFilterUpdateRequest |
| 169 | + :rtype: RumHardcodedRetentionFilterResponse |
| 170 | + """ |
| 171 | + kwargs: Dict[str, Any] = {} |
| 172 | + kwargs["app_id"] = app_id |
| 173 | + |
| 174 | + kwargs["rf_id"] = rf_id |
| 175 | + |
| 176 | + kwargs["body"] = body |
| 177 | + |
| 178 | + return self._update_hardcoded_retention_filter_endpoint.call_with_http_info(**kwargs) |
0 commit comments