Re-order retention filters

PUT https://api.ap1.datadoghq.com/api/v2/apm/config/retention-filters-execution-orderhttps://api.ap2.datadoghq.com/api/v2/apm/config/retention-filters-execution-orderhttps://api.datadoghq.eu/api/v2/apm/config/retention-filters-execution-orderhttps://api.ddog-gov.com/api/v2/apm/config/retention-filters-execution-orderhttps://api.us2.ddog-gov.com/api/v2/apm/config/retention-filters-execution-orderhttps://api.datadoghq.com/api/v2/apm/config/retention-filters-execution-orderhttps://api.us3.datadoghq.com/api/v2/apm/config/retention-filters-execution-orderhttps://api.us5.datadoghq.com/api/v2/apm/config/retention-filters-execution-order

Overview

Re-order the execution order of retention filters. This endpoint requires the apm_retention_filter_write permission.

Request

Body Data (required)

The list of retention filters in the new order.

Expand All

Field

Type

Description

data [required]

[object]

A list of retention filters objects.

id [required]

string

The ID of the retention filter.

type [required]

enum

The type of the resource. Allowed enum values: apm_retention_filter

default: apm_retention_filter

{
  "data": [
    {
      "id": "jdZrilSJQLqzb6Cu7aub9Q",
      "type": "apm_retention_filter"
    },
    {
      "id": "7RBOb7dLSYWI01yc3pIH8w",
      "type": "apm_retention_filter"
    }
  ]
}

Response

OK

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Authorized

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                          ## default
# 

# Curl command
curl -X PUT "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/apm/config/retention-filters-execution-order" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": [ { "id": "7RBOb7dLSYWI01yc3pIH8w", "type": "apm_retention_filter" } ] } EOF
// Re-order retention filters returns "OK" response

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	body := datadogV2.ReorderRetentionFiltersRequest{
		Data: []datadogV2.RetentionFilterWithoutAttributes{
			{
				Id:   "jdZrilSJQLqzb6Cu7aub9Q",
				Type: datadogV2.APMRETENTIONFILTERTYPE_apm_retention_filter,
			},
			{
				Id:   "7RBOb7dLSYWI01yc3pIH8w",
				Type: datadogV2.APMRETENTIONFILTERTYPE_apm_retention_filter,
			},
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewAPMRetentionFiltersApi(apiClient)
	r, err := api.ReorderApmRetentionFilters(ctx, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `APMRetentionFiltersApi.ReorderApmRetentionFilters`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Re-order retention filters returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.ApmRetentionFiltersApi;
import com.datadog.api.client.v2.model.ApmRetentionFilterType;
import com.datadog.api.client.v2.model.ReorderRetentionFiltersRequest;
import com.datadog.api.client.v2.model.RetentionFilterWithoutAttributes;
import java.util.Arrays;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    ApmRetentionFiltersApi apiInstance = new ApmRetentionFiltersApi(defaultClient);

    ReorderRetentionFiltersRequest body =
        new ReorderRetentionFiltersRequest()
            .data(
                Arrays.asList(
                    new RetentionFilterWithoutAttributes()
                        .id("jdZrilSJQLqzb6Cu7aub9Q")
                        .type(ApmRetentionFilterType.apm_retention_filter),
                    new RetentionFilterWithoutAttributes()
                        .id("7RBOb7dLSYWI01yc3pIH8w")
                        .type(ApmRetentionFilterType.apm_retention_filter)));

    try {
      apiInstance.reorderApmRetentionFilters(body);
    } catch (ApiException e) {
      System.err.println(
          "Exception when calling ApmRetentionFiltersApi#reorderApmRetentionFilters");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
"""
Re-order retention filters returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.apm_retention_filters_api import APMRetentionFiltersApi
from datadog_api_client.v2.model.apm_retention_filter_type import ApmRetentionFilterType
from datadog_api_client.v2.model.reorder_retention_filters_request import ReorderRetentionFiltersRequest
from datadog_api_client.v2.model.retention_filter_without_attributes import RetentionFilterWithoutAttributes

body = ReorderRetentionFiltersRequest(
    data=[
        RetentionFilterWithoutAttributes(
            id="jdZrilSJQLqzb6Cu7aub9Q",
            type=ApmRetentionFilterType.apm_retention_filter,
        ),
        RetentionFilterWithoutAttributes(
            id="7RBOb7dLSYWI01yc3pIH8w",
            type=ApmRetentionFilterType.apm_retention_filter,
        ),
    ],
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = APMRetentionFiltersApi(api_client)
    api_instance.reorder_apm_retention_filters(body=body)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
# Re-order retention filters returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::APMRetentionFiltersAPI.new

body = DatadogAPIClient::V2::ReorderRetentionFiltersRequest.new({
  data: [
    DatadogAPIClient::V2::RetentionFilterWithoutAttributes.new({
      id: "jdZrilSJQLqzb6Cu7aub9Q",
      type: DatadogAPIClient::V2::ApmRetentionFilterType::APM_RETENTION_FILTER,
    }),
    DatadogAPIClient::V2::RetentionFilterWithoutAttributes.new({
      id: "7RBOb7dLSYWI01yc3pIH8w",
      type: DatadogAPIClient::V2::ApmRetentionFilterType::APM_RETENTION_FILTER,
    }),
  ],
})
p api_instance.reorder_apm_retention_filters(body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
// Re-order retention filters returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_apm_retention_filters::APMRetentionFiltersAPI;
use datadog_api_client::datadogV2::model::ApmRetentionFilterType;
use datadog_api_client::datadogV2::model::ReorderRetentionFiltersRequest;
use datadog_api_client::datadogV2::model::RetentionFilterWithoutAttributes;

#[tokio::main]
async fn main() {
    let body = ReorderRetentionFiltersRequest::new(vec![
        RetentionFilterWithoutAttributes::new(
            "jdZrilSJQLqzb6Cu7aub9Q".to_string(),
            ApmRetentionFilterType::apm_retention_filter,
        ),
        RetentionFilterWithoutAttributes::new(
            "7RBOb7dLSYWI01yc3pIH8w".to_string(),
            ApmRetentionFilterType::apm_retention_filter,
        ),
    ]);
    let configuration = datadog::Configuration::new();
    let api = APMRetentionFiltersAPI::with_config(configuration);
    let resp = api.reorder_apm_retention_filters(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
/**
 * Re-order retention filters returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.APMRetentionFiltersApi(configuration);

const params: v2.APMRetentionFiltersApiReorderApmRetentionFiltersRequest = {
  body: {
    data: [
      {
        id: "jdZrilSJQLqzb6Cu7aub9Q",
        type: "apm_retention_filter",
      },
      {
        id: "7RBOb7dLSYWI01yc3pIH8w",
        type: "apm_retention_filter",
      },
    ],
  },
};

apiInstance
  .reorderApmRetentionFilters(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"