
com.pulumi.azure.appservice.kotlin.ActiveSlot.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.String
import kotlin.Suppress
import kotlin.Unit
/**
* Builder for [ActiveSlot].
*/
@PulumiTagMarker
public class ActiveSlotResourceBuilder internal constructor() {
public var name: String? = null
public var args: ActiveSlotArgs = ActiveSlotArgs()
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 ActiveSlotArgsBuilder.() -> Unit) {
val builder = ActiveSlotArgsBuilder()
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(): ActiveSlot {
val builtJavaResource = com.pulumi.azure.appservice.ActiveSlot(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return ActiveSlot(builtJavaResource)
}
}
/**
* Promotes an App Service Slot to Production within an App Service.
* !> **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.WebAppActiveSlot` resource instead.
* > **Note:** When using Slots - the `app_settings`, `connection_string` and `site_config` blocks on the `azure.appservice.AppService` resource will be overwritten when promoting a Slot using the `azure.appservice.ActiveSlot` resource.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* import * as random from "@pulumi/random";
* const server = new random.RandomId("server", {});
* const example = new azure.core.ResourceGroup("example", {});
* const examplePlan = new azure.appservice.Plan("example", {});
* const exampleAppService = new azure.appservice.AppService("example", {});
* const exampleSlot = new azure.appservice.Slot("example", {});
* const exampleActiveSlot = new azure.appservice.ActiveSlot("example", {
* resourceGroupName: example.name,
* appServiceName: exampleAppService.name,
* appServiceSlotName: exampleSlot.name,
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* import pulumi_random as random
* server = random.RandomId("server")
* example = azure.core.ResourceGroup("example")
* example_plan = azure.appservice.Plan("example")
* example_app_service = azure.appservice.AppService("example")
* example_slot = azure.appservice.Slot("example")
* example_active_slot = azure.appservice.ActiveSlot("example",
* resource_group_name=example.name,
* app_service_name=example_app_service.name,
* app_service_slot_name=example_slot.name)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Azure = Pulumi.Azure;
* using Random = Pulumi.Random;
* return await Deployment.RunAsync(() =>
* {
* var server = new Random.RandomId("server");
* var example = new Azure.Core.ResourceGroup("example");
* var examplePlan = new Azure.AppService.Plan("example");
* var exampleAppService = new Azure.AppService.AppService("example");
* var exampleSlot = new Azure.AppService.Slot("example");
* var exampleActiveSlot = new Azure.AppService.ActiveSlot("example", new()
* {
* ResourceGroupName = example.Name,
* AppServiceName = exampleAppService.Name,
* AppServiceSlotName = exampleSlot.Name,
* });
* });
* ```
* ```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-random/sdk/v4/go/random"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := random.NewRandomId(ctx, "server", nil)
* if err != nil {
* return err
* }
* example, err := core.NewResourceGroup(ctx, "example", nil)
* if err != nil {
* return err
* }
* _, err = appservice.NewPlan(ctx, "example", nil)
* if err != nil {
* return err
* }
* exampleAppService, err := appservice.NewAppService(ctx, "example", nil)
* if err != nil {
* return err
* }
* exampleSlot, err := appservice.NewSlot(ctx, "example", nil)
* if err != nil {
* return err
* }
* _, err = appservice.NewActiveSlot(ctx, "example", &appservice.ActiveSlotArgs{
* ResourceGroupName: example.Name,
* AppServiceName: exampleAppService.Name,
* AppServiceSlotName: exampleSlot.Name,
* })
* 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.random.RandomId;
* import com.pulumi.azure.core.ResourceGroup;
* import com.pulumi.azure.appservice.Plan;
* import com.pulumi.azure.appservice.AppService;
* import com.pulumi.azure.appservice.Slot;
* import com.pulumi.azure.appservice.ActiveSlot;
* import com.pulumi.azure.appservice.ActiveSlotArgs;
* 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 server = new RandomId("server");
* var example = new ResourceGroup("example");
* var examplePlan = new Plan("examplePlan");
* var exampleAppService = new AppService("exampleAppService");
* var exampleSlot = new Slot("exampleSlot");
* var exampleActiveSlot = new ActiveSlot("exampleActiveSlot", ActiveSlotArgs.builder()
* .resourceGroupName(example.name())
* .appServiceName(exampleAppService.name())
* .appServiceSlotName(exampleSlot.name())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* server:
* type: random:RandomId
* example:
* type: azure:core:ResourceGroup
* examplePlan:
* type: azure:appservice:Plan
* name: example
* exampleAppService:
* type: azure:appservice:AppService
* name: example
* exampleSlot:
* type: azure:appservice:Slot
* name: example
* exampleActiveSlot:
* type: azure:appservice:ActiveSlot
* name: example
* properties:
* resourceGroupName: ${example.name}
* appServiceName: ${exampleAppService.name}
* appServiceSlotName: ${exampleSlot.name}
* ```
*
*/
public class ActiveSlot internal constructor(
override val javaResource: com.pulumi.azure.appservice.ActiveSlot,
) : KotlinCustomResource(javaResource, ActiveSlotMapper) {
/**
* The name of the App Service within which the Slot exists. Changing this forces a new resource to be created.
*/
public val appServiceName: Output
get() = javaResource.appServiceName().applyValue({ args0 -> args0 })
/**
* The name of the App Service Slot which should be promoted to the Production Slot within the App Service.
*/
public val appServiceSlotName: Output
get() = javaResource.appServiceSlotName().applyValue({ args0 -> args0 })
/**
* The name of the resource group in which the App Service exists. Changing this forces a new resource to be created.
*/
public val resourceGroupName: Output
get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
}
public object ActiveSlotMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.appservice.ActiveSlot::class == javaResource::class
override fun map(javaResource: Resource): ActiveSlot = ActiveSlot(
javaResource as
com.pulumi.azure.appservice.ActiveSlot,
)
}
/**
* @see [ActiveSlot].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [ActiveSlot].
*/
public suspend fun activeSlot(name: String, block: suspend ActiveSlotResourceBuilder.() -> Unit):
ActiveSlot {
val builder = ActiveSlotResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [ActiveSlot].
* @param name The _unique_ name of the resulting resource.
*/
public fun activeSlot(name: String): ActiveSlot {
val builder = ActiveSlotResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy