Array of scopes to grant the application key. This feature is in private beta, please contact Datadog support to enable scopes for your application keys.
Array of scopes to grant the application key. This feature is in private beta, please contact Datadog support to enable scopes for your application keys.
{"data":{"attributes":{"created_at":"2020-11-23T10:00:00.000Z","key":"string","last4":"abcd","name":"Application Key for managing dashboards","scopes":["dashboards_read","dashboards_write","dashboards_public_share"]},"id":"string","relationships":{"owned_by":{"data":{"id":"00000000-0000-0000-2345-000000000000","type":"users"}}},"type":"application_keys"},"included":[{"attributes":{"created_at":"2019-09-19T10:00:00.000Z","disabled":false,"email":"string","handle":"string","icon":"string","modified_at":"2019-09-19T10:00:00.000Z","name":"string","service_account":false,"status":"string","title":"string","verified":false},"id":"string","relationships":{"org":{"data":{"id":"00000000-0000-beef-0000-000000000000","type":"orgs"}},"other_orgs":{"data":[{"id":"00000000-0000-beef-0000-000000000000","type":"orgs"}]},"other_users":{"data":[{"id":"00000000-0000-0000-2345-000000000000","type":"users"}]},"roles":{"data":[{"id":"3653d3c6-0c75-11ea-ad28-fb5701eabc7d","type":"roles"}]}},"type":"users"}]}
// Create an app key for this service account returns "Created" response
packagemainimport("context""encoding/json""fmt""os"datadog"github.com/DataDog/datadog-api-client-go/api/v2/datadog")funcmain(){// there is a valid "service_account_user" in the system
ServiceAccountUserDataID:=os.Getenv("SERVICE_ACCOUNT_USER_DATA_ID")body:=datadog.ApplicationKeyCreateRequest{Data:datadog.ApplicationKeyCreateData{Attributes:datadog.ApplicationKeyCreateAttributes{Name:"Example-Create_an_app_key_for_this_service_account_returns_Created_response",},Type:datadog.APPLICATIONKEYSTYPE_APPLICATION_KEYS,},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)resp,r,err:=apiClient.ServiceAccountsApi.CreateServiceAccountApplicationKey(ctx,ServiceAccountUserDataID,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `ServiceAccountsApi.CreateServiceAccountApplicationKey`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `ServiceAccountsApi.CreateServiceAccountApplicationKey`:\n%s\n",responseContent)}
// Create an application key with scopes for this service account returns "Created" response
packagemainimport("context""encoding/json""fmt""os"datadog"github.com/DataDog/datadog-api-client-go/api/v2/datadog")funcmain(){// there is a valid "service_account_user" in the system
ServiceAccountUserDataID:=os.Getenv("SERVICE_ACCOUNT_USER_DATA_ID")body:=datadog.ApplicationKeyCreateRequest{Data:datadog.ApplicationKeyCreateData{Attributes:datadog.ApplicationKeyCreateAttributes{Name:"Example-Create_an_application_key_with_scopes_for_this_service_account_returns_Created_response",Scopes:[]string{"dashboards_read","dashboards_write","dashboards_public_share",},},Type:datadog.APPLICATIONKEYSTYPE_APPLICATION_KEYS,},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)resp,r,err:=apiClient.ServiceAccountsApi.CreateServiceAccountApplicationKey(ctx,ServiceAccountUserDataID,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `ServiceAccountsApi.CreateServiceAccountApplicationKey`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `ServiceAccountsApi.CreateServiceAccountApplicationKey`:\n%s\n",responseContent)}
// Create an app key for this service account returns "Created" response
importcom.datadog.api.v2.client.ApiClient;importcom.datadog.api.v2.client.ApiException;importcom.datadog.api.v2.client.Configuration;importcom.datadog.api.v2.client.api.ServiceAccountsApi;importcom.datadog.api.v2.client.model.ApplicationKeyCreateAttributes;importcom.datadog.api.v2.client.model.ApplicationKeyCreateData;importcom.datadog.api.v2.client.model.ApplicationKeyCreateRequest;importcom.datadog.api.v2.client.model.ApplicationKeyResponse;importcom.datadog.api.v2.client.model.ApplicationKeysType;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=Configuration.getDefaultApiClient();ServiceAccountsApiapiInstance=newServiceAccountsApi(defaultClient);// there is a valid "service_account_user" in the system
StringSERVICE_ACCOUNT_USER_DATA_ID=System.getenv("SERVICE_ACCOUNT_USER_DATA_ID");ApplicationKeyCreateRequestbody=newApplicationKeyCreateRequest().data(newApplicationKeyCreateData().attributes(newApplicationKeyCreateAttributes().name("Example-Create_an_app_key_for_this_service_account_returns_Created_response")).type(ApplicationKeysType.APPLICATION_KEYS));try{ApplicationKeyResponseresult=apiInstance.createServiceAccountApplicationKey(SERVICE_ACCOUNT_USER_DATA_ID,body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling ServiceAccountsApi#createServiceAccountApplicationKey");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Create an application key with scopes for this service account returns "Created" response
importcom.datadog.api.v2.client.ApiClient;importcom.datadog.api.v2.client.ApiException;importcom.datadog.api.v2.client.Configuration;importcom.datadog.api.v2.client.api.ServiceAccountsApi;importcom.datadog.api.v2.client.model.ApplicationKeyCreateAttributes;importcom.datadog.api.v2.client.model.ApplicationKeyCreateData;importcom.datadog.api.v2.client.model.ApplicationKeyCreateRequest;importcom.datadog.api.v2.client.model.ApplicationKeyResponse;importcom.datadog.api.v2.client.model.ApplicationKeysType;importjava.util.Arrays;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=Configuration.getDefaultApiClient();ServiceAccountsApiapiInstance=newServiceAccountsApi(defaultClient);// there is a valid "service_account_user" in the system
StringSERVICE_ACCOUNT_USER_DATA_ID=System.getenv("SERVICE_ACCOUNT_USER_DATA_ID");ApplicationKeyCreateRequestbody=newApplicationKeyCreateRequest().data(newApplicationKeyCreateData().attributes(newApplicationKeyCreateAttributes().name("Example-Create_an_application_key_with_scopes_for_this_service_account_returns_Created_response").scopes(Arrays.asList("dashboards_read","dashboards_write","dashboards_public_share"))).type(ApplicationKeysType.APPLICATION_KEYS));try{ApplicationKeyResponseresult=apiInstance.createServiceAccountApplicationKey(SERVICE_ACCOUNT_USER_DATA_ID,body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling ServiceAccountsApi#createServiceAccountApplicationKey");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Create an app key for this service account returns "Created" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.service_accounts_apiimportServiceAccountsApifromdatadog_api_client.v2.model.application_key_create_attributesimportApplicationKeyCreateAttributesfromdatadog_api_client.v2.model.application_key_create_dataimportApplicationKeyCreateDatafromdatadog_api_client.v2.model.application_key_create_requestimportApplicationKeyCreateRequestfromdatadog_api_client.v2.model.application_keys_typeimportApplicationKeysType# there is a valid "service_account_user" in the systemSERVICE_ACCOUNT_USER_DATA_ID=environ["SERVICE_ACCOUNT_USER_DATA_ID"]body=ApplicationKeyCreateRequest(data=ApplicationKeyCreateData(attributes=ApplicationKeyCreateAttributes(name="Example-Create_an_app_key_for_this_service_account_returns_Created_response",),type=ApplicationKeysType("application_keys"),),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=ServiceAccountsApi(api_client)response=api_instance.create_service_account_application_key(service_account_id=SERVICE_ACCOUNT_USER_DATA_ID,body=body)print(response)
"""
Create an application key with scopes for this service account returns "Created" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.service_accounts_apiimportServiceAccountsApifromdatadog_api_client.v2.model.application_key_create_attributesimportApplicationKeyCreateAttributesfromdatadog_api_client.v2.model.application_key_create_dataimportApplicationKeyCreateDatafromdatadog_api_client.v2.model.application_key_create_requestimportApplicationKeyCreateRequestfromdatadog_api_client.v2.model.application_keys_typeimportApplicationKeysType# there is a valid "service_account_user" in the systemSERVICE_ACCOUNT_USER_DATA_ID=environ["SERVICE_ACCOUNT_USER_DATA_ID"]body=ApplicationKeyCreateRequest(data=ApplicationKeyCreateData(attributes=ApplicationKeyCreateAttributes(name="Example-Create_an_application_key_with_scopes_for_this_service_account_returns_Created_response",scopes=["dashboards_read","dashboards_write","dashboards_public_share",],),type=ApplicationKeysType("application_keys"),),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=ServiceAccountsApi(api_client)response=api_instance.create_service_account_application_key(service_account_id=SERVICE_ACCOUNT_USER_DATA_ID,body=body)print(response)
# Create an app key for this service account returns "Created" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::ServiceAccountsAPI.new# there is a valid "service_account_user" in the systemSERVICE_ACCOUNT_USER_DATA_ID=ENV["SERVICE_ACCOUNT_USER_DATA_ID"]body=DatadogAPIClient::V2::ApplicationKeyCreateRequest.new({data:DatadogAPIClient::V2::ApplicationKeyCreateData.new({attributes:DatadogAPIClient::V2::ApplicationKeyCreateAttributes.new({name:"Example-Create_an_app_key_for_this_service_account_returns_Created_response",}),type:DatadogAPIClient::V2::ApplicationKeysType::APPLICATION_KEYS,}),})papi_instance.create_service_account_application_key(SERVICE_ACCOUNT_USER_DATA_ID,body)
# Create an application key with scopes for this service account returns "Created" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::ServiceAccountsAPI.new# there is a valid "service_account_user" in the systemSERVICE_ACCOUNT_USER_DATA_ID=ENV["SERVICE_ACCOUNT_USER_DATA_ID"]body=DatadogAPIClient::V2::ApplicationKeyCreateRequest.new({data:DatadogAPIClient::V2::ApplicationKeyCreateData.new({attributes:DatadogAPIClient::V2::ApplicationKeyCreateAttributes.new({name:"Example-Create_an_application_key_with_scopes_for_this_service_account_returns_Created_response",scopes:["dashboards_read","dashboards_write","dashboards_public_share",],}),type:DatadogAPIClient::V2::ApplicationKeysType::APPLICATION_KEYS,}),})papi_instance.create_service_account_application_key(SERVICE_ACCOUNT_USER_DATA_ID,body)
/**
* Create an app key for this service account returns "Created" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.ServiceAccountsApi(configuration);// there is a valid "service_account_user" in the system
constSERVICE_ACCOUNT_USER_DATA_ID=process.env.SERVICE_ACCOUNT_USER_DATA_IDasstring;constparams: v2.ServiceAccountsApiCreateServiceAccountApplicationKeyRequest={body:{data:{attributes:{name:"Example-Create_an_app_key_for_this_service_account_returns_Created_response",},type:"application_keys",},},serviceAccountId: SERVICE_ACCOUNT_USER_DATA_ID,};apiInstance.createServiceAccountApplicationKey(params).then((data: v2.ApplicationKeyResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
/**
* Create an application key with scopes for this service account returns "Created" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.ServiceAccountsApi(configuration);// there is a valid "service_account_user" in the system
constSERVICE_ACCOUNT_USER_DATA_ID=process.env.SERVICE_ACCOUNT_USER_DATA_IDasstring;constparams: v2.ServiceAccountsApiCreateServiceAccountApplicationKeyRequest={body:{data:{attributes:{name:"Example-Create_an_application_key_with_scopes_for_this_service_account_returns_Created_response",scopes:["dashboards_read","dashboards_write","dashboards_public_share",],},type:"application_keys",},},serviceAccountId: SERVICE_ACCOUNT_USER_DATA_ID,};apiInstance.createServiceAccountApplicationKey(params).then((data: v2.ApplicationKeyResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
List all application keys available for this service account.
引数
パスパラメーター
名前
種類
説明
service_account_id [required]
string
The ID of the service account.
クエリ文字列
名前
種類
説明
page[size]
integer
Size for a given page.
page[number]
integer
Specific page number to return.
sort
enum
Application key attribute used to sort results. Sort order is ascending
by default. In order to specify a descending sort, prefix the
attribute with a minus sign. Allowed enum values: created_at, -created_at, last4, -last4, name, -name
filter
string
Filter application keys by the specified string.
filter[created_at][start]
string
Only include application keys created on or after the specified date.
filter[created_at][end]
string
Only include application keys created on or before the specified date.
Array of scopes to grant the application key. This feature is in private beta, please contact Datadog support to enable scopes for your application keys.
{"data":[{"attributes":{"created_at":"2020-11-23T10:00:00.000Z","last4":"abcd","name":"Application Key for managing dashboards","scopes":["dashboards_read","dashboards_write","dashboards_public_share"]},"id":"string","relationships":{"owned_by":{"data":{"id":"00000000-0000-0000-2345-000000000000","type":"users"}}},"type":"application_keys"}],"included":[{"attributes":{"created_at":"2019-09-19T10:00:00.000Z","disabled":false,"email":"string","handle":"string","icon":"string","modified_at":"2019-09-19T10:00:00.000Z","name":"string","service_account":false,"status":"string","title":"string","verified":false},"id":"string","relationships":{"org":{"data":{"id":"00000000-0000-beef-0000-000000000000","type":"orgs"}},"other_orgs":{"data":[{"id":"00000000-0000-beef-0000-000000000000","type":"orgs"}]},"other_users":{"data":[{"id":"00000000-0000-0000-2345-000000000000","type":"users"}]},"roles":{"data":[{"id":"3653d3c6-0c75-11ea-ad28-fb5701eabc7d","type":"roles"}]}},"type":"users"}]}
// Get all app keys owned by this service account returns "OK" response
packagemainimport("context""encoding/json""fmt""os"datadog"github.com/DataDog/datadog-api-client-go/api/v2/datadog")funcmain(){// there is a valid "service_account_user" in the system
ServiceAccountUserDataID:=os.Getenv("SERVICE_ACCOUNT_USER_DATA_ID")ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)resp,r,err:=apiClient.ServiceAccountsApi.ListServiceAccountApplicationKeys(ctx,ServiceAccountUserDataID,*datadog.NewListServiceAccountApplicationKeysOptionalParameters())iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `ServiceAccountsApi.ListServiceAccountApplicationKeys`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `ServiceAccountsApi.ListServiceAccountApplicationKeys`:\n%s\n",responseContent)}
// Get all app keys owned by this service account returns "OK" response
importcom.datadog.api.v2.client.ApiClient;importcom.datadog.api.v2.client.ApiException;importcom.datadog.api.v2.client.Configuration;importcom.datadog.api.v2.client.api.ServiceAccountsApi;importcom.datadog.api.v2.client.model.ListApplicationKeysResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=Configuration.getDefaultApiClient();ServiceAccountsApiapiInstance=newServiceAccountsApi(defaultClient);// there is a valid "service_account_user" in the system
StringSERVICE_ACCOUNT_USER_DATA_ID=System.getenv("SERVICE_ACCOUNT_USER_DATA_ID");try{ListApplicationKeysResponseresult=apiInstance.listServiceAccountApplicationKeys(SERVICE_ACCOUNT_USER_DATA_ID);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling ServiceAccountsApi#listServiceAccountApplicationKeys");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Get all app keys owned by this service account returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.service_accounts_apiimportServiceAccountsApi# there is a valid "service_account_user" in the systemSERVICE_ACCOUNT_USER_DATA_ID=environ["SERVICE_ACCOUNT_USER_DATA_ID"]configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=ServiceAccountsApi(api_client)response=api_instance.list_service_account_application_keys(service_account_id=SERVICE_ACCOUNT_USER_DATA_ID,)print(response)
# Get all app keys owned by this service account returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::ServiceAccountsAPI.new# there is a valid "service_account_user" in the systemSERVICE_ACCOUNT_USER_DATA_ID=ENV["SERVICE_ACCOUNT_USER_DATA_ID"]papi_instance.list_service_account_application_keys(SERVICE_ACCOUNT_USER_DATA_ID)
/**
* Get all app keys owned by this service account returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.ServiceAccountsApi(configuration);// there is a valid "service_account_user" in the system
constSERVICE_ACCOUNT_USER_DATA_ID=process.env.SERVICE_ACCOUNT_USER_DATA_IDasstring;constparams: v2.ServiceAccountsApiListServiceAccountApplicationKeysRequest={serviceAccountId: SERVICE_ACCOUNT_USER_DATA_ID,};apiInstance.listServiceAccountApplicationKeys(params).then((data: v2.ListApplicationKeysResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
Response for retrieving a partial application key.
Expand All
フィールド
種類
説明
data
object
Partial Datadog application key.
attributes
object
Attributes of a partial application key.
created_at
string
Creation date of the application key.
last4
string
The last four characters of the application key.
name
string
Name of the application key.
scopes
[string]
Array of scopes to grant the application key. This feature is in private beta, please contact Datadog support to enable scopes for your application keys.
{"data":{"attributes":{"created_at":"2020-11-23T10:00:00.000Z","last4":"abcd","name":"Application Key for managing dashboards","scopes":["dashboards_read","dashboards_write","dashboards_public_share"]},"id":"string","relationships":{"owned_by":{"data":{"id":"00000000-0000-0000-2345-000000000000","type":"users"}}},"type":"application_keys"},"included":[{"attributes":{"created_at":"2019-09-19T10:00:00.000Z","disabled":false,"email":"string","handle":"string","icon":"string","modified_at":"2019-09-19T10:00:00.000Z","name":"string","service_account":false,"status":"string","title":"string","verified":false},"id":"string","relationships":{"org":{"data":{"id":"00000000-0000-beef-0000-000000000000","type":"orgs"}},"other_orgs":{"data":[{"id":"00000000-0000-beef-0000-000000000000","type":"orgs"}]},"other_users":{"data":[{"id":"00000000-0000-0000-2345-000000000000","type":"users"}]},"roles":{"data":[{"id":"3653d3c6-0c75-11ea-ad28-fb5701eabc7d","type":"roles"}]}},"type":"users"}]}
// Get one app key owned by this service account returns "OK" response
packagemainimport("context""encoding/json""fmt""os"datadog"github.com/DataDog/datadog-api-client-go/api/v2/datadog")funcmain(){// there is a valid "service_account_user" in the system
ServiceAccountUserDataID:=os.Getenv("SERVICE_ACCOUNT_USER_DATA_ID")// there is a valid "service_account_application_key" for "service_account_user"
ServiceAccountApplicationKeyDataID:=os.Getenv("SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID")ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)resp,r,err:=apiClient.ServiceAccountsApi.GetServiceAccountApplicationKey(ctx,ServiceAccountUserDataID,ServiceAccountApplicationKeyDataID)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `ServiceAccountsApi.GetServiceAccountApplicationKey`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `ServiceAccountsApi.GetServiceAccountApplicationKey`:\n%s\n",responseContent)}
// Get one app key owned by this service account returns "OK" response
importcom.datadog.api.v2.client.ApiClient;importcom.datadog.api.v2.client.ApiException;importcom.datadog.api.v2.client.Configuration;importcom.datadog.api.v2.client.api.ServiceAccountsApi;importcom.datadog.api.v2.client.model.PartialApplicationKeyResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=Configuration.getDefaultApiClient();ServiceAccountsApiapiInstance=newServiceAccountsApi(defaultClient);// there is a valid "service_account_user" in the system
StringSERVICE_ACCOUNT_USER_DATA_ID=System.getenv("SERVICE_ACCOUNT_USER_DATA_ID");// there is a valid "service_account_application_key" for "service_account_user"
StringSERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID=System.getenv("SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID");try{PartialApplicationKeyResponseresult=apiInstance.getServiceAccountApplicationKey(SERVICE_ACCOUNT_USER_DATA_ID,SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling ServiceAccountsApi#getServiceAccountApplicationKey");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Get one app key owned by this service account returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.service_accounts_apiimportServiceAccountsApi# there is a valid "service_account_user" in the systemSERVICE_ACCOUNT_USER_DATA_ID=environ["SERVICE_ACCOUNT_USER_DATA_ID"]# there is a valid "service_account_application_key" for "service_account_user"SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID=environ["SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID"]configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=ServiceAccountsApi(api_client)response=api_instance.get_service_account_application_key(service_account_id=SERVICE_ACCOUNT_USER_DATA_ID,app_key_id=SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID,)print(response)
# Get one app key owned by this service account returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::ServiceAccountsAPI.new# there is a valid "service_account_user" in the systemSERVICE_ACCOUNT_USER_DATA_ID=ENV["SERVICE_ACCOUNT_USER_DATA_ID"]# there is a valid "service_account_application_key" for "service_account_user"SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID=ENV["SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID"]papi_instance.get_service_account_application_key(SERVICE_ACCOUNT_USER_DATA_ID,SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID)
/**
* Get one app key owned by this service account returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.ServiceAccountsApi(configuration);// there is a valid "service_account_user" in the system
constSERVICE_ACCOUNT_USER_DATA_ID=process.env.SERVICE_ACCOUNT_USER_DATA_IDasstring;// there is a valid "service_account_application_key" for "service_account_user"
constSERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID=process.env.SERVICE_ACCOUNT_APPLICATION_KEY_DATA_IDasstring;constparams: v2.ServiceAccountsApiGetServiceAccountApplicationKeyRequest={serviceAccountId: SERVICE_ACCOUNT_USER_DATA_ID,appKeyId: SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID,};apiInstance.getServiceAccountApplicationKey(params).then((data: v2.PartialApplicationKeyResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
Array of scopes to grant the application key. This feature is in private beta, please contact Datadog support to enable scopes for your application keys.
{"data":{"id":"67963b57-d67c-dfa7-b180-62ee9301d2f6","type":"application_keys","attributes":{"name":"Application Key for managing dashboards-updated"}}}
Response for retrieving a partial application key.
Expand All
フィールド
種類
説明
data
object
Partial Datadog application key.
attributes
object
Attributes of a partial application key.
created_at
string
Creation date of the application key.
last4
string
The last four characters of the application key.
name
string
Name of the application key.
scopes
[string]
Array of scopes to grant the application key. This feature is in private beta, please contact Datadog support to enable scopes for your application keys.
{"data":{"attributes":{"created_at":"2020-11-23T10:00:00.000Z","last4":"abcd","name":"Application Key for managing dashboards","scopes":["dashboards_read","dashboards_write","dashboards_public_share"]},"id":"string","relationships":{"owned_by":{"data":{"id":"00000000-0000-0000-2345-000000000000","type":"users"}}},"type":"application_keys"},"included":[{"attributes":{"created_at":"2019-09-19T10:00:00.000Z","disabled":false,"email":"string","handle":"string","icon":"string","modified_at":"2019-09-19T10:00:00.000Z","name":"string","service_account":false,"status":"string","title":"string","verified":false},"id":"string","relationships":{"org":{"data":{"id":"00000000-0000-beef-0000-000000000000","type":"orgs"}},"other_orgs":{"data":[{"id":"00000000-0000-beef-0000-000000000000","type":"orgs"}]},"other_users":{"data":[{"id":"00000000-0000-0000-2345-000000000000","type":"users"}]},"roles":{"data":[{"id":"3653d3c6-0c75-11ea-ad28-fb5701eabc7d","type":"roles"}]}},"type":"users"}]}
// Edit an app key owned by this service account returns "OK" response
packagemainimport("context""encoding/json""fmt""os"datadog"github.com/DataDog/datadog-api-client-go/api/v2/datadog")funcmain(){// there is a valid "service_account_user" in the system
ServiceAccountUserDataID:=os.Getenv("SERVICE_ACCOUNT_USER_DATA_ID")// there is a valid "service_account_application_key" for "service_account_user"
ServiceAccountApplicationKeyDataID:=os.Getenv("SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID")body:=datadog.ApplicationKeyUpdateRequest{Data:datadog.ApplicationKeyUpdateData{Id:ServiceAccountApplicationKeyDataID,Type:datadog.APPLICATIONKEYSTYPE_APPLICATION_KEYS,Attributes:datadog.ApplicationKeyUpdateAttributes{Name:datadog.PtrString("Application Key for managing dashboards-updated"),},},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)resp,r,err:=apiClient.ServiceAccountsApi.UpdateServiceAccountApplicationKey(ctx,ServiceAccountUserDataID,ServiceAccountApplicationKeyDataID,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `ServiceAccountsApi.UpdateServiceAccountApplicationKey`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `ServiceAccountsApi.UpdateServiceAccountApplicationKey`:\n%s\n",responseContent)}
// Edit an app key owned by this service account returns "OK" response
importcom.datadog.api.v2.client.ApiClient;importcom.datadog.api.v2.client.ApiException;importcom.datadog.api.v2.client.Configuration;importcom.datadog.api.v2.client.api.ServiceAccountsApi;importcom.datadog.api.v2.client.model.ApplicationKeyUpdateAttributes;importcom.datadog.api.v2.client.model.ApplicationKeyUpdateData;importcom.datadog.api.v2.client.model.ApplicationKeyUpdateRequest;importcom.datadog.api.v2.client.model.ApplicationKeysType;importcom.datadog.api.v2.client.model.PartialApplicationKeyResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=Configuration.getDefaultApiClient();ServiceAccountsApiapiInstance=newServiceAccountsApi(defaultClient);// there is a valid "service_account_user" in the system
StringSERVICE_ACCOUNT_USER_DATA_ID=System.getenv("SERVICE_ACCOUNT_USER_DATA_ID");// there is a valid "service_account_application_key" for "service_account_user"
StringSERVICE_ACCOUNT_APPLICATION_KEY_DATA_ATTRIBUTES_NAME=System.getenv("SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ATTRIBUTES_NAME");StringSERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID=System.getenv("SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID");ApplicationKeyUpdateRequestbody=newApplicationKeyUpdateRequest().data(newApplicationKeyUpdateData().id(SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID).type(ApplicationKeysType.APPLICATION_KEYS).attributes(newApplicationKeyUpdateAttributes().name("Application Key for managing dashboards-updated")));try{PartialApplicationKeyResponseresult=apiInstance.updateServiceAccountApplicationKey(SERVICE_ACCOUNT_USER_DATA_ID,SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID,body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling ServiceAccountsApi#updateServiceAccountApplicationKey");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Edit an app key owned by this service account returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.service_accounts_apiimportServiceAccountsApifromdatadog_api_client.v2.model.application_key_update_attributesimportApplicationKeyUpdateAttributesfromdatadog_api_client.v2.model.application_key_update_dataimportApplicationKeyUpdateDatafromdatadog_api_client.v2.model.application_key_update_requestimportApplicationKeyUpdateRequestfromdatadog_api_client.v2.model.application_keys_typeimportApplicationKeysType# there is a valid "service_account_user" in the systemSERVICE_ACCOUNT_USER_DATA_ID=environ["SERVICE_ACCOUNT_USER_DATA_ID"]# there is a valid "service_account_application_key" for "service_account_user"SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ATTRIBUTES_NAME=environ["SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ATTRIBUTES_NAME"]SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID=environ["SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID"]body=ApplicationKeyUpdateRequest(data=ApplicationKeyUpdateData(id=SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID,type=ApplicationKeysType("application_keys"),attributes=ApplicationKeyUpdateAttributes(name="Application Key for managing dashboards-updated",),),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=ServiceAccountsApi(api_client)response=api_instance.update_service_account_application_key(service_account_id=SERVICE_ACCOUNT_USER_DATA_ID,app_key_id=SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID,body=body)print(response)
# Edit an app key owned by this service account returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::ServiceAccountsAPI.new# there is a valid "service_account_user" in the systemSERVICE_ACCOUNT_USER_DATA_ID=ENV["SERVICE_ACCOUNT_USER_DATA_ID"]# there is a valid "service_account_application_key" for "service_account_user"SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ATTRIBUTES_NAME=ENV["SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ATTRIBUTES_NAME"]SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID=ENV["SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID"]body=DatadogAPIClient::V2::ApplicationKeyUpdateRequest.new({data:DatadogAPIClient::V2::ApplicationKeyUpdateData.new({id:SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID,type:DatadogAPIClient::V2::ApplicationKeysType::APPLICATION_KEYS,attributes:DatadogAPIClient::V2::ApplicationKeyUpdateAttributes.new({name:"Application Key for managing dashboards-updated",}),}),})papi_instance.update_service_account_application_key(SERVICE_ACCOUNT_USER_DATA_ID,SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID,body)
/**
* Edit an app key owned by this service account returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.ServiceAccountsApi(configuration);// there is a valid "service_account_user" in the system
constSERVICE_ACCOUNT_USER_DATA_ID=process.env.SERVICE_ACCOUNT_USER_DATA_IDasstring;// there is a valid "service_account_application_key" for "service_account_user"
constSERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID=process.env.SERVICE_ACCOUNT_APPLICATION_KEY_DATA_IDasstring;constparams: v2.ServiceAccountsApiUpdateServiceAccountApplicationKeyRequest={body:{data:{id: SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID,type:"application_keys",attributes:{name:"Application Key for managing dashboards-updated",},},},serviceAccountId: SERVICE_ACCOUNT_USER_DATA_ID,appKeyId: SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID,};apiInstance.updateServiceAccountApplicationKey(params).then((data: v2.PartialApplicationKeyResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
// Delete an app key owned by this service account returns "No Content" response
packagemainimport("context""fmt""os"datadog"github.com/DataDog/datadog-api-client-go/api/v2/datadog")funcmain(){// there is a valid "service_account_user" in the system
ServiceAccountUserDataID:=os.Getenv("SERVICE_ACCOUNT_USER_DATA_ID")// there is a valid "service_account_application_key" for "service_account_user"
ServiceAccountApplicationKeyDataID:=os.Getenv("SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID")ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)r,err:=apiClient.ServiceAccountsApi.DeleteServiceAccountApplicationKey(ctx,ServiceAccountUserDataID,ServiceAccountApplicationKeyDataID)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `ServiceAccountsApi.DeleteServiceAccountApplicationKey`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}}
// Delete an app key owned by this service account returns "No Content" response
importcom.datadog.api.v2.client.ApiClient;importcom.datadog.api.v2.client.ApiException;importcom.datadog.api.v2.client.Configuration;importcom.datadog.api.v2.client.api.ServiceAccountsApi;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=Configuration.getDefaultApiClient();ServiceAccountsApiapiInstance=newServiceAccountsApi(defaultClient);// there is a valid "service_account_user" in the system
StringSERVICE_ACCOUNT_USER_DATA_ID=System.getenv("SERVICE_ACCOUNT_USER_DATA_ID");// there is a valid "service_account_application_key" for "service_account_user"
StringSERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID=System.getenv("SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID");try{apiInstance.deleteServiceAccountApplicationKey(SERVICE_ACCOUNT_USER_DATA_ID,SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID);}catch(ApiExceptione){System.err.println("Exception when calling ServiceAccountsApi#deleteServiceAccountApplicationKey");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Delete an app key owned by this service account returns "No Content" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.service_accounts_apiimportServiceAccountsApi# there is a valid "service_account_user" in the systemSERVICE_ACCOUNT_USER_DATA_ID=environ["SERVICE_ACCOUNT_USER_DATA_ID"]# there is a valid "service_account_application_key" for "service_account_user"SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID=environ["SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID"]configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=ServiceAccountsApi(api_client)api_instance.delete_service_account_application_key(service_account_id=SERVICE_ACCOUNT_USER_DATA_ID,app_key_id=SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID,)
# Delete an app key owned by this service account returns "No Content" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::ServiceAccountsAPI.new# there is a valid "service_account_user" in the systemSERVICE_ACCOUNT_USER_DATA_ID=ENV["SERVICE_ACCOUNT_USER_DATA_ID"]# there is a valid "service_account_application_key" for "service_account_user"SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID=ENV["SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID"]api_instance.delete_service_account_application_key(SERVICE_ACCOUNT_USER_DATA_ID,SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID)
/**
* Delete an app key owned by this service account returns "No Content" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.ServiceAccountsApi(configuration);// there is a valid "service_account_user" in the system
constSERVICE_ACCOUNT_USER_DATA_ID=process.env.SERVICE_ACCOUNT_USER_DATA_IDasstring;// there is a valid "service_account_application_key" for "service_account_user"
constSERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID=process.env.SERVICE_ACCOUNT_APPLICATION_KEY_DATA_IDasstring;constparams: v2.ServiceAccountsApiDeleteServiceAccountApplicationKeyRequest={serviceAccountId: SERVICE_ACCOUNT_USER_DATA_ID,appKeyId: SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID,};apiInstance.deleteServiceAccountApplicationKey(params).then((data: any)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));