The IP allowlist API is used to manage the IP addresses that
can access the Datadog API and web UI. It does not block
access to intake APIs or public dashboards.
This is an enterprise-only feature. Request access by
contacting Datadog support, or see the IP Allowlist page for more information.
"""
Get IP Allowlist returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.ip_allowlist_apiimportIPAllowlistApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=IPAllowlistApi(api_client)response=api_instance.get_ip_allowlist()print(response)
# Get IP Allowlist returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::IPAllowlistAPI.newpapi_instance.get_ip_allowlist()
// Get IP Allowlist returns "OK" response
packagemainimport("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")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewIPAllowlistApi(apiClient)resp,r,err:=api.GetIPAllowlist(ctx)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `IPAllowlistApi.GetIPAllowlist`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `IPAllowlistApi.GetIPAllowlist`:\n%s\n",responseContent)}
// Get IP Allowlist returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.IpAllowlistApi;importcom.datadog.api.client.v2.model.IPAllowlistResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();IpAllowlistApiapiInstance=newIpAllowlistApi(defaultClient);try{IPAllowlistResponseresult=apiInstance.getIPAllowlist();System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling IpAllowlistApi#getIPAllowlist");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Get IP Allowlist returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_ip_allowlist::IPAllowlistAPI;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=IPAllowlistAPI::with_config(configuration);letresp=api.get_ip_allowlist().await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Get IP Allowlist returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.IPAllowlistApi(configuration);apiInstance.getIPAllowlist().then((data: v2.IPAllowlistResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Update IP Allowlist returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.IPAllowlistApi(configuration);constparams: v2.IPAllowlistApiUpdateIPAllowlistRequest={body:{data:{attributes:{entries:[{data:{attributes:{note:"Example-IP-Allowlist",cidrBlock:"127.0.0.1",},type:"ip_allowlist_entry",},},],enabled: false,},type:"ip_allowlist",},},};apiInstance.updateIPAllowlist(params).then((data: v2.IPAllowlistResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));