"""
Revoke a personal access token returns "No Content" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.key_management_apiimportKeyManagementApi# there is a valid "personal_access_token" in the systemPERSONAL_ACCESS_TOKEN_DATA_ID=environ["PERSONAL_ACCESS_TOKEN_DATA_ID"]configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=KeyManagementApi(api_client)api_instance.revoke_personal_access_token(pat_id=PERSONAL_ACCESS_TOKEN_DATA_ID,)
# Revoke a personal access token returns "No Content" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::KeyManagementAPI.new# there is a valid "personal_access_token" in the systemPERSONAL_ACCESS_TOKEN_DATA_ID=ENV["PERSONAL_ACCESS_TOKEN_DATA_ID"]api_instance.revoke_personal_access_token(PERSONAL_ACCESS_TOKEN_DATA_ID)
// Revoke a personal access token returns "No Content" responsepackagemainimport("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 "personal_access_token" in the systemPersonalAccessTokenDataID:=os.Getenv("PERSONAL_ACCESS_TOKEN_DATA_ID")ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewKeyManagementApi(apiClient)r,err:=api.RevokePersonalAccessToken(ctx,PersonalAccessTokenDataID)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `KeyManagementApi.RevokePersonalAccessToken`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}}
// Revoke a personal access token returns "No Content" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.KeyManagementApi;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();KeyManagementApiapiInstance=newKeyManagementApi(defaultClient);// there is a valid "personal_access_token" in the systemStringPERSONAL_ACCESS_TOKEN_DATA_ID=System.getenv("PERSONAL_ACCESS_TOKEN_DATA_ID");try{apiInstance.revokePersonalAccessToken(PERSONAL_ACCESS_TOKEN_DATA_ID);}catch(ApiExceptione){System.err.println("Exception when calling KeyManagementApi#revokePersonalAccessToken");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Revoke a personal access token returns "No Content" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_key_management::KeyManagementAPI;#[tokio::main]asyncfnmain(){// there is a valid "personal_access_token" in the system
letpersonal_access_token_data_id=std::env::var("PERSONAL_ACCESS_TOKEN_DATA_ID").unwrap();letconfiguration=datadog::Configuration::new();letapi=KeyManagementAPI::with_config(configuration);letresp=api.revoke_personal_access_token(personal_access_token_data_id.clone()).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="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Revoke a personal access token returns "No Content" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.KeyManagementApi(configuration);// there is a valid "personal_access_token" in the system
constPERSONAL_ACCESS_TOKEN_DATA_ID=process.env.PERSONAL_ACCESS_TOKEN_DATA_IDasstring;constparams: v2.KeyManagementApiRevokePersonalAccessTokenRequest={patId: PERSONAL_ACCESS_TOKEN_DATA_ID,};apiInstance.revokePersonalAccessToken(params).then((data: any)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));