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

com.pulumi.aws.appsync.kotlin.ApiCache.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: 6.57.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.aws.appsync.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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit

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

    public var args: ApiCacheArgs = ApiCacheArgs()

    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 ApiCacheArgsBuilder.() -> Unit) {
        val builder = ApiCacheArgsBuilder()
        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(): ApiCache {
        val builtJavaResource = com.pulumi.aws.appsync.ApiCache(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return ApiCache(builtJavaResource)
    }
}

/**
 * Provides an AppSync API Cache.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const example = new aws.appsync.GraphQLApi("example", {
 *     authenticationType: "API_KEY",
 *     name: "example",
 * });
 * const exampleApiCache = new aws.appsync.ApiCache("example", {
 *     apiId: example.id,
 *     apiCachingBehavior: "FULL_REQUEST_CACHING",
 *     type: "LARGE",
 *     ttl: 900,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * example = aws.appsync.GraphQLApi("example",
 *     authentication_type="API_KEY",
 *     name="example")
 * example_api_cache = aws.appsync.ApiCache("example",
 *     api_id=example.id,
 *     api_caching_behavior="FULL_REQUEST_CACHING",
 *     type="LARGE",
 *     ttl=900)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Aws.AppSync.GraphQLApi("example", new()
 *     {
 *         AuthenticationType = "API_KEY",
 *         Name = "example",
 *     });
 *     var exampleApiCache = new Aws.AppSync.ApiCache("example", new()
 *     {
 *         ApiId = example.Id,
 *         ApiCachingBehavior = "FULL_REQUEST_CACHING",
 *         Type = "LARGE",
 *         Ttl = 900,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appsync"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := appsync.NewGraphQLApi(ctx, "example", &appsync.GraphQLApiArgs{
 * 			AuthenticationType: pulumi.String("API_KEY"),
 * 			Name:               pulumi.String("example"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = appsync.NewApiCache(ctx, "example", &appsync.ApiCacheArgs{
 * 			ApiId:              example.ID(),
 * 			ApiCachingBehavior: pulumi.String("FULL_REQUEST_CACHING"),
 * 			Type:               pulumi.String("LARGE"),
 * 			Ttl:                pulumi.Int(900),
 * 		})
 * 		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.aws.appsync.GraphQLApi;
 * import com.pulumi.aws.appsync.GraphQLApiArgs;
 * import com.pulumi.aws.appsync.ApiCache;
 * import com.pulumi.aws.appsync.ApiCacheArgs;
 * 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 GraphQLApi("example", GraphQLApiArgs.builder()
 *             .authenticationType("API_KEY")
 *             .name("example")
 *             .build());
 *         var exampleApiCache = new ApiCache("exampleApiCache", ApiCacheArgs.builder()
 *             .apiId(example.id())
 *             .apiCachingBehavior("FULL_REQUEST_CACHING")
 *             .type("LARGE")
 *             .ttl(900)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: aws:appsync:GraphQLApi
 *     properties:
 *       authenticationType: API_KEY
 *       name: example
 *   exampleApiCache:
 *     type: aws:appsync:ApiCache
 *     name: example
 *     properties:
 *       apiId: ${example.id}
 *       apiCachingBehavior: FULL_REQUEST_CACHING
 *       type: LARGE
 *       ttl: 900
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import `aws_appsync_api_cache` using the AppSync API ID. For example:
 * ```sh
 * $ pulumi import aws:appsync/apiCache:ApiCache example xxxxx
 * ```
 */
public class ApiCache internal constructor(
    override val javaResource: com.pulumi.aws.appsync.ApiCache,
) : KotlinCustomResource(javaResource, ApiCacheMapper) {
    /**
     * Caching behavior. Valid values are `FULL_REQUEST_CACHING` and `PER_RESOLVER_CACHING`.
     */
    public val apiCachingBehavior: Output
        get() = javaResource.apiCachingBehavior().applyValue({ args0 -> args0 })

    /**
     * GraphQL API ID.
     */
    public val apiId: Output
        get() = javaResource.apiId().applyValue({ args0 -> args0 })

    /**
     * At-rest encryption flag for cache. You cannot update this setting after creation.
     */
    public val atRestEncryptionEnabled: Output?
        get() = javaResource.atRestEncryptionEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Transit encryption flag when connecting to cache. You cannot update this setting after creation.
     */
    public val transitEncryptionEnabled: Output?
        get() = javaResource.transitEncryptionEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * TTL in seconds for cache entries.
     */
    public val ttl: Output
        get() = javaResource.ttl().applyValue({ args0 -> args0 })

    /**
     * Cache instance type. Valid values are `SMALL`, `MEDIUM`, `LARGE`, `XLARGE`, `LARGE_2X`, `LARGE_4X`, `LARGE_8X`, `LARGE_12X`, `T2_SMALL`, `T2_MEDIUM`, `R4_LARGE`, `R4_XLARGE`, `R4_2XLARGE`, `R4_4XLARGE`, `R4_8XLARGE`.
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })
}

public object ApiCacheMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.aws.appsync.ApiCache::class == javaResource::class

    override fun map(javaResource: Resource): ApiCache = ApiCache(
        javaResource as
            com.pulumi.aws.appsync.ApiCache,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy