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

com.pulumi.aws.rds.kotlin.ProxyTarget.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.rds.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 [ProxyTarget].
 */
@PulumiTagMarker
public class ProxyTargetResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: ProxyTargetArgs = ProxyTargetArgs()

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

/**
 * Provides an RDS DB proxy target resource.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const example = new aws.rds.Proxy("example", {
 *     name: "example",
 *     debugLogging: false,
 *     engineFamily: "MYSQL",
 *     idleClientTimeout: 1800,
 *     requireTls: true,
 *     roleArn: exampleAwsIamRole.arn,
 *     vpcSecurityGroupIds: [exampleAwsSecurityGroup.id],
 *     vpcSubnetIds: [exampleAwsSubnet.id],
 *     auths: [{
 *         authScheme: "SECRETS",
 *         description: "example",
 *         iamAuth: "DISABLED",
 *         secretArn: exampleAwsSecretsmanagerSecret.arn,
 *     }],
 *     tags: {
 *         Name: "example",
 *         Key: "value",
 *     },
 * });
 * const exampleProxyDefaultTargetGroup = new aws.rds.ProxyDefaultTargetGroup("example", {
 *     dbProxyName: example.name,
 *     connectionPoolConfig: {
 *         connectionBorrowTimeout: 120,
 *         initQuery: "SET x=1, y=2",
 *         maxConnectionsPercent: 100,
 *         maxIdleConnectionsPercent: 50,
 *         sessionPinningFilters: ["EXCLUDE_VARIABLE_SETS"],
 *     },
 * });
 * const exampleProxyTarget = new aws.rds.ProxyTarget("example", {
 *     dbInstanceIdentifier: exampleAwsDbInstance.identifier,
 *     dbProxyName: example.name,
 *     targetGroupName: exampleProxyDefaultTargetGroup.name,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * example = aws.rds.Proxy("example",
 *     name="example",
 *     debug_logging=False,
 *     engine_family="MYSQL",
 *     idle_client_timeout=1800,
 *     require_tls=True,
 *     role_arn=example_aws_iam_role["arn"],
 *     vpc_security_group_ids=[example_aws_security_group["id"]],
 *     vpc_subnet_ids=[example_aws_subnet["id"]],
 *     auths=[{
 *         "auth_scheme": "SECRETS",
 *         "description": "example",
 *         "iam_auth": "DISABLED",
 *         "secret_arn": example_aws_secretsmanager_secret["arn"],
 *     }],
 *     tags={
 *         "Name": "example",
 *         "Key": "value",
 *     })
 * example_proxy_default_target_group = aws.rds.ProxyDefaultTargetGroup("example",
 *     db_proxy_name=example.name,
 *     connection_pool_config={
 *         "connection_borrow_timeout": 120,
 *         "init_query": "SET x=1, y=2",
 *         "max_connections_percent": 100,
 *         "max_idle_connections_percent": 50,
 *         "session_pinning_filters": ["EXCLUDE_VARIABLE_SETS"],
 *     })
 * example_proxy_target = aws.rds.ProxyTarget("example",
 *     db_instance_identifier=example_aws_db_instance["identifier"],
 *     db_proxy_name=example.name,
 *     target_group_name=example_proxy_default_target_group.name)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Aws.Rds.Proxy("example", new()
 *     {
 *         Name = "example",
 *         DebugLogging = false,
 *         EngineFamily = "MYSQL",
 *         IdleClientTimeout = 1800,
 *         RequireTls = true,
 *         RoleArn = exampleAwsIamRole.Arn,
 *         VpcSecurityGroupIds = new[]
 *         {
 *             exampleAwsSecurityGroup.Id,
 *         },
 *         VpcSubnetIds = new[]
 *         {
 *             exampleAwsSubnet.Id,
 *         },
 *         Auths = new[]
 *         {
 *             new Aws.Rds.Inputs.ProxyAuthArgs
 *             {
 *                 AuthScheme = "SECRETS",
 *                 Description = "example",
 *                 IamAuth = "DISABLED",
 *                 SecretArn = exampleAwsSecretsmanagerSecret.Arn,
 *             },
 *         },
 *         Tags =
 *         {
 *             { "Name", "example" },
 *             { "Key", "value" },
 *         },
 *     });
 *     var exampleProxyDefaultTargetGroup = new Aws.Rds.ProxyDefaultTargetGroup("example", new()
 *     {
 *         DbProxyName = example.Name,
 *         ConnectionPoolConfig = new Aws.Rds.Inputs.ProxyDefaultTargetGroupConnectionPoolConfigArgs
 *         {
 *             ConnectionBorrowTimeout = 120,
 *             InitQuery = "SET x=1, y=2",
 *             MaxConnectionsPercent = 100,
 *             MaxIdleConnectionsPercent = 50,
 *             SessionPinningFilters = new[]
 *             {
 *                 "EXCLUDE_VARIABLE_SETS",
 *             },
 *         },
 *     });
 *     var exampleProxyTarget = new Aws.Rds.ProxyTarget("example", new()
 *     {
 *         DbInstanceIdentifier = exampleAwsDbInstance.Identifier,
 *         DbProxyName = example.Name,
 *         TargetGroupName = exampleProxyDefaultTargetGroup.Name,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/rds"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := rds.NewProxy(ctx, "example", &rds.ProxyArgs{
 * 			Name:              pulumi.String("example"),
 * 			DebugLogging:      pulumi.Bool(false),
 * 			EngineFamily:      pulumi.String("MYSQL"),
 * 			IdleClientTimeout: pulumi.Int(1800),
 * 			RequireTls:        pulumi.Bool(true),
 * 			RoleArn:           pulumi.Any(exampleAwsIamRole.Arn),
 * 			VpcSecurityGroupIds: pulumi.StringArray{
 * 				exampleAwsSecurityGroup.Id,
 * 			},
 * 			VpcSubnetIds: pulumi.StringArray{
 * 				exampleAwsSubnet.Id,
 * 			},
 * 			Auths: rds.ProxyAuthArray{
 * 				&rds.ProxyAuthArgs{
 * 					AuthScheme:  pulumi.String("SECRETS"),
 * 					Description: pulumi.String("example"),
 * 					IamAuth:     pulumi.String("DISABLED"),
 * 					SecretArn:   pulumi.Any(exampleAwsSecretsmanagerSecret.Arn),
 * 				},
 * 			},
 * 			Tags: pulumi.StringMap{
 * 				"Name": pulumi.String("example"),
 * 				"Key":  pulumi.String("value"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleProxyDefaultTargetGroup, err := rds.NewProxyDefaultTargetGroup(ctx, "example", &rds.ProxyDefaultTargetGroupArgs{
 * 			DbProxyName: example.Name,
 * 			ConnectionPoolConfig: &rds.ProxyDefaultTargetGroupConnectionPoolConfigArgs{
 * 				ConnectionBorrowTimeout:   pulumi.Int(120),
 * 				InitQuery:                 pulumi.String("SET x=1, y=2"),
 * 				MaxConnectionsPercent:     pulumi.Int(100),
 * 				MaxIdleConnectionsPercent: pulumi.Int(50),
 * 				SessionPinningFilters: pulumi.StringArray{
 * 					pulumi.String("EXCLUDE_VARIABLE_SETS"),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = rds.NewProxyTarget(ctx, "example", &rds.ProxyTargetArgs{
 * 			DbInstanceIdentifier: pulumi.Any(exampleAwsDbInstance.Identifier),
 * 			DbProxyName:          example.Name,
 * 			TargetGroupName:      exampleProxyDefaultTargetGroup.Name,
 * 		})
 * 		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.rds.Proxy;
 * import com.pulumi.aws.rds.ProxyArgs;
 * import com.pulumi.aws.rds.inputs.ProxyAuthArgs;
 * import com.pulumi.aws.rds.ProxyDefaultTargetGroup;
 * import com.pulumi.aws.rds.ProxyDefaultTargetGroupArgs;
 * import com.pulumi.aws.rds.inputs.ProxyDefaultTargetGroupConnectionPoolConfigArgs;
 * import com.pulumi.aws.rds.ProxyTarget;
 * import com.pulumi.aws.rds.ProxyTargetArgs;
 * 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 Proxy("example", ProxyArgs.builder()
 *             .name("example")
 *             .debugLogging(false)
 *             .engineFamily("MYSQL")
 *             .idleClientTimeout(1800)
 *             .requireTls(true)
 *             .roleArn(exampleAwsIamRole.arn())
 *             .vpcSecurityGroupIds(exampleAwsSecurityGroup.id())
 *             .vpcSubnetIds(exampleAwsSubnet.id())
 *             .auths(ProxyAuthArgs.builder()
 *                 .authScheme("SECRETS")
 *                 .description("example")
 *                 .iamAuth("DISABLED")
 *                 .secretArn(exampleAwsSecretsmanagerSecret.arn())
 *                 .build())
 *             .tags(Map.ofEntries(
 *                 Map.entry("Name", "example"),
 *                 Map.entry("Key", "value")
 *             ))
 *             .build());
 *         var exampleProxyDefaultTargetGroup = new ProxyDefaultTargetGroup("exampleProxyDefaultTargetGroup", ProxyDefaultTargetGroupArgs.builder()
 *             .dbProxyName(example.name())
 *             .connectionPoolConfig(ProxyDefaultTargetGroupConnectionPoolConfigArgs.builder()
 *                 .connectionBorrowTimeout(120)
 *                 .initQuery("SET x=1, y=2")
 *                 .maxConnectionsPercent(100)
 *                 .maxIdleConnectionsPercent(50)
 *                 .sessionPinningFilters("EXCLUDE_VARIABLE_SETS")
 *                 .build())
 *             .build());
 *         var exampleProxyTarget = new ProxyTarget("exampleProxyTarget", ProxyTargetArgs.builder()
 *             .dbInstanceIdentifier(exampleAwsDbInstance.identifier())
 *             .dbProxyName(example.name())
 *             .targetGroupName(exampleProxyDefaultTargetGroup.name())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: aws:rds:Proxy
 *     properties:
 *       name: example
 *       debugLogging: false
 *       engineFamily: MYSQL
 *       idleClientTimeout: 1800
 *       requireTls: true
 *       roleArn: ${exampleAwsIamRole.arn}
 *       vpcSecurityGroupIds:
 *         - ${exampleAwsSecurityGroup.id}
 *       vpcSubnetIds:
 *         - ${exampleAwsSubnet.id}
 *       auths:
 *         - authScheme: SECRETS
 *           description: example
 *           iamAuth: DISABLED
 *           secretArn: ${exampleAwsSecretsmanagerSecret.arn}
 *       tags:
 *         Name: example
 *         Key: value
 *   exampleProxyDefaultTargetGroup:
 *     type: aws:rds:ProxyDefaultTargetGroup
 *     name: example
 *     properties:
 *       dbProxyName: ${example.name}
 *       connectionPoolConfig:
 *         connectionBorrowTimeout: 120
 *         initQuery: SET x=1, y=2
 *         maxConnectionsPercent: 100
 *         maxIdleConnectionsPercent: 50
 *         sessionPinningFilters:
 *           - EXCLUDE_VARIABLE_SETS
 *   exampleProxyTarget:
 *     type: aws:rds:ProxyTarget
 *     name: example
 *     properties:
 *       dbInstanceIdentifier: ${exampleAwsDbInstance.identifier}
 *       dbProxyName: ${example.name}
 *       targetGroupName: ${exampleProxyDefaultTargetGroup.name}
 * ```
 * 
 * ## Import
 * Provisioned Clusters:
 * __Using `pulumi import` to import__ RDS DB Proxy Targets using the `db_proxy_name`, `target_group_name`, target type (such as `RDS_INSTANCE` or `TRACKED_CLUSTER`), and resource identifier separated by forward slashes (`/`). For example:
 * Instances:
 * ```sh
 * $ pulumi import aws:rds/proxyTarget:ProxyTarget example example-proxy/default/RDS_INSTANCE/example-instance
 * ```
 * Provisioned Clusters:
 * ```sh
 * $ pulumi import aws:rds/proxyTarget:ProxyTarget example example-proxy/default/TRACKED_CLUSTER/example-cluster
 * ```
 */
public class ProxyTarget internal constructor(
    override val javaResource: com.pulumi.aws.rds.ProxyTarget,
) : KotlinCustomResource(javaResource, ProxyTargetMapper) {
    /**
     * DB cluster identifier.
     * **NOTE:** Either `db_instance_identifier` or `db_cluster_identifier` should be specified and both should not be specified together
     */
    public val dbClusterIdentifier: Output?
        get() = javaResource.dbClusterIdentifier().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * DB instance identifier.
     */
    public val dbInstanceIdentifier: Output?
        get() = javaResource.dbInstanceIdentifier().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the DB proxy.
     */
    public val dbProxyName: Output
        get() = javaResource.dbProxyName().applyValue({ args0 -> args0 })

    /**
     * Hostname for the target RDS DB Instance. Only returned for `RDS_INSTANCE` type.
     */
    public val endpoint: Output
        get() = javaResource.endpoint().applyValue({ args0 -> args0 })

    /**
     * Port for the target RDS DB Instance or Aurora DB Cluster.
     */
    public val port: Output
        get() = javaResource.port().applyValue({ args0 -> args0 })

    /**
     * Identifier representing the DB Instance or DB Cluster target.
     */
    public val rdsResourceId: Output
        get() = javaResource.rdsResourceId().applyValue({ args0 -> args0 })

    /**
     * Amazon Resource Name (ARN) for the DB instance or DB cluster. Currently not returned by the RDS API.
     */
    public val targetArn: Output
        get() = javaResource.targetArn().applyValue({ args0 -> args0 })

    /**
     * The name of the target group.
     */
    public val targetGroupName: Output
        get() = javaResource.targetGroupName().applyValue({ args0 -> args0 })

    /**
     * DB Cluster identifier for the DB Instance target. Not returned unless manually importing an `RDS_INSTANCE` target that is part of a DB Cluster.
     */
    public val trackedClusterId: Output
        get() = javaResource.trackedClusterId().applyValue({ args0 -> args0 })

    /**
     * Type of targetE.g., `RDS_INSTANCE` or `TRACKED_CLUSTER`
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })
}

public object ProxyTargetMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.aws.rds.ProxyTarget::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy