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

com.pulumi.azure.appservice.kotlin.HybridConnection.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.appservice.kotlin

import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit

/**
 * Builder for [HybridConnection].
 */
@PulumiTagMarker
public class HybridConnectionResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: HybridConnectionArgs = HybridConnectionArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend HybridConnectionArgsBuilder.() -> Unit) {
        val builder = HybridConnectionArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): HybridConnection {
        val builtJavaResource = com.pulumi.azure.appservice.HybridConnection(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return HybridConnection(builtJavaResource)
    }
}

/**
 * Manages an App Service Hybrid Connection for an existing App Service, Relay and Service Bus.
 * !> **NOTE:** This resource has been deprecated in version 5.0 of the provider and will be removed in version 6.0. Please use `azure.appservice.FunctionAppHybridConnection` resources instead.
 * ## Example Usage
 * This example provisions an App Service, a Relay Hybrid Connection, and a Service Bus using their outputs to create the App Service Hybrid Connection.
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "exampleResourceGroup1",
 *     location: "West Europe",
 * });
 * const examplePlan = new azure.appservice.Plan("example", {
 *     name: "exampleAppServicePlan1",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     sku: {
 *         tier: "Standard",
 *         size: "S1",
 *     },
 * });
 * const exampleAppService = new azure.appservice.AppService("example", {
 *     name: "exampleAppService1",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     appServicePlanId: examplePlan.id,
 * });
 * const exampleNamespace = new azure.relay.Namespace("example", {
 *     name: "exampleRN1",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     skuName: "Standard",
 * });
 * const exampleHybridConnection = new azure.relay.HybridConnection("example", {
 *     name: "exampleRHC1",
 *     resourceGroupName: example.name,
 *     relayNamespaceName: exampleNamespace.name,
 *     userMetadata: "examplemetadata",
 * });
 * const exampleHybridConnection2 = new azure.appservice.HybridConnection("example", {
 *     appServiceName: exampleAppService.name,
 *     resourceGroupName: example.name,
 *     relayId: exampleHybridConnection.id,
 *     hostname: "testhostname.example",
 *     port: 8080,
 *     sendKeyName: "exampleSharedAccessKey",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="exampleResourceGroup1",
 *     location="West Europe")
 * example_plan = azure.appservice.Plan("example",
 *     name="exampleAppServicePlan1",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     sku={
 *         "tier": "Standard",
 *         "size": "S1",
 *     })
 * example_app_service = azure.appservice.AppService("example",
 *     name="exampleAppService1",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     app_service_plan_id=example_plan.id)
 * example_namespace = azure.relay.Namespace("example",
 *     name="exampleRN1",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     sku_name="Standard")
 * example_hybrid_connection = azure.relay.HybridConnection("example",
 *     name="exampleRHC1",
 *     resource_group_name=example.name,
 *     relay_namespace_name=example_namespace.name,
 *     user_metadata="examplemetadata")
 * example_hybrid_connection2 = azure.appservice.HybridConnection("example",
 *     app_service_name=example_app_service.name,
 *     resource_group_name=example.name,
 *     relay_id=example_hybrid_connection.id,
 *     hostname="testhostname.example",
 *     port=8080,
 *     send_key_name="exampleSharedAccessKey")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "exampleResourceGroup1",
 *         Location = "West Europe",
 *     });
 *     var examplePlan = new Azure.AppService.Plan("example", new()
 *     {
 *         Name = "exampleAppServicePlan1",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         Sku = new Azure.AppService.Inputs.PlanSkuArgs
 *         {
 *             Tier = "Standard",
 *             Size = "S1",
 *         },
 *     });
 *     var exampleAppService = new Azure.AppService.AppService("example", new()
 *     {
 *         Name = "exampleAppService1",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         AppServicePlanId = examplePlan.Id,
 *     });
 *     var exampleNamespace = new Azure.Relay.Namespace("example", new()
 *     {
 *         Name = "exampleRN1",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         SkuName = "Standard",
 *     });
 *     var exampleHybridConnection = new Azure.Relay.HybridConnection("example", new()
 *     {
 *         Name = "exampleRHC1",
 *         ResourceGroupName = example.Name,
 *         RelayNamespaceName = exampleNamespace.Name,
 *         UserMetadata = "examplemetadata",
 *     });
 *     var exampleHybridConnection2 = new Azure.AppService.HybridConnection("example", new()
 *     {
 *         AppServiceName = exampleAppService.Name,
 *         ResourceGroupName = example.Name,
 *         RelayId = exampleHybridConnection.Id,
 *         Hostname = "testhostname.example",
 *         Port = 8080,
 *         SendKeyName = "exampleSharedAccessKey",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/appservice"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/relay"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("exampleResourceGroup1"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		examplePlan, err := appservice.NewPlan(ctx, "example", &appservice.PlanArgs{
 * 			Name:              pulumi.String("exampleAppServicePlan1"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			Sku: &appservice.PlanSkuArgs{
 * 				Tier: pulumi.String("Standard"),
 * 				Size: pulumi.String("S1"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleAppService, err := appservice.NewAppService(ctx, "example", &appservice.AppServiceArgs{
 * 			Name:              pulumi.String("exampleAppService1"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			AppServicePlanId:  examplePlan.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleNamespace, err := relay.NewNamespace(ctx, "example", &relay.NamespaceArgs{
 * 			Name:              pulumi.String("exampleRN1"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			SkuName:           pulumi.String("Standard"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleHybridConnection, err := relay.NewHybridConnection(ctx, "example", &relay.HybridConnectionArgs{
 * 			Name:               pulumi.String("exampleRHC1"),
 * 			ResourceGroupName:  example.Name,
 * 			RelayNamespaceName: exampleNamespace.Name,
 * 			UserMetadata:       pulumi.String("examplemetadata"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = appservice.NewHybridConnection(ctx, "example", &appservice.HybridConnectionArgs{
 * 			AppServiceName:    exampleAppService.Name,
 * 			ResourceGroupName: example.Name,
 * 			RelayId:           exampleHybridConnection.ID(),
 * 			Hostname:          pulumi.String("testhostname.example"),
 * 			Port:              pulumi.Int(8080),
 * 			SendKeyName:       pulumi.String("exampleSharedAccessKey"),
 * 		})
 * 		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.appservice.Plan;
 * import com.pulumi.azure.appservice.PlanArgs;
 * import com.pulumi.azure.appservice.inputs.PlanSkuArgs;
 * import com.pulumi.azure.appservice.AppService;
 * import com.pulumi.azure.appservice.AppServiceArgs;
 * import com.pulumi.azure.relay.Namespace;
 * import com.pulumi.azure.relay.NamespaceArgs;
 * import com.pulumi.azure.relay.HybridConnection;
 * import com.pulumi.azure.relay.HybridConnectionArgs;
 * import com.pulumi.azure.appservice.HybridConnection;
 * import com.pulumi.azure.appservice.HybridConnectionArgs;
 * 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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("exampleResourceGroup1")
 *             .location("West Europe")
 *             .build());
 *         var examplePlan = new Plan("examplePlan", PlanArgs.builder()
 *             .name("exampleAppServicePlan1")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .sku(PlanSkuArgs.builder()
 *                 .tier("Standard")
 *                 .size("S1")
 *                 .build())
 *             .build());
 *         var exampleAppService = new AppService("exampleAppService", AppServiceArgs.builder()
 *             .name("exampleAppService1")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .appServicePlanId(examplePlan.id())
 *             .build());
 *         var exampleNamespace = new Namespace("exampleNamespace", NamespaceArgs.builder()
 *             .name("exampleRN1")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .skuName("Standard")
 *             .build());
 *         var exampleHybridConnection = new HybridConnection("exampleHybridConnection", HybridConnectionArgs.builder()
 *             .name("exampleRHC1")
 *             .resourceGroupName(example.name())
 *             .relayNamespaceName(exampleNamespace.name())
 *             .userMetadata("examplemetadata")
 *             .build());
 *         var exampleHybridConnection2 = new HybridConnection("exampleHybridConnection2", HybridConnectionArgs.builder()
 *             .appServiceName(exampleAppService.name())
 *             .resourceGroupName(example.name())
 *             .relayId(exampleHybridConnection.id())
 *             .hostname("testhostname.example")
 *             .port(8080)
 *             .sendKeyName("exampleSharedAccessKey")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: exampleResourceGroup1
 *       location: West Europe
 *   examplePlan:
 *     type: azure:appservice:Plan
 *     name: example
 *     properties:
 *       name: exampleAppServicePlan1
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       sku:
 *         tier: Standard
 *         size: S1
 *   exampleAppService:
 *     type: azure:appservice:AppService
 *     name: example
 *     properties:
 *       name: exampleAppService1
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       appServicePlanId: ${examplePlan.id}
 *   exampleNamespace:
 *     type: azure:relay:Namespace
 *     name: example
 *     properties:
 *       name: exampleRN1
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       skuName: Standard
 *   exampleHybridConnection:
 *     type: azure:relay:HybridConnection
 *     name: example
 *     properties:
 *       name: exampleRHC1
 *       resourceGroupName: ${example.name}
 *       relayNamespaceName: ${exampleNamespace.name}
 *       userMetadata: examplemetadata
 *   exampleHybridConnection2:
 *     type: azure:appservice:HybridConnection
 *     name: example
 *     properties:
 *       appServiceName: ${exampleAppService.name}
 *       resourceGroupName: ${example.name}
 *       relayId: ${exampleHybridConnection.id}
 *       hostname: testhostname.example
 *       port: 8080
 *       sendKeyName: exampleSharedAccessKey
 * ```
 * 
 * ## Import
 * App Service Hybrid Connections can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:appservice/hybridConnection:HybridConnection example /subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/exampleResourceGroup1/providers/Microsoft.Web/sites/exampleAppService1/hybridConnectionNamespaces/exampleRN1/relays/exampleRHC1
 * ```
 */
public class HybridConnection internal constructor(
    override val javaResource: com.pulumi.azure.appservice.HybridConnection,
) : KotlinCustomResource(javaResource, HybridConnectionMapper) {
    /**
     * Specifies the name of the App Service. Changing this forces a new resource to be created.
     */
    public val appServiceName: Output
        get() = javaResource.appServiceName().applyValue({ args0 -> args0 })

    /**
     * The hostname of the endpoint.
     */
    public val hostname: Output
        get() = javaResource.hostname().applyValue({ args0 -> args0 })

    /**
     * The name of the Relay Namespace.
     */
    public val namespaceName: Output
        get() = javaResource.namespaceName().applyValue({ args0 -> args0 })

    /**
     * The port of the endpoint.
     */
    public val port: Output
        get() = javaResource.port().applyValue({ args0 -> args0 })

    /**
     * The ID of the Service Bus Relay. Changing this forces a new resource to be created.
     */
    public val relayId: Output
        get() = javaResource.relayId().applyValue({ args0 -> args0 })

    public val relayName: Output
        get() = javaResource.relayName().applyValue({ args0 -> args0 })

    /**
     * The name of the resource group in which to create the App Service. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * The name of the Service Bus key which has Send permissions. Defaults to `RootManageSharedAccessKey`.
     */
    public val sendKeyName: Output?
        get() = javaResource.sendKeyName().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The value of the Service Bus Primary Access key.
     */
    public val sendKeyValue: Output
        get() = javaResource.sendKeyValue().applyValue({ args0 -> args0 })

    /**
     * The name of the Service Bus namespace.
     */
    public val serviceBusNamespace: Output
        get() = javaResource.serviceBusNamespace().applyValue({ args0 -> args0 })

    /**
     * The suffix for the service bus endpoint.
     */
    public val serviceBusSuffix: Output
        get() = javaResource.serviceBusSuffix().applyValue({ args0 -> args0 })
}

public object HybridConnectionMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.appservice.HybridConnection::class == javaResource::class

    override fun map(javaResource: Resource): HybridConnection = HybridConnection(
        javaResource as
            com.pulumi.azure.appservice.HybridConnection,
    )
}

/**
 * @see [HybridConnection].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [HybridConnection].
 */
public suspend fun hybridConnection(
    name: String,
    block: suspend HybridConnectionResourceBuilder.() -> Unit,
): HybridConnection {
    val builder = HybridConnectionResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [HybridConnection].
 * @param name The _unique_ name of the resulting resource.
 */
public fun hybridConnection(name: String): HybridConnection {
    val builder = HybridConnectionResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy