Files

127 lines
6.2 KiB
TypeScript

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/**
* This sample demonstrates how to Updates an existing input under an existing streaming job. This can be used to partially update (ie. update one or two properties) an input without affecting the rest the job or input definition.
*
* @summary Updates an existing input under an existing streaming job. This can be used to partially update (ie. update one or two properties) an input without affecting the rest the job or input definition.
* x-ms-original-file: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/Input_Update_Reference_Blob.json
*/
import type { Input } from "@azure/arm-streamanalytics";
import { StreamAnalyticsManagementClient } from "@azure/arm-streamanalytics";
import { DefaultAzureCredential } from "@azure/identity";
import "dotenv/config";
async function updateAReferenceBlobInput(): Promise<void> {
const subscriptionId =
process.env["STREAMANALYTICS_SUBSCRIPTION_ID"] || "56b5e0a9-b645-407d-99b0-c64f86013e3d";
const resourceGroupName = process.env["STREAMANALYTICS_RESOURCE_GROUP"] || "sjrg8440";
const jobName = "sj9597";
const inputName = "input7225";
const input: Input = {
properties: {
type: "Reference",
datasource: {
type: "Microsoft.Storage/Blob",
container: "differentContainer",
},
serialization: { type: "Csv", encoding: "UTF8", fieldDelimiter: "|" },
},
};
const credential = new DefaultAzureCredential();
const client = new StreamAnalyticsManagementClient(credential, subscriptionId);
const result = await client.inputs.update(resourceGroupName, jobName, inputName, input);
console.log(result);
}
/**
* This sample demonstrates how to Updates an existing input under an existing streaming job. This can be used to partially update (ie. update one or two properties) an input without affecting the rest the job or input definition.
*
* @summary Updates an existing input under an existing streaming job. This can be used to partially update (ie. update one or two properties) an input without affecting the rest the job or input definition.
* x-ms-original-file: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/Input_Update_Stream_EventHub.json
*/
async function updateAStreamEventHubInput(): Promise<void> {
const subscriptionId =
process.env["STREAMANALYTICS_SUBSCRIPTION_ID"] || "56b5e0a9-b645-407d-99b0-c64f86013e3d";
const resourceGroupName = process.env["STREAMANALYTICS_RESOURCE_GROUP"] || "sjrg3139";
const jobName = "sj197";
const inputName = "input7425";
const input: Input = {
properties: {
type: "Stream",
datasource: {
type: "Microsoft.ServiceBus/EventHub",
consumerGroupName: "differentConsumerGroupName",
},
serialization: { type: "Avro" },
},
};
const credential = new DefaultAzureCredential();
const client = new StreamAnalyticsManagementClient(credential, subscriptionId);
const result = await client.inputs.update(resourceGroupName, jobName, inputName, input);
console.log(result);
}
/**
* This sample demonstrates how to Updates an existing input under an existing streaming job. This can be used to partially update (ie. update one or two properties) an input without affecting the rest the job or input definition.
*
* @summary Updates an existing input under an existing streaming job. This can be used to partially update (ie. update one or two properties) an input without affecting the rest the job or input definition.
* x-ms-original-file: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/Input_Update_Stream_IoTHub.json
*/
async function updateAStreamIoTHubInput(): Promise<void> {
const subscriptionId =
process.env["STREAMANALYTICS_SUBSCRIPTION_ID"] || "56b5e0a9-b645-407d-99b0-c64f86013e3d";
const resourceGroupName = process.env["STREAMANALYTICS_RESOURCE_GROUP"] || "sjrg3467";
const jobName = "sj9742";
const inputName = "input7970";
const input: Input = {
properties: {
type: "Stream",
datasource: {
type: "Microsoft.Devices/IotHubs",
endpoint: "messages/operationsMonitoringEvents",
},
serialization: { type: "Csv", encoding: "UTF8", fieldDelimiter: "|" },
},
};
const credential = new DefaultAzureCredential();
const client = new StreamAnalyticsManagementClient(credential, subscriptionId);
const result = await client.inputs.update(resourceGroupName, jobName, inputName, input);
console.log(result);
}
/**
* This sample demonstrates how to Updates an existing input under an existing streaming job. This can be used to partially update (ie. update one or two properties) an input without affecting the rest the job or input definition.
*
* @summary Updates an existing input under an existing streaming job. This can be used to partially update (ie. update one or two properties) an input without affecting the rest the job or input definition.
* x-ms-original-file: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/Input_Update_Stream_Blob.json
*/
async function updateAStreamBlobInput(): Promise<void> {
const subscriptionId =
process.env["STREAMANALYTICS_SUBSCRIPTION_ID"] || "56b5e0a9-b645-407d-99b0-c64f86013e3d";
const resourceGroupName = process.env["STREAMANALYTICS_RESOURCE_GROUP"] || "sjrg8161";
const jobName = "sj6695";
const inputName = "input8899";
const input: Input = {
properties: {
type: "Stream",
datasource: { type: "Microsoft.Storage/Blob", sourcePartitionCount: 32 },
serialization: { type: "Csv", encoding: "UTF8", fieldDelimiter: "|" },
},
};
const credential = new DefaultAzureCredential();
const client = new StreamAnalyticsManagementClient(credential, subscriptionId);
const result = await client.inputs.update(resourceGroupName, jobName, inputName, input);
console.log(result);
}
async function main(): Promise<void> {
await updateAReferenceBlobInput();
await updateAStreamEventHubInput();
await updateAStreamIoTHubInput();
await updateAStreamBlobInput();
}
main().catch(console.error);