Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 111 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132067,6 +132067,35 @@ components:
type: string
x-enum-varnames:
- TAG_INDEXING_RULE_EXEMPTIONS
TagIndexingRuleExemptionUpdateAttributes:
description: Attributes for updating a tag indexing rule exemption.
properties:
reason:
description: The updated reason the metric is exempt from tag indexing rules.
example: This metric must remain exempt because of its query requirements.
type: string
required:
- reason
type: object
TagIndexingRuleExemptionUpdateData:
description: Data object for updating a tag indexing rule exemption.
properties:
attributes:
$ref: "#/components/schemas/TagIndexingRuleExemptionUpdateAttributes"
type:
$ref: "#/components/schemas/TagIndexingRuleExemptionType"
required:
- type
- attributes
type: object
TagIndexingRuleExemptionUpdateRequest:
description: Request body for updating a tag indexing rule exemption.
properties:
data:
$ref: "#/components/schemas/TagIndexingRuleExemptionUpdateData"
required:
- data
type: object
TagIndexingRuleExemptionVolumeStatus:
description: |-
Indicates whether `estimated_change_in_volume` is available and, if not, why. `ok` indicates a fresh estimate.
Expand Down Expand Up @@ -203875,6 +203904,88 @@ paths:
x-unstable: |-
**Note**: The Tag Indexing Rules feature is currently in Preview.
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
put:
description: |-
Update the reason for an explicit tag indexing rule exemption. The exemption's `created_at` and
`created_by_handle` values remain unchanged. Returns 404 when the metric has no explicit exemption or has
only a legacy tag configuration. Requires the `Manage Tags for Metrics` permission.
operationId: UpdateTagIndexingRuleExemption
parameters:
- $ref: "#/components/parameters/MetricName"
requestBody:
content:
application/json:
examples:
default:
value:
data:
attributes:
reason: This metric must remain exempt because of its query requirements.
type: tag_indexing_rule_exemptions
schema:
$ref: "#/components/schemas/TagIndexingRuleExemptionUpdateRequest"
required: true
responses:
"200":
content:
application/json:
examples:
default:
value:
data:
attributes:
created_at: "2024-01-15T12:00:00.000Z"
created_by_handle: user@datadoghq.com
estimated_change_in_volume:
kind: exemption
missing_indexed_tags: []
reason: This metric must remain exempt because of its query requirements.
volume_status: unavailable
id: dd.test.metric
type: tag_indexing_rule_exemptions
schema:
$ref: "#/components/schemas/TagIndexingRuleExemptionResponse"
description: OK
"400":
content:
application/json:
schema:
$ref: "#/components/schemas/JSONAPIErrorResponse"
description: Bad Request
"403":
content:
application/json:
schema:
$ref: "#/components/schemas/JSONAPIErrorResponse"
description: Forbidden
"404":
content:
application/json:
schema:
$ref: "#/components/schemas/JSONAPIErrorResponse"
description: Not Found
"429":
content:
application/json:
schema:
$ref: "#/components/schemas/JSONAPIErrorResponse"
description: Too Many Requests
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- metric_tags_write
summary: Update a tag indexing rule exemption
tags:
- Metrics
x-codegen-request-body-name: body
"x-permission":
operator: OR
permissions:
- metric_tags_write
x-unstable: |-
**Note**: The Tag Indexing Rules feature is currently in Preview.
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
/api/v2/metrics/{metric_name}/tag-indexing-rules:
get:
description: |-
Expand Down
42 changes: 42 additions & 0 deletions examples/v2/metrics/UpdateTagIndexingRuleExemption.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Update a tag indexing rule exemption returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.MetricsApi;
import com.datadog.api.client.v2.model.TagIndexingRuleExemptionResponse;
import com.datadog.api.client.v2.model.TagIndexingRuleExemptionType;
import com.datadog.api.client.v2.model.TagIndexingRuleExemptionUpdateAttributes;
import com.datadog.api.client.v2.model.TagIndexingRuleExemptionUpdateData;
import com.datadog.api.client.v2.model.TagIndexingRuleExemptionUpdateRequest;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
defaultClient.setUnstableOperationEnabled("v2.updateTagIndexingRuleExemption", true);
MetricsApi apiInstance = new MetricsApi(defaultClient);

TagIndexingRuleExemptionUpdateRequest body =
new TagIndexingRuleExemptionUpdateRequest()
.data(
new TagIndexingRuleExemptionUpdateData()
.attributes(
new TagIndexingRuleExemptionUpdateAttributes()
.reason(
"This metric must remain exempt because of its query"
+ " requirements."))
.type(TagIndexingRuleExemptionType.TAG_INDEXING_RULE_EXEMPTIONS));

try {
TagIndexingRuleExemptionResponse result =
apiInstance.updateTagIndexingRuleExemption("dist.http.endpoint.request", body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MetricsApi#updateTagIndexingRuleExemption");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
1 change: 1 addition & 0 deletions src/main/java/com/datadog/api/client/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -1460,6 +1460,7 @@ public class ApiClient {
put("v2.listTagIndexingRulesForMetric", false);
put("v2.reorderTagIndexingRules", false);
put("v2.updateTagIndexingRule", false);
put("v2.updateTagIndexingRuleExemption", false);
put("v2.deleteModelLabRun", false);
put("v2.getModelLabArtifactContent", false);
put("v2.getModelLabProject", false);
Expand Down
190 changes: 190 additions & 0 deletions src/main/java/com/datadog/api/client/v2/api/MetricsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.datadog.api.client.v2.model.TagIndexingRuleExemptionData;
import com.datadog.api.client.v2.model.TagIndexingRuleExemptionResponse;
import com.datadog.api.client.v2.model.TagIndexingRuleExemptionSort;
import com.datadog.api.client.v2.model.TagIndexingRuleExemptionUpdateRequest;
import com.datadog.api.client.v2.model.TagIndexingRuleExemptionsResponse;
import com.datadog.api.client.v2.model.TagIndexingRuleOrderRequest;
import com.datadog.api.client.v2.model.TagIndexingRuleResponse;
Expand Down Expand Up @@ -6384,4 +6385,193 @@ public ApiResponse<TagIndexingRuleResponse> updateTagIndexingRuleWithHttpInfo(
false,
new GenericType<TagIndexingRuleResponse>() {});
}

/**
* Update a tag indexing rule exemption.
*
* <p>See {@link #updateTagIndexingRuleExemptionWithHttpInfo}.
*
* @param metricName The name of the metric. (required)
* @param body (required)
* @return TagIndexingRuleExemptionResponse
* @throws ApiException if fails to make API call
*/
public TagIndexingRuleExemptionResponse updateTagIndexingRuleExemption(
String metricName, TagIndexingRuleExemptionUpdateRequest body) throws ApiException {
return updateTagIndexingRuleExemptionWithHttpInfo(metricName, body).getData();
}

/**
* Update a tag indexing rule exemption.
*
* <p>See {@link #updateTagIndexingRuleExemptionWithHttpInfoAsync}.
*
* @param metricName The name of the metric. (required)
* @param body (required)
* @return CompletableFuture&lt;TagIndexingRuleExemptionResponse&gt;
*/
public CompletableFuture<TagIndexingRuleExemptionResponse> updateTagIndexingRuleExemptionAsync(
String metricName, TagIndexingRuleExemptionUpdateRequest body) {
return updateTagIndexingRuleExemptionWithHttpInfoAsync(metricName, body)
.thenApply(
response -> {
return response.getData();
});
}

/**
* Update the reason for an explicit tag indexing rule exemption. The exemption's <code>created_at
* </code> and <code>created_by_handle</code> values remain unchanged. Returns 404 when the metric
* has no explicit exemption or has only a legacy tag configuration. Requires the <code>
* Manage Tags for Metrics</code> permission.
*
* @param metricName The name of the metric. (required)
* @param body (required)
* @return ApiResponse&lt;TagIndexingRuleExemptionResponse&gt;
* @throws ApiException if fails to make API call
* @http.response.details
* <table border="1">
* <caption>Response details</caption>
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
* <tr><td> 200 </td><td> OK </td><td> - </td></tr>
* <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr>
* <tr><td> 403 </td><td> Forbidden </td><td> - </td></tr>
* <tr><td> 404 </td><td> Not Found </td><td> - </td></tr>
* <tr><td> 429 </td><td> Too Many Requests </td><td> - </td></tr>
* </table>
*/
public ApiResponse<TagIndexingRuleExemptionResponse> updateTagIndexingRuleExemptionWithHttpInfo(
String metricName, TagIndexingRuleExemptionUpdateRequest body) throws ApiException {
// Check if unstable operation is enabled
String operationId = "updateTagIndexingRuleExemption";
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
} else {
throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId));
}
Object localVarPostBody = body;

// verify the required parameter 'metricName' is set
if (metricName == null) {
throw new ApiException(
400,
"Missing the required parameter 'metricName' when calling"
+ " updateTagIndexingRuleExemption");
}

// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(
400, "Missing the required parameter 'body' when calling updateTagIndexingRuleExemption");
}
// create path and map variables
String localVarPath =
"/api/v2/metrics/{metric_name}/tag-indexing-rule-exemptions"
.replaceAll(
"\\{" + "metric_name" + "\\}", apiClient.escapeString(metricName.toString()));

Map<String, String> localVarHeaderParams = new HashMap<String, String>();

Invocation.Builder builder =
apiClient.createBuilder(
"v2.MetricsApi.updateTagIndexingRuleExemption",
localVarPath,
new ArrayList<Pair>(),
localVarHeaderParams,
new HashMap<String, String>(),
new String[] {"application/json"},
new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"});
return apiClient.invokeAPI(
"PUT",
builder,
localVarHeaderParams,
new String[] {"application/json"},
localVarPostBody,
new HashMap<String, Object>(),
false,
new GenericType<TagIndexingRuleExemptionResponse>() {});
}

/**
* Update a tag indexing rule exemption.
*
* <p>See {@link #updateTagIndexingRuleExemptionWithHttpInfo}.
*
* @param metricName The name of the metric. (required)
* @param body (required)
* @return CompletableFuture&lt;ApiResponse&lt;TagIndexingRuleExemptionResponse&gt;&gt;
*/
public CompletableFuture<ApiResponse<TagIndexingRuleExemptionResponse>>
updateTagIndexingRuleExemptionWithHttpInfoAsync(
String metricName, TagIndexingRuleExemptionUpdateRequest body) {
// Check if unstable operation is enabled
String operationId = "updateTagIndexingRuleExemption";
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
} else {
CompletableFuture<ApiResponse<TagIndexingRuleExemptionResponse>> result =
new CompletableFuture<>();
result.completeExceptionally(
new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)));
return result;
}
Object localVarPostBody = body;

// verify the required parameter 'metricName' is set
if (metricName == null) {
CompletableFuture<ApiResponse<TagIndexingRuleExemptionResponse>> result =
new CompletableFuture<>();
result.completeExceptionally(
new ApiException(
400,
"Missing the required parameter 'metricName' when calling"
+ " updateTagIndexingRuleExemption"));
return result;
}

// verify the required parameter 'body' is set
if (body == null) {
CompletableFuture<ApiResponse<TagIndexingRuleExemptionResponse>> result =
new CompletableFuture<>();
result.completeExceptionally(
new ApiException(
400,
"Missing the required parameter 'body' when calling updateTagIndexingRuleExemption"));
return result;
}
// create path and map variables
String localVarPath =
"/api/v2/metrics/{metric_name}/tag-indexing-rule-exemptions"
.replaceAll(
"\\{" + "metric_name" + "\\}", apiClient.escapeString(metricName.toString()));

Map<String, String> localVarHeaderParams = new HashMap<String, String>();

Invocation.Builder builder;
try {
builder =
apiClient.createBuilder(
"v2.MetricsApi.updateTagIndexingRuleExemption",
localVarPath,
new ArrayList<Pair>(),
localVarHeaderParams,
new HashMap<String, String>(),
new String[] {"application/json"},
new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"});
} catch (ApiException ex) {
CompletableFuture<ApiResponse<TagIndexingRuleExemptionResponse>> result =
new CompletableFuture<>();
result.completeExceptionally(ex);
return result;
}
return apiClient.invokeAPIAsync(
"PUT",
builder,
localVarHeaderParams,
new String[] {"application/json"},
localVarPostBody,
new HashMap<String, Object>(),
false,
new GenericType<TagIndexingRuleExemptionResponse>() {});
}
}
Loading
Loading