All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.azure.connections.kotlin.ApiConnectionArgs.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.15.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.connections.kotlin

import com.pulumi.azure.connections.ApiConnectionArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Manages an API Connection.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const exampleResourceGroup = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const example = azure.connections.getManagedApiOutput({
 *     name: "servicebus",
 *     location: exampleResourceGroup.location,
 * });
 * const exampleNamespace = new azure.servicebus.Namespace("example", {
 *     name: "acctestsbn-conn-example",
 *     location: exampleResourceGroup.location,
 *     resourceGroupName: exampleResourceGroup.name,
 *     sku: "Basic",
 * });
 * const exampleApiConnection = new azure.connections.ApiConnection("example", {
 *     name: "example-connection",
 *     resourceGroupName: exampleResourceGroup.name,
 *     managedApiId: example.apply(example => example.id),
 *     displayName: "Example 1",
 *     parameterValues: {
 *         connectionString: exampleNamespace.defaultPrimaryConnectionString,
 *     },
 *     tags: {
 *         Hello: "World",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example_resource_group = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example = azure.connections.get_managed_api_output(name="servicebus",
 *     location=example_resource_group.location)
 * example_namespace = azure.servicebus.Namespace("example",
 *     name="acctestsbn-conn-example",
 *     location=example_resource_group.location,
 *     resource_group_name=example_resource_group.name,
 *     sku="Basic")
 * example_api_connection = azure.connections.ApiConnection("example",
 *     name="example-connection",
 *     resource_group_name=example_resource_group.name,
 *     managed_api_id=example.id,
 *     display_name="Example 1",
 *     parameter_values={
 *         "connectionString": example_namespace.default_primary_connection_string,
 *     },
 *     tags={
 *         "Hello": "World",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var exampleResourceGroup = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var example = Azure.Connections.GetManagedApi.Invoke(new()
 *     {
 *         Name = "servicebus",
 *         Location = exampleResourceGroup.Location,
 *     });
 *     var exampleNamespace = new Azure.ServiceBus.Namespace("example", new()
 *     {
 *         Name = "acctestsbn-conn-example",
 *         Location = exampleResourceGroup.Location,
 *         ResourceGroupName = exampleResourceGroup.Name,
 *         Sku = "Basic",
 *     });
 *     var exampleApiConnection = new Azure.Connections.ApiConnection("example", new()
 *     {
 *         Name = "example-connection",
 *         ResourceGroupName = exampleResourceGroup.Name,
 *         ManagedApiId = example.Apply(getManagedApiResult => getManagedApiResult.Id),
 *         DisplayName = "Example 1",
 *         ParameterValues =
 *         {
 *             { "connectionString", exampleNamespace.DefaultPrimaryConnectionString },
 *         },
 *         Tags =
 *         {
 *             { "Hello", "World" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/connections"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/servicebus"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		exampleResourceGroup, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		example := connections.GetManagedApiOutput(ctx, connections.GetManagedApiOutputArgs{
 * 			Name:     pulumi.String("servicebus"),
 * 			Location: exampleResourceGroup.Location,
 * 		}, nil)
 * 		exampleNamespace, err := servicebus.NewNamespace(ctx, "example", &servicebus.NamespaceArgs{
 * 			Name:              pulumi.String("acctestsbn-conn-example"),
 * 			Location:          exampleResourceGroup.Location,
 * 			ResourceGroupName: exampleResourceGroup.Name,
 * 			Sku:               pulumi.String("Basic"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = connections.NewApiConnection(ctx, "example", &connections.ApiConnectionArgs{
 * 			Name:              pulumi.String("example-connection"),
 * 			ResourceGroupName: exampleResourceGroup.Name,
 * 			ManagedApiId: example.ApplyT(func(example connections.GetManagedApiResult) (*string, error) {
 * 				return &example.Id, nil
 * 			}).(pulumi.StringPtrOutput),
 * 			DisplayName: pulumi.String("Example 1"),
 * 			ParameterValues: pulumi.StringMap{
 * 				"connectionString": exampleNamespace.DefaultPrimaryConnectionString,
 * 			},
 * 			Tags: pulumi.StringMap{
 * 				"Hello": pulumi.String("World"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```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("exampleResourceGroup", ResourceGroupArgs.builder()
 *             .name("example-resources")
 *             .location("West Europe")
 *             .build());
 *         final var example = ConnectionsFunctions.getManagedApi(GetManagedApiArgs.builder()
 *             .name("servicebus")
 *             .location(exampleResourceGroup.location())
 *             .build());
 *         var exampleNamespace = new Namespace("exampleNamespace", NamespaceArgs.builder()
 *             .name("acctestsbn-conn-example")
 *             .location(exampleResourceGroup.location())
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .sku("Basic")
 *             .build());
 *         var exampleApiConnection = new ApiConnection("exampleApiConnection", ApiConnectionArgs.builder()
 *             .name("example-connection")
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .managedApiId(example.applyValue(getManagedApiResult -> getManagedApiResult).applyValue(example -> example.applyValue(getManagedApiResult -> getManagedApiResult.id())))
 *             .displayName("Example 1")
 *             .parameterValues(Map.of("connectionString", exampleNamespace.defaultPrimaryConnectionString()))
 *             .tags(Map.of("Hello", "World"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   exampleResourceGroup:
 *     type: azure:core:ResourceGroup
 *     name: example
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleNamespace:
 *     type: azure:servicebus:Namespace
 *     name: example
 *     properties:
 *       name: acctestsbn-conn-example
 *       location: ${exampleResourceGroup.location}
 *       resourceGroupName: ${exampleResourceGroup.name}
 *       sku: Basic
 *   exampleApiConnection:
 *     type: azure:connections:ApiConnection
 *     name: example
 *     properties:
 *       name: example-connection
 *       resourceGroupName: ${exampleResourceGroup.name}
 *       managedApiId: ${example.id}
 *       displayName: Example 1
 *       parameterValues:
 *         connectionString: ${exampleNamespace.defaultPrimaryConnectionString}
 *       tags:
 *         Hello: World
 * variables:
 *   example:
 *     fn::invoke:
 *       Function: azure:connections:getManagedApi
 *       Arguments:
 *         name: servicebus
 *         location: ${exampleResourceGroup.location}
 * ```
 * 
 * ## 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
 * ```
 * @property displayName A display name for this API Connection. Changing this forces a new API Connection to be created.
 * @property managedApiId The ID of the Managed API which this API Connection is linked to. Changing this forces a new API Connection to be created.
 * @property name The Name which should be used for this API Connection. Changing this forces a new API Connection to be created.
 * @property parameterValues
 * @property resourceGroupName The name of the Resource Group where this API Connection should exist. Changing this forces a new API Connection to be created.
 * @property tags A mapping of tags which should be assigned to the API Connection.
 */
public data class ApiConnectionArgs(
    public val displayName: Output? = null,
    public val managedApiId: Output? = null,
    public val name: Output? = null,
    public val parameterValues: Output>? = null,
    public val resourceGroupName: Output? = null,
    public val tags: Output>? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.connections.ApiConnectionArgs =
        com.pulumi.azure.connections.ApiConnectionArgs.builder()
            .displayName(displayName?.applyValue({ args0 -> args0 }))
            .managedApiId(managedApiId?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .parameterValues(
                parameterValues?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.key.to(args0.value)
                    }).toMap()
                }),
            )
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .tags(
                tags?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.key.to(args0.value)
                    }).toMap()
                }),
            ).build()
}

/**
 * Builder for [ApiConnectionArgs].
 */
@PulumiTagMarker
public class ApiConnectionArgsBuilder internal constructor() {
    private var displayName: Output? = null

    private var managedApiId: Output? = null

    private var name: Output? = null

    private var parameterValues: Output>? = null

    private var resourceGroupName: Output? = null

    private var tags: Output>? = null

    /**
     * @param value A display name for this API Connection. Changing this forces a new API Connection to be created.
     */
    @JvmName("buwqthpgqrgrdpkk")
    public suspend fun displayName(`value`: Output) {
        this.displayName = value
    }

    /**
     * @param value The ID of the Managed API which this API Connection is linked to. Changing this forces a new API Connection to be created.
     */
    @JvmName("yhnpawbnfmosjqlp")
    public suspend fun managedApiId(`value`: Output) {
        this.managedApiId = value
    }

    /**
     * @param value The Name which should be used for this API Connection. Changing this forces a new API Connection to be created.
     */
    @JvmName("mgxsgifufrpgdbrt")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value
     */
    @JvmName("jsfiicutnrjisebg")
    public suspend fun parameterValues(`value`: Output>) {
        this.parameterValues = value
    }

    /**
     * @param value The name of the Resource Group where this API Connection should exist. Changing this forces a new API Connection to be created.
     */
    @JvmName("yjjuennsikfqovmr")
    public suspend fun resourceGroupName(`value`: Output) {
        this.resourceGroupName = value
    }

    /**
     * @param value A mapping of tags which should be assigned to the API Connection.
     */
    @JvmName("jvusuqxkuqmhbxod")
    public suspend fun tags(`value`: Output>) {
        this.tags = value
    }

    /**
     * @param value A display name for this API Connection. Changing this forces a new API Connection to be created.
     */
    @JvmName("lostkvoludxoqwjr")
    public suspend fun displayName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.displayName = mapped
    }

    /**
     * @param value The ID of the Managed API which this API Connection is linked to. Changing this forces a new API Connection to be created.
     */
    @JvmName("rjmkeintdhqcfojj")
    public suspend fun managedApiId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.managedApiId = mapped
    }

    /**
     * @param value The Name which should be used for this API Connection. Changing this forces a new API Connection to be created.
     */
    @JvmName("htoqsctgrqjwqdnx")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value
     */
    @JvmName("spiwunihuhybrlbv")
    public suspend fun parameterValues(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.parameterValues = mapped
    }

    /**
     * @param values
     */
    @JvmName("kctrgpmjqadnnnct")
    public fun parameterValues(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.parameterValues = mapped
    }

    /**
     * @param value The name of the Resource Group where this API Connection should exist. Changing this forces a new API Connection to be created.
     */
    @JvmName("gflfmxapvgvqomkt")
    public suspend fun resourceGroupName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupName = mapped
    }

    /**
     * @param value A mapping of tags which should be assigned to the API Connection.
     */
    @JvmName("avfdpxiybkrstyag")
    public suspend fun tags(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param values A mapping of tags which should be assigned to the API Connection.
     */
    @JvmName("tknaipmqmnsmfiwj")
    public fun tags(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    internal fun build(): ApiConnectionArgs = ApiConnectionArgs(
        displayName = displayName,
        managedApiId = managedApiId,
        name = name,
        parameterValues = parameterValues,
        resourceGroupName = resourceGroupName,
        tags = tags,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy