// Update component 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""github.com/google/uuid")funcmain(){// there is a valid "status_page" in the systemStatusPageDataAttributesComponents0ID:=uuid.MustParse(os.Getenv("STATUS_PAGE_DATA_ATTRIBUTES_COMPONENTS_0_ID"))StatusPageDataID:=uuid.MustParse(os.Getenv("STATUS_PAGE_DATA_ID"))body:=datadogV2.PatchComponentRequest{Data:&datadogV2.PatchComponentRequestData{Attributes:datadogV2.PatchComponentRequestDataAttributes{Name:datadog.PtrString("Logs Indexing"),},Id:StatusPageDataAttributesComponents0ID,Type:datadogV2.STATUSPAGESCOMPONENTGROUPTYPE_COMPONENTS,},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewStatusPagesApi(apiClient)resp,r,err:=api.UpdateComponent(ctx,StatusPageDataID,StatusPageDataAttributesComponents0ID,body,*datadogV2.NewUpdateComponentOptionalParameters())iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `StatusPagesApi.UpdateComponent`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `StatusPagesApi.UpdateComponent`:\n%s\n",responseContent)}
// Update component returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.StatusPagesApi;importcom.datadog.api.client.v2.model.PatchComponentRequest;importcom.datadog.api.client.v2.model.PatchComponentRequestData;importcom.datadog.api.client.v2.model.PatchComponentRequestDataAttributes;importcom.datadog.api.client.v2.model.StatusPagesComponent;importcom.datadog.api.client.v2.model.StatusPagesComponentGroupType;importjava.util.UUID;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();StatusPagesApiapiInstance=newStatusPagesApi(defaultClient);// there is a valid "status_page" in the systemUUIDSTATUS_PAGE_DATA_ATTRIBUTES_COMPONENTS_0_ID=null;try{STATUS_PAGE_DATA_ATTRIBUTES_COMPONENTS_0_ID=UUID.fromString(System.getenv("STATUS_PAGE_DATA_ATTRIBUTES_COMPONENTS_0_ID"));}catch(IllegalArgumentExceptione){System.err.println("Error parsing UUID: "+e.getMessage());}UUIDSTATUS_PAGE_DATA_ID=null;try{STATUS_PAGE_DATA_ID=UUID.fromString(System.getenv("STATUS_PAGE_DATA_ID"));}catch(IllegalArgumentExceptione){System.err.println("Error parsing UUID: "+e.getMessage());}PatchComponentRequestbody=newPatchComponentRequest().data(newPatchComponentRequestData().attributes(newPatchComponentRequestDataAttributes().name("Logs Indexing")).id(STATUS_PAGE_DATA_ATTRIBUTES_COMPONENTS_0_ID).type(StatusPagesComponentGroupType.COMPONENTS));try{StatusPagesComponentresult=apiInstance.updateComponent(STATUS_PAGE_DATA_ID,STATUS_PAGE_DATA_ATTRIBUTES_COMPONENTS_0_ID,body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling StatusPagesApi#updateComponent");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Update component returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.status_pages_apiimportStatusPagesApifromdatadog_api_client.v2.model.patch_component_requestimportPatchComponentRequestfromdatadog_api_client.v2.model.patch_component_request_dataimportPatchComponentRequestDatafromdatadog_api_client.v2.model.patch_component_request_data_attributesimportPatchComponentRequestDataAttributesfromdatadog_api_client.v2.model.status_pages_component_group_typeimportStatusPagesComponentGroupType# there is a valid "status_page" in the systemSTATUS_PAGE_DATA_ATTRIBUTES_COMPONENTS_0_ID=environ["STATUS_PAGE_DATA_ATTRIBUTES_COMPONENTS_0_ID"]STATUS_PAGE_DATA_ID=environ["STATUS_PAGE_DATA_ID"]body=PatchComponentRequest(data=PatchComponentRequestData(attributes=PatchComponentRequestDataAttributes(name="Logs Indexing",),id=STATUS_PAGE_DATA_ATTRIBUTES_COMPONENTS_0_ID,type=StatusPagesComponentGroupType.COMPONENTS,),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=StatusPagesApi(api_client)response=api_instance.update_component(page_id=STATUS_PAGE_DATA_ID,component_id=STATUS_PAGE_DATA_ATTRIBUTES_COMPONENTS_0_ID,body=body)print(response)
# Update component returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::StatusPagesAPI.new# there is a valid "status_page" in the systemSTATUS_PAGE_DATA_ATTRIBUTES_COMPONENTS_0_ID=ENV["STATUS_PAGE_DATA_ATTRIBUTES_COMPONENTS_0_ID"]STATUS_PAGE_DATA_ID=ENV["STATUS_PAGE_DATA_ID"]body=DatadogAPIClient::V2::PatchComponentRequest.new({data:DatadogAPIClient::V2::PatchComponentRequestData.new({attributes:DatadogAPIClient::V2::PatchComponentRequestDataAttributes.new({name:"Logs Indexing",}),id:STATUS_PAGE_DATA_ATTRIBUTES_COMPONENTS_0_ID,type:DatadogAPIClient::V2::StatusPagesComponentGroupType::COMPONENTS,}),})papi_instance.update_component(STATUS_PAGE_DATA_ID,STATUS_PAGE_DATA_ATTRIBUTES_COMPONENTS_0_ID,body)
// Update component returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_status_pages::StatusPagesAPI;usedatadog_api_client::datadogV2::api_status_pages::UpdateComponentOptionalParams;usedatadog_api_client::datadogV2::model::PatchComponentRequest;usedatadog_api_client::datadogV2::model::PatchComponentRequestData;usedatadog_api_client::datadogV2::model::PatchComponentRequestDataAttributes;usedatadog_api_client::datadogV2::model::StatusPagesComponentGroupType;#[tokio::main]asyncfnmain(){// there is a valid "status_page" in the system
letstatus_page_data_attributes_components_0_id=uuid::Uuid::parse_str(&std::env::var("STATUS_PAGE_DATA_ATTRIBUTES_COMPONENTS_0_ID").unwrap(),).expect("Invalid UUID");letstatus_page_data_id=uuid::Uuid::parse_str(&std::env::var("STATUS_PAGE_DATA_ID").unwrap()).expect("Invalid UUID");letbody=PatchComponentRequest::new().data(PatchComponentRequestData::new(PatchComponentRequestDataAttributes::new().name("Logs Indexing".to_string()),status_page_data_attributes_components_0_id.clone(),StatusPagesComponentGroupType::COMPONENTS,));letconfiguration=datadog::Configuration::new();letapi=StatusPagesAPI::with_config(configuration);letresp=api.update_component(status_page_data_id.clone(),status_page_data_attributes_components_0_id.clone(),body,UpdateComponentOptionalParams::default(),).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 component returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.StatusPagesApi(configuration);// there is a valid "status_page" in the system
constSTATUS_PAGE_DATA_ATTRIBUTES_COMPONENTS_0_ID=process.env.STATUS_PAGE_DATA_ATTRIBUTES_COMPONENTS_0_IDasstring;constSTATUS_PAGE_DATA_ID=process.env.STATUS_PAGE_DATA_IDasstring;constparams: v2.StatusPagesApiUpdateComponentRequest={body:{data:{attributes:{name:"Logs Indexing",},id: STATUS_PAGE_DATA_ATTRIBUTES_COMPONENTS_0_ID,type:"components",},},pageId: STATUS_PAGE_DATA_ID,componentId: STATUS_PAGE_DATA_ATTRIBUTES_COMPONENTS_0_ID,};apiInstance.updateComponent(params).then((data: v2.StatusPagesComponent)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));