mirror of
https://github.com/hanzoai/azure-sdk-for-js.git
synced 2026-10-30 19:51:51 +00:00
Configurations: 'specification/datafactory/resource-manager/Microsoft.DataFactory/DataFactory/tspconfig.yaml', API Version: 2018-06-01, SDK Release Type: beta, and CommitSHA: '7abc832d6648172c6bc13657251521904db58762' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6218450 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --------- Co-authored-by: Jiao Di (MSFT) <[email protected]>
86 lines
2.5 KiB
TypeScript
86 lines
2.5 KiB
TypeScript
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT License.
|
|
|
|
import { DataFactoryManagementClient } from "@azure/arm-datafactory";
|
|
import { DefaultAzureCredential } from "@azure/identity";
|
|
|
|
/**
|
|
* This sample demonstrates how to creates or updates a trigger.
|
|
*
|
|
* @summary creates or updates a trigger.
|
|
* x-ms-original-file: 2018-06-01/Triggers_Create.json
|
|
*/
|
|
async function triggersCreate(): Promise<void> {
|
|
const credential = new DefaultAzureCredential();
|
|
const subscriptionId = "12345678-1234-1234-1234-123456789012";
|
|
const client = new DataFactoryManagementClient(credential, subscriptionId);
|
|
const result = await client.triggers.createOrUpdate(
|
|
"exampleResourceGroup",
|
|
"exampleFactoryName",
|
|
"exampleTrigger",
|
|
{
|
|
properties: {
|
|
type: "ScheduleTrigger",
|
|
pipelines: [
|
|
{
|
|
parameters: { OutputBlobNameList: ["exampleoutput.csv"] },
|
|
pipelineReference: { type: "PipelineReference", referenceName: "examplePipeline" },
|
|
},
|
|
],
|
|
recurrence: {
|
|
endTime: new Date("2018-06-16T00:55:13.8441801Z"),
|
|
frequency: "Minute",
|
|
interval: 4,
|
|
startTime: new Date("2018-06-16T00:39:13.8441801Z"),
|
|
timeZone: "UTC",
|
|
},
|
|
},
|
|
},
|
|
);
|
|
console.log(result);
|
|
}
|
|
|
|
/**
|
|
* This sample demonstrates how to creates or updates a trigger.
|
|
*
|
|
* @summary creates or updates a trigger.
|
|
* x-ms-original-file: 2018-06-01/Triggers_Update.json
|
|
*/
|
|
async function triggersUpdate(): Promise<void> {
|
|
const credential = new DefaultAzureCredential();
|
|
const subscriptionId = "12345678-1234-1234-1234-123456789012";
|
|
const client = new DataFactoryManagementClient(credential, subscriptionId);
|
|
const result = await client.triggers.createOrUpdate(
|
|
"exampleResourceGroup",
|
|
"exampleFactoryName",
|
|
"exampleTrigger",
|
|
{
|
|
properties: {
|
|
type: "ScheduleTrigger",
|
|
description: "Example description",
|
|
pipelines: [
|
|
{
|
|
parameters: { OutputBlobNameList: ["exampleoutput.csv"] },
|
|
pipelineReference: { type: "PipelineReference", referenceName: "examplePipeline" },
|
|
},
|
|
],
|
|
recurrence: {
|
|
endTime: new Date("2018-06-16T00:55:14.905167Z"),
|
|
frequency: "Minute",
|
|
interval: 4,
|
|
startTime: new Date("2018-06-16T00:39:14.905167Z"),
|
|
timeZone: "UTC",
|
|
},
|
|
},
|
|
},
|
|
);
|
|
console.log(result);
|
|
}
|
|
|
|
async function main(): Promise<void> {
|
|
await triggersCreate();
|
|
await triggersUpdate();
|
|
}
|
|
|
|
main().catch(console.error);
|