Enable or disable CI Visibility for a GitHub account, one of its repositories, or both in the same request.
The account (and, optionally, repository) are identified by name. Account-level and repository-level
changes are independent and may both be supplied in the same request. At least one of enabled or
repository.enabled must be provided. If the account name matches installations on more than one host,
host must be supplied to disambiguate, otherwise a 409 is returned. Returns a 404 if the CI Visibility
GitHub integration is not enabled for this organization, or if the given account or repository cannot be
found by name.
This endpoint requires the ci_provider_settings_write permission.
OAuth apps require the ci_provider_settings_write authorization scope to access this endpoint.
Data object for updating a GitHub account's CI Visibility opt-in status.
attributes [required]
object
Attributes for updating a GitHub account's CI Visibility opt-in status.
At least one of enabled or repository.enabled must be provided.
account [required]
string
The GitHub account (organization or user) name to update, identified by name.
enabled
boolean
Whether to enable or disable CI Visibility at the account level.
host
string
The GitHub host (github.com or a GHES hostname) the account belongs to. Required to disambiguate
when the same account name exists on more than one host.
repository
object
Repository-level opt-in change to apply, identified by name.
enabled [required]
boolean
Whether to enable or disable CI Visibility for this repository.
name [required]
string
The repository name to update.
type [required]
enum
JSON:API type for the GitHub account resource.
The value must always be ci_github_account.
Allowed enum values: ci_github_account
"""
Update GitHub CI Visibility status returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.ci_visibility_git_hub_accounts_apiimportCIVisibilityGitHubAccountsApifromdatadog_api_client.v2.model.ci_app_git_hub_account_typeimportCIAppGitHubAccountTypefromdatadog_api_client.v2.model.ci_app_git_hub_account_update_requestimportCIAppGitHubAccountUpdateRequestfromdatadog_api_client.v2.model.ci_app_git_hub_account_update_request_attributesimport(CIAppGitHubAccountUpdateRequestAttributes,)fromdatadog_api_client.v2.model.ci_app_git_hub_account_update_request_dataimportCIAppGitHubAccountUpdateRequestDatafromdatadog_api_client.v2.model.ci_app_git_hub_account_update_request_repositoryimport(CIAppGitHubAccountUpdateRequestRepository,)body=CIAppGitHubAccountUpdateRequest(data=CIAppGitHubAccountUpdateRequestData(attributes=CIAppGitHubAccountUpdateRequestAttributes(account="datadog",enabled=True,host="github.com",repository=CIAppGitHubAccountUpdateRequestRepository(enabled=True,name="shopist",),),type=CIAppGitHubAccountType.CI_GITHUB_ACCOUNT,),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=CIVisibilityGitHubAccountsApi(api_client)response=api_instance.update_ci_app_git_hub_account(body=body)print(response)
# Update GitHub CI Visibility status returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::CIVisibilityGitHubAccountsAPI.newbody=DatadogAPIClient::V2::CIAppGitHubAccountUpdateRequest.new({data:DatadogAPIClient::V2::CIAppGitHubAccountUpdateRequestData.new({attributes:DatadogAPIClient::V2::CIAppGitHubAccountUpdateRequestAttributes.new({account:"datadog",enabled:true,host:"github.com",repository:DatadogAPIClient::V2::CIAppGitHubAccountUpdateRequestRepository.new({enabled:true,name:"shopist",}),}),type:DatadogAPIClient::V2::CIAppGitHubAccountType::CI_GITHUB_ACCOUNT,}),})papi_instance.update_ci_app_git_hub_account(body)
// Update GitHub CI Visibility status 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.CIAppGitHubAccountUpdateRequest{Data:datadogV2.CIAppGitHubAccountUpdateRequestData{Attributes:datadogV2.CIAppGitHubAccountUpdateRequestAttributes{Account:"datadog",Enabled:datadog.PtrBool(true),Host:datadog.PtrString("github.com"),Repository:&datadogV2.CIAppGitHubAccountUpdateRequestRepository{Enabled:true,Name:"shopist",},},Type:datadogV2.CIAPPGITHUBACCOUNTTYPE_CI_GITHUB_ACCOUNT,},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewCIVisibilityGitHubAccountsApi(apiClient)resp,r,err:=api.UpdateCIAppGitHubAccount(ctx,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `CIVisibilityGitHubAccountsApi.UpdateCIAppGitHubAccount`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `CIVisibilityGitHubAccountsApi.UpdateCIAppGitHubAccount`:\n%s\n",responseContent)}
// Update GitHub CI Visibility status returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_ci_visibility_git_hub_accounts::CIVisibilityGitHubAccountsAPI;usedatadog_api_client::datadogV2::model::CIAppGitHubAccountType;usedatadog_api_client::datadogV2::model::CIAppGitHubAccountUpdateRequest;usedatadog_api_client::datadogV2::model::CIAppGitHubAccountUpdateRequestAttributes;usedatadog_api_client::datadogV2::model::CIAppGitHubAccountUpdateRequestData;usedatadog_api_client::datadogV2::model::CIAppGitHubAccountUpdateRequestRepository;#[tokio::main]asyncfnmain(){letbody=CIAppGitHubAccountUpdateRequest::new(CIAppGitHubAccountUpdateRequestData::new(CIAppGitHubAccountUpdateRequestAttributes::new("datadog".to_string()).enabled(true).host("github.com".to_string()).repository(CIAppGitHubAccountUpdateRequestRepository::new(true,"shopist".to_string(),)),CIAppGitHubAccountType::CI_GITHUB_ACCOUNT,));letconfiguration=datadog::Configuration::new();letapi=CIVisibilityGitHubAccountsAPI::with_config(configuration);letresp=api.update_ci_app_git_hub_account(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 GitHub CI Visibility status returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.CIVisibilityGitHubAccountsApi(configuration);constparams: v2.CIVisibilityGitHubAccountsApiUpdateCIAppGitHubAccountRequest={body:{data:{attributes:{account:"datadog",enabled: true,host:"github.com",repository:{enabled: true,name:"shopist",},},type:"ci_github_account",},},};apiInstance.updateCIAppGitHubAccount(params).then((data: v2.CIAppGitHubAccountResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));