Récupérer le coût prévisionnel dans les comptes multi-org et les comptes racine uniques.
Les données de coût prévisionnel sont uniquement disponibles pour le mois en cours et deviennent disponibles vers le 12 du mois.
This endpoint requires
all
of the following permissions:
usage_read
billing_read
OAuth apps require the usage_read, billing_read authorization scope to access this endpoint.
Arguments
Chaînes de requête
Nom
Type
Description
view
string
String to specify whether cost is broken down at a parent-org level or at the sub-org level. Available views are summary and sub-org. Defaults to summary.
include_connected_accounts
boolean
Boolean to specify whether to include accounts connected to the current account as partner customers in the Datadog partner network program. Defaults to false.
"""
Get projected cost across your account returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.usage_metering_apiimportUsageMeteringApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=UsageMeteringApi(api_client)response=api_instance.get_projected_cost(view="sub-org",)print(response)
# Get projected cost across your account returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::UsageMeteringAPI.newopts={view:"sub-org",}papi_instance.get_projected_cost(opts)
// Get projected cost across your account 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/datadogV2")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewUsageMeteringApi(apiClient)resp,r,err:=api.GetProjectedCost(ctx,*datadogV2.NewGetProjectedCostOptionalParameters().WithView("sub-org"))iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsageMeteringApi.GetProjectedCost`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsageMeteringApi.GetProjectedCost`:\n%s\n",responseContent)}
// Get projected cost across your account returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.UsageMeteringApi;importcom.datadog.api.client.v2.api.UsageMeteringApi.GetProjectedCostOptionalParameters;importcom.datadog.api.client.v2.model.ProjectedCostResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();UsageMeteringApiapiInstance=newUsageMeteringApi(defaultClient);try{ProjectedCostResponseresult=apiInstance.getProjectedCost(newGetProjectedCostOptionalParameters().view("sub-org"));System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling UsageMeteringApi#getProjectedCost");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Get projected cost across your account returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_usage_metering::GetProjectedCostOptionalParams;usedatadog_api_client::datadogV2::api_usage_metering::UsageMeteringAPI;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=UsageMeteringAPI::with_config(configuration);letresp=api.get_projected_cost(GetProjectedCostOptionalParams::default().view("sub-org".to_string())).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Get projected cost across your account returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.UsageMeteringApi(configuration);constparams: v2.UsageMeteringApiGetProjectedCostRequest={view:"sub-org",};apiInstance.getProjectedCost(params).then((data: v2.ProjectedCostResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));