|
| 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_retention_quota_scope_type import RumRetentionQuotaScopeType |
| 11 | +from datadog_api_client.v2.model.rum_retention_quota_config_response import RumRetentionQuotaConfigResponse |
| 12 | +from datadog_api_client.v2.model.rum_retention_quota_config_update_request import RumRetentionQuotaConfigUpdateRequest |
| 13 | + |
| 14 | + |
| 15 | +class RUMRetentionQuotaApi: |
| 16 | + """ |
| 17 | + Manage RUM retention quota configurations for your organization's RUM applications. |
| 18 | + """ |
| 19 | + |
| 20 | + def __init__(self, api_client=None): |
| 21 | + if api_client is None: |
| 22 | + api_client = ApiClient(Configuration()) |
| 23 | + self.api_client = api_client |
| 24 | + |
| 25 | + self._delete_rum_quota_config_endpoint = _Endpoint( |
| 26 | + settings={ |
| 27 | + "response_type": None, |
| 28 | + "auth": ["apiKeyAuth", "appKeyAuth"], |
| 29 | + "endpoint_path": "/api/v2/rum/config/retention-quota/{scope_type}/{scope_id}", |
| 30 | + "operation_id": "delete_rum_quota_config", |
| 31 | + "http_method": "DELETE", |
| 32 | + "version": "v2", |
| 33 | + }, |
| 34 | + params_map={ |
| 35 | + "scope_type": { |
| 36 | + "required": True, |
| 37 | + "openapi_types": (RumRetentionQuotaScopeType,), |
| 38 | + "attribute": "scope_type", |
| 39 | + "location": "path", |
| 40 | + }, |
| 41 | + "scope_id": { |
| 42 | + "required": True, |
| 43 | + "openapi_types": (str,), |
| 44 | + "attribute": "scope_id", |
| 45 | + "location": "path", |
| 46 | + }, |
| 47 | + }, |
| 48 | + headers_map={ |
| 49 | + "accept": ["*/*"], |
| 50 | + }, |
| 51 | + api_client=api_client, |
| 52 | + ) |
| 53 | + |
| 54 | + self._get_rum_quota_config_endpoint = _Endpoint( |
| 55 | + settings={ |
| 56 | + "response_type": (RumRetentionQuotaConfigResponse,), |
| 57 | + "auth": ["apiKeyAuth", "appKeyAuth"], |
| 58 | + "endpoint_path": "/api/v2/rum/config/retention-quota/{scope_type}/{scope_id}", |
| 59 | + "operation_id": "get_rum_quota_config", |
| 60 | + "http_method": "GET", |
| 61 | + "version": "v2", |
| 62 | + }, |
| 63 | + params_map={ |
| 64 | + "scope_type": { |
| 65 | + "required": True, |
| 66 | + "openapi_types": (RumRetentionQuotaScopeType,), |
| 67 | + "attribute": "scope_type", |
| 68 | + "location": "path", |
| 69 | + }, |
| 70 | + "scope_id": { |
| 71 | + "required": True, |
| 72 | + "openapi_types": (str,), |
| 73 | + "attribute": "scope_id", |
| 74 | + "location": "path", |
| 75 | + }, |
| 76 | + }, |
| 77 | + headers_map={ |
| 78 | + "accept": ["application/json"], |
| 79 | + }, |
| 80 | + api_client=api_client, |
| 81 | + ) |
| 82 | + |
| 83 | + self._upsert_rum_quota_config_endpoint = _Endpoint( |
| 84 | + settings={ |
| 85 | + "response_type": (RumRetentionQuotaConfigResponse,), |
| 86 | + "auth": ["apiKeyAuth", "appKeyAuth"], |
| 87 | + "endpoint_path": "/api/v2/rum/config/retention-quota/{scope_type}/{scope_id}", |
| 88 | + "operation_id": "upsert_rum_quota_config", |
| 89 | + "http_method": "PUT", |
| 90 | + "version": "v2", |
| 91 | + }, |
| 92 | + params_map={ |
| 93 | + "scope_type": { |
| 94 | + "required": True, |
| 95 | + "openapi_types": (RumRetentionQuotaScopeType,), |
| 96 | + "attribute": "scope_type", |
| 97 | + "location": "path", |
| 98 | + }, |
| 99 | + "scope_id": { |
| 100 | + "required": True, |
| 101 | + "openapi_types": (str,), |
| 102 | + "attribute": "scope_id", |
| 103 | + "location": "path", |
| 104 | + }, |
| 105 | + "body": { |
| 106 | + "required": True, |
| 107 | + "openapi_types": (RumRetentionQuotaConfigUpdateRequest,), |
| 108 | + "location": "body", |
| 109 | + }, |
| 110 | + }, |
| 111 | + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, |
| 112 | + api_client=api_client, |
| 113 | + ) |
| 114 | + |
| 115 | + def delete_rum_quota_config( |
| 116 | + self, |
| 117 | + scope_type: RumRetentionQuotaScopeType, |
| 118 | + scope_id: str, |
| 119 | + ) -> None: |
| 120 | + """Delete a RUM retention quota configuration. |
| 121 | +
|
| 122 | + Delete the RUM retention quota configuration for a given scope. |
| 123 | +
|
| 124 | + :param scope_type: The type of scope the retention quota configuration applies to. |
| 125 | + :type scope_type: RumRetentionQuotaScopeType |
| 126 | + :param scope_id: The identifier of the scope the retention quota configuration applies to. |
| 127 | + For the ``application`` scope, this is the RUM application ID. |
| 128 | + :type scope_id: str |
| 129 | + :rtype: None |
| 130 | + """ |
| 131 | + kwargs: Dict[str, Any] = {} |
| 132 | + kwargs["scope_type"] = scope_type |
| 133 | + |
| 134 | + kwargs["scope_id"] = scope_id |
| 135 | + |
| 136 | + return self._delete_rum_quota_config_endpoint.call_with_http_info(**kwargs) |
| 137 | + |
| 138 | + def get_rum_quota_config( |
| 139 | + self, |
| 140 | + scope_type: RumRetentionQuotaScopeType, |
| 141 | + scope_id: str, |
| 142 | + ) -> RumRetentionQuotaConfigResponse: |
| 143 | + """Get a RUM retention quota configuration. |
| 144 | +
|
| 145 | + Get the RUM retention quota configuration for a given scope. |
| 146 | +
|
| 147 | + :param scope_type: The type of scope the retention quota configuration applies to. |
| 148 | + :type scope_type: RumRetentionQuotaScopeType |
| 149 | + :param scope_id: The identifier of the scope the retention quota configuration applies to. |
| 150 | + For the ``application`` scope, this is the RUM application ID. |
| 151 | + :type scope_id: str |
| 152 | + :rtype: RumRetentionQuotaConfigResponse |
| 153 | + """ |
| 154 | + kwargs: Dict[str, Any] = {} |
| 155 | + kwargs["scope_type"] = scope_type |
| 156 | + |
| 157 | + kwargs["scope_id"] = scope_id |
| 158 | + |
| 159 | + return self._get_rum_quota_config_endpoint.call_with_http_info(**kwargs) |
| 160 | + |
| 161 | + def upsert_rum_quota_config( |
| 162 | + self, |
| 163 | + scope_type: RumRetentionQuotaScopeType, |
| 164 | + scope_id: str, |
| 165 | + body: RumRetentionQuotaConfigUpdateRequest, |
| 166 | + ) -> RumRetentionQuotaConfigResponse: |
| 167 | + """Create or update a RUM retention quota config. |
| 168 | +
|
| 169 | + Create or update the RUM retention quota configuration for a given scope. |
| 170 | + Returns the retention quota configuration object when the request is successful. |
| 171 | +
|
| 172 | + :param scope_type: The type of scope the retention quota configuration applies to. |
| 173 | + :type scope_type: RumRetentionQuotaScopeType |
| 174 | + :param scope_id: The identifier of the scope the retention quota configuration applies to. |
| 175 | + For the ``application`` scope, this is the RUM application ID. |
| 176 | + :type scope_id: str |
| 177 | + :param body: The definition of the RUM retention quota configuration to create or update. |
| 178 | + :type body: RumRetentionQuotaConfigUpdateRequest |
| 179 | + :rtype: RumRetentionQuotaConfigResponse |
| 180 | + """ |
| 181 | + kwargs: Dict[str, Any] = {} |
| 182 | + kwargs["scope_type"] = scope_type |
| 183 | + |
| 184 | + kwargs["scope_id"] = scope_id |
| 185 | + |
| 186 | + kwargs["body"] = body |
| 187 | + |
| 188 | + return self._upsert_rum_quota_config_endpoint.call_with_http_info(**kwargs) |
0 commit comments