Object containing metadata about the private location.
restricted_roles
[string]
DEPRECATED: A list of role identifiers that can be pulled from the Roles API, for restricting read and write access. This field is deprecated. Use the restriction policies API to manage permissions.
name [required]
string
Name of the private location.
secrets
object
Secrets for the private location. Only present in the response when creating the private location.
Object that contains the new private location, the public key for result encryption, and the configuration skeleton.
Expand All
Field
Type
Description
config
object
Configuration skeleton for the private location. See installation instructions of the private location on how to use this configuration.
private_location
object
Object containing information about the private location to create.
description [required]
string
Description of the private location.
id
string
Unique identifier of the private location.
metadata
object
Object containing metadata about the private location.
restricted_roles
[string]
DEPRECATED: A list of role identifiers that can be pulled from the Roles API, for restricting read and write access. This field is deprecated. Use the restriction policies API to manage permissions.
name [required]
string
Name of the private location.
secrets
object
Secrets for the private location. Only present in the response when creating the private location.
authentication
object
Authentication part of the secrets.
id
string
Access key for the private location.
key
string
Secret access key for the private location.
config_decryption
object
Private key for the private location.
key
string
Private key for the private location.
tags [required]
[string]
Array of tags attached to the private location.
result_encryption
object
Public key for the result encryption.
id
string
Fingerprint for the encryption key.
key
string
Public key for result encryption.
{"config":{},"private_location":{"description":"Description of private location","id":"string","metadata":{"restricted_roles":["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"]},"name":"New private location","secrets":{"authentication":{"id":"string","key":"string"},"config_decryption":{"key":"string"}},"tags":["team:front"]},"result_encryption":{"id":"string","key":"string"}}
// Create a private location returns "OK" responsepackagemainimport("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")funcmain(){// there is a valid "role" in the systemRoleDataID:=os.Getenv("ROLE_DATA_ID")body:=datadogV1.SyntheticsPrivateLocation{Description:"Test Example-Synthetic description",Metadata:&datadogV1.SyntheticsPrivateLocationMetadata{RestrictedRoles:[]string{RoleDataID,},},Name:"Example-Synthetic",Tags:[]string{"test:examplesynthetic",},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewSyntheticsApi(apiClient)resp,r,err:=api.CreatePrivateLocation(ctx,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `SyntheticsApi.CreatePrivateLocation`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `SyntheticsApi.CreatePrivateLocation`:\n%s\n",responseContent)}
// Create a private location returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v1.api.SyntheticsApi;importcom.datadog.api.client.v1.model.SyntheticsPrivateLocation;importcom.datadog.api.client.v1.model.SyntheticsPrivateLocationCreationResponse;importcom.datadog.api.client.v1.model.SyntheticsPrivateLocationMetadata;importjava.util.Collections;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();SyntheticsApiapiInstance=newSyntheticsApi(defaultClient);// there is a valid "role" in the systemStringROLE_DATA_ID=System.getenv("ROLE_DATA_ID");SyntheticsPrivateLocationbody=newSyntheticsPrivateLocation().description("Test Example-Synthetic description").metadata(newSyntheticsPrivateLocationMetadata().restrictedRoles(Collections.singletonList(ROLE_DATA_ID))).name("Example-Synthetic").tags(Collections.singletonList("test:examplesynthetic"));try{SyntheticsPrivateLocationCreationResponseresult=apiInstance.createPrivateLocation(body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling SyntheticsApi#createPrivateLocation");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Create a private location returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.synthetics_apiimportSyntheticsApifromdatadog_api_client.v1.model.synthetics_private_locationimportSyntheticsPrivateLocationfromdatadog_api_client.v1.model.synthetics_private_location_metadataimportSyntheticsPrivateLocationMetadatafromdatadog_api_client.v1.model.synthetics_restricted_rolesimportSyntheticsRestrictedRoles# there is a valid "role" in the systemROLE_DATA_ID=environ["ROLE_DATA_ID"]body=SyntheticsPrivateLocation(description="Test Example-Synthetic description",metadata=SyntheticsPrivateLocationMetadata(restricted_roles=SyntheticsRestrictedRoles([ROLE_DATA_ID,]),),name="Example-Synthetic",tags=["test:examplesynthetic",],)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=SyntheticsApi(api_client)response=api_instance.create_private_location(body=body)print(response)
# Create a private location returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::SyntheticsAPI.new# there is a valid "role" in the systemROLE_DATA_ID=ENV["ROLE_DATA_ID"]body=DatadogAPIClient::V1::SyntheticsPrivateLocation.new({description:"Test Example-Synthetic description",metadata:DatadogAPIClient::V1::SyntheticsPrivateLocationMetadata.new({restricted_roles:[ROLE_DATA_ID,],}),name:"Example-Synthetic",tags:["test:examplesynthetic",],})papi_instance.create_private_location(body)
// Create a private location returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_synthetics::SyntheticsAPI;usedatadog_api_client::datadogV1::model::SyntheticsPrivateLocation;usedatadog_api_client::datadogV1::model::SyntheticsPrivateLocationMetadata;#[tokio::main]asyncfnmain(){// there is a valid "role" in the system
letrole_data_id=std::env::var("ROLE_DATA_ID").unwrap();letbody=SyntheticsPrivateLocation::new("Test Example-Synthetic description".to_string(),"Example-Synthetic".to_string(),vec!["test:examplesynthetic".to_string()],).metadata(SyntheticsPrivateLocationMetadata::new().restricted_roles(vec![role_data_id.clone()]),);letconfiguration=datadog::Configuration::new();letapi=SyntheticsAPI::with_config(configuration);letresp=api.create_private_location(body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Create a private location returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.SyntheticsApi(configuration);// there is a valid "role" in the system
constROLE_DATA_ID=process.env.ROLE_DATA_IDasstring;constparams: v1.SyntheticsApiCreatePrivateLocationRequest={body:{description:"Test Example-Synthetic description",metadata:{restrictedRoles:[ROLE_DATA_ID],},name:"Example-Synthetic",tags:["test:examplesynthetic"],},};apiInstance.createPrivateLocation(params).then((data: v1.SyntheticsPrivateLocationCreationResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));