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

com.pulumi.aws.dynamodb.kotlin.DynamodbFunctions.kt Maven / Gradle / Ivy

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

package com.pulumi.aws.dynamodb.kotlin

import com.pulumi.aws.dynamodb.DynamodbFunctions.getTableItemPlain
import com.pulumi.aws.dynamodb.DynamodbFunctions.getTablePlain
import com.pulumi.aws.dynamodb.kotlin.inputs.GetTableItemPlainArgs
import com.pulumi.aws.dynamodb.kotlin.inputs.GetTableItemPlainArgsBuilder
import com.pulumi.aws.dynamodb.kotlin.inputs.GetTablePlainArgs
import com.pulumi.aws.dynamodb.kotlin.inputs.GetTablePlainArgsBuilder
import com.pulumi.aws.dynamodb.kotlin.inputs.GetTableServerSideEncryption
import com.pulumi.aws.dynamodb.kotlin.outputs.GetTableItemResult
import com.pulumi.aws.dynamodb.kotlin.outputs.GetTableResult
import kotlinx.coroutines.future.await
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
import com.pulumi.aws.dynamodb.kotlin.outputs.GetTableItemResult.Companion.toKotlin as getTableItemResultToKotlin
import com.pulumi.aws.dynamodb.kotlin.outputs.GetTableResult.Companion.toKotlin as getTableResultToKotlin

public object DynamodbFunctions {
    /**
     * Provides information about a DynamoDB table.
     * ## Example Usage
     * 
     * ```typescript
     * import * as pulumi from "@pulumi/pulumi";
     * import * as aws from "@pulumi/aws";
     * const tableName = aws.dynamodb.getTable({
     *     name: "tableName",
     * });
     * ```
     * ```python
     * import pulumi
     * import pulumi_aws as aws
     * table_name = aws.dynamodb.get_table(name="tableName")
     * ```
     * ```csharp
     * using System.Collections.Generic;
     * using System.Linq;
     * using Pulumi;
     * using Aws = Pulumi.Aws;
     * return await Deployment.RunAsync(() =>
     * {
     *     var tableName = Aws.DynamoDB.GetTable.Invoke(new()
     *     {
     *         Name = "tableName",
     *     });
     * });
     * ```
     * ```go
     * package main
     * import (
     * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/dynamodb"
     * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
     * )
     * func main() {
     * 	pulumi.Run(func(ctx *pulumi.Context) error {
     * 		_, err := dynamodb.LookupTable(ctx, &dynamodb.LookupTableArgs{
     * 			Name: "tableName",
     * 		}, nil)
     * 		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.dynamodb.DynamodbFunctions;
     * import com.pulumi.aws.dynamodb.inputs.GetTableArgs;
     * 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) {
     *         final var tableName = DynamodbFunctions.getTable(GetTableArgs.builder()
     *             .name("tableName")
     *             .build());
     *     }
     * }
     * ```
     * ```yaml
     * variables:
     *   tableName:
     *     fn::invoke:
     *       Function: aws:dynamodb:getTable
     *       Arguments:
     *         name: tableName
     * ```
     * 
     * @param argument A collection of arguments for invoking getTable.
     * @return A collection of values returned by getTable.
     */
    public suspend fun getTable(argument: GetTablePlainArgs): GetTableResult =
        getTableResultToKotlin(getTablePlain(argument.toJava()).await())

    /**
     * @see [getTable].
     * @param name Name of the DynamoDB table.
     * @param serverSideEncryption
     * @param tags
     * @return A collection of values returned by getTable.
     */
    public suspend fun getTable(
        name: String,
        serverSideEncryption: GetTableServerSideEncryption? = null,
        tags: Map? = null,
    ): GetTableResult {
        val argument = GetTablePlainArgs(
            name = name,
            serverSideEncryption = serverSideEncryption,
            tags = tags,
        )
        return getTableResultToKotlin(getTablePlain(argument.toJava()).await())
    }

    /**
     * @see [getTable].
     * @param argument Builder for [com.pulumi.aws.dynamodb.kotlin.inputs.GetTablePlainArgs].
     * @return A collection of values returned by getTable.
     */
    public suspend fun getTable(argument: suspend GetTablePlainArgsBuilder.() -> Unit): GetTableResult {
        val builder = GetTablePlainArgsBuilder()
        builder.argument()
        val builtArgument = builder.build()
        return getTableResultToKotlin(getTablePlain(builtArgument.toJava()).await())
    }

    /**
     * Data source for retrieving a value from an AWS DynamoDB table.
     * ## Example Usage
     * ### Basic Usage
     * 
     * ```typescript
     * import * as pulumi from "@pulumi/pulumi";
     * import * as aws from "@pulumi/aws";
     * const test = aws.dynamodb.getTableItem({
     *     tableName: example.name,
     *     expressionAttributeNames: {
     *         "#P": "Percentile",
     *     },
     *     projectionExpression: "#P",
     *     key: `{
     * \x09"hashKey": {"S": "example"}
     * }
     * `,
     * });
     * ```
     * ```python
     * import pulumi
     * import pulumi_aws as aws
     * test = aws.dynamodb.get_table_item(table_name=example["name"],
     *     expression_attribute_names={
     *         "#P": "Percentile",
     *     },
     *     projection_expression="#P",
     *     key="""{
     * \x09"hashKey": {"S": "example"}
     * }
     * """)
     * ```
     * ```csharp
     * using System.Collections.Generic;
     * using System.Linq;
     * using Pulumi;
     * using Aws = Pulumi.Aws;
     * return await Deployment.RunAsync(() =>
     * {
     *     var test = Aws.DynamoDB.GetTableItem.Invoke(new()
     *     {
     *         TableName = example.Name,
     *         ExpressionAttributeNames =
     *         {
     *             { "#P", "Percentile" },
     *         },
     *         ProjectionExpression = "#P",
     *         Key = @"{
     * 	""hashKey"": {""S"": ""example""}
     * }
     * ",
     *     });
     * });
     * ```
     * ```go
     * package main
     * import (
     * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/dynamodb"
     * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
     * )
     * func main() {
     * 	pulumi.Run(func(ctx *pulumi.Context) error {
     * 		_, err := dynamodb.LookupTableItem(ctx, &dynamodb.LookupTableItemArgs{
     * 			TableName: example.Name,
     * 			ExpressionAttributeNames: map[string]interface{}{
     * 				"#P": "Percentile",
     * 			},
     * 			ProjectionExpression: pulumi.StringRef("#P"),
     * 			Key:                  "{\n	\"hashKey\": {\"S\": \"example\"}\n}\n",
     * 		}, nil)
     * 		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.dynamodb.DynamodbFunctions;
     * import com.pulumi.aws.dynamodb.inputs.GetTableItemArgs;
     * 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) {
     *         final var test = DynamodbFunctions.getTableItem(GetTableItemArgs.builder()
     *             .tableName(example.name())
     *             .expressionAttributeNames(Map.of("#P", "Percentile"))
     *             .projectionExpression("#P")
     *             .key("""
     * {
     * 	"hashKey": {"S": "example"}
     * }
     *             """)
     *             .build());
     *     }
     * }
     * ```
     * ```yaml
     * variables:
     *   test:
     *     fn::invoke:
     *       Function: aws:dynamodb:getTableItem
     *       Arguments:
     *         tableName: ${example.name}
     *         expressionAttributeNames:
     *           '#P': Percentile
     *         projectionExpression: '#P'
     *         key: |
     *           {
     *           	"hashKey": {"S": "example"}
     *           }
     * ```
     * 
     * @param argument A collection of arguments for invoking getTableItem.
     * @return A collection of values returned by getTableItem.
     */
    public suspend fun getTableItem(argument: GetTableItemPlainArgs): GetTableItemResult =
        getTableItemResultToKotlin(getTableItemPlain(argument.toJava()).await())

    /**
     * @see [getTableItem].
     * @param expressionAttributeNames
     * @param key A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.
     * For the primary key, you must provide all of the attributes. For example, with a simple primary key, you only need to provide a value for the partition key. For a composite primary key, you must provide values for both the partition key and the sort key.
     * The following arguments are optional:
     * @param projectionExpression A string that identifies one or more attributes to retrieve from the table. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must be separated by commas.
     * If no attribute names are specified, then all attributes are returned. If any of the requested attributes are not found, they do not appear in the result.
     * @param tableName The name of the table containing the requested item.
     * @return A collection of values returned by getTableItem.
     */
    public suspend fun getTableItem(
        expressionAttributeNames: Map? = null,
        key: String,
        projectionExpression: String? = null,
        tableName: String,
    ): GetTableItemResult {
        val argument = GetTableItemPlainArgs(
            expressionAttributeNames = expressionAttributeNames,
            key = key,
            projectionExpression = projectionExpression,
            tableName = tableName,
        )
        return getTableItemResultToKotlin(getTableItemPlain(argument.toJava()).await())
    }

    /**
     * @see [getTableItem].
     * @param argument Builder for [com.pulumi.aws.dynamodb.kotlin.inputs.GetTableItemPlainArgs].
     * @return A collection of values returned by getTableItem.
     */
    public suspend fun getTableItem(argument: suspend GetTableItemPlainArgsBuilder.() -> Unit): GetTableItemResult {
        val builder = GetTableItemPlainArgsBuilder()
        builder.argument()
        val builtArgument = builder.build()
        return getTableItemResultToKotlin(getTableItemPlain(builtArgument.toJava()).await())
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy