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

com.pulumi.azurenative.servicefabric.kotlin.ManagedClusterService.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: 2.82.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azurenative.servicefabric.kotlin

import com.pulumi.azurenative.servicefabric.kotlin.outputs.StatefulServicePropertiesResponse
import com.pulumi.azurenative.servicefabric.kotlin.outputs.StatelessServicePropertiesResponse
import com.pulumi.azurenative.servicefabric.kotlin.outputs.SystemDataResponse
import com.pulumi.azurenative.servicefabric.kotlin.outputs.SystemDataResponse.Companion.toKotlin
import com.pulumi.core.Either
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.Map

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

    public var args: ManagedClusterServiceArgs = ManagedClusterServiceArgs()

    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 ManagedClusterServiceArgsBuilder.() -> Unit) {
        val builder = ManagedClusterServiceArgsBuilder()
        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(): ManagedClusterService {
        val builtJavaResource =
            com.pulumi.azurenative.servicefabric.ManagedClusterService(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return ManagedClusterService(builtJavaResource)
    }
}

/**
 * The service resource.
 * Azure REST API version: 2023-03-01-preview.
 * Other available API versions: 2023-07-01-preview, 2023-09-01-preview, 2023-11-01-preview, 2023-12-01-preview, 2024-02-01-preview, 2024-04-01, 2024-06-01-preview.
 * ## Example Usage
 * ### Put a service with maximum parameters
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var managedClusterService = new AzureNative.ServiceFabric.ManagedClusterService("managedClusterService", new()
 *     {
 *         ApplicationName = "myApp",
 *         ClusterName = "myCluster",
 *         Location = "eastus",
 *         Properties = new AzureNative.ServiceFabric.Inputs.StatelessServicePropertiesArgs
 *         {
 *             CorrelationScheme = new[]
 *             {
 *                 new AzureNative.ServiceFabric.Inputs.ServiceCorrelationArgs
 *                 {
 *                     Scheme = AzureNative.ServiceFabric.ServiceCorrelationScheme.AlignedAffinity,
 *                     ServiceName = "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resRg/providers/Microsoft.ServiceFabric/managedclusters/myCluster/applications/myApp/services/myService1",
 *                 },
 *             },
 *             DefaultMoveCost = AzureNative.ServiceFabric.MoveCost.Medium,
 *             InstanceCount = 5,
 *             MinInstanceCount = 3,
 *             MinInstancePercentage = 30,
 *             PartitionDescription = new AzureNative.ServiceFabric.Inputs.SingletonPartitionSchemeArgs
 *             {
 *                 PartitionScheme = "Singleton",
 *             },
 *             PlacementConstraints = "NodeType==frontend",
 *             ScalingPolicies = new[]
 *             {
 *                 new AzureNative.ServiceFabric.Inputs.ScalingPolicyArgs
 *                 {
 *                     ScalingMechanism = new AzureNative.ServiceFabric.Inputs.PartitionInstanceCountScaleMechanismArgs
 *                     {
 *                         Kind = "ScalePartitionInstanceCount",
 *                         MaxInstanceCount = 9,
 *                         MinInstanceCount = 3,
 *                         ScaleIncrement = 2,
 *                     },
 *                     ScalingTrigger = new AzureNative.ServiceFabric.Inputs.AveragePartitionLoadScalingTriggerArgs
 *                     {
 *                         Kind = "AveragePartitionLoadTrigger",
 *                         LowerLoadThreshold = 2,
 *                         MetricName = "metricName",
 *                         ScaleInterval = "00:01:00",
 *                         UpperLoadThreshold = 8,
 *                     },
 *                 },
 *             },
 *             ServiceDnsName = "myservicednsname.myApp",
 *             ServiceKind = "Stateless",
 *             ServiceLoadMetrics = new[]
 *             {
 *                 new AzureNative.ServiceFabric.Inputs.ServiceLoadMetricArgs
 *                 {
 *                     DefaultLoad = 3,
 *                     Name = "metric1",
 *                     Weight = AzureNative.ServiceFabric.ServiceLoadMetricWeight.Low,
 *                 },
 *             },
 *             ServicePackageActivationMode = AzureNative.ServiceFabric.ServicePackageActivationMode.SharedProcess,
 *             ServicePlacementPolicies = new[]
 *             {
 *                 new AzureNative.ServiceFabric.Inputs.ServicePlacementNonPartiallyPlaceServicePolicyArgs
 *                 {
 *                     Type = "NonPartiallyPlaceService",
 *                 },
 *             },
 *             ServiceTypeName = "myServiceType",
 *         },
 *         ResourceGroupName = "resRg",
 *         ServiceName = "myService",
 *         Tags =
 *         {
 *             { "a", "b" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	servicefabric "github.com/pulumi/pulumi-azure-native-sdk/servicefabric/v2"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := servicefabric.NewManagedClusterService(ctx, "managedClusterService", &servicefabric.ManagedClusterServiceArgs{
 * 			ApplicationName: pulumi.String("myApp"),
 * 			ClusterName:     pulumi.String("myCluster"),
 * 			Location:        pulumi.String("eastus"),
 * 			Properties: &servicefabric.StatelessServicePropertiesArgs{
 * 				CorrelationScheme: servicefabric.ServiceCorrelationArray{
 * 					&servicefabric.ServiceCorrelationArgs{
 * 						Scheme:      pulumi.String(servicefabric.ServiceCorrelationSchemeAlignedAffinity),
 * 						ServiceName: pulumi.String("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resRg/providers/Microsoft.ServiceFabric/managedclusters/myCluster/applications/myApp/services/myService1"),
 * 					},
 * 				},
 * 				DefaultMoveCost:       pulumi.String(servicefabric.MoveCostMedium),
 * 				InstanceCount:         pulumi.Int(5),
 * 				MinInstanceCount:      pulumi.Int(3),
 * 				MinInstancePercentage: pulumi.Int(30),
 * 				PartitionDescription: servicefabric.SingletonPartitionScheme{
 * 					PartitionScheme: "Singleton",
 * 				},
 * 				PlacementConstraints: pulumi.String("NodeType==frontend"),
 * 				ScalingPolicies: servicefabric.ScalingPolicyArray{
 * 					&servicefabric.ScalingPolicyArgs{
 * 						ScalingMechanism: servicefabric.PartitionInstanceCountScaleMechanism{
 * 							Kind:             "ScalePartitionInstanceCount",
 * 							MaxInstanceCount: 9,
 * 							MinInstanceCount: 3,
 * 							ScaleIncrement:   2,
 * 						},
 * 						ScalingTrigger: servicefabric.AveragePartitionLoadScalingTrigger{
 * 							Kind:               "AveragePartitionLoadTrigger",
 * 							LowerLoadThreshold: 2,
 * 							MetricName:         "metricName",
 * 							ScaleInterval:      "00:01:00",
 * 							UpperLoadThreshold: 8,
 * 						},
 * 					},
 * 				},
 * 				ServiceDnsName: pulumi.String("myservicednsname.myApp"),
 * 				ServiceKind:    pulumi.String("Stateless"),
 * 				ServiceLoadMetrics: servicefabric.ServiceLoadMetricArray{
 * 					&servicefabric.ServiceLoadMetricArgs{
 * 						DefaultLoad: pulumi.Int(3),
 * 						Name:        pulumi.String("metric1"),
 * 						Weight:      pulumi.String(servicefabric.ServiceLoadMetricWeightLow),
 * 					},
 * 				},
 * 				ServicePackageActivationMode: pulumi.String(servicefabric.ServicePackageActivationModeSharedProcess),
 * 				ServicePlacementPolicies: pulumi.Array{
 * 					servicefabric.ServicePlacementNonPartiallyPlaceServicePolicy{
 * 						Type: "NonPartiallyPlaceService",
 * 					},
 * 				},
 * 				ServiceTypeName: pulumi.String("myServiceType"),
 * 			},
 * 			ResourceGroupName: pulumi.String("resRg"),
 * 			ServiceName:       pulumi.String("myService"),
 * 			Tags: pulumi.StringMap{
 * 				"a": pulumi.String("b"),
 * 			},
 * 		})
 * 		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.azurenative.servicefabric.ManagedClusterService;
 * import com.pulumi.azurenative.servicefabric.ManagedClusterServiceArgs;
 * 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 managedClusterService = new ManagedClusterService("managedClusterService", ManagedClusterServiceArgs.builder()
 *             .applicationName("myApp")
 *             .clusterName("myCluster")
 *             .location("eastus")
 *             .properties(StatelessServicePropertiesArgs.builder()
 *                 .correlationScheme(ServiceCorrelationArgs.builder()
 *                     .scheme("AlignedAffinity")
 *                     .serviceName("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resRg/providers/Microsoft.ServiceFabric/managedclusters/myCluster/applications/myApp/services/myService1")
 *                     .build())
 *                 .defaultMoveCost("Medium")
 *                 .instanceCount(5)
 *                 .minInstanceCount(3)
 *                 .minInstancePercentage(30)
 *                 .partitionDescription(SingletonPartitionSchemeArgs.builder()
 *                     .partitionScheme("Singleton")
 *                     .build())
 *                 .placementConstraints("NodeType==frontend")
 *                 .scalingPolicies(ScalingPolicyArgs.builder()
 *                     .scalingMechanism(AddRemoveIncrementalNamedPartitionScalingMechanismArgs.builder()
 *                         .kind("ScalePartitionInstanceCount")
 *                         .maxInstanceCount(9)
 *                         .minInstanceCount(3)
 *                         .scaleIncrement(2)
 *                         .build())
 *                     .scalingTrigger(AveragePartitionLoadScalingTriggerArgs.builder()
 *                         .kind("AveragePartitionLoadTrigger")
 *                         .lowerLoadThreshold(2)
 *                         .metricName("metricName")
 *                         .scaleInterval("00:01:00")
 *                         .upperLoadThreshold(8)
 *                         .build())
 *                     .build())
 *                 .serviceDnsName("myservicednsname.myApp")
 *                 .serviceKind("Stateless")
 *                 .serviceLoadMetrics(ServiceLoadMetricArgs.builder()
 *                     .defaultLoad(3)
 *                     .name("metric1")
 *                     .weight("Low")
 *                     .build())
 *                 .servicePackageActivationMode("SharedProcess")
 *                 .servicePlacementPolicies(ServicePlacementNonPartiallyPlaceServicePolicyArgs.builder()
 *                     .type("NonPartiallyPlaceService")
 *                     .build())
 *                 .serviceTypeName("myServiceType")
 *                 .build())
 *             .resourceGroupName("resRg")
 *             .serviceName("myService")
 *             .tags(Map.of("a", "b"))
 *             .build());
 *     }
 * }
 * ```
 * ### Put a service with minimum parameters
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var managedClusterService = new AzureNative.ServiceFabric.ManagedClusterService("managedClusterService", new()
 *     {
 *         ApplicationName = "myApp",
 *         ClusterName = "myCluster",
 *         Location = "eastus",
 *         Properties = new AzureNative.ServiceFabric.Inputs.StatelessServicePropertiesArgs
 *         {
 *             InstanceCount = 1,
 *             PartitionDescription = new AzureNative.ServiceFabric.Inputs.SingletonPartitionSchemeArgs
 *             {
 *                 PartitionScheme = "Singleton",
 *             },
 *             ServiceKind = "Stateless",
 *             ServiceTypeName = "myServiceType",
 *         },
 *         ResourceGroupName = "resRg",
 *         ServiceName = "myService",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	servicefabric "github.com/pulumi/pulumi-azure-native-sdk/servicefabric/v2"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := servicefabric.NewManagedClusterService(ctx, "managedClusterService", &servicefabric.ManagedClusterServiceArgs{
 * 			ApplicationName: pulumi.String("myApp"),
 * 			ClusterName:     pulumi.String("myCluster"),
 * 			Location:        pulumi.String("eastus"),
 * 			Properties: &servicefabric.StatelessServicePropertiesArgs{
 * 				InstanceCount: pulumi.Int(1),
 * 				PartitionDescription: servicefabric.SingletonPartitionScheme{
 * 					PartitionScheme: "Singleton",
 * 				},
 * 				ServiceKind:     pulumi.String("Stateless"),
 * 				ServiceTypeName: pulumi.String("myServiceType"),
 * 			},
 * 			ResourceGroupName: pulumi.String("resRg"),
 * 			ServiceName:       pulumi.String("myService"),
 * 		})
 * 		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.azurenative.servicefabric.ManagedClusterService;
 * import com.pulumi.azurenative.servicefabric.ManagedClusterServiceArgs;
 * 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 managedClusterService = new ManagedClusterService("managedClusterService", ManagedClusterServiceArgs.builder()
 *             .applicationName("myApp")
 *             .clusterName("myCluster")
 *             .location("eastus")
 *             .properties(StatelessServicePropertiesArgs.builder()
 *                 .instanceCount(1)
 *                 .partitionDescription(SingletonPartitionSchemeArgs.builder()
 *                     .partitionScheme("Singleton")
 *                     .build())
 *                 .serviceKind("Stateless")
 *                 .serviceTypeName("myServiceType")
 *                 .build())
 *             .resourceGroupName("resRg")
 *             .serviceName("myService")
 *             .build());
 *     }
 * }
 * ```
 * ## Import
 * An existing resource can be imported using its type token, name, and identifier, e.g.
 * ```sh
 * $ pulumi import azure-native:servicefabric:ManagedClusterService myService /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}
 * ```
 */
public class ManagedClusterService internal constructor(
    override val javaResource: com.pulumi.azurenative.servicefabric.ManagedClusterService,
) : KotlinCustomResource(javaResource, ManagedClusterServiceMapper) {
    /**
     * Resource location depends on the parent resource.
     */
    public val location: Output?
        get() = javaResource.location().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Azure resource name.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The service resource properties.
     */
    public val properties:
        Output>
        get() = javaResource.properties().applyValue({ args0 ->
            args0.transform(
                { args0 ->
                    args0.let({ args0 ->
                        com.pulumi.azurenative.servicefabric.kotlin.outputs.StatefulServicePropertiesResponse.Companion.toKotlin(args0)
                    })
                },
                { args0 ->
                    args0.let({ args0 ->
                        com.pulumi.azurenative.servicefabric.kotlin.outputs.StatelessServicePropertiesResponse.Companion.toKotlin(args0)
                    })
                },
            )
        })

    /**
     * Metadata pertaining to creation and last modification of the resource.
     */
    public val systemData: Output
        get() = javaResource.systemData().applyValue({ args0 -> args0.let({ args0 -> toKotlin(args0) }) })

    /**
     * Azure resource tags.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * Azure resource type.
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })
}

public object ManagedClusterServiceMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azurenative.servicefabric.ManagedClusterService::class == javaResource::class

    override fun map(javaResource: Resource): ManagedClusterService =
        ManagedClusterService(
            javaResource as
                com.pulumi.azurenative.servicefabric.ManagedClusterService,
        )
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy