Files

39 lines
1.4 KiB
TypeScript

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/**
* This sample demonstrates how to Create or update a monitored GitHub owner.
*
* @summary Create or update a monitored GitHub owner.
* x-ms-original-file: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubOwnerCreateOrUpdate.json
*/
import type { GitHubOwner } from "@azure/arm-securitydevops";
import { MicrosoftSecurityDevOps } from "@azure/arm-securitydevops";
import { DefaultAzureCredential } from "@azure/identity";
import "dotenv/config";
async function gitHubOwnerCreateOrUpdate(): 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 gitHubOwner: GitHubOwner = {};
const credential = new DefaultAzureCredential();
const client = new MicrosoftSecurityDevOps(credential, subscriptionId);
const result = await client.gitHubOwnerOperations.beginCreateOrUpdateAndWait(
resourceGroupName,
gitHubConnectorName,
gitHubOwnerName,
gitHubOwner,
);
console.log(result);
}
async function main(): Promise<void> {
await gitHubOwnerCreateOrUpdate();
}
main().catch(console.error);