// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.azure.streamanalytics;

import com.pulumi.azure.Utilities;
import com.pulumi.azure.streamanalytics.OutputCosmosdbArgs;
import com.pulumi.azure.streamanalytics.inputs.OutputCosmosdbState;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.String;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * Manages a Stream Analytics Output to CosmosDB.
 * 
 * ## Example Usage
 * ```java
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.streamanalytics.StreamanalyticsFunctions;
 * import com.pulumi.azure.streamanalytics.inputs.GetJobArgs;
 * import com.pulumi.azure.cosmosdb.Account;
 * import com.pulumi.azure.cosmosdb.AccountArgs;
 * import com.pulumi.azure.cosmosdb.inputs.AccountConsistencyPolicyArgs;
 * import com.pulumi.azure.cosmosdb.inputs.AccountGeoLocationArgs;
 * import com.pulumi.azure.cosmosdb.SqlDatabase;
 * import com.pulumi.azure.cosmosdb.SqlDatabaseArgs;
 * import com.pulumi.azure.cosmosdb.SqlContainer;
 * import com.pulumi.azure.cosmosdb.SqlContainerArgs;
 * import com.pulumi.azure.streamanalytics.OutputCosmosdb;
 * import com.pulumi.azure.streamanalytics.OutputCosmosdbArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * 
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 * 
 *     public static void stack(Context ctx) {
 *         var exampleResourceGroup = new ResourceGroup(&#34;exampleResourceGroup&#34;, ResourceGroupArgs.builder()        
 *             .location(&#34;West Europe&#34;)
 *             .build());
 * 
 *         final var exampleJob = StreamanalyticsFunctions.getJob(GetJobArgs.builder()
 *             .name(&#34;example-job&#34;)
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .build());
 * 
 *         var exampleAccount = new Account(&#34;exampleAccount&#34;, AccountArgs.builder()        
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .location(exampleResourceGroup.location())
 *             .offerType(&#34;Standard&#34;)
 *             .kind(&#34;GlobalDocumentDB&#34;)
 *             .consistencyPolicy(AccountConsistencyPolicyArgs.builder()
 *                 .consistencyLevel(&#34;BoundedStaleness&#34;)
 *                 .maxIntervalInSeconds(10)
 *                 .maxStalenessPrefix(200)
 *                 .build())
 *             .geoLocations(AccountGeoLocationArgs.builder()
 *                 .location(exampleResourceGroup.location())
 *                 .failoverPriority(0)
 *                 .build())
 *             .build());
 * 
 *         var exampleSqlDatabase = new SqlDatabase(&#34;exampleSqlDatabase&#34;, SqlDatabaseArgs.builder()        
 *             .resourceGroupName(exampleAccount.resourceGroupName())
 *             .accountName(exampleAccount.name())
 *             .throughput(400)
 *             .build());
 * 
 *         var exampleSqlContainer = new SqlContainer(&#34;exampleSqlContainer&#34;, SqlContainerArgs.builder()        
 *             .resourceGroupName(exampleAccount.resourceGroupName())
 *             .accountName(exampleAccount.name())
 *             .databaseName(exampleSqlDatabase.name())
 *             .partitionKeyPath(&#34;foo&#34;)
 *             .build());
 * 
 *         var exampleOutputCosmosdb = new OutputCosmosdb(&#34;exampleOutputCosmosdb&#34;, OutputCosmosdbArgs.builder()        
 *             .streamAnalyticsJobId(exampleJob.applyValue(getJobResult -&gt; getJobResult).applyValue(exampleJob -&gt; exampleJob.applyValue(getJobResult -&gt; getJobResult.id())))
 *             .cosmosdbAccountKey(exampleAccount.primaryKey())
 *             .cosmosdbSqlDatabaseId(exampleSqlDatabase.id())
 *             .containerName(exampleSqlContainer.name())
 *             .documentId(&#34;exampledocumentid&#34;)
 *             .build());
 * 
 *     }
 * }
 * ```
 * 
 * ## Import
 * 
 * Stream Analytics Outputs for CosmosDB can be imported using the `resource id`, e.g.
 * 
 * ```sh
 *  $ pulumi import azure:streamanalytics/outputCosmosdb:OutputCosmosdb example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.StreamAnalytics/streamingJobs/job1/outputs/output1
 * ```
 * 
 */
@ResourceType(type="azure:streamanalytics/outputCosmosdb:OutputCosmosdb")
public class OutputCosmosdb extends com.pulumi.resources.CustomResource {
    /**
     * The name of the CosmosDB container.
     * 
     */
    @Export(name="containerName", refs={String.class}, tree="[0]")
    private Output<String> containerName;

    /**
     * @return The name of the CosmosDB container.
     * 
     */
    public Output<String> containerName() {
        return this.containerName;
    }
    /**
     * The account key for the CosmosDB database.
     * 
     */
    @Export(name="cosmosdbAccountKey", refs={String.class}, tree="[0]")
    private Output<String> cosmosdbAccountKey;

    /**
     * @return The account key for the CosmosDB database.
     * 
     */
    public Output<String> cosmosdbAccountKey() {
        return this.cosmosdbAccountKey;
    }
    /**
     * The ID of the CosmosDB database.
     * 
     */
    @Export(name="cosmosdbSqlDatabaseId", refs={String.class}, tree="[0]")
    private Output<String> cosmosdbSqlDatabaseId;

    /**
     * @return The ID of the CosmosDB database.
     * 
     */
    public Output<String> cosmosdbSqlDatabaseId() {
        return this.cosmosdbSqlDatabaseId;
    }
    /**
     * The name of the field in output events used to specify the primary key which insert or update operations are based on.
     * 
     */
    @Export(name="documentId", refs={String.class}, tree="[0]")
    private Output</* @Nullable */ String> documentId;

    /**
     * @return The name of the field in output events used to specify the primary key which insert or update operations are based on.
     * 
     */
    public Output<Optional<String>> documentId() {
        return Codegen.optional(this.documentId);
    }
    /**
     * The name of the Stream Analytics Output. Changing this forces a new resource to be created.
     * 
     */
    @Export(name="name", refs={String.class}, tree="[0]")
    private Output<String> name;

    /**
     * @return The name of the Stream Analytics Output. Changing this forces a new resource to be created.
     * 
     */
    public Output<String> name() {
        return this.name;
    }
    /**
     * The name of the field in output events used to specify the key for partitioning output across collections. If `container_name` contains `{partition}` token, this property is required to be specified.
     * 
     */
    @Export(name="partitionKey", refs={String.class}, tree="[0]")
    private Output</* @Nullable */ String> partitionKey;

    /**
     * @return The name of the field in output events used to specify the key for partitioning output across collections. If `container_name` contains `{partition}` token, this property is required to be specified.
     * 
     */
    public Output<Optional<String>> partitionKey() {
        return Codegen.optional(this.partitionKey);
    }
    /**
     * The ID of the Stream Analytics Job. Changing this forces a new resource to be created.
     * 
     */
    @Export(name="streamAnalyticsJobId", refs={String.class}, tree="[0]")
    private Output<String> streamAnalyticsJobId;

    /**
     * @return The ID of the Stream Analytics Job. Changing this forces a new resource to be created.
     * 
     */
    public Output<String> streamAnalyticsJobId() {
        return this.streamAnalyticsJobId;
    }

    /**
     *
     * @param name The _unique_ name of the resulting resource.
     */
    public OutputCosmosdb(String name) {
        this(name, OutputCosmosdbArgs.Empty);
    }
    /**
     *
     * @param name The _unique_ name of the resulting resource.
     * @param args The arguments to use to populate this resource's properties.
     */
    public OutputCosmosdb(String name, OutputCosmosdbArgs args) {
        this(name, args, null);
    }
    /**
     *
     * @param name The _unique_ name of the resulting resource.
     * @param args The arguments to use to populate this resource's properties.
     * @param options A bag of options that control this resource's behavior.
     */
    public OutputCosmosdb(String name, OutputCosmosdbArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        super("azure:streamanalytics/outputCosmosdb:OutputCosmosdb", name, args == null ? OutputCosmosdbArgs.Empty : args, makeResourceOptions(options, Codegen.empty()));
    }

    private OutputCosmosdb(String name, Output<String> id, @Nullable OutputCosmosdbState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        super("azure:streamanalytics/outputCosmosdb:OutputCosmosdb", name, state, makeResourceOptions(options, id));
    }

    private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output<String> id) {
        var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder()
            .version(Utilities.getVersion())
            .additionalSecretOutputs(List.of(
                "cosmosdbAccountKey"
            ))
            .build();
        return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id);
    }

    /**
     * Get an existing Host resource's state with the given name, ID, and optional extra
     * properties used to qualify the lookup.
     *
     * @param name The _unique_ name of the resulting resource.
     * @param id The _unique_ provider ID of the resource to lookup.
     * @param state
     * @param options Optional settings to control the behavior of the CustomResource.
     */
    public static OutputCosmosdb get(String name, Output<String> id, @Nullable OutputCosmosdbState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        return new OutputCosmosdb(name, id, state, options);
    }
}
