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

package com.azure.resourcemanager.timeseriesinsights.generated;

import com.azure.resourcemanager.timeseriesinsights.models.Gen1EnvironmentCreateOrUpdateParameters;
import com.azure.resourcemanager.timeseriesinsights.models.PropertyType;
import com.azure.resourcemanager.timeseriesinsights.models.Sku;
import com.azure.resourcemanager.timeseriesinsights.models.SkuName;
import com.azure.resourcemanager.timeseriesinsights.models.TimeSeriesIdProperty;
import java.time.Duration;
import java.util.Arrays;

/** Samples for Environments CreateOrUpdate. */
public final class EnvironmentsCreateOrUpdateSamples {
    /*
     * x-ms-original-file: specification/timeseriesinsights/resource-manager/Microsoft.TimeSeriesInsights/stable/2020-05-15/examples/EnvironmentsCreate.json
     */
    /**
     * Sample code: EnvironmentsCreate.
     *
     * @param manager Entry point to TimeSeriesInsightsManager.
     */
    public static void environmentsCreate(
        com.azure.resourcemanager.timeseriesinsights.TimeSeriesInsightsManager manager) {
        manager
            .environments()
            .createOrUpdate(
                "rg1",
                "env1",
                new Gen1EnvironmentCreateOrUpdateParameters()
                    .withLocation("West US")
                    .withSku(new Sku().withName(SkuName.S1).withCapacity(1))
                    .withDataRetentionTime(Duration.parse("P31D"))
                    .withPartitionKeyProperties(
                        Arrays.asList(new TimeSeriesIdProperty().withName("DeviceId1").withType(PropertyType.STRING))),
                com.azure.core.util.Context.NONE);
    }
}
