Files

56 lines
2.7 KiB
TypeScript

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/**
* This sample demonstrates how to Lists all of the streaming jobs in the specified resource group.
*
* @summary Lists all of the streaming jobs in the specified resource group.
* x-ms-original-file: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/StreamingJob_List_ByResourceGroup_NoExpand.json
*/
import type { StreamingJobsListByResourceGroupOptionalParams } from "@azure/arm-streamanalytics";
import { StreamAnalyticsManagementClient } from "@azure/arm-streamanalytics";
import { DefaultAzureCredential } from "@azure/identity";
import "dotenv/config";
async function listAllStreamingJobsInAResourceGroupAndDoNotUseTheExpandODataQueryParameter(): Promise<void> {
const subscriptionId =
process.env["STREAMANALYTICS_SUBSCRIPTION_ID"] || "56b5e0a9-b645-407d-99b0-c64f86013e3d";
const resourceGroupName = process.env["STREAMANALYTICS_RESOURCE_GROUP"] || "sjrg6936";
const credential = new DefaultAzureCredential();
const client = new StreamAnalyticsManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (const item of client.streamingJobs.listByResourceGroup(resourceGroupName)) {
resArray.push(item);
}
console.log(resArray);
}
/**
* This sample demonstrates how to Lists all of the streaming jobs in the specified resource group.
*
* @summary Lists all of the streaming jobs in the specified resource group.
* x-ms-original-file: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/StreamingJob_List_ByResourceGroup_Expand.json
*/
async function listAllStreamingJobsInAResourceGroupAndUseTheExpandODataQueryParameterToExpandInputsOutputsTransformationAndFunctions(): Promise<void> {
const subscriptionId =
process.env["STREAMANALYTICS_SUBSCRIPTION_ID"] || "56b5e0a9-b645-407d-99b0-c64f86013e3d";
const expand = "inputs,outputs,transformation,functions";
const resourceGroupName = process.env["STREAMANALYTICS_RESOURCE_GROUP"] || "sjrg3276";
const options: StreamingJobsListByResourceGroupOptionalParams = { expand };
const credential = new DefaultAzureCredential();
const client = new StreamAnalyticsManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (const item of client.streamingJobs.listByResourceGroup(resourceGroupName, options)) {
resArray.push(item);
}
console.log(resArray);
}
async function main(): Promise<void> {
await listAllStreamingJobsInAResourceGroupAndDoNotUseTheExpandODataQueryParameter();
await listAllStreamingJobsInAResourceGroupAndUseTheExpandODataQueryParameterToExpandInputsOutputsTransformationAndFunctions();
}
main().catch(console.error);