The AuthN Mappings API
is used to automatically map groups of users to roles in Datadog using attributes
sent from Identity Providers. Use these endpoints to manage your AuthN Mappings.
"""
Get an AuthN Mapping by UUID returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.authn_mappings_apiimportAuthNMappingsApi# there is a valid "authn_mapping" in the systemAUTHN_MAPPING_DATA_ID=environ["AUTHN_MAPPING_DATA_ID"]configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=AuthNMappingsApi(api_client)response=api_instance.get_authn_mapping(authn_mapping_id=AUTHN_MAPPING_DATA_ID,)print(response)
# Get an AuthN Mapping by UUID returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::AuthNMappingsAPI.new# there is a valid "authn_mapping" in the systemAUTHN_MAPPING_DATA_ID=ENV["AUTHN_MAPPING_DATA_ID"]papi_instance.get_authn_mapping(AUTHN_MAPPING_DATA_ID)
// Get an AuthN Mapping by UUID 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(){// there is a valid "authn_mapping" in the system
AuthnMappingDataID:=os.Getenv("AUTHN_MAPPING_DATA_ID")ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewAuthNMappingsApi(apiClient)resp,r,err:=api.GetAuthNMapping(ctx,AuthnMappingDataID)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `AuthNMappingsApi.GetAuthNMapping`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `AuthNMappingsApi.GetAuthNMapping`:\n%s\n",responseContent)}
// Get an AuthN Mapping by UUID returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.AuthNMappingsApi;importcom.datadog.api.client.v2.model.AuthNMappingResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();AuthNMappingsApiapiInstance=newAuthNMappingsApi(defaultClient);// there is a valid "authn_mapping" in the systemStringAUTHN_MAPPING_DATA_ID=System.getenv("AUTHN_MAPPING_DATA_ID");try{AuthNMappingResponseresult=apiInstance.getAuthNMapping(AUTHN_MAPPING_DATA_ID);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling AuthNMappingsApi#getAuthNMapping");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Get an AuthN Mapping by UUID returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_authn_mappings::AuthNMappingsAPI;#[tokio::main]asyncfnmain(){// there is a valid "authn_mapping" in the system
letauthn_mapping_data_id=std::env::var("AUTHN_MAPPING_DATA_ID").unwrap();letconfiguration=datadog::Configuration::new();letapi=AuthNMappingsAPI::with_config(configuration);letresp=api.get_authn_mapping(authn_mapping_data_id.clone()).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="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Get an AuthN Mapping by UUID returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.AuthNMappingsApi(configuration);// there is a valid "authn_mapping" in the system
constAUTHN_MAPPING_DATA_ID=process.env.AUTHN_MAPPING_DATA_IDasstring;constparams: v2.AuthNMappingsApiGetAuthNMappingRequest={authnMappingId: AUTHN_MAPPING_DATA_ID,};apiInstance.getAuthNMapping(params).then((data: v2.AuthNMappingResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
// Edit an AuthN Mapping 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(){// there is a valid "authn_mapping" in the system
AuthnMappingDataID:=os.Getenv("AUTHN_MAPPING_DATA_ID")// there is a valid "role" in the system
RoleDataID:=os.Getenv("ROLE_DATA_ID")body:=datadogV2.AuthNMappingUpdateRequest{Data:datadogV2.AuthNMappingUpdateData{Attributes:&datadogV2.AuthNMappingUpdateAttributes{AttributeKey:datadog.PtrString("member-of"),AttributeValue:datadog.PtrString("Development"),},Id:AuthnMappingDataID,Relationships:&datadogV2.AuthNMappingUpdateRelationships{AuthNMappingRelationshipToRole:&datadogV2.AuthNMappingRelationshipToRole{Role:datadogV2.RelationshipToRole{Data:&datadogV2.RelationshipToRoleData{Id:datadog.PtrString(RoleDataID),Type:datadogV2.ROLESTYPE_ROLES.Ptr(),},},}},Type:datadogV2.AUTHNMAPPINGSTYPE_AUTHN_MAPPINGS,},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewAuthNMappingsApi(apiClient)resp,r,err:=api.UpdateAuthNMapping(ctx,AuthnMappingDataID,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `AuthNMappingsApi.UpdateAuthNMapping`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `AuthNMappingsApi.UpdateAuthNMapping`:\n%s\n",responseContent)}
// Edit an AuthN Mapping returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.AuthNMappingsApi;importcom.datadog.api.client.v2.model.AuthNMappingRelationshipToRole;importcom.datadog.api.client.v2.model.AuthNMappingResponse;importcom.datadog.api.client.v2.model.AuthNMappingUpdateAttributes;importcom.datadog.api.client.v2.model.AuthNMappingUpdateData;importcom.datadog.api.client.v2.model.AuthNMappingUpdateRelationships;importcom.datadog.api.client.v2.model.AuthNMappingUpdateRequest;importcom.datadog.api.client.v2.model.AuthNMappingsType;importcom.datadog.api.client.v2.model.RelationshipToRole;importcom.datadog.api.client.v2.model.RelationshipToRoleData;importcom.datadog.api.client.v2.model.RolesType;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();AuthNMappingsApiapiInstance=newAuthNMappingsApi(defaultClient);// there is a valid "authn_mapping" in the systemStringAUTHN_MAPPING_DATA_ID=System.getenv("AUTHN_MAPPING_DATA_ID");// there is a valid "role" in the systemStringROLE_DATA_ID=System.getenv("ROLE_DATA_ID");AuthNMappingUpdateRequestbody=newAuthNMappingUpdateRequest().data(newAuthNMappingUpdateData().attributes(newAuthNMappingUpdateAttributes().attributeKey("member-of").attributeValue("Development")).id(AUTHN_MAPPING_DATA_ID).relationships(newAuthNMappingUpdateRelationships(newAuthNMappingRelationshipToRole().role(newRelationshipToRole().data(newRelationshipToRoleData().id(ROLE_DATA_ID).type(RolesType.ROLES))))).type(AuthNMappingsType.AUTHN_MAPPINGS));try{AuthNMappingResponseresult=apiInstance.updateAuthNMapping(AUTHN_MAPPING_DATA_ID,body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling AuthNMappingsApi#updateAuthNMapping");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Edit an AuthN Mapping returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.authn_mappings_apiimportAuthNMappingsApifromdatadog_api_client.v2.model.authn_mapping_relationship_to_roleimportAuthNMappingRelationshipToRolefromdatadog_api_client.v2.model.authn_mapping_update_attributesimportAuthNMappingUpdateAttributesfromdatadog_api_client.v2.model.authn_mapping_update_dataimportAuthNMappingUpdateDatafromdatadog_api_client.v2.model.authn_mapping_update_requestimportAuthNMappingUpdateRequestfromdatadog_api_client.v2.model.authn_mappings_typeimportAuthNMappingsTypefromdatadog_api_client.v2.model.relationship_to_roleimportRelationshipToRolefromdatadog_api_client.v2.model.relationship_to_role_dataimportRelationshipToRoleDatafromdatadog_api_client.v2.model.roles_typeimportRolesType# there is a valid "authn_mapping" in the systemAUTHN_MAPPING_DATA_ID=environ["AUTHN_MAPPING_DATA_ID"]# there is a valid "role" in the systemROLE_DATA_ID=environ["ROLE_DATA_ID"]body=AuthNMappingUpdateRequest(data=AuthNMappingUpdateData(attributes=AuthNMappingUpdateAttributes(attribute_key="member-of",attribute_value="Development",),id=AUTHN_MAPPING_DATA_ID,relationships=AuthNMappingRelationshipToRole(role=RelationshipToRole(data=RelationshipToRoleData(id=ROLE_DATA_ID,type=RolesType.ROLES,),),),type=AuthNMappingsType.AUTHN_MAPPINGS,),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=AuthNMappingsApi(api_client)response=api_instance.update_authn_mapping(authn_mapping_id=AUTHN_MAPPING_DATA_ID,body=body)print(response)
# Edit an AuthN Mapping returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::AuthNMappingsAPI.new# there is a valid "authn_mapping" in the systemAUTHN_MAPPING_DATA_ID=ENV["AUTHN_MAPPING_DATA_ID"]# there is a valid "role" in the systemROLE_DATA_ID=ENV["ROLE_DATA_ID"]body=DatadogAPIClient::V2::AuthNMappingUpdateRequest.new({data:DatadogAPIClient::V2::AuthNMappingUpdateData.new({attributes:DatadogAPIClient::V2::AuthNMappingUpdateAttributes.new({attribute_key:"member-of",attribute_value:"Development",}),id:AUTHN_MAPPING_DATA_ID,relationships:DatadogAPIClient::V2::AuthNMappingRelationshipToRole.new({role:DatadogAPIClient::V2::RelationshipToRole.new({data:DatadogAPIClient::V2::RelationshipToRoleData.new({id:ROLE_DATA_ID,type:DatadogAPIClient::V2::RolesType::ROLES,}),}),}),type:DatadogAPIClient::V2::AuthNMappingsType::AUTHN_MAPPINGS,}),})papi_instance.update_authn_mapping(AUTHN_MAPPING_DATA_ID,body)
// Edit an AuthN Mapping returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_authn_mappings::AuthNMappingsAPI;usedatadog_api_client::datadogV2::model::AuthNMappingRelationshipToRole;usedatadog_api_client::datadogV2::model::AuthNMappingUpdateAttributes;usedatadog_api_client::datadogV2::model::AuthNMappingUpdateData;usedatadog_api_client::datadogV2::model::AuthNMappingUpdateRelationships;usedatadog_api_client::datadogV2::model::AuthNMappingUpdateRequest;usedatadog_api_client::datadogV2::model::AuthNMappingsType;usedatadog_api_client::datadogV2::model::RelationshipToRole;usedatadog_api_client::datadogV2::model::RelationshipToRoleData;usedatadog_api_client::datadogV2::model::RolesType;#[tokio::main]asyncfnmain(){// there is a valid "authn_mapping" in the system
letauthn_mapping_data_id=std::env::var("AUTHN_MAPPING_DATA_ID").unwrap();// there is a valid "role" in the system
letrole_data_id=std::env::var("ROLE_DATA_ID").unwrap();letbody=AuthNMappingUpdateRequest::new(AuthNMappingUpdateData::new(authn_mapping_data_id.clone(),AuthNMappingsType::AUTHN_MAPPINGS,).attributes(AuthNMappingUpdateAttributes::new().attribute_key("member-of".to_string()).attribute_value("Development".to_string()),).relationships(AuthNMappingUpdateRelationships::AuthNMappingRelationshipToRole(Box::new(AuthNMappingRelationshipToRole::new(RelationshipToRole::new().data(RelationshipToRoleData::new().id(role_data_id.clone()).type_(RolesType::ROLES),),),)),),);letconfiguration=datadog::Configuration::new();letapi=AuthNMappingsAPI::with_config(configuration);letresp=api.update_authn_mapping(authn_mapping_data_id.clone(),body).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="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Edit an AuthN Mapping returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.AuthNMappingsApi(configuration);// there is a valid "authn_mapping" in the system
constAUTHN_MAPPING_DATA_ID=process.env.AUTHN_MAPPING_DATA_IDasstring;// there is a valid "role" in the system
constROLE_DATA_ID=process.env.ROLE_DATA_IDasstring;constparams: v2.AuthNMappingsApiUpdateAuthNMappingRequest={body:{data:{attributes:{attributeKey:"member-of",attributeValue:"Development",},id: AUTHN_MAPPING_DATA_ID,relationships:{role:{data:{id: ROLE_DATA_ID,type:"roles",},},},type:"authn_mappings",},},authnMappingId: AUTHN_MAPPING_DATA_ID,};apiInstance.updateAuthNMapping(params).then((data: v2.AuthNMappingResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
"""
Delete an AuthN Mapping returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.authn_mappings_apiimportAuthNMappingsApi# there is a valid "authn_mapping" in the systemAUTHN_MAPPING_DATA_ID=environ["AUTHN_MAPPING_DATA_ID"]configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=AuthNMappingsApi(api_client)api_instance.delete_authn_mapping(authn_mapping_id=AUTHN_MAPPING_DATA_ID,)
# Delete an AuthN Mapping returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::AuthNMappingsAPI.new# there is a valid "authn_mapping" in the systemAUTHN_MAPPING_DATA_ID=ENV["AUTHN_MAPPING_DATA_ID"]api_instance.delete_authn_mapping(AUTHN_MAPPING_DATA_ID)
// Delete an AuthN Mapping returns "OK" response
packagemainimport("context""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){// there is a valid "authn_mapping" in the system
AuthnMappingDataID:=os.Getenv("AUTHN_MAPPING_DATA_ID")ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewAuthNMappingsApi(apiClient)r,err:=api.DeleteAuthNMapping(ctx,AuthnMappingDataID)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `AuthNMappingsApi.DeleteAuthNMapping`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}}
// Delete an AuthN Mapping returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.AuthNMappingsApi;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();AuthNMappingsApiapiInstance=newAuthNMappingsApi(defaultClient);// there is a valid "authn_mapping" in the systemStringAUTHN_MAPPING_DATA_ID=System.getenv("AUTHN_MAPPING_DATA_ID");try{apiInstance.deleteAuthNMapping(AUTHN_MAPPING_DATA_ID);}catch(ApiExceptione){System.err.println("Exception when calling AuthNMappingsApi#deleteAuthNMapping");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Delete an AuthN Mapping returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_authn_mappings::AuthNMappingsAPI;#[tokio::main]asyncfnmain(){// there is a valid "authn_mapping" in the system
letauthn_mapping_data_id=std::env::var("AUTHN_MAPPING_DATA_ID").unwrap();letconfiguration=datadog::Configuration::new();letapi=AuthNMappingsAPI::with_config(configuration);letresp=api.delete_authn_mapping(authn_mapping_data_id.clone()).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="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Delete an AuthN Mapping returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.AuthNMappingsApi(configuration);// there is a valid "authn_mapping" in the system
constAUTHN_MAPPING_DATA_ID=process.env.AUTHN_MAPPING_DATA_IDasstring;constparams: v2.AuthNMappingsApiDeleteAuthNMappingRequest={authnMappingId: AUTHN_MAPPING_DATA_ID,};apiInstance.deleteAuthNMapping(params).then((data: any)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
"""
List all AuthN Mappings returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.authn_mappings_apiimportAuthNMappingsApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=AuthNMappingsApi(api_client)response=api_instance.list_authn_mappings()print(response)
# List all AuthN Mappings returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::AuthNMappingsAPI.newpapi_instance.list_authn_mappings()
// List all AuthN Mappings 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.NewAuthNMappingsApi(apiClient)resp,r,err:=api.ListAuthNMappings(ctx,*datadogV2.NewListAuthNMappingsOptionalParameters())iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `AuthNMappingsApi.ListAuthNMappings`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `AuthNMappingsApi.ListAuthNMappings`:\n%s\n",responseContent)}
// List all AuthN Mappings returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_authn_mappings::AuthNMappingsAPI;usedatadog_api_client::datadogV2::api_authn_mappings::ListAuthNMappingsOptionalParams;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=AuthNMappingsAPI::with_config(configuration);letresp=api.list_authn_mappings(ListAuthNMappingsOptionalParams::default()).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="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* List all AuthN Mappings returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.AuthNMappingsApi(configuration);apiInstance.listAuthNMappings().then((data: v2.AuthNMappingsResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
// Create an AuthN Mapping 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(){// there is a valid "role" in the system
RoleDataID:=os.Getenv("ROLE_DATA_ID")body:=datadogV2.AuthNMappingCreateRequest{Data:datadogV2.AuthNMappingCreateData{Attributes:&datadogV2.AuthNMappingCreateAttributes{AttributeKey:datadog.PtrString("exampleauthnmapping"),AttributeValue:datadog.PtrString("Example-AuthN-Mapping"),},Relationships:&datadogV2.AuthNMappingCreateRelationships{AuthNMappingRelationshipToRole:&datadogV2.AuthNMappingRelationshipToRole{Role:datadogV2.RelationshipToRole{Data:&datadogV2.RelationshipToRoleData{Id:datadog.PtrString(RoleDataID),Type:datadogV2.ROLESTYPE_ROLES.Ptr(),},},}},Type:datadogV2.AUTHNMAPPINGSTYPE_AUTHN_MAPPINGS,},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewAuthNMappingsApi(apiClient)resp,r,err:=api.CreateAuthNMapping(ctx,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `AuthNMappingsApi.CreateAuthNMapping`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `AuthNMappingsApi.CreateAuthNMapping`:\n%s\n",responseContent)}
// Create an AuthN Mapping returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.AuthNMappingsApi;importcom.datadog.api.client.v2.model.AuthNMappingCreateAttributes;importcom.datadog.api.client.v2.model.AuthNMappingCreateData;importcom.datadog.api.client.v2.model.AuthNMappingCreateRelationships;importcom.datadog.api.client.v2.model.AuthNMappingCreateRequest;importcom.datadog.api.client.v2.model.AuthNMappingRelationshipToRole;importcom.datadog.api.client.v2.model.AuthNMappingResponse;importcom.datadog.api.client.v2.model.AuthNMappingsType;importcom.datadog.api.client.v2.model.RelationshipToRole;importcom.datadog.api.client.v2.model.RelationshipToRoleData;importcom.datadog.api.client.v2.model.RolesType;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();AuthNMappingsApiapiInstance=newAuthNMappingsApi(defaultClient);// there is a valid "role" in the systemStringROLE_DATA_ID=System.getenv("ROLE_DATA_ID");AuthNMappingCreateRequestbody=newAuthNMappingCreateRequest().data(newAuthNMappingCreateData().attributes(newAuthNMappingCreateAttributes().attributeKey("exampleauthnmapping").attributeValue("Example-AuthN-Mapping")).relationships(newAuthNMappingCreateRelationships(newAuthNMappingRelationshipToRole().role(newRelationshipToRole().data(newRelationshipToRoleData().id(ROLE_DATA_ID).type(RolesType.ROLES))))).type(AuthNMappingsType.AUTHN_MAPPINGS));try{AuthNMappingResponseresult=apiInstance.createAuthNMapping(body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling AuthNMappingsApi#createAuthNMapping");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Create an AuthN Mapping returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.authn_mappings_apiimportAuthNMappingsApifromdatadog_api_client.v2.model.authn_mapping_create_attributesimportAuthNMappingCreateAttributesfromdatadog_api_client.v2.model.authn_mapping_create_dataimportAuthNMappingCreateDatafromdatadog_api_client.v2.model.authn_mapping_create_requestimportAuthNMappingCreateRequestfromdatadog_api_client.v2.model.authn_mapping_relationship_to_roleimportAuthNMappingRelationshipToRolefromdatadog_api_client.v2.model.authn_mappings_typeimportAuthNMappingsTypefromdatadog_api_client.v2.model.relationship_to_roleimportRelationshipToRolefromdatadog_api_client.v2.model.relationship_to_role_dataimportRelationshipToRoleDatafromdatadog_api_client.v2.model.roles_typeimportRolesType# there is a valid "role" in the systemROLE_DATA_ID=environ["ROLE_DATA_ID"]body=AuthNMappingCreateRequest(data=AuthNMappingCreateData(attributes=AuthNMappingCreateAttributes(attribute_key="exampleauthnmapping",attribute_value="Example-AuthN-Mapping",),relationships=AuthNMappingRelationshipToRole(role=RelationshipToRole(data=RelationshipToRoleData(id=ROLE_DATA_ID,type=RolesType.ROLES,),),),type=AuthNMappingsType.AUTHN_MAPPINGS,),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=AuthNMappingsApi(api_client)response=api_instance.create_authn_mapping(body=body)print(response)
# Create an AuthN Mapping returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::AuthNMappingsAPI.new# there is a valid "role" in the systemROLE_DATA_ID=ENV["ROLE_DATA_ID"]body=DatadogAPIClient::V2::AuthNMappingCreateRequest.new({data:DatadogAPIClient::V2::AuthNMappingCreateData.new({attributes:DatadogAPIClient::V2::AuthNMappingCreateAttributes.new({attribute_key:"exampleauthnmapping",attribute_value:"Example-AuthN-Mapping",}),relationships:DatadogAPIClient::V2::AuthNMappingRelationshipToRole.new({role:DatadogAPIClient::V2::RelationshipToRole.new({data:DatadogAPIClient::V2::RelationshipToRoleData.new({id:ROLE_DATA_ID,type:DatadogAPIClient::V2::RolesType::ROLES,}),}),}),type:DatadogAPIClient::V2::AuthNMappingsType::AUTHN_MAPPINGS,}),})papi_instance.create_authn_mapping(body)
// Create an AuthN Mapping returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_authn_mappings::AuthNMappingsAPI;usedatadog_api_client::datadogV2::model::AuthNMappingCreateAttributes;usedatadog_api_client::datadogV2::model::AuthNMappingCreateData;usedatadog_api_client::datadogV2::model::AuthNMappingCreateRelationships;usedatadog_api_client::datadogV2::model::AuthNMappingCreateRequest;usedatadog_api_client::datadogV2::model::AuthNMappingRelationshipToRole;usedatadog_api_client::datadogV2::model::AuthNMappingsType;usedatadog_api_client::datadogV2::model::RelationshipToRole;usedatadog_api_client::datadogV2::model::RelationshipToRoleData;usedatadog_api_client::datadogV2::model::RolesType;#[tokio::main]asyncfnmain(){// there is a valid "role" in the system
letrole_data_id=std::env::var("ROLE_DATA_ID").unwrap();letbody=AuthNMappingCreateRequest::new(AuthNMappingCreateData::new(AuthNMappingsType::AUTHN_MAPPINGS).attributes(AuthNMappingCreateAttributes::new().attribute_key("exampleauthnmapping".to_string()).attribute_value("Example-AuthN-Mapping".to_string()),).relationships(AuthNMappingCreateRelationships::AuthNMappingRelationshipToRole(Box::new(AuthNMappingRelationshipToRole::new(RelationshipToRole::new().data(RelationshipToRoleData::new().id(role_data_id.clone()).type_(RolesType::ROLES),),),)),),);letconfiguration=datadog::Configuration::new();letapi=AuthNMappingsAPI::with_config(configuration);letresp=api.create_authn_mapping(body).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="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Create an AuthN Mapping returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.AuthNMappingsApi(configuration);// there is a valid "role" in the system
constROLE_DATA_ID=process.env.ROLE_DATA_IDasstring;constparams: v2.AuthNMappingsApiCreateAuthNMappingRequest={body:{data:{attributes:{attributeKey:"exampleauthnmapping",attributeValue:"Example-AuthN-Mapping",},relationships:{role:{data:{id: ROLE_DATA_ID,type:"roles",},},},type:"authn_mappings",},},};apiInstance.createAuthNMapping(params).then((data: v2.AuthNMappingResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));