Update GitHub CI Visibility status
https://api.datadoghq.com/api/v2/ci/github/accountshttps://api.us3.datadoghq.com/api/v2/ci/github/accountshttps://api.us5.datadoghq.com/api/v2/ci/github/accountshttps://api.datadoghq.eu/api/v2/ci/github/accountshttps://api.ap1.datadoghq.com/api/v2/ci/github/accountshttps://api.ap2.datadoghq.com/api/v2/ci/github/accountshttps://api.uk1.datadoghq.com/api/v2/ci/github/accountshttps://api.ddog-gov.com/api/v2/ci/github/accountshttps://api.us2.ddog-gov.com/api/v2/ci/github/accountsDescripción general
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.
OAuth apps require the ci_provider_settings_write authorization scope to access this endpoint.
Solicitud
Body Data (required)
data [required]Data object for updating a GitHub account's CI Visibility opt-in status.
attributes [required]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]The GitHub account (organization or user) name to update, identified by name.
enabledWhether to enable or disable CI Visibility at the account level.
hostThe 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.
repositoryRepository-level opt-in change to apply, identified by name.
enabled [required]Whether to enable or disable CI Visibility for this repository.
name [required]The repository name to update.
type [required]JSON:API type for the GitHub account resource.
The value must always be ci_github_account.
ci_github_account{
"data": {
"attributes": {
"account": "datadog",
"enabled": true,
"host": "github.com",
"repository": {
"enabled": true,
"name": "shopist"
}
},
"type": "ci_github_account"
}
}Respuesta
OK
Response object containing a single GitHub account's CI Visibility opt-in status.
data [required]Data object for a GitHub account.
attributes [required]Attributes describing a GitHub account's CI Visibility opt-in status.
accountThe GitHub account (organization or user) name.
enabledWhether CI Visibility is enabled at the account level.
hostThe GitHub host (github.com or a GitHub Enterprise Server (GHES) hostname) this account belongs to.
repo_countThe number of repositories known for this account.
repositoriesThe repositories belonging to this account, with their individual opt-in status.
enabledWhether CI Visibility is enabled for this repository.
nameThe repository name.
id [required]The account's unique identifier, in the form <host>/<account name>
(for example github.com/datadog).
type [required]JSON:API type for the GitHub account resource.
The value must always be ci_github_account.
ci_github_account{
"data": {
"attributes": {
"account": "datadog",
"enabled": true,
"host": "github.com",
"repo_count": 12,
"repositories": [
{
"enabled": true,
"name": "shopist"
}
]
},
"id": "github.com/datadog",
"type": "ci_github_account"
}
}Bad Request
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Not Authorized
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Not Found
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Conflict
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Too many requests
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Ejemplo de código
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/github/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"account": "datadog",
"enabled": true,
"host": "github.com",
"repository": {
"enabled": true,
"name": "shopist"
}
},
"type": "ci_github_account"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/github/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"account": "datadog",
"enabled": true,
"host": "github.com",
"repository": {
"enabled": true,
"name": "shopist"
}
},
"type": "ci_github_account"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/github/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"account": "datadog",
"enabled": true,
"host": "github.com",
"repository": {
"enabled": true,
"name": "shopist"
}
},
"type": "ci_github_account"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/github/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"account": "datadog",
"enabled": true,
"host": "github.com",
"repository": {
"enabled": true,
"name": "shopist"
}
},
"type": "ci_github_account"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/github/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"account": "datadog",
"enabled": true,
"host": "github.com",
"repository": {
"enabled": true,
"name": "shopist"
}
},
"type": "ci_github_account"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/github/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"account": "datadog",
"enabled": true,
"host": "github.com",
"repository": {
"enabled": true,
"name": "shopist"
}
},
"type": "ci_github_account"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/github/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"account": "datadog",
"enabled": true,
"host": "github.com",
"repository": {
"enabled": true,
"name": "shopist"
}
},
"type": "ci_github_account"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/github/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"account": "datadog",
"enabled": true,
"host": "github.com",
"repository": {
"enabled": true,
"name": "shopist"
}
},
"type": "ci_github_account"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/github/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"account": "datadog",
"enabled": true,
"host": "github.com",
"repository": {
"enabled": true,
"name": "shopist"
}
},
"type": "ci_github_account"
}
}
EOF// Update GitHub CI Visibility status returns "OK" response
package main
import (
"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"
)
func main() {
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())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewCIVisibilityGitHubAccountsApi(apiClient)
resp, r, err := api.UpdateCIAppGitHubAccount(ctx, body)
if err != 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)
}
Instructions
First install the library and its dependencies and then save the example to main.go and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"// Update GitHub CI Visibility status returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CiVisibilityGitHubAccountsApi;
import com.datadog.api.client.v2.model.CIAppGitHubAccountResponse;
import com.datadog.api.client.v2.model.CIAppGitHubAccountType;
import com.datadog.api.client.v2.model.CIAppGitHubAccountUpdateRequest;
import com.datadog.api.client.v2.model.CIAppGitHubAccountUpdateRequestAttributes;
import com.datadog.api.client.v2.model.CIAppGitHubAccountUpdateRequestData;
import com.datadog.api.client.v2.model.CIAppGitHubAccountUpdateRequestRepository;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
CiVisibilityGitHubAccountsApi apiInstance = new CiVisibilityGitHubAccountsApi(defaultClient);
CIAppGitHubAccountUpdateRequest body =
new CIAppGitHubAccountUpdateRequest()
.data(
new CIAppGitHubAccountUpdateRequestData()
.attributes(
new CIAppGitHubAccountUpdateRequestAttributes()
.account("datadog")
.enabled(true)
.host("github.com")
.repository(
new CIAppGitHubAccountUpdateRequestRepository()
.enabled(true)
.name("shopist")))
.type(CIAppGitHubAccountType.CI_GITHUB_ACCOUNT));
try {
CIAppGitHubAccountResponse result = apiInstance.updateCIAppGitHubAccount(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println(
"Exception when calling CiVisibilityGitHubAccountsApi#updateCIAppGitHubAccount");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Instructions
First install the library and its dependencies and then save the example to Example.java and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java""""
Update GitHub CI Visibility status returns "OK" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.ci_visibility_git_hub_accounts_api import CIVisibilityGitHubAccountsApi
from datadog_api_client.v2.model.ci_app_git_hub_account_type import CIAppGitHubAccountType
from datadog_api_client.v2.model.ci_app_git_hub_account_update_request import CIAppGitHubAccountUpdateRequest
from datadog_api_client.v2.model.ci_app_git_hub_account_update_request_attributes import (
CIAppGitHubAccountUpdateRequestAttributes,
)
from datadog_api_client.v2.model.ci_app_git_hub_account_update_request_data import CIAppGitHubAccountUpdateRequestData
from datadog_api_client.v2.model.ci_app_git_hub_account_update_request_repository import (
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()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
api_instance = CIVisibilityGitHubAccountsApi(api_client)
response = api_instance.update_ci_app_git_hub_account(body=body)
print(response)
Instructions
First install the library and its dependencies and then save the example to example.py and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"# Update GitHub CI Visibility status returns "OK" response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::CIVisibilityGitHubAccountsAPI.new
body = 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,
}),
})
p api_instance.update_ci_app_git_hub_account(body)
Instructions
First install the library and its dependencies and then save the example to example.rb and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"// Update GitHub CI Visibility status returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_ci_visibility_git_hub_accounts::CIVisibilityGitHubAccountsAPI;
use datadog_api_client::datadogV2::model::CIAppGitHubAccountType;
use datadog_api_client::datadogV2::model::CIAppGitHubAccountUpdateRequest;
use datadog_api_client::datadogV2::model::CIAppGitHubAccountUpdateRequestAttributes;
use datadog_api_client::datadogV2::model::CIAppGitHubAccountUpdateRequestData;
use datadog_api_client::datadogV2::model::CIAppGitHubAccountUpdateRequestRepository;
#[tokio::main]
async fn main() {
let body = 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,
));
let configuration = datadog::Configuration::new();
let api = CIVisibilityGitHubAccountsAPI::with_config(configuration);
let resp = api.update_ci_app_git_hub_account(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Instructions
First install the library and its dependencies and then save the example to src/main.rs and run following commands:
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us3.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us5.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="datadoghq.eu" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ap1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ap2.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="uk1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us2.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";
const configuration = client.createConfiguration({
authMethods: {
AuthZ: {
accessToken: process.env.DD_BEARER_TOKEN as string,
},
},
});
const apiInstance = new v2.CIVisibilityGitHubAccountsApi(configuration);
const params: 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));
Instructions
First install the library and its dependencies and then save the example to example.ts and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"