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

com.pulumi.azure.appplatform.kotlin.SpringCloudAppRedisAssociation.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.appplatform.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 [SpringCloudAppRedisAssociation].
 */
@PulumiTagMarker
public class SpringCloudAppRedisAssociationResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: SpringCloudAppRedisAssociationArgs = SpringCloudAppRedisAssociationArgs()

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

/**
 * Associates a Spring Cloud Application with a Redis Cache.
 * ## 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 exampleSpringCloudService = new azure.appplatform.SpringCloudService("example", {
 *     name: "example-springcloud",
 *     resourceGroupName: example.name,
 *     location: example.location,
 * });
 * const exampleSpringCloudApp = new azure.appplatform.SpringCloudApp("example", {
 *     name: "example-springcloudapp",
 *     resourceGroupName: example.name,
 *     serviceName: exampleSpringCloudService.name,
 * });
 * const exampleCache = new azure.redis.Cache("example", {
 *     name: "example-cache",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     capacity: 0,
 *     family: "C",
 *     skuName: "Basic",
 *     enableNonSslPort: true,
 * });
 * const exampleSpringCloudAppRedisAssociation = new azure.appplatform.SpringCloudAppRedisAssociation("example", {
 *     name: "example-bind",
 *     springCloudAppId: exampleSpringCloudApp.id,
 *     redisCacheId: exampleCache.id,
 *     redisAccessKey: exampleCache.primaryAccessKey,
 *     sslEnabled: true,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_spring_cloud_service = azure.appplatform.SpringCloudService("example",
 *     name="example-springcloud",
 *     resource_group_name=example.name,
 *     location=example.location)
 * example_spring_cloud_app = azure.appplatform.SpringCloudApp("example",
 *     name="example-springcloudapp",
 *     resource_group_name=example.name,
 *     service_name=example_spring_cloud_service.name)
 * example_cache = azure.redis.Cache("example",
 *     name="example-cache",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     capacity=0,
 *     family="C",
 *     sku_name="Basic",
 *     enable_non_ssl_port=True)
 * example_spring_cloud_app_redis_association = azure.appplatform.SpringCloudAppRedisAssociation("example",
 *     name="example-bind",
 *     spring_cloud_app_id=example_spring_cloud_app.id,
 *     redis_cache_id=example_cache.id,
 *     redis_access_key=example_cache.primary_access_key,
 *     ssl_enabled=True)
 * ```
 * ```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 exampleSpringCloudService = new Azure.AppPlatform.SpringCloudService("example", new()
 *     {
 *         Name = "example-springcloud",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *     });
 *     var exampleSpringCloudApp = new Azure.AppPlatform.SpringCloudApp("example", new()
 *     {
 *         Name = "example-springcloudapp",
 *         ResourceGroupName = example.Name,
 *         ServiceName = exampleSpringCloudService.Name,
 *     });
 *     var exampleCache = new Azure.Redis.Cache("example", new()
 *     {
 *         Name = "example-cache",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         Capacity = 0,
 *         Family = "C",
 *         SkuName = "Basic",
 *         EnableNonSslPort = true,
 *     });
 *     var exampleSpringCloudAppRedisAssociation = new Azure.AppPlatform.SpringCloudAppRedisAssociation("example", new()
 *     {
 *         Name = "example-bind",
 *         SpringCloudAppId = exampleSpringCloudApp.Id,
 *         RedisCacheId = exampleCache.Id,
 *         RedisAccessKey = exampleCache.PrimaryAccessKey,
 *         SslEnabled = true,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/appplatform"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/redis"
 * 	"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
 * 		}
 * 		exampleSpringCloudService, err := appplatform.NewSpringCloudService(ctx, "example", &appplatform.SpringCloudServiceArgs{
 * 			Name:              pulumi.String("example-springcloud"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleSpringCloudApp, err := appplatform.NewSpringCloudApp(ctx, "example", &appplatform.SpringCloudAppArgs{
 * 			Name:              pulumi.String("example-springcloudapp"),
 * 			ResourceGroupName: example.Name,
 * 			ServiceName:       exampleSpringCloudService.Name,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleCache, err := redis.NewCache(ctx, "example", &redis.CacheArgs{
 * 			Name:              pulumi.String("example-cache"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			Capacity:          pulumi.Int(0),
 * 			Family:            pulumi.String("C"),
 * 			SkuName:           pulumi.String("Basic"),
 * 			EnableNonSslPort:  pulumi.Bool(true),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = appplatform.NewSpringCloudAppRedisAssociation(ctx, "example", &appplatform.SpringCloudAppRedisAssociationArgs{
 * 			Name:             pulumi.String("example-bind"),
 * 			SpringCloudAppId: exampleSpringCloudApp.ID(),
 * 			RedisCacheId:     exampleCache.ID(),
 * 			RedisAccessKey:   exampleCache.PrimaryAccessKey,
 * 			SslEnabled:       pulumi.Bool(true),
 * 		})
 * 		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.appplatform.SpringCloudService;
 * import com.pulumi.azure.appplatform.SpringCloudServiceArgs;
 * import com.pulumi.azure.appplatform.SpringCloudApp;
 * import com.pulumi.azure.appplatform.SpringCloudAppArgs;
 * import com.pulumi.azure.redis.Cache;
 * import com.pulumi.azure.redis.CacheArgs;
 * import com.pulumi.azure.appplatform.SpringCloudAppRedisAssociation;
 * import com.pulumi.azure.appplatform.SpringCloudAppRedisAssociationArgs;
 * 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 exampleSpringCloudService = new SpringCloudService("exampleSpringCloudService", SpringCloudServiceArgs.builder()
 *             .name("example-springcloud")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .build());
 *         var exampleSpringCloudApp = new SpringCloudApp("exampleSpringCloudApp", SpringCloudAppArgs.builder()
 *             .name("example-springcloudapp")
 *             .resourceGroupName(example.name())
 *             .serviceName(exampleSpringCloudService.name())
 *             .build());
 *         var exampleCache = new Cache("exampleCache", CacheArgs.builder()
 *             .name("example-cache")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .capacity(0)
 *             .family("C")
 *             .skuName("Basic")
 *             .enableNonSslPort(true)
 *             .build());
 *         var exampleSpringCloudAppRedisAssociation = new SpringCloudAppRedisAssociation("exampleSpringCloudAppRedisAssociation", SpringCloudAppRedisAssociationArgs.builder()
 *             .name("example-bind")
 *             .springCloudAppId(exampleSpringCloudApp.id())
 *             .redisCacheId(exampleCache.id())
 *             .redisAccessKey(exampleCache.primaryAccessKey())
 *             .sslEnabled(true)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleSpringCloudService:
 *     type: azure:appplatform:SpringCloudService
 *     name: example
 *     properties:
 *       name: example-springcloud
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *   exampleSpringCloudApp:
 *     type: azure:appplatform:SpringCloudApp
 *     name: example
 *     properties:
 *       name: example-springcloudapp
 *       resourceGroupName: ${example.name}
 *       serviceName: ${exampleSpringCloudService.name}
 *   exampleCache:
 *     type: azure:redis:Cache
 *     name: example
 *     properties:
 *       name: example-cache
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       capacity: 0
 *       family: C
 *       skuName: Basic
 *       enableNonSslPort: true
 *   exampleSpringCloudAppRedisAssociation:
 *     type: azure:appplatform:SpringCloudAppRedisAssociation
 *     name: example
 *     properties:
 *       name: example-bind
 *       springCloudAppId: ${exampleSpringCloudApp.id}
 *       redisCacheId: ${exampleCache.id}
 *       redisAccessKey: ${exampleCache.primaryAccessKey}
 *       sslEnabled: true
 * ```
 * 
 * ## Import
 * Spring Cloud Application Redis Association can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:appplatform/springCloudAppRedisAssociation:SpringCloudAppRedisAssociation example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.AppPlatform/spring/myservice/apps/myapp/bindings/bind1
 * ```
 */
public class SpringCloudAppRedisAssociation internal constructor(
    override val javaResource: com.pulumi.azure.appplatform.SpringCloudAppRedisAssociation,
) : KotlinCustomResource(javaResource, SpringCloudAppRedisAssociationMapper) {
    /**
     * Specifies the name of the Spring Cloud Application Association. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Specifies the Redis Cache access key.
     */
    public val redisAccessKey: Output
        get() = javaResource.redisAccessKey().applyValue({ args0 -> args0 })

    /**
     * Specifies the Redis Cache resource ID. Changing this forces a new resource to be created.
     */
    public val redisCacheId: Output
        get() = javaResource.redisCacheId().applyValue({ args0 -> args0 })

    /**
     * Specifies the Spring Cloud Application resource ID in which the Association is created. Changing this forces a new resource to be created.
     */
    public val springCloudAppId: Output
        get() = javaResource.springCloudAppId().applyValue({ args0 -> args0 })

    /**
     * Should SSL be used when connecting to Redis? Defaults to `true`.
     */
    public val sslEnabled: Output?
        get() = javaResource.sslEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

public object SpringCloudAppRedisAssociationMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.appplatform.SpringCloudAppRedisAssociation::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy