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

com.pulumi.azure.apimanagement.kotlin.RedisCache.kt Maven / Gradle / Ivy

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

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

    public var args: RedisCacheArgs = RedisCacheArgs()

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

/**
 * Manages a API Management 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 exampleService = new azure.apimanagement.Service("example", {
 *     name: "example-apim",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     publisherName: "pub1",
 *     publisherEmail: "[email protected]",
 *     skuName: "Consumption_0",
 * });
 * const exampleCache = new azure.redis.Cache("example", {
 *     name: "example-cache",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     capacity: 1,
 *     family: "C",
 *     skuName: "Basic",
 *     enableNonSslPort: false,
 *     minimumTlsVersion: "1.2",
 *     redisConfiguration: {},
 * });
 * const exampleRedisCache = new azure.apimanagement.RedisCache("example", {
 *     name: "example-Redis-Cache",
 *     apiManagementId: exampleService.id,
 *     connectionString: exampleCache.primaryConnectionString,
 *     description: "Redis cache instances",
 *     redisCacheId: exampleCache.id,
 *     cacheLocation: "East Us",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_service = azure.apimanagement.Service("example",
 *     name="example-apim",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     publisher_name="pub1",
 *     publisher_email="[email protected]",
 *     sku_name="Consumption_0")
 * example_cache = azure.redis.Cache("example",
 *     name="example-cache",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     capacity=1,
 *     family="C",
 *     sku_name="Basic",
 *     enable_non_ssl_port=False,
 *     minimum_tls_version="1.2",
 *     redis_configuration={})
 * example_redis_cache = azure.apimanagement.RedisCache("example",
 *     name="example-Redis-Cache",
 *     api_management_id=example_service.id,
 *     connection_string=example_cache.primary_connection_string,
 *     description="Redis cache instances",
 *     redis_cache_id=example_cache.id,
 *     cache_location="East Us")
 * ```
 * ```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 exampleService = new Azure.ApiManagement.Service("example", new()
 *     {
 *         Name = "example-apim",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         PublisherName = "pub1",
 *         PublisherEmail = "[email protected]",
 *         SkuName = "Consumption_0",
 *     });
 *     var exampleCache = new Azure.Redis.Cache("example", new()
 *     {
 *         Name = "example-cache",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         Capacity = 1,
 *         Family = "C",
 *         SkuName = "Basic",
 *         EnableNonSslPort = false,
 *         MinimumTlsVersion = "1.2",
 *         RedisConfiguration = null,
 *     });
 *     var exampleRedisCache = new Azure.ApiManagement.RedisCache("example", new()
 *     {
 *         Name = "example-Redis-Cache",
 *         ApiManagementId = exampleService.Id,
 *         ConnectionString = exampleCache.PrimaryConnectionString,
 *         Description = "Redis cache instances",
 *         RedisCacheId = exampleCache.Id,
 *         CacheLocation = "East Us",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/apimanagement"
 * 	"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
 * 		}
 * 		exampleService, err := apimanagement.NewService(ctx, "example", &apimanagement.ServiceArgs{
 * 			Name:              pulumi.String("example-apim"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			PublisherName:     pulumi.String("pub1"),
 * 			PublisherEmail:    pulumi.String("[email protected]"),
 * 			SkuName:           pulumi.String("Consumption_0"),
 * 		})
 * 		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(1),
 * 			Family:             pulumi.String("C"),
 * 			SkuName:            pulumi.String("Basic"),
 * 			EnableNonSslPort:   pulumi.Bool(false),
 * 			MinimumTlsVersion:  pulumi.String("1.2"),
 * 			RedisConfiguration: nil,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = apimanagement.NewRedisCache(ctx, "example", &apimanagement.RedisCacheArgs{
 * 			Name:             pulumi.String("example-Redis-Cache"),
 * 			ApiManagementId:  exampleService.ID(),
 * 			ConnectionString: exampleCache.PrimaryConnectionString,
 * 			Description:      pulumi.String("Redis cache instances"),
 * 			RedisCacheId:     exampleCache.ID(),
 * 			CacheLocation:    pulumi.String("East Us"),
 * 		})
 * 		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.apimanagement.Service;
 * import com.pulumi.azure.apimanagement.ServiceArgs;
 * import com.pulumi.azure.redis.Cache;
 * import com.pulumi.azure.redis.CacheArgs;
 * import com.pulumi.azure.redis.inputs.CacheRedisConfigurationArgs;
 * import com.pulumi.azure.apimanagement.RedisCache;
 * import com.pulumi.azure.apimanagement.RedisCacheArgs;
 * 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 exampleService = new Service("exampleService", ServiceArgs.builder()
 *             .name("example-apim")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .publisherName("pub1")
 *             .publisherEmail("[email protected]")
 *             .skuName("Consumption_0")
 *             .build());
 *         var exampleCache = new Cache("exampleCache", CacheArgs.builder()
 *             .name("example-cache")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .capacity(1)
 *             .family("C")
 *             .skuName("Basic")
 *             .enableNonSslPort(false)
 *             .minimumTlsVersion("1.2")
 *             .redisConfiguration()
 *             .build());
 *         var exampleRedisCache = new RedisCache("exampleRedisCache", RedisCacheArgs.builder()
 *             .name("example-Redis-Cache")
 *             .apiManagementId(exampleService.id())
 *             .connectionString(exampleCache.primaryConnectionString())
 *             .description("Redis cache instances")
 *             .redisCacheId(exampleCache.id())
 *             .cacheLocation("East Us")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleService:
 *     type: azure:apimanagement:Service
 *     name: example
 *     properties:
 *       name: example-apim
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       publisherName: pub1
 *       publisherEmail: [email protected]
 *       skuName: Consumption_0
 *   exampleCache:
 *     type: azure:redis:Cache
 *     name: example
 *     properties:
 *       name: example-cache
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       capacity: 1
 *       family: C
 *       skuName: Basic
 *       enableNonSslPort: false
 *       minimumTlsVersion: '1.2'
 *       redisConfiguration: {}
 *   exampleRedisCache:
 *     type: azure:apimanagement:RedisCache
 *     name: example
 *     properties:
 *       name: example-Redis-Cache
 *       apiManagementId: ${exampleService.id}
 *       connectionString: ${exampleCache.primaryConnectionString}
 *       description: Redis cache instances
 *       redisCacheId: ${exampleCache.id}
 *       cacheLocation: East Us
 * ```
 * 
 * ## Import
 * API Management Redis Caches can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:apimanagement/redisCache:RedisCache example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ApiManagement/service/service1/caches/cache1
 * ```
 */
public class RedisCache internal constructor(
    override val javaResource: com.pulumi.azure.apimanagement.RedisCache,
) : KotlinCustomResource(javaResource, RedisCacheMapper) {
    /**
     * The resource ID of the API Management Service from which to create this external cache. Changing this forces a new API Management Redis Cache to be created.
     */
    public val apiManagementId: Output
        get() = javaResource.apiManagementId().applyValue({ args0 -> args0 })

    /**
     * The location where to use cache from. Possible values are `default` and valid Azure regions. Defaults to `default`.
     */
    public val cacheLocation: Output?
        get() = javaResource.cacheLocation().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The connection string to the Cache for Redis.
     */
    public val connectionString: Output
        get() = javaResource.connectionString().applyValue({ args0 -> args0 })

    /**
     * The description of the API Management Redis Cache.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

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

    /**
     * The resource ID of the Cache for Redis.
     */
    public val redisCacheId: Output?
        get() = javaResource.redisCacheId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

public object RedisCacheMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.apimanagement.RedisCache::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy