Updates the supplied fields on a usage quota and leaves omitted fields unchanged. The quota must belong to the caller’s organization or one of its descendants, and its opaque identifier must belong to the requested quota namespace. Requires the billing_edit permission.
This endpoint requires the billing_edit permission.
OAuth apps require the billing_edit authorization scope to access this endpoint.
Argumentos
Parámetros de ruta
Nombre
Type
Descripción
quota_namespace [required]
string
The product-specific namespace whose usage quotas are being managed.
id [required]
string
The opaque quota identifier returned by a previous list or create request. Clients must pass this value verbatim.
Solicitud
Body Data (required)
The usage quota fields to update. Omitting an attribute leaves its current value unchanged.
Attributes to update on a usage quota. Omitting a property leaves its current value unchanged.
enforced
boolean
Whether to actively block usage above the limit. Omit this field to leave the current enforcement setting unchanged.
usage_limit
int64
The new quota limit in the usage units defined by the quota namespace. For an organization-wide quota (empty scope), the limit must be greater than the usage already recorded in the current period. Omit this field to leave the current limit unchanged.
id [required]
string
The opaque usage quota identifier, which must match the identifier in the request path.
type [required]
enum
The JSON:API resource type for a usage quota.
Allowed enum values: quotas
Whether usage above the limit is actively blocked instead of only tracked or alerted on.
org_public_id [required]
string
The public ID of the organization that owns the quota.
scope
object
A namespace-specific key and value identifying what the quota applies to within an organization. The object contains exactly one entry. A value of "*" identifies the default quota applied to entities without a specific quota. This field is omitted for an organization-wide quota.
<any-key>
string
usage_limit [required]
double
The quota limit in the usage units defined by the quota namespace. May be fractional for quotas configured before public writes required whole units.
id [required]
string
An opaque usage quota identifier. Clients must pass this value back verbatim in update and delete requests and must not infer any structure from it.
type [required]
enum
The JSON:API resource type for a usage quota.
Allowed enum values: quotas
## default
#
# Path parameters exportquota_namespace="ai_credits" exportid="MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f" # Use a Personal Access Token or Service Access Token exportDD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"python3"example.py"
# Update a usage quota returns "OK" responserequire"datadog_api_client"DatadogAPIClient.configuredo|config|config.access_token=ENV["DD_BEARER_TOKEN"]config.unstable_operations["v2.update_quota".to_sym]=trueendapi_instance=DatadogAPIClient::V2::UsageMeteringAPI.newbody=DatadogAPIClient::V2::UsageQuotaUpdateRequest.new({data:DatadogAPIClient::V2::UsageQuotaUpdateData.new({attributes:DatadogAPIClient::V2::UsageQuotaUpdateAttributes.new({enforced:false,usage_limit:120000,}),id:"MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f",type:DatadogAPIClient::V2::UsageQuotaType::QUOTAS,}),})papi_instance.update_quota("ai_credits","MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f",body)
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"rb"example.rb"
// Update a usage quota 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(){body:=datadogV2.UsageQuotaUpdateRequest{Data:datadogV2.UsageQuotaUpdateData{Attributes:datadogV2.UsageQuotaUpdateAttributes{Enforced:*datadog.NewNullableBool(datadog.PtrBool(false)),UsageLimit:*datadog.NewNullableInt64(datadog.PtrInt64(120000)),},Id:"MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f",Type:datadogV2.USAGEQUOTATYPE_QUOTAS,},}ctx:=datadog.NewDefaultContext(context.Background())ctx=context.WithValue(ctx,datadog.ContextAccessToken,os.Getenv("DD_BEARER_TOKEN"))configuration:=datadog.NewConfiguration()configuration.SetUnstableOperationEnabled("v2.UpdateQuota",true)apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewUsageMeteringApi(apiClient)resp,r,err:=api.UpdateQuota(ctx,"ai_credits","MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f",body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsageMeteringApi.UpdateQuota`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsageMeteringApi.UpdateQuota`:\n%s\n",responseContent)}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"go run"main.go"
// Update a usage quota returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.UsageMeteringApi;importcom.datadog.api.client.v2.model.UsageQuotaResponse;importcom.datadog.api.client.v2.model.UsageQuotaType;importcom.datadog.api.client.v2.model.UsageQuotaUpdateAttributes;importcom.datadog.api.client.v2.model.UsageQuotaUpdateData;importcom.datadog.api.client.v2.model.UsageQuotaUpdateRequest;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));defaultClient.setUnstableOperationEnabled("v2.updateQuota",true);UsageMeteringApiapiInstance=newUsageMeteringApi(defaultClient);UsageQuotaUpdateRequestbody=newUsageQuotaUpdateRequest().data(newUsageQuotaUpdateData().attributes(newUsageQuotaUpdateAttributes().enforced(false).usageLimit(120000L)).id("MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f").type(UsageQuotaType.QUOTAS));try{UsageQuotaResponseresult=apiInstance.updateQuota("ai_credits","MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f",body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling UsageMeteringApi#updateQuota");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"java"Example.java"
// Update a usage quota returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_usage_metering::UsageMeteringAPI;usedatadog_api_client::datadogV2::model::UsageQuotaType;usedatadog_api_client::datadogV2::model::UsageQuotaUpdateAttributes;usedatadog_api_client::datadogV2::model::UsageQuotaUpdateData;usedatadog_api_client::datadogV2::model::UsageQuotaUpdateRequest;#[tokio::main]asyncfnmain(){letbody=UsageQuotaUpdateRequest::new(UsageQuotaUpdateData::new(UsageQuotaUpdateAttributes::new().enforced(Some(false)).usage_limit(Some(120000)),"MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f".to_string(),UsageQuotaType::QUOTAS,));letmutconfiguration=datadog::Configuration::new();configuration.set_unstable_operation_enabled("v2.update_quota",true);letapi=UsageMeteringAPI::with_config(configuration);letresp=api.update_quota("ai_credits".to_string(),"MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f".to_string(),body,).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
/**
* Update a usage quota returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration({authMethods:{AuthZ:{accessToken: process.env.DD_BEARER_TOKENasstring,},},});configuration.unstableOperations["v2.updateQuota"]=true;constapiInstance=newv2.UsageMeteringApi(configuration);constparams: v2.UsageMeteringApiUpdateQuotaRequest={body:{data:{attributes:{enforced: false,usageLimit: 120000,},id:"MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f",type:"quotas",},},quotaNamespace:"ai_credits",id:"MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f",};apiInstance.updateQuota(params).then((data: v2.UsageQuotaResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"tsc"example.ts"
Solicite una demostración personalizada
Comience con Datadog
Ask AI
AI-generated responses may be inaccurate. Verify important info.