// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.streamanalytics.generated;

import com.azure.core.util.Context;
import com.azure.resourcemanager.streamanalytics.models.AvroSerialization;
import com.azure.resourcemanager.streamanalytics.models.BlobReferenceInputDataSource;
import com.azure.resourcemanager.streamanalytics.models.BlobStreamInputDataSource;
import com.azure.resourcemanager.streamanalytics.models.CsvSerialization;
import com.azure.resourcemanager.streamanalytics.models.Encoding;
import com.azure.resourcemanager.streamanalytics.models.EventHubStreamInputDataSource;
import com.azure.resourcemanager.streamanalytics.models.Input;
import com.azure.resourcemanager.streamanalytics.models.IoTHubStreamInputDataSource;
import com.azure.resourcemanager.streamanalytics.models.ReferenceInputProperties;
import com.azure.resourcemanager.streamanalytics.models.StreamInputProperties;

/** Samples for Inputs Update. */
public final class InputsUpdateSamples {
    /*
     * x-ms-original-file: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/stable/2020-03-01/examples/Input_Update_Stream_IoTHub.json
     */
    /**
     * Sample code: Update a stream IoT Hub input.
     *
     * @param manager Entry point to StreamAnalyticsManager.
     */
    public static void updateAStreamIoTHubInput(
        com.azure.resourcemanager.streamanalytics.StreamAnalyticsManager manager) {
        Input resource = manager.inputs().getWithResponse("sjrg3467", "sj9742", "input7970", Context.NONE).getValue();
        resource
            .update()
            .withProperties(
                new StreamInputProperties()
                    .withSerialization(new CsvSerialization().withFieldDelimiter("|").withEncoding(Encoding.UTF8))
                    .withDatasource(
                        new IoTHubStreamInputDataSource().withEndpoint("messages/operationsMonitoringEvents")))
            .apply();
    }

    /*
     * x-ms-original-file: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/stable/2020-03-01/examples/Input_Update_Reference_Blob.json
     */
    /**
     * Sample code: Update a reference blob input.
     *
     * @param manager Entry point to StreamAnalyticsManager.
     */
    public static void updateAReferenceBlobInput(
        com.azure.resourcemanager.streamanalytics.StreamAnalyticsManager manager) {
        Input resource = manager.inputs().getWithResponse("sjrg8440", "sj9597", "input7225", Context.NONE).getValue();
        resource
            .update()
            .withProperties(
                new ReferenceInputProperties()
                    .withSerialization(new CsvSerialization().withFieldDelimiter("|").withEncoding(Encoding.UTF8))
                    .withDatasource(new BlobReferenceInputDataSource()))
            .apply();
    }

    /*
     * x-ms-original-file: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/stable/2020-03-01/examples/Input_Update_Stream_EventHub.json
     */
    /**
     * Sample code: Update a stream Event Hub input.
     *
     * @param manager Entry point to StreamAnalyticsManager.
     */
    public static void updateAStreamEventHubInput(
        com.azure.resourcemanager.streamanalytics.StreamAnalyticsManager manager) {
        Input resource = manager.inputs().getWithResponse("sjrg3139", "sj197", "input7425", Context.NONE).getValue();
        resource
            .update()
            .withProperties(
                new StreamInputProperties()
                    .withSerialization(new AvroSerialization())
                    .withDatasource(
                        new EventHubStreamInputDataSource().withConsumerGroupName("differentConsumerGroupName")))
            .apply();
    }

    /*
     * x-ms-original-file: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/stable/2020-03-01/examples/Input_Update_Stream_Blob.json
     */
    /**
     * Sample code: Update a stream blob input.
     *
     * @param manager Entry point to StreamAnalyticsManager.
     */
    public static void updateAStreamBlobInput(
        com.azure.resourcemanager.streamanalytics.StreamAnalyticsManager manager) {
        Input resource = manager.inputs().getWithResponse("sjrg8161", "sj6695", "input8899", Context.NONE).getValue();
        resource
            .update()
            .withProperties(
                new StreamInputProperties()
                    .withSerialization(new CsvSerialization().withFieldDelimiter("|").withEncoding(Encoding.UTF8))
                    .withDatasource(new BlobStreamInputDataSource().withSourcePartitionCount(32)))
            .apply();
    }
}
