// *** 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.connections;

import com.pulumi.azure.Utilities;
import com.pulumi.azure.connections.ApiConnectionArgs;
import com.pulumi.azure.connections.inputs.ApiConnectionState;
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.Map;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * Manages an API Connection.
 * 
 * ## 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.connections.ConnectionsFunctions;
 * import com.pulumi.azure.connections.inputs.GetManagedApiArgs;
 * import com.pulumi.azure.servicebus.Namespace;
 * import com.pulumi.azure.servicebus.NamespaceArgs;
 * import com.pulumi.azure.connections.ApiConnection;
 * import com.pulumi.azure.connections.ApiConnectionArgs;
 * 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 exampleManagedApi = ConnectionsFunctions.getManagedApi(GetManagedApiArgs.builder()
 *             .name(&#34;servicebus&#34;)
 *             .location(exampleResourceGroup.location())
 *             .build());
 * 
 *         var exampleNamespace = new Namespace(&#34;exampleNamespace&#34;, NamespaceArgs.builder()        
 *             .location(exampleResourceGroup.location())
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .sku(&#34;Basic&#34;)
 *             .build());
 * 
 *         var exampleApiConnection = new ApiConnection(&#34;exampleApiConnection&#34;, ApiConnectionArgs.builder()        
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .managedApiId(exampleManagedApi.applyValue(getManagedApiResult -&gt; getManagedApiResult).applyValue(exampleManagedApi -&gt; exampleManagedApi.applyValue(getManagedApiResult -&gt; getManagedApiResult.id())))
 *             .displayName(&#34;Example 1&#34;)
 *             .parameterValues(Map.of(&#34;connectionString&#34;, exampleNamespace.defaultPrimaryConnectionString()))
 *             .tags(Map.of(&#34;Hello&#34;, &#34;World&#34;))
 *             .build());
 * 
 *     }
 * }
 * ```
 * 
 * ## Import
 * 
 * API Connections can be imported using the `resource id`, e.g.
 * 
 * ```sh
 *  $ pulumi import azure:connections/apiConnection:ApiConnection example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example/providers/Microsoft.Web/connections/example-connection
 * ```
 * 
 */
@ResourceType(type="azure:connections/apiConnection:ApiConnection")
public class ApiConnection extends com.pulumi.resources.CustomResource {
    /**
     * A display name for this API Connection. Changing this forces a new API Connection to be created.
     * 
     */
    @Export(name="displayName", refs={String.class}, tree="[0]")
    private Output<String> displayName;

    /**
     * @return A display name for this API Connection. Changing this forces a new API Connection to be created.
     * 
     */
    public Output<String> displayName() {
        return this.displayName;
    }
    /**
     * The ID of the Managed API which this API Connection is linked to. Changing this forces a new API Connection to be created.
     * 
     */
    @Export(name="managedApiId", refs={String.class}, tree="[0]")
    private Output<String> managedApiId;

    /**
     * @return The ID of the Managed API which this API Connection is linked to. Changing this forces a new API Connection to be created.
     * 
     */
    public Output<String> managedApiId() {
        return this.managedApiId;
    }
    /**
     * The Name which should be used for this API Connection. Changing this forces a new API Connection to be created.
     * 
     */
    @Export(name="name", refs={String.class}, tree="[0]")
    private Output<String> name;

    /**
     * @return The Name which should be used for this API Connection. Changing this forces a new API Connection to be created.
     * 
     */
    public Output<String> name() {
        return this.name;
    }
    @Export(name="parameterValues", refs={Map.class,String.class}, tree="[0,1,1]")
    private Output</* @Nullable */ Map<String,String>> parameterValues;

    public Output<Optional<Map<String,String>>> parameterValues() {
        return Codegen.optional(this.parameterValues);
    }
    /**
     * The name of the Resource Group where this API Connection should exist. Changing this forces a new API Connection to be created.
     * 
     */
    @Export(name="resourceGroupName", refs={String.class}, tree="[0]")
    private Output<String> resourceGroupName;

    /**
     * @return The name of the Resource Group where this API Connection should exist. Changing this forces a new API Connection to be created.
     * 
     */
    public Output<String> resourceGroupName() {
        return this.resourceGroupName;
    }
    /**
     * A mapping of tags which should be assigned to the API Connection.
     * 
     */
    @Export(name="tags", refs={Map.class,String.class}, tree="[0,1,1]")
    private Output</* @Nullable */ Map<String,String>> tags;

    /**
     * @return A mapping of tags which should be assigned to the API Connection.
     * 
     */
    public Output<Optional<Map<String,String>>> tags() {
        return Codegen.optional(this.tags);
    }

    /**
     *
     * @param name The _unique_ name of the resulting resource.
     */
    public ApiConnection(String name) {
        this(name, ApiConnectionArgs.Empty);
    }
    /**
     *
     * @param name The _unique_ name of the resulting resource.
     * @param args The arguments to use to populate this resource's properties.
     */
    public ApiConnection(String name, ApiConnectionArgs 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 ApiConnection(String name, ApiConnectionArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        super("azure:connections/apiConnection:ApiConnection", name, args == null ? ApiConnectionArgs.Empty : args, makeResourceOptions(options, Codegen.empty()));
    }

    private ApiConnection(String name, Output<String> id, @Nullable ApiConnectionState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        super("azure:connections/apiConnection:ApiConnection", 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())
            .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 ApiConnection get(String name, Output<String> id, @Nullable ApiConnectionState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        return new ApiConnection(name, id, state, options);
    }
}
