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

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

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

package com.pulumi.azure.appservice.kotlin

import com.pulumi.azure.appservice.kotlin.outputs.WindowsWebAppAuthSettings
import com.pulumi.azure.appservice.kotlin.outputs.WindowsWebAppAuthSettingsV2
import com.pulumi.azure.appservice.kotlin.outputs.WindowsWebAppBackup
import com.pulumi.azure.appservice.kotlin.outputs.WindowsWebAppConnectionString
import com.pulumi.azure.appservice.kotlin.outputs.WindowsWebAppIdentity
import com.pulumi.azure.appservice.kotlin.outputs.WindowsWebAppLogs
import com.pulumi.azure.appservice.kotlin.outputs.WindowsWebAppSiteConfig
import com.pulumi.azure.appservice.kotlin.outputs.WindowsWebAppSiteCredential
import com.pulumi.azure.appservice.kotlin.outputs.WindowsWebAppStickySettings
import com.pulumi.azure.appservice.kotlin.outputs.WindowsWebAppStorageAccount
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.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.azure.appservice.kotlin.outputs.WindowsWebAppAuthSettings.Companion.toKotlin as windowsWebAppAuthSettingsToKotlin
import com.pulumi.azure.appservice.kotlin.outputs.WindowsWebAppAuthSettingsV2.Companion.toKotlin as windowsWebAppAuthSettingsV2ToKotlin
import com.pulumi.azure.appservice.kotlin.outputs.WindowsWebAppBackup.Companion.toKotlin as windowsWebAppBackupToKotlin
import com.pulumi.azure.appservice.kotlin.outputs.WindowsWebAppConnectionString.Companion.toKotlin as windowsWebAppConnectionStringToKotlin
import com.pulumi.azure.appservice.kotlin.outputs.WindowsWebAppIdentity.Companion.toKotlin as windowsWebAppIdentityToKotlin
import com.pulumi.azure.appservice.kotlin.outputs.WindowsWebAppLogs.Companion.toKotlin as windowsWebAppLogsToKotlin
import com.pulumi.azure.appservice.kotlin.outputs.WindowsWebAppSiteConfig.Companion.toKotlin as windowsWebAppSiteConfigToKotlin
import com.pulumi.azure.appservice.kotlin.outputs.WindowsWebAppSiteCredential.Companion.toKotlin as windowsWebAppSiteCredentialToKotlin
import com.pulumi.azure.appservice.kotlin.outputs.WindowsWebAppStickySettings.Companion.toKotlin as windowsWebAppStickySettingsToKotlin
import com.pulumi.azure.appservice.kotlin.outputs.WindowsWebAppStorageAccount.Companion.toKotlin as windowsWebAppStorageAccountToKotlin

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

    public var args: WindowsWebAppArgs = WindowsWebAppArgs()

    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 WindowsWebAppArgsBuilder.() -> Unit) {
        val builder = WindowsWebAppArgsBuilder()
        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(): WindowsWebApp {
        val builtJavaResource = com.pulumi.azure.appservice.WindowsWebApp(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return WindowsWebApp(builtJavaResource)
    }
}

/**
 * Manages a Windows Web App.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleServicePlan = new azure.appservice.ServicePlan("example", {
 *     name: "example",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     skuName: "P1v2",
 *     osType: "Windows",
 * });
 * const exampleWindowsWebApp = new azure.appservice.WindowsWebApp("example", {
 *     name: "example",
 *     resourceGroupName: example.name,
 *     location: exampleServicePlan.location,
 *     servicePlanId: exampleServicePlan.id,
 *     siteConfig: {},
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_service_plan = azure.appservice.ServicePlan("example",
 *     name="example",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     sku_name="P1v2",
 *     os_type="Windows")
 * example_windows_web_app = azure.appservice.WindowsWebApp("example",
 *     name="example",
 *     resource_group_name=example.name,
 *     location=example_service_plan.location,
 *     service_plan_id=example_service_plan.id,
 *     site_config={})
 * ```
 * ```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 = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleServicePlan = new Azure.AppService.ServicePlan("example", new()
 *     {
 *         Name = "example",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         SkuName = "P1v2",
 *         OsType = "Windows",
 *     });
 *     var exampleWindowsWebApp = new Azure.AppService.WindowsWebApp("example", new()
 *     {
 *         Name = "example",
 *         ResourceGroupName = example.Name,
 *         Location = exampleServicePlan.Location,
 *         ServicePlanId = exampleServicePlan.Id,
 *         SiteConfig = null,
 *     });
 * });
 * ```
 * ```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/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleServicePlan, err := appservice.NewServicePlan(ctx, "example", &appservice.ServicePlanArgs{
 * 			Name:              pulumi.String("example"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 			SkuName:           pulumi.String("P1v2"),
 * 			OsType:            pulumi.String("Windows"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = appservice.NewWindowsWebApp(ctx, "example", &appservice.WindowsWebAppArgs{
 * 			Name:              pulumi.String("example"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          exampleServicePlan.Location,
 * 			ServicePlanId:     exampleServicePlan.ID(),
 * 			SiteConfig:        nil,
 * 		})
 * 		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.ServicePlan;
 * import com.pulumi.azure.appservice.ServicePlanArgs;
 * import com.pulumi.azure.appservice.WindowsWebApp;
 * import com.pulumi.azure.appservice.WindowsWebAppArgs;
 * import com.pulumi.azure.appservice.inputs.WindowsWebAppSiteConfigArgs;
 * 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("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleServicePlan = new ServicePlan("exampleServicePlan", ServicePlanArgs.builder()
 *             .name("example")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .skuName("P1v2")
 *             .osType("Windows")
 *             .build());
 *         var exampleWindowsWebApp = new WindowsWebApp("exampleWindowsWebApp", WindowsWebAppArgs.builder()
 *             .name("example")
 *             .resourceGroupName(example.name())
 *             .location(exampleServicePlan.location())
 *             .servicePlanId(exampleServicePlan.id())
 *             .siteConfig()
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleServicePlan:
 *     type: azure:appservice:ServicePlan
 *     name: example
 *     properties:
 *       name: example
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       skuName: P1v2
 *       osType: Windows
 *   exampleWindowsWebApp:
 *     type: azure:appservice:WindowsWebApp
 *     name: example
 *     properties:
 *       name: example
 *       resourceGroupName: ${example.name}
 *       location: ${exampleServicePlan.location}
 *       servicePlanId: ${exampleServicePlan.id}
 *       siteConfig: {}
 * ```
 * 
 * ## Import
 * Windows Web Apps can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:appservice/windowsWebApp:WindowsWebApp example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Web/sites/site1
 * ```
 */
public class WindowsWebApp internal constructor(
    override val javaResource: com.pulumi.azure.appservice.WindowsWebApp,
) : KotlinCustomResource(javaResource, WindowsWebAppMapper) {
    /**
     * A map of key-value pairs of App Settings.
     */
    public val appSettings: Output>?
        get() = javaResource.appSettings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * An `auth_settings` block as defined below.
     */
    public val authSettings: Output?
        get() = javaResource.authSettings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    windowsWebAppAuthSettingsToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * An `auth_settings_v2` block as defined below.
     */
    public val authSettingsV2: Output?
        get() = javaResource.authSettingsV2().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> windowsWebAppAuthSettingsV2ToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * A `backup` block as defined below.
     */
    public val backup: Output?
        get() = javaResource.backup().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    windowsWebAppBackupToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Should Client Affinity be enabled?
     */
    public val clientAffinityEnabled: Output?
        get() = javaResource.clientAffinityEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Should Client Certificates be enabled?
     */
    public val clientCertificateEnabled: Output?
        get() = javaResource.clientCertificateEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Paths to exclude when using client certificates, separated by ;
     */
    public val clientCertificateExclusionPaths: Output?
        get() = javaResource.clientCertificateExclusionPaths().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The Client Certificate mode. Possible values are `Required`, `Optional`, and `OptionalInteractiveUser`. This property has no effect when `client_cert_enabled` is `false`. Defaults to `Required`.
     */
    public val clientCertificateMode: Output?
        get() = javaResource.clientCertificateMode().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * One or more `connection_string` blocks as defined below.
     */
    public val connectionStrings: Output>?
        get() = javaResource.connectionStrings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        windowsWebAppConnectionStringToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * The identifier used by App Service to perform domain ownership verification via DNS TXT record.
     */
    public val customDomainVerificationId: Output
        get() = javaResource.customDomainVerificationId().applyValue({ args0 -> args0 })

    /**
     * The default hostname of the Windows Web App.
     */
    public val defaultHostname: Output
        get() = javaResource.defaultHostname().applyValue({ args0 -> args0 })

    /**
     * Should the Windows Web App be enabled? Defaults to `true`.
     */
    public val enabled: Output?
        get() = javaResource.enabled().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Should the default FTP Basic Authentication publishing profile be enabled. Defaults to `true`.
     */
    public val ftpPublishBasicAuthenticationEnabled: Output?
        get() = javaResource.ftpPublishBasicAuthenticationEnabled().applyValue({ args0 ->
            args0.map({ args0 -> args0 }).orElse(null)
        })

    /**
     * The ID of the App Service Environment used by App Service.
     */
    public val hostingEnvironmentId: Output
        get() = javaResource.hostingEnvironmentId().applyValue({ args0 -> args0 })

    /**
     * Should the Windows Web App require HTTPS connections. Defaults to `false`.
     */
    public val httpsOnly: Output?
        get() = javaResource.httpsOnly().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * An `identity` block as defined below.
     */
    public val identity: Output?
        get() = javaResource.identity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    windowsWebAppIdentityToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The User Assigned Identity ID used for accessing KeyVault secrets. The identity must be assigned to the application in the `identity` block. [For more information see - Access vaults with a user-assigned identity](https://docs.microsoft.com/azure/app-service/app-service-key-vault-references#access-vaults-with-a-user-assigned-identity)
     */
    public val keyVaultReferenceIdentityId: Output
        get() = javaResource.keyVaultReferenceIdentityId().applyValue({ args0 -> args0 })

    /**
     * The Kind value for this Windows Web App.
     */
    public val kind: Output
        get() = javaResource.kind().applyValue({ args0 -> args0 })

    /**
     * The Azure Region where the Windows Web App should exist. Changing this forces a new Windows Web App to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * A `logs` block as defined below.
     */
    public val logs: Output?
        get() = javaResource.logs().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    windowsWebAppLogsToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The name which should be used for this Windows Web App. Changing this forces a new Windows Web App to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * A list of outbound IP addresses - such as `["52.23.25.3", "52.143.43.12"]`
     */
    public val outboundIpAddressLists: Output>
        get() = javaResource.outboundIpAddressLists().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * A comma separated list of outbound IP addresses - such as `52.23.25.3,52.143.43.12`.
     */
    public val outboundIpAddresses: Output
        get() = javaResource.outboundIpAddresses().applyValue({ args0 -> args0 })

    /**
     * A list of possible outbound ip address.
     */
    public val possibleOutboundIpAddressLists: Output>
        get() = javaResource.possibleOutboundIpAddressLists().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            })
        })

    /**
     * A comma separated list of outbound IP addresses - such as `52.23.25.3,52.143.43.12,52.143.43.17` - not all of which are necessarily in use. Superset of `outbound_ip_addresses`.
     */
    public val possibleOutboundIpAddresses: Output
        get() = javaResource.possibleOutboundIpAddresses().applyValue({ args0 -> args0 })

    /**
     * Should public network access be enabled for the Web App. Defaults to `true`.
     */
    public val publicNetworkAccessEnabled: Output?
        get() = javaResource.publicNetworkAccessEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the Resource Group where the Windows Web App should exist. Changing this forces a new Windows Web App to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * The ID of the Service Plan that this Windows App Service will be created in.
     */
    public val servicePlanId: Output
        get() = javaResource.servicePlanId().applyValue({ args0 -> args0 })

    /**
     * A `site_config` block as defined below.
     */
    public val siteConfig: Output
        get() = javaResource.siteConfig().applyValue({ args0 ->
            args0.let({ args0 ->
                windowsWebAppSiteConfigToKotlin(args0)
            })
        })

    /**
     * A `site_credential` block as defined below.
     */
    public val siteCredentials: Output>
        get() = javaResource.siteCredentials().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> windowsWebAppSiteCredentialToKotlin(args0) })
            })
        })

    /**
     * A `sticky_settings` block as defined below.
     */
    public val stickySettings: Output?
        get() = javaResource.stickySettings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> windowsWebAppStickySettingsToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * One or more `storage_account` blocks as defined below.
     * > **Note:** Using this value requires `WEBSITE_RUN_FROM_PACKAGE=1` to be set on the App in `app_settings`. Refer to the [Azure docs](https://docs.microsoft.com/en-us/azure/app-service/deploy-run-package) for further details.
     */
    public val storageAccounts: Output>?
        get() = javaResource.storageAccounts().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        windowsWebAppStorageAccountToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * A mapping of tags which should be assigned to the Windows Web App.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    public val virtualNetworkSubnetId: Output?
        get() = javaResource.virtualNetworkSubnetId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Should the default WebDeploy Basic Authentication publishing credentials enabled. Defaults to `true`.
     * > **NOTE:** Setting this value to true will disable the ability to use `zip_deploy_file` which currently relies on the default publishing profile.
     */
    public val webdeployPublishBasicAuthenticationEnabled: Output?
        get() = javaResource.webdeployPublishBasicAuthenticationEnabled().applyValue({ args0 ->
            args0.map({ args0 -> args0 }).orElse(null)
        })

    /**
     * The local path and filename of the Zip packaged application to deploy to this Windows Web App.
     * > **Note:** Using this value requires either `WEBSITE_RUN_FROM_PACKAGE=1` or `SCM_DO_BUILD_DURING_DEPLOYMENT=true` to be set on the App in `app_settings`. Refer to the Azure docs on [running the Web App directly from the Zip package](https://learn.microsoft.com/en-us/azure/app-service/deploy-run-package), or [automating the build for Zip deploy](https://learn.microsoft.com/en-us/azure/app-service/deploy-zip#enable-build-automation-for-zip-deploy) for further details.
     */
    public val zipDeployFile: Output
        get() = javaResource.zipDeployFile().applyValue({ args0 -> args0 })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy