태그 인덱싱 규칙 예외 만들기
https://api.datadoghq.com/api/v2/metrics/{metric_name}/tag-indexing-rule-exemptionshttps://api.us3.datadoghq.com/api/v2/metrics/{metric_name}/tag-indexing-rule-exemptionshttps://api.us5.datadoghq.com/api/v2/metrics/{metric_name}/tag-indexing-rule-exemptionshttps://api.datadoghq.eu/api/v2/metrics/{metric_name}/tag-indexing-rule-exemptionshttps://api.ap1.datadoghq.com/api/v2/metrics/{metric_name}/tag-indexing-rule-exemptionshttps://api.ap2.datadoghq.com/api/v2/metrics/{metric_name}/tag-indexing-rule-exemptionshttps://api.uk1.datadoghq.com/api/v2/metrics/{metric_name}/tag-indexing-rule-exemptionshttps://api.ddog-gov.com/api/v2/metrics/{metric_name}/tag-indexing-rule-exemptionshttps://api.us2.ddog-gov.com/api/v2/metrics/{metric_name}/tag-indexing-rule-exemptions개요
모든 태그 인덱싱 규칙에서 메트릭을 제외합니다. 응답에는 생성된 예외 리소스가
포함됩니다. Manage Tags for Metrics 권한이 필요합니다.
OAuth apps require the metric_tags_write authorization scope to access this endpoint.
인수
경로 파라미터
metric_name [required]The name of the metric.
요청
Body Data (required)
data [required]태그 인덱싱 규칙 예외를 생성하기 위한 요청 본문입니다.
attributes [required]Attributes for creating a tag indexing rule exemption.
reason [required]The reason the metric is exempt from tag indexing rules.
type [required]The tag indexing rule exemption resource type.
tag_indexing_rule_exemptionstag_indexing_rule_exemptions{
"data": {
"attributes": {
"reason": "This metric has a pre-existing tag configuration."
},
"type": "tag_indexing_rule_exemptions"
}
}응답
Created
Response containing a tag indexing rule exemption.
dataA tag indexing rule exemption resource object.
attributesAttributes of a tag indexing rule exemption.
created_atTimestamp when the exemption was created.
created_by_handleHandle of the user who created the exemption.
estimated_change_in_volumeEstimated change in indexed cardinality or points if the exemption is removed and the matching tag indexing
rule applies to the metric. A negative value indicates a reduction in indexed volume, a positive value
indicates an increase, and zero indicates no change. A null value indicates that the estimate is unavailable.
kindDiscriminates between an explicit exemption (exemption) and a pre-existing legacy tag configuration acting as an implicit exclusion (legacy_tag_configuration).
missing_indexed_tagsTag keys used to query this metric in monitors, dashboards, notebooks, and SLOs that the matching rule would remove or not include if the exemption is removed.
reasonThe reason the metric is exempt from tag indexing rules.
volume_statusIndicates whether estimated_change_in_volume is available and, if not, why. ok indicates a fresh estimate.
unindexed_tags indicates that the matching rule uses tags that are not indexed for the metric.
unavailable indicates that the estimate is stale, was not computed, or could not be retrieved.
ok, unindexed_tags, unavailableidThe metric name, used as the resource ID.
typeThe tag indexing rule exemption resource type.
tag_indexing_rule_exemptionstag_indexing_rule_exemptions{
"data": {
"attributes": {
"created_at": "2024-01-15T12:00:00.000Z",
"created_by_handle": "user@datadoghq.com",
"estimated_change_in_volume": 45,
"kind": "exemption",
"missing_indexed_tags": [
"service"
],
"reason": "This metric has a pre-existing tag configuration.",
"volume_status": "unavailable"
},
"id": "dd.test.metric",
"type": "tag_indexing_rule_exemptions"
}
}Bad Request
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}Forbidden
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}Too Many Requests
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}코드 예시
# Path parameters
export metric_name="dist.http.endpoint.request"
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/metrics/${metric_name}/tag-indexing-rule-exemptions" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"reason": "This metric has a pre-existing tag configuration."
},
"type": "tag_indexing_rule_exemptions"
}
}
EOF# Path parameters
export metric_name="dist.http.endpoint.request"
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/metrics/${metric_name}/tag-indexing-rule-exemptions" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"reason": "This metric has a pre-existing tag configuration."
},
"type": "tag_indexing_rule_exemptions"
}
}
EOF# Path parameters
export metric_name="dist.http.endpoint.request"
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/metrics/${metric_name}/tag-indexing-rule-exemptions" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"reason": "This metric has a pre-existing tag configuration."
},
"type": "tag_indexing_rule_exemptions"
}
}
EOF# Path parameters
export metric_name="dist.http.endpoint.request"
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/metrics/${metric_name}/tag-indexing-rule-exemptions" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"reason": "This metric has a pre-existing tag configuration."
},
"type": "tag_indexing_rule_exemptions"
}
}
EOF# Path parameters
export metric_name="dist.http.endpoint.request"
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/metrics/${metric_name}/tag-indexing-rule-exemptions" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"reason": "This metric has a pre-existing tag configuration."
},
"type": "tag_indexing_rule_exemptions"
}
}
EOF# Path parameters
export metric_name="dist.http.endpoint.request"
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/metrics/${metric_name}/tag-indexing-rule-exemptions" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"reason": "This metric has a pre-existing tag configuration."
},
"type": "tag_indexing_rule_exemptions"
}
}
EOF# Path parameters
export metric_name="dist.http.endpoint.request"
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/metrics/${metric_name}/tag-indexing-rule-exemptions" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"reason": "This metric has a pre-existing tag configuration."
},
"type": "tag_indexing_rule_exemptions"
}
}
EOF# Path parameters
export metric_name="dist.http.endpoint.request"
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/metrics/${metric_name}/tag-indexing-rule-exemptions" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"reason": "This metric has a pre-existing tag configuration."
},
"type": "tag_indexing_rule_exemptions"
}
}
EOF# Path parameters
export metric_name="dist.http.endpoint.request"
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/metrics/${metric_name}/tag-indexing-rule-exemptions" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"reason": "This metric has a pre-existing tag configuration."
},
"type": "tag_indexing_rule_exemptions"
}
}
EOF// Create a tag indexing rule exemption returns "Created" response
package main
import (
"context"
"encoding/json"
"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.TagIndexingRuleExemptionCreateRequest{
Data: datadogV2.TagIndexingRuleExemptionCreateData{
Attributes: datadogV2.TagIndexingRuleExemptionCreateAttributes{
Reason: "This metric has a pre-existing tag configuration.",
},
Type: datadogV2.TAGINDEXINGRULEEXEMPTIONTYPE_TAG_INDEXING_RULE_EXEMPTIONS,
},
}
ctx := datadog.NewDefaultContext(context.Background())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
configuration.SetUnstableOperationEnabled("v2.CreateTagIndexingRuleExemption", true)
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewMetricsApi(apiClient)
resp, r, err := api.CreateTagIndexingRuleExemption(ctx, "metric_name", body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `MetricsApi.CreateTagIndexingRuleExemption`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `MetricsApi.CreateTagIndexingRuleExemption`:\n%s\n", responseContent)
}
Instructions
First install the library and its dependencies and then save the example to main.go and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"// Create a tag indexing rule exemption returns "Created" 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.TagIndexingRuleExemptionCreateAttributes;
import com.datadog.api.client.v2.model.TagIndexingRuleExemptionCreateData;
import com.datadog.api.client.v2.model.TagIndexingRuleExemptionCreateRequest;
import com.datadog.api.client.v2.model.TagIndexingRuleExemptionResponse;
import com.datadog.api.client.v2.model.TagIndexingRuleExemptionType;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
defaultClient.setUnstableOperationEnabled("v2.createTagIndexingRuleExemption", true);
MetricsApi apiInstance = new MetricsApi(defaultClient);
TagIndexingRuleExemptionCreateRequest body =
new TagIndexingRuleExemptionCreateRequest()
.data(
new TagIndexingRuleExemptionCreateData()
.attributes(
new TagIndexingRuleExemptionCreateAttributes()
.reason("This metric has a pre-existing tag configuration."))
.type(TagIndexingRuleExemptionType.TAG_INDEXING_RULE_EXEMPTIONS));
try {
TagIndexingRuleExemptionResponse result =
apiInstance.createTagIndexingRuleExemption("dist.http.endpoint.request", body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MetricsApi#createTagIndexingRuleExemption");
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.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java""""
Create a tag indexing rule exemption returns "Created" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.metrics_api import MetricsApi
from datadog_api_client.v2.model.tag_indexing_rule_exemption_create_attributes import (
TagIndexingRuleExemptionCreateAttributes,
)
from datadog_api_client.v2.model.tag_indexing_rule_exemption_create_data import TagIndexingRuleExemptionCreateData
from datadog_api_client.v2.model.tag_indexing_rule_exemption_create_request import TagIndexingRuleExemptionCreateRequest
from datadog_api_client.v2.model.tag_indexing_rule_exemption_type import TagIndexingRuleExemptionType
body = TagIndexingRuleExemptionCreateRequest(
data=TagIndexingRuleExemptionCreateData(
attributes=TagIndexingRuleExemptionCreateAttributes(
reason="This metric has a pre-existing tag configuration.",
),
type=TagIndexingRuleExemptionType.TAG_INDEXING_RULE_EXEMPTIONS,
),
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
configuration.unstable_operations["create_tag_indexing_rule_exemption"] = True
with ApiClient(configuration) as api_client:
api_instance = MetricsApi(api_client)
response = api_instance.create_tag_indexing_rule_exemption(metric_name="metric_name", body=body)
print(response)
Instructions
First install the library and its dependencies and then save the example to example.py and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"# Create a tag indexing rule exemption returns "Created" response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
config.unstable_operations["v2.create_tag_indexing_rule_exemption".to_sym] = true
end
api_instance = DatadogAPIClient::V2::MetricsAPI.new
body = DatadogAPIClient::V2::TagIndexingRuleExemptionCreateRequest.new({
data: DatadogAPIClient::V2::TagIndexingRuleExemptionCreateData.new({
attributes: DatadogAPIClient::V2::TagIndexingRuleExemptionCreateAttributes.new({
reason: "This metric has a pre-existing tag configuration.",
}),
type: DatadogAPIClient::V2::TagIndexingRuleExemptionType::TAG_INDEXING_RULE_EXEMPTIONS,
}),
})
p api_instance.create_tag_indexing_rule_exemption("metric_name", body)
Instructions
First install the library and its dependencies and then save the example to example.rb and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"// Create a tag indexing rule exemption returns "Created" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_metrics::MetricsAPI;
use datadog_api_client::datadogV2::model::TagIndexingRuleExemptionCreateAttributes;
use datadog_api_client::datadogV2::model::TagIndexingRuleExemptionCreateData;
use datadog_api_client::datadogV2::model::TagIndexingRuleExemptionCreateRequest;
use datadog_api_client::datadogV2::model::TagIndexingRuleExemptionType;
#[tokio::main]
async fn main() {
let body = TagIndexingRuleExemptionCreateRequest::new(TagIndexingRuleExemptionCreateData::new(
TagIndexingRuleExemptionCreateAttributes::new(
"This metric has a pre-existing tag configuration.".to_string(),
),
TagIndexingRuleExemptionType::TAG_INDEXING_RULE_EXEMPTIONS,
));
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.create_tag_indexing_rule_exemption", true);
let api = MetricsAPI::with_config(configuration);
let resp = api
.create_tag_indexing_rule_exemption("metric_name".to_string(), 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.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us3.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us5.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="datadoghq.eu" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ap1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ap2.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="uk1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run/**
* Create a tag indexing rule exemption returns "Created" response
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration({
authMethods: {
AuthZ: {
accessToken: process.env.DD_BEARER_TOKEN as string,
},
},
});
configuration.unstableOperations["v2.createTagIndexingRuleExemption"] = true;
const apiInstance = new v2.MetricsApi(configuration);
const params: v2.MetricsApiCreateTagIndexingRuleExemptionRequest = {
body: {
data: {
attributes: {
reason: "This metric has a pre-existing tag configuration.",
},
type: "tag_indexing_rule_exemptions",
},
},
metricName: "metric_name",
};
apiInstance
.createTagIndexingRuleExemption(params)
.then((data: v2.TagIndexingRuleExemptionResponse) => {
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.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"