1. Packages
  2. AWS
  3. API Docs
  4. redshiftdata
  5. Statement
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

aws.redshiftdata.Statement

Explore with Pulumi AI

aws logo
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

    Executes a Redshift Data Statement.

    Example Usage

    cluster_identifier

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.redshiftdata.Statement("example", {
        clusterIdentifier: exampleAwsRedshiftCluster.clusterIdentifier,
        database: exampleAwsRedshiftCluster.databaseName,
        dbUser: exampleAwsRedshiftCluster.masterUsername,
        sql: "CREATE GROUP group_name;",
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.redshiftdata.Statement("example",
        cluster_identifier=example_aws_redshift_cluster["clusterIdentifier"],
        database=example_aws_redshift_cluster["databaseName"],
        db_user=example_aws_redshift_cluster["masterUsername"],
        sql="CREATE GROUP group_name;")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/redshiftdata"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := redshiftdata.NewStatement(ctx, "example", &redshiftdata.StatementArgs{
    			ClusterIdentifier: pulumi.Any(exampleAwsRedshiftCluster.ClusterIdentifier),
    			Database:          pulumi.Any(exampleAwsRedshiftCluster.DatabaseName),
    			DbUser:            pulumi.Any(exampleAwsRedshiftCluster.MasterUsername),
    			Sql:               pulumi.String("CREATE GROUP group_name;"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.RedshiftData.Statement("example", new()
        {
            ClusterIdentifier = exampleAwsRedshiftCluster.ClusterIdentifier,
            Database = exampleAwsRedshiftCluster.DatabaseName,
            DbUser = exampleAwsRedshiftCluster.MasterUsername,
            Sql = "CREATE GROUP group_name;",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.redshiftdata.Statement;
    import com.pulumi.aws.redshiftdata.StatementArgs;
    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 Statement("example", StatementArgs.builder()
                .clusterIdentifier(exampleAwsRedshiftCluster.clusterIdentifier())
                .database(exampleAwsRedshiftCluster.databaseName())
                .dbUser(exampleAwsRedshiftCluster.masterUsername())
                .sql("CREATE GROUP group_name;")
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:redshiftdata:Statement
        properties:
          clusterIdentifier: ${exampleAwsRedshiftCluster.clusterIdentifier}
          database: ${exampleAwsRedshiftCluster.databaseName}
          dbUser: ${exampleAwsRedshiftCluster.masterUsername}
          sql: CREATE GROUP group_name;
    

    workgroup_name

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.redshiftdata.Statement("example", {
        workgroupName: exampleAwsRedshiftserverlessWorkgroup.workgroupName,
        database: "dev",
        sql: "CREATE GROUP group_name;",
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.redshiftdata.Statement("example",
        workgroup_name=example_aws_redshiftserverless_workgroup["workgroupName"],
        database="dev",
        sql="CREATE GROUP group_name;")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/redshiftdata"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := redshiftdata.NewStatement(ctx, "example", &redshiftdata.StatementArgs{
    			WorkgroupName: pulumi.Any(exampleAwsRedshiftserverlessWorkgroup.WorkgroupName),
    			Database:      pulumi.String("dev"),
    			Sql:           pulumi.String("CREATE GROUP group_name;"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.RedshiftData.Statement("example", new()
        {
            WorkgroupName = exampleAwsRedshiftserverlessWorkgroup.WorkgroupName,
            Database = "dev",
            Sql = "CREATE GROUP group_name;",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.redshiftdata.Statement;
    import com.pulumi.aws.redshiftdata.StatementArgs;
    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 Statement("example", StatementArgs.builder()
                .workgroupName(exampleAwsRedshiftserverlessWorkgroup.workgroupName())
                .database("dev")
                .sql("CREATE GROUP group_name;")
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:redshiftdata:Statement
        properties:
          workgroupName: ${exampleAwsRedshiftserverlessWorkgroup.workgroupName}
          database: dev
          sql: CREATE GROUP group_name;
    

    Create Statement Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Statement(name: string, args: StatementArgs, opts?: CustomResourceOptions);
    @overload
    def Statement(resource_name: str,
                  args: StatementArgs,
                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def Statement(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  database: Optional[str] = None,
                  sql: Optional[str] = None,
                  cluster_identifier: Optional[str] = None,
                  db_user: Optional[str] = None,
                  parameters: Optional[Sequence[StatementParameterArgs]] = None,
                  secret_arn: Optional[str] = None,
                  statement_name: Optional[str] = None,
                  with_event: Optional[bool] = None,
                  workgroup_name: Optional[str] = None)
    func NewStatement(ctx *Context, name string, args StatementArgs, opts ...ResourceOption) (*Statement, error)
    public Statement(string name, StatementArgs args, CustomResourceOptions? opts = null)
    public Statement(String name, StatementArgs args)
    public Statement(String name, StatementArgs args, CustomResourceOptions options)
    
    type: aws:redshiftdata:Statement
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args StatementArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args StatementArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args StatementArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args StatementArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args StatementArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var statementResource = new Aws.RedshiftData.Statement("statementResource", new()
    {
        Database = "string",
        Sql = "string",
        ClusterIdentifier = "string",
        DbUser = "string",
        Parameters = new[]
        {
            new Aws.RedshiftData.Inputs.StatementParameterArgs
            {
                Name = "string",
                Value = "string",
            },
        },
        SecretArn = "string",
        StatementName = "string",
        WithEvent = false,
        WorkgroupName = "string",
    });
    
    example, err := redshiftdata.NewStatement(ctx, "statementResource", &redshiftdata.StatementArgs{
    	Database:          pulumi.String("string"),
    	Sql:               pulumi.String("string"),
    	ClusterIdentifier: pulumi.String("string"),
    	DbUser:            pulumi.String("string"),
    	Parameters: redshiftdata.StatementParameterArray{
    		&redshiftdata.StatementParameterArgs{
    			Name:  pulumi.String("string"),
    			Value: pulumi.String("string"),
    		},
    	},
    	SecretArn:     pulumi.String("string"),
    	StatementName: pulumi.String("string"),
    	WithEvent:     pulumi.Bool(false),
    	WorkgroupName: pulumi.String("string"),
    })
    
    var statementResource = new Statement("statementResource", StatementArgs.builder()
        .database("string")
        .sql("string")
        .clusterIdentifier("string")
        .dbUser("string")
        .parameters(StatementParameterArgs.builder()
            .name("string")
            .value("string")
            .build())
        .secretArn("string")
        .statementName("string")
        .withEvent(false)
        .workgroupName("string")
        .build());
    
    statement_resource = aws.redshiftdata.Statement("statementResource",
        database="string",
        sql="string",
        cluster_identifier="string",
        db_user="string",
        parameters=[{
            "name": "string",
            "value": "string",
        }],
        secret_arn="string",
        statement_name="string",
        with_event=False,
        workgroup_name="string")
    
    const statementResource = new aws.redshiftdata.Statement("statementResource", {
        database: "string",
        sql: "string",
        clusterIdentifier: "string",
        dbUser: "string",
        parameters: [{
            name: "string",
            value: "string",
        }],
        secretArn: "string",
        statementName: "string",
        withEvent: false,
        workgroupName: "string",
    });
    
    type: aws:redshiftdata:Statement
    properties:
        clusterIdentifier: string
        database: string
        dbUser: string
        parameters:
            - name: string
              value: string
        secretArn: string
        sql: string
        statementName: string
        withEvent: false
        workgroupName: string
    

    Statement Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Statement resource accepts the following input properties:

    Database string
    The name of the database.
    Sql string

    The SQL statement text to run.

    The following arguments are optional:

    ClusterIdentifier string
    The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.
    DbUser string
    The database user name.
    Parameters List<StatementParameter>
    SecretArn string
    The name or ARN of the secret that enables access to the database.
    StatementName string
    The name of the SQL statement. You can name the SQL statement when you create it to identify the query.
    WithEvent bool
    A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs.
    WorkgroupName string
    The serverless workgroup name. This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.
    Database string
    The name of the database.
    Sql string

    The SQL statement text to run.

    The following arguments are optional:

    ClusterIdentifier string
    The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.
    DbUser string
    The database user name.
    Parameters []StatementParameterArgs
    SecretArn string
    The name or ARN of the secret that enables access to the database.
    StatementName string
    The name of the SQL statement. You can name the SQL statement when you create it to identify the query.
    WithEvent bool
    A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs.
    WorkgroupName string
    The serverless workgroup name. This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.
    database String
    The name of the database.
    sql String

    The SQL statement text to run.

    The following arguments are optional:

    clusterIdentifier String
    The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.
    dbUser String
    The database user name.
    parameters List<StatementParameter>
    secretArn String
    The name or ARN of the secret that enables access to the database.
    statementName String
    The name of the SQL statement. You can name the SQL statement when you create it to identify the query.
    withEvent Boolean
    A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs.
    workgroupName String
    The serverless workgroup name. This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.
    database string
    The name of the database.
    sql string

    The SQL statement text to run.

    The following arguments are optional:

    clusterIdentifier string
    The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.
    dbUser string
    The database user name.
    parameters StatementParameter[]
    secretArn string
    The name or ARN of the secret that enables access to the database.
    statementName string
    The name of the SQL statement. You can name the SQL statement when you create it to identify the query.
    withEvent boolean
    A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs.
    workgroupName string
    The serverless workgroup name. This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.
    database str
    The name of the database.
    sql str

    The SQL statement text to run.

    The following arguments are optional:

    cluster_identifier str
    The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.
    db_user str
    The database user name.
    parameters Sequence[StatementParameterArgs]
    secret_arn str
    The name or ARN of the secret that enables access to the database.
    statement_name str
    The name of the SQL statement. You can name the SQL statement when you create it to identify the query.
    with_event bool
    A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs.
    workgroup_name str
    The serverless workgroup name. This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.
    database String
    The name of the database.
    sql String

    The SQL statement text to run.

    The following arguments are optional:

    clusterIdentifier String
    The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.
    dbUser String
    The database user name.
    parameters List<Property Map>
    secretArn String
    The name or ARN of the secret that enables access to the database.
    statementName String
    The name of the SQL statement. You can name the SQL statement when you create it to identify the query.
    withEvent Boolean
    A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs.
    workgroupName String
    The serverless workgroup name. This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Statement resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Statement Resource

    Get an existing Statement resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: StatementState, opts?: CustomResourceOptions): Statement
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            cluster_identifier: Optional[str] = None,
            database: Optional[str] = None,
            db_user: Optional[str] = None,
            parameters: Optional[Sequence[StatementParameterArgs]] = None,
            secret_arn: Optional[str] = None,
            sql: Optional[str] = None,
            statement_name: Optional[str] = None,
            with_event: Optional[bool] = None,
            workgroup_name: Optional[str] = None) -> Statement
    func GetStatement(ctx *Context, name string, id IDInput, state *StatementState, opts ...ResourceOption) (*Statement, error)
    public static Statement Get(string name, Input<string> id, StatementState? state, CustomResourceOptions? opts = null)
    public static Statement get(String name, Output<String> id, StatementState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    ClusterIdentifier string
    The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.
    Database string
    The name of the database.
    DbUser string
    The database user name.
    Parameters List<StatementParameter>
    SecretArn string
    The name or ARN of the secret that enables access to the database.
    Sql string

    The SQL statement text to run.

    The following arguments are optional:

    StatementName string
    The name of the SQL statement. You can name the SQL statement when you create it to identify the query.
    WithEvent bool
    A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs.
    WorkgroupName string
    The serverless workgroup name. This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.
    ClusterIdentifier string
    The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.
    Database string
    The name of the database.
    DbUser string
    The database user name.
    Parameters []StatementParameterArgs
    SecretArn string
    The name or ARN of the secret that enables access to the database.
    Sql string

    The SQL statement text to run.

    The following arguments are optional:

    StatementName string
    The name of the SQL statement. You can name the SQL statement when you create it to identify the query.
    WithEvent bool
    A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs.
    WorkgroupName string
    The serverless workgroup name. This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.
    clusterIdentifier String
    The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.
    database String
    The name of the database.
    dbUser String
    The database user name.
    parameters List<StatementParameter>
    secretArn String
    The name or ARN of the secret that enables access to the database.
    sql String

    The SQL statement text to run.

    The following arguments are optional:

    statementName String
    The name of the SQL statement. You can name the SQL statement when you create it to identify the query.
    withEvent Boolean
    A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs.
    workgroupName String
    The serverless workgroup name. This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.
    clusterIdentifier string
    The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.
    database string
    The name of the database.
    dbUser string
    The database user name.
    parameters StatementParameter[]
    secretArn string
    The name or ARN of the secret that enables access to the database.
    sql string

    The SQL statement text to run.

    The following arguments are optional:

    statementName string
    The name of the SQL statement. You can name the SQL statement when you create it to identify the query.
    withEvent boolean
    A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs.
    workgroupName string
    The serverless workgroup name. This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.
    cluster_identifier str
    The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.
    database str
    The name of the database.
    db_user str
    The database user name.
    parameters Sequence[StatementParameterArgs]
    secret_arn str
    The name or ARN of the secret that enables access to the database.
    sql str

    The SQL statement text to run.

    The following arguments are optional:

    statement_name str
    The name of the SQL statement. You can name the SQL statement when you create it to identify the query.
    with_event bool
    A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs.
    workgroup_name str
    The serverless workgroup name. This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.
    clusterIdentifier String
    The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.
    database String
    The name of the database.
    dbUser String
    The database user name.
    parameters List<Property Map>
    secretArn String
    The name or ARN of the secret that enables access to the database.
    sql String

    The SQL statement text to run.

    The following arguments are optional:

    statementName String
    The name of the SQL statement. You can name the SQL statement when you create it to identify the query.
    withEvent Boolean
    A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs.
    workgroupName String
    The serverless workgroup name. This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.

    Supporting Types

    StatementParameter, StatementParameterArgs

    Name string
    Value string
    Name string
    Value string
    name String
    value String
    name string
    value string
    name str
    value str
    name String
    value String

    Import

    Using pulumi import, import Redshift Data Statements using the id. For example:

    $ pulumi import aws:redshiftdata/statement:Statement example example
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi