mirror of
https://github.com/hanzoai/azure-sdk-for-js.git
synced 2026-10-30 19:51:51 +00:00
42 lines
1.5 KiB
TypeScript
42 lines
1.5 KiB
TypeScript
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT License.
|
|
|
|
/**
|
|
* This sample demonstrates how to Patch a monitored GitHub repository.
|
|
*
|
|
* @summary Patch a monitored GitHub repository.
|
|
* x-ms-original-file: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubRepoUpdate.json
|
|
*/
|
|
|
|
import type { GitHubRepo, GitHubRepoUpdateOptionalParams } from "@azure/arm-securitydevops";
|
|
import { MicrosoftSecurityDevOps } from "@azure/arm-securitydevops";
|
|
import { DefaultAzureCredential } from "@azure/identity";
|
|
import "dotenv/config";
|
|
|
|
async function gitHubRepoUpdate(): Promise<void> {
|
|
const subscriptionId =
|
|
process.env["SECURITYDEVOPS_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
|
|
const resourceGroupName = process.env["SECURITYDEVOPS_RESOURCE_GROUP"] || "westusrg";
|
|
const gitHubConnectorName = "testconnector";
|
|
const gitHubOwnerName = "Azure";
|
|
const gitHubRepoName = "azure-rest-api-specs";
|
|
const gitHubRepo: GitHubRepo = {};
|
|
const options: GitHubRepoUpdateOptionalParams = { gitHubRepo };
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new MicrosoftSecurityDevOps(credential, subscriptionId);
|
|
const result = await client.gitHubRepoOperations.beginUpdateAndWait(
|
|
resourceGroupName,
|
|
gitHubConnectorName,
|
|
gitHubOwnerName,
|
|
gitHubRepoName,
|
|
options,
|
|
);
|
|
console.log(result);
|
|
}
|
|
|
|
async function main(): Promise<void> {
|
|
await gitHubRepoUpdate();
|
|
}
|
|
|
|
main().catch(console.error);
|