mirror of
https://github.com/hanzoai/azure-sdk-for-js.git
synced 2026-10-30 19:51:51 +00:00
44 lines
1.5 KiB
TypeScript
44 lines
1.5 KiB
TypeScript
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT License.
|
|
|
|
/**
|
|
* This sample demonstrates how to Test the Stream Analytics output.
|
|
*
|
|
* @summary Test the Stream Analytics output.
|
|
* x-ms-original-file: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/Subscription_TestOutput.json
|
|
*/
|
|
|
|
import type { TestOutput } from "@azure/arm-streamanalytics";
|
|
import { StreamAnalyticsManagementClient } from "@azure/arm-streamanalytics";
|
|
import { DefaultAzureCredential } from "@azure/identity";
|
|
import "dotenv/config";
|
|
|
|
async function testTheStreamAnalyticsOutput(): Promise<void> {
|
|
const subscriptionId =
|
|
process.env["STREAMANALYTICS_SUBSCRIPTION_ID"] || "56b5e0a9-b645-407d-99b0-c64f86013e3d";
|
|
const location = "West US";
|
|
const testOutput: TestOutput = {
|
|
output: {
|
|
datasource: {
|
|
type: "Microsoft.Storage/Blob",
|
|
container: "state",
|
|
dateFormat: "yyyy/MM/dd",
|
|
pathPattern: "{date}/{time}",
|
|
storageAccounts: [{ accountKey: "accountKey==", accountName: "someAccountName" }],
|
|
timeFormat: "HH",
|
|
},
|
|
serialization: { type: "Csv", encoding: "UTF8", fieldDelimiter: "," },
|
|
},
|
|
};
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new StreamAnalyticsManagementClient(credential, subscriptionId);
|
|
const result = await client.subscriptions.beginTestOutputAndWait(location, testOutput);
|
|
console.log(result);
|
|
}
|
|
|
|
async function main(): Promise<void> {
|
|
await testTheStreamAnalyticsOutput();
|
|
}
|
|
|
|
main().catch(console.error);
|