Mettre à jour les filtres de host d'une intégration Azure
https://api.datadoghq.com/api/v1/integration/azure/host_filtershttps://api.us3.datadoghq.com/api/v1/integration/azure/host_filtershttps://api.us5.datadoghq.com/api/v1/integration/azure/host_filtershttps://api.datadoghq.eu/api/v1/integration/azure/host_filtershttps://api.ap1.datadoghq.com/api/v1/integration/azure/host_filtershttps://api.ap2.datadoghq.com/api/v1/integration/azure/host_filtershttps://api.uk1.datadoghq.com/api/v1/integration/azure/host_filtershttps://api.ddog-gov.com/api/v1/integration/azure/host_filtershttps://api.us2.ddog-gov.com/api/v1/integration/azure/host_filtersPrésentation
Mettez à jour la liste définie des filtres de host pour une intégration Datadog/Azure donnée.
Requête
Body Data (required)
Corps de requête pour la mise à jour des filtres de host d'une intégration Datadog/Azure.
app_service_plan_filtersIntégrations Datadog/Azure configurées pour votre organisation.
automuteSilence monitors for expected Azure VM shutdowns.
client_idYour Azure web application ID.
client_secretYour Azure web application secret key.
container_app_filtersLimit the Azure container apps that are pulled into Datadog using tags. Only container apps that match one of the defined tags are imported into Datadog.
cspm_enabledWhen enabled, Datadog’s Cloud Security Management product scans resource configurations monitored by this app registration. Note: This requires resource_collection_enabled to be set to true.
custom_metrics_enabledEnable custom metrics for your organization.
errorsErrors in your configuration.
host_filtersLimit the Azure instances that are pulled into Datadog by using tags. Only hosts that match one of the defined tags are imported into Datadog.
metrics_enabledEnable Azure metrics for your organization.
metrics_enabled_defaultEnable Azure metrics for your organization for resource providers where no resource provider config is specified.
new_client_idYour New Azure web application ID.
new_tenant_nameYour New Azure Active Directory ID.
resource_collection_enabledWhen enabled, Datadog collects metadata and configuration info from cloud resources (compute instances, databases, load balancers, etc.) monitored by this app registration.
resource_provider_configsConfiguration settings applied to resources from the specified Azure resource providers.
metrics_enabledCollect metrics for resources from this provider.
namespaceThe provider namespace to apply this configuration to.
secretless_auth_enabled(Preview) When enabled, Datadog authenticates with this app registration using federated workload identity credentials instead of a client secret.
tenant_nameYour Azure Active Directory ID.
usage_metrics_enabledEnable azure.usage metrics for your organization.
{
"app_service_plan_filters": "key:value,filter:example",
"automute": true,
"client_id": "testc7f6-1234-5678-9101-3fcbf464test",
"client_secret": "TestingRh2nx664kUy5dIApvM54T4AtO",
"container_app_filters": "key:value,filter:example",
"cspm_enabled": true,
"custom_metrics_enabled": true,
"errors": [
"*"
],
"host_filters": "key:value,filter:example",
"metrics_enabled": true,
"metrics_enabled_default": true,
"new_client_id": "new1c7f6-1234-5678-9101-3fcbf464test",
"new_tenant_name": "new1c44-1234-5678-9101-cc00736ftest",
"resource_collection_enabled": true,
"resource_provider_configs": [
{
"metrics_enabled": true,
"namespace": "Microsoft.Compute"
}
],
"secretless_auth_enabled": true,
"tenant_name": "testc44-1234-5678-9101-cc00736ftest",
"usage_metrics_enabled": true
}Réponse
OK
No response body
{}Bad Request
Error response object.
errors [required]Array of errors returned by the API.
{
"errors": [
"Bad Request"
]
}Authentication Error
Error response object.
errors [required]Array of errors returned by the API.
{
"errors": [
"Bad Request"
]
}Too many requests
Error response object.
errors [required]Array of errors returned by the API.
{
"errors": [
"Bad Request"
]
}Exemple de code
# 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/v1/integration/azure/host_filters" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"client_id": "testc7f6-1234-5678-9101-3fcbf464test",
"host_filters": "key:value,filter:example",
"tenant_name": "testc44-1234-5678-9101-cc00736ftest"
}
EOF# 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/v1/integration/azure/host_filters" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"client_id": "testc7f6-1234-5678-9101-3fcbf464test",
"host_filters": "key:value,filter:example",
"tenant_name": "testc44-1234-5678-9101-cc00736ftest"
}
EOF# 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/v1/integration/azure/host_filters" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"client_id": "testc7f6-1234-5678-9101-3fcbf464test",
"host_filters": "key:value,filter:example",
"tenant_name": "testc44-1234-5678-9101-cc00736ftest"
}
EOF# 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/v1/integration/azure/host_filters" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"client_id": "testc7f6-1234-5678-9101-3fcbf464test",
"host_filters": "key:value,filter:example",
"tenant_name": "testc44-1234-5678-9101-cc00736ftest"
}
EOF# 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/v1/integration/azure/host_filters" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"client_id": "testc7f6-1234-5678-9101-3fcbf464test",
"host_filters": "key:value,filter:example",
"tenant_name": "testc44-1234-5678-9101-cc00736ftest"
}
EOF# 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/v1/integration/azure/host_filters" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"client_id": "testc7f6-1234-5678-9101-3fcbf464test",
"host_filters": "key:value,filter:example",
"tenant_name": "testc44-1234-5678-9101-cc00736ftest"
}
EOF# 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/v1/integration/azure/host_filters" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"client_id": "testc7f6-1234-5678-9101-3fcbf464test",
"host_filters": "key:value,filter:example",
"tenant_name": "testc44-1234-5678-9101-cc00736ftest"
}
EOF# 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/v1/integration/azure/host_filters" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"client_id": "testc7f6-1234-5678-9101-3fcbf464test",
"host_filters": "key:value,filter:example",
"tenant_name": "testc44-1234-5678-9101-cc00736ftest"
}
EOF# 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/v1/integration/azure/host_filters" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"client_id": "testc7f6-1234-5678-9101-3fcbf464test",
"host_filters": "key:value,filter:example",
"tenant_name": "testc44-1234-5678-9101-cc00736ftest"
}
EOF// Update Azure integration host filters returns "OK" 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/datadogV1"
)
func main() {
body := datadogV1.AzureAccount{
AppServicePlanFilters: datadog.PtrString("key:value,filter:example"),
Automute: datadog.PtrBool(true),
ClientId: datadog.PtrString("testc7f6-1234-5678-9101-3fcbf464test"),
ClientSecret: datadog.PtrString("TestingRh2nx664kUy5dIApvM54T4AtO"),
ContainerAppFilters: datadog.PtrString("key:value,filter:example"),
CspmEnabled: datadog.PtrBool(true),
CustomMetricsEnabled: datadog.PtrBool(true),
Errors: []string{
"*",
},
HostFilters: datadog.PtrString("key:value,filter:example"),
MetricsEnabled: datadog.PtrBool(true),
MetricsEnabledDefault: datadog.PtrBool(true),
NewClientId: datadog.PtrString("new1c7f6-1234-5678-9101-3fcbf464test"),
NewTenantName: datadog.PtrString("new1c44-1234-5678-9101-cc00736ftest"),
ResourceCollectionEnabled: datadog.PtrBool(true),
ResourceProviderConfigs: []datadogV1.ResourceProviderConfig{
{
MetricsEnabled: datadog.PtrBool(true),
Namespace: datadog.PtrString("Microsoft.Compute"),
},
},
SecretlessAuthEnabled: datadog.PtrBool(true),
TenantName: datadog.PtrString("testc44-1234-5678-9101-cc00736ftest"),
UsageMetricsEnabled: datadog.PtrBool(true),
}
ctx := datadog.NewDefaultContext(context.Background())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV1.NewAzureIntegrationApi(apiClient)
resp, r, err := api.UpdateAzureHostFilters(ctx, body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `AzureIntegrationApi.UpdateAzureHostFilters`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `AzureIntegrationApi.UpdateAzureHostFilters`:\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"// Update Azure integration host filters returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.AzureIntegrationApi;
import com.datadog.api.client.v1.model.AzureAccount;
import com.datadog.api.client.v1.model.ResourceProviderConfig;
import java.util.Collections;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
AzureIntegrationApi apiInstance = new AzureIntegrationApi(defaultClient);
AzureAccount body =
new AzureAccount()
.appServicePlanFilters("key:value,filter:example")
.automute(true)
.clientId("testc7f6-1234-5678-9101-3fcbf464test")
.clientSecret("TestingRh2nx664kUy5dIApvM54T4AtO")
.containerAppFilters("key:value,filter:example")
.cspmEnabled(true)
.customMetricsEnabled(true)
.errors(Collections.singletonList("*"))
.hostFilters("key:value,filter:example")
.metricsEnabled(true)
.metricsEnabledDefault(true)
.newClientId("new1c7f6-1234-5678-9101-3fcbf464test")
.newTenantName("new1c44-1234-5678-9101-cc00736ftest")
.resourceCollectionEnabled(true)
.resourceProviderConfigs(
Collections.singletonList(
new ResourceProviderConfig()
.metricsEnabled(true)
.namespace("Microsoft.Compute")))
.secretlessAuthEnabled(true)
.tenantName("testc44-1234-5678-9101-cc00736ftest")
.usageMetricsEnabled(true);
try {
apiInstance.updateAzureHostFilters(body);
} catch (ApiException e) {
System.err.println("Exception when calling AzureIntegrationApi#updateAzureHostFilters");
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""""
Update Azure integration host filters returns "OK" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.azure_integration_api import AzureIntegrationApi
from datadog_api_client.v1.model.azure_account import AzureAccount
from datadog_api_client.v1.model.resource_provider_config import ResourceProviderConfig
body = AzureAccount(
app_service_plan_filters="key:value,filter:example",
automute=True,
client_id="testc7f6-1234-5678-9101-3fcbf464test",
client_secret="TestingRh2nx664kUy5dIApvM54T4AtO",
container_app_filters="key:value,filter:example",
cspm_enabled=True,
custom_metrics_enabled=True,
errors=[
"*",
],
host_filters="key:value,filter:example",
metrics_enabled=True,
metrics_enabled_default=True,
new_client_id="new1c7f6-1234-5678-9101-3fcbf464test",
new_tenant_name="new1c44-1234-5678-9101-cc00736ftest",
resource_collection_enabled=True,
resource_provider_configs=[
ResourceProviderConfig(
metrics_enabled=True,
namespace="Microsoft.Compute",
),
],
secretless_auth_enabled=True,
tenant_name="testc44-1234-5678-9101-cc00736ftest",
usage_metrics_enabled=True,
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
api_instance = AzureIntegrationApi(api_client)
response = api_instance.update_azure_host_filters(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"# Update Azure integration host filters returns "OK" response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V1::AzureIntegrationAPI.new
body = DatadogAPIClient::V1::AzureAccount.new({
app_service_plan_filters: "key:value,filter:example",
automute: true,
client_id: "testc7f6-1234-5678-9101-3fcbf464test",
client_secret: "TestingRh2nx664kUy5dIApvM54T4AtO",
container_app_filters: "key:value,filter:example",
cspm_enabled: true,
custom_metrics_enabled: true,
errors: [
"*",
],
host_filters: "key:value,filter:example",
metrics_enabled: true,
metrics_enabled_default: true,
new_client_id: "new1c7f6-1234-5678-9101-3fcbf464test",
new_tenant_name: "new1c44-1234-5678-9101-cc00736ftest",
resource_collection_enabled: true,
resource_provider_configs: [
DatadogAPIClient::V1::ResourceProviderConfig.new({
metrics_enabled: true,
namespace: "Microsoft.Compute",
}),
],
secretless_auth_enabled: true,
tenant_name: "testc44-1234-5678-9101-cc00736ftest",
usage_metrics_enabled: true,
})
p api_instance.update_azure_host_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.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"// Update Azure integration host filters returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_azure_integration::AzureIntegrationAPI;
use datadog_api_client::datadogV1::model::AzureAccount;
use datadog_api_client::datadogV1::model::ResourceProviderConfig;
#[tokio::main]
async fn main() {
let body = AzureAccount::new()
.app_service_plan_filters("key:value,filter:example".to_string())
.automute(true)
.client_id("testc7f6-1234-5678-9101-3fcbf464test".to_string())
.client_secret("TestingRh2nx664kUy5dIApvM54T4AtO".to_string())
.container_app_filters("key:value,filter:example".to_string())
.cspm_enabled(true)
.custom_metrics_enabled(true)
.errors(vec!["*".to_string()])
.host_filters("key:value,filter:example".to_string())
.metrics_enabled(true)
.metrics_enabled_default(true)
.new_client_id("new1c7f6-1234-5678-9101-3fcbf464test".to_string())
.new_tenant_name("new1c44-1234-5678-9101-cc00736ftest".to_string())
.resource_collection_enabled(true)
.resource_provider_configs(vec![ResourceProviderConfig::new()
.metrics_enabled(true)
.namespace("Microsoft.Compute".to_string())])
.secretless_auth_enabled(true)
.tenant_name("testc44-1234-5678-9101-cc00736ftest".to_string())
.usage_metrics_enabled(true);
let configuration = datadog::Configuration::new();
let api = AzureIntegrationAPI::with_config(configuration);
let resp = api.update_azure_host_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.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="us3.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="us5.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="datadoghq.eu" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="ap1.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="ap2.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="uk1.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="us2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run/**
* Update Azure integration host filters returns "OK" response
*/
import { client, v1 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration({
authMethods: {
AuthZ: {
accessToken: process.env.DD_BEARER_TOKEN as string,
},
},
});
const apiInstance = new v1.AzureIntegrationApi(configuration);
const params: v1.AzureIntegrationApiUpdateAzureHostFiltersRequest = {
body: {
appServicePlanFilters: "key:value,filter:example",
automute: true,
clientId: "testc7f6-1234-5678-9101-3fcbf464test",
clientSecret: "TestingRh2nx664kUy5dIApvM54T4AtO",
containerAppFilters: "key:value,filter:example",
cspmEnabled: true,
customMetricsEnabled: true,
errors: ["*"],
hostFilters: "key:value,filter:example",
metricsEnabled: true,
metricsEnabledDefault: true,
newClientId: "new1c7f6-1234-5678-9101-3fcbf464test",
newTenantName: "new1c44-1234-5678-9101-cc00736ftest",
resourceCollectionEnabled: true,
resourceProviderConfigs: [
{
metricsEnabled: true,
namespace: "Microsoft.Compute",
},
],
secretlessAuthEnabled: true,
tenantName: "testc44-1234-5678-9101-cc00736ftest",
usageMetricsEnabled: true,
},
};
apiInstance
.updateAzureHostFilters(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.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"from datadog import initialize, api
options = {
'api_key': '<DATADOG_API_KEY>',
'app_key': '<DATADOG_APPLICATION_KEY>'
}
initialize(**options)
api.AzureIntegration.update_host_filters(
tenant_name="<AZURE_TENANT_NAME>",
host_filters="new:filters",
client_id="<AZURE_CLIENT_ID>"
)
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_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python "example.py"DD_SITE="us3.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python "example.py"DD_SITE="us5.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python "example.py"DD_SITE="datadoghq.eu" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python "example.py"DD_SITE="ap1.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python "example.py"DD_SITE="ap2.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python "example.py"DD_SITE="uk1.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python "example.py"DD_SITE="ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python "example.py"DD_SITE="us2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python "example.py"require 'rubygems'
require 'dogapi'
api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'
config= {
"tenant_name": "<AZURE_TENANT_NAME>",
"client_id": "<AZURE_CLIENT_ID>",
"host_filters": "<NEW_KEY>:<NEW_VALUE>"
}
dog = Dogapi::Client.new(api_key, app_key)
dog.azure_integration_update_host_filters(config)
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_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"DD_SITE="us3.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"DD_SITE="us5.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"DD_SITE="datadoghq.eu" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"DD_SITE="ap1.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"DD_SITE="ap2.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"DD_SITE="uk1.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"DD_SITE="ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"DD_SITE="us2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"