github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/redshiftdata/statement.go (about) 1 // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package redshiftdata 5 6 import ( 7 "context" 8 "reflect" 9 10 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Executes a Redshift Data Statement. 16 // 17 // ## Example Usage 18 // 19 // ### clusterIdentifier 20 // 21 // <!--Start PulumiCodeChooser --> 22 // ```go 23 // package main 24 // 25 // import ( 26 // 27 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/redshiftdata" 28 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 29 // 30 // ) 31 // 32 // func main() { 33 // pulumi.Run(func(ctx *pulumi.Context) error { 34 // _, err := redshiftdata.NewStatement(ctx, "example", &redshiftdata.StatementArgs{ 35 // ClusterIdentifier: pulumi.Any(exampleAwsRedshiftCluster.ClusterIdentifier), 36 // Database: pulumi.Any(exampleAwsRedshiftCluster.DatabaseName), 37 // DbUser: pulumi.Any(exampleAwsRedshiftCluster.MasterUsername), 38 // Sql: pulumi.String("CREATE GROUP group_name;"), 39 // }) 40 // if err != nil { 41 // return err 42 // } 43 // return nil 44 // }) 45 // } 46 // 47 // ``` 48 // <!--End PulumiCodeChooser --> 49 // 50 // ### workgroupName 51 // 52 // <!--Start PulumiCodeChooser --> 53 // ```go 54 // package main 55 // 56 // import ( 57 // 58 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/redshiftdata" 59 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 60 // 61 // ) 62 // 63 // func main() { 64 // pulumi.Run(func(ctx *pulumi.Context) error { 65 // _, err := redshiftdata.NewStatement(ctx, "example", &redshiftdata.StatementArgs{ 66 // WorkgroupName: pulumi.Any(exampleAwsRedshiftserverlessWorkgroup.WorkgroupName), 67 // Database: pulumi.String("dev"), 68 // Sql: pulumi.String("CREATE GROUP group_name;"), 69 // }) 70 // if err != nil { 71 // return err 72 // } 73 // return nil 74 // }) 75 // } 76 // 77 // ``` 78 // <!--End PulumiCodeChooser --> 79 // 80 // ## Import 81 // 82 // Using `pulumi import`, import Redshift Data Statements using the `id`. For example: 83 // 84 // ```sh 85 // $ pulumi import aws:redshiftdata/statement:Statement example example 86 // ``` 87 type Statement struct { 88 pulumi.CustomResourceState 89 90 // The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials. 91 ClusterIdentifier pulumi.StringPtrOutput `pulumi:"clusterIdentifier"` 92 // The name of the database. 93 Database pulumi.StringOutput `pulumi:"database"` 94 // The database user name. 95 DbUser pulumi.StringPtrOutput `pulumi:"dbUser"` 96 Parameters StatementParameterArrayOutput `pulumi:"parameters"` 97 // The name or ARN of the secret that enables access to the database. 98 SecretArn pulumi.StringPtrOutput `pulumi:"secretArn"` 99 // The SQL statement text to run. 100 // 101 // The following arguments are optional: 102 Sql pulumi.StringOutput `pulumi:"sql"` 103 // The name of the SQL statement. You can name the SQL statement when you create it to identify the query. 104 StatementName pulumi.StringPtrOutput `pulumi:"statementName"` 105 // A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs. 106 WithEvent pulumi.BoolPtrOutput `pulumi:"withEvent"` 107 // The serverless workgroup name. This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials. 108 WorkgroupName pulumi.StringPtrOutput `pulumi:"workgroupName"` 109 } 110 111 // NewStatement registers a new resource with the given unique name, arguments, and options. 112 func NewStatement(ctx *pulumi.Context, 113 name string, args *StatementArgs, opts ...pulumi.ResourceOption) (*Statement, error) { 114 if args == nil { 115 return nil, errors.New("missing one or more required arguments") 116 } 117 118 if args.Database == nil { 119 return nil, errors.New("invalid value for required argument 'Database'") 120 } 121 if args.Sql == nil { 122 return nil, errors.New("invalid value for required argument 'Sql'") 123 } 124 opts = internal.PkgResourceDefaultOpts(opts) 125 var resource Statement 126 err := ctx.RegisterResource("aws:redshiftdata/statement:Statement", name, args, &resource, opts...) 127 if err != nil { 128 return nil, err 129 } 130 return &resource, nil 131 } 132 133 // GetStatement gets an existing Statement resource's state with the given name, ID, and optional 134 // state properties that are used to uniquely qualify the lookup (nil if not required). 135 func GetStatement(ctx *pulumi.Context, 136 name string, id pulumi.IDInput, state *StatementState, opts ...pulumi.ResourceOption) (*Statement, error) { 137 var resource Statement 138 err := ctx.ReadResource("aws:redshiftdata/statement:Statement", name, id, state, &resource, opts...) 139 if err != nil { 140 return nil, err 141 } 142 return &resource, nil 143 } 144 145 // Input properties used for looking up and filtering Statement resources. 146 type statementState struct { 147 // The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials. 148 ClusterIdentifier *string `pulumi:"clusterIdentifier"` 149 // The name of the database. 150 Database *string `pulumi:"database"` 151 // The database user name. 152 DbUser *string `pulumi:"dbUser"` 153 Parameters []StatementParameter `pulumi:"parameters"` 154 // The name or ARN of the secret that enables access to the database. 155 SecretArn *string `pulumi:"secretArn"` 156 // The SQL statement text to run. 157 // 158 // The following arguments are optional: 159 Sql *string `pulumi:"sql"` 160 // The name of the SQL statement. You can name the SQL statement when you create it to identify the query. 161 StatementName *string `pulumi:"statementName"` 162 // A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs. 163 WithEvent *bool `pulumi:"withEvent"` 164 // The serverless workgroup name. This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials. 165 WorkgroupName *string `pulumi:"workgroupName"` 166 } 167 168 type StatementState struct { 169 // The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials. 170 ClusterIdentifier pulumi.StringPtrInput 171 // The name of the database. 172 Database pulumi.StringPtrInput 173 // The database user name. 174 DbUser pulumi.StringPtrInput 175 Parameters StatementParameterArrayInput 176 // The name or ARN of the secret that enables access to the database. 177 SecretArn pulumi.StringPtrInput 178 // The SQL statement text to run. 179 // 180 // The following arguments are optional: 181 Sql pulumi.StringPtrInput 182 // The name of the SQL statement. You can name the SQL statement when you create it to identify the query. 183 StatementName pulumi.StringPtrInput 184 // A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs. 185 WithEvent pulumi.BoolPtrInput 186 // The serverless workgroup name. This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials. 187 WorkgroupName pulumi.StringPtrInput 188 } 189 190 func (StatementState) ElementType() reflect.Type { 191 return reflect.TypeOf((*statementState)(nil)).Elem() 192 } 193 194 type statementArgs struct { 195 // The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials. 196 ClusterIdentifier *string `pulumi:"clusterIdentifier"` 197 // The name of the database. 198 Database string `pulumi:"database"` 199 // The database user name. 200 DbUser *string `pulumi:"dbUser"` 201 Parameters []StatementParameter `pulumi:"parameters"` 202 // The name or ARN of the secret that enables access to the database. 203 SecretArn *string `pulumi:"secretArn"` 204 // The SQL statement text to run. 205 // 206 // The following arguments are optional: 207 Sql string `pulumi:"sql"` 208 // The name of the SQL statement. You can name the SQL statement when you create it to identify the query. 209 StatementName *string `pulumi:"statementName"` 210 // A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs. 211 WithEvent *bool `pulumi:"withEvent"` 212 // The serverless workgroup name. This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials. 213 WorkgroupName *string `pulumi:"workgroupName"` 214 } 215 216 // The set of arguments for constructing a Statement resource. 217 type StatementArgs struct { 218 // The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials. 219 ClusterIdentifier pulumi.StringPtrInput 220 // The name of the database. 221 Database pulumi.StringInput 222 // The database user name. 223 DbUser pulumi.StringPtrInput 224 Parameters StatementParameterArrayInput 225 // The name or ARN of the secret that enables access to the database. 226 SecretArn pulumi.StringPtrInput 227 // The SQL statement text to run. 228 // 229 // The following arguments are optional: 230 Sql pulumi.StringInput 231 // The name of the SQL statement. You can name the SQL statement when you create it to identify the query. 232 StatementName pulumi.StringPtrInput 233 // A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs. 234 WithEvent pulumi.BoolPtrInput 235 // The serverless workgroup name. This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials. 236 WorkgroupName pulumi.StringPtrInput 237 } 238 239 func (StatementArgs) ElementType() reflect.Type { 240 return reflect.TypeOf((*statementArgs)(nil)).Elem() 241 } 242 243 type StatementInput interface { 244 pulumi.Input 245 246 ToStatementOutput() StatementOutput 247 ToStatementOutputWithContext(ctx context.Context) StatementOutput 248 } 249 250 func (*Statement) ElementType() reflect.Type { 251 return reflect.TypeOf((**Statement)(nil)).Elem() 252 } 253 254 func (i *Statement) ToStatementOutput() StatementOutput { 255 return i.ToStatementOutputWithContext(context.Background()) 256 } 257 258 func (i *Statement) ToStatementOutputWithContext(ctx context.Context) StatementOutput { 259 return pulumi.ToOutputWithContext(ctx, i).(StatementOutput) 260 } 261 262 // StatementArrayInput is an input type that accepts StatementArray and StatementArrayOutput values. 263 // You can construct a concrete instance of `StatementArrayInput` via: 264 // 265 // StatementArray{ StatementArgs{...} } 266 type StatementArrayInput interface { 267 pulumi.Input 268 269 ToStatementArrayOutput() StatementArrayOutput 270 ToStatementArrayOutputWithContext(context.Context) StatementArrayOutput 271 } 272 273 type StatementArray []StatementInput 274 275 func (StatementArray) ElementType() reflect.Type { 276 return reflect.TypeOf((*[]*Statement)(nil)).Elem() 277 } 278 279 func (i StatementArray) ToStatementArrayOutput() StatementArrayOutput { 280 return i.ToStatementArrayOutputWithContext(context.Background()) 281 } 282 283 func (i StatementArray) ToStatementArrayOutputWithContext(ctx context.Context) StatementArrayOutput { 284 return pulumi.ToOutputWithContext(ctx, i).(StatementArrayOutput) 285 } 286 287 // StatementMapInput is an input type that accepts StatementMap and StatementMapOutput values. 288 // You can construct a concrete instance of `StatementMapInput` via: 289 // 290 // StatementMap{ "key": StatementArgs{...} } 291 type StatementMapInput interface { 292 pulumi.Input 293 294 ToStatementMapOutput() StatementMapOutput 295 ToStatementMapOutputWithContext(context.Context) StatementMapOutput 296 } 297 298 type StatementMap map[string]StatementInput 299 300 func (StatementMap) ElementType() reflect.Type { 301 return reflect.TypeOf((*map[string]*Statement)(nil)).Elem() 302 } 303 304 func (i StatementMap) ToStatementMapOutput() StatementMapOutput { 305 return i.ToStatementMapOutputWithContext(context.Background()) 306 } 307 308 func (i StatementMap) ToStatementMapOutputWithContext(ctx context.Context) StatementMapOutput { 309 return pulumi.ToOutputWithContext(ctx, i).(StatementMapOutput) 310 } 311 312 type StatementOutput struct{ *pulumi.OutputState } 313 314 func (StatementOutput) ElementType() reflect.Type { 315 return reflect.TypeOf((**Statement)(nil)).Elem() 316 } 317 318 func (o StatementOutput) ToStatementOutput() StatementOutput { 319 return o 320 } 321 322 func (o StatementOutput) ToStatementOutputWithContext(ctx context.Context) StatementOutput { 323 return o 324 } 325 326 // The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials. 327 func (o StatementOutput) ClusterIdentifier() pulumi.StringPtrOutput { 328 return o.ApplyT(func(v *Statement) pulumi.StringPtrOutput { return v.ClusterIdentifier }).(pulumi.StringPtrOutput) 329 } 330 331 // The name of the database. 332 func (o StatementOutput) Database() pulumi.StringOutput { 333 return o.ApplyT(func(v *Statement) pulumi.StringOutput { return v.Database }).(pulumi.StringOutput) 334 } 335 336 // The database user name. 337 func (o StatementOutput) DbUser() pulumi.StringPtrOutput { 338 return o.ApplyT(func(v *Statement) pulumi.StringPtrOutput { return v.DbUser }).(pulumi.StringPtrOutput) 339 } 340 341 func (o StatementOutput) Parameters() StatementParameterArrayOutput { 342 return o.ApplyT(func(v *Statement) StatementParameterArrayOutput { return v.Parameters }).(StatementParameterArrayOutput) 343 } 344 345 // The name or ARN of the secret that enables access to the database. 346 func (o StatementOutput) SecretArn() pulumi.StringPtrOutput { 347 return o.ApplyT(func(v *Statement) pulumi.StringPtrOutput { return v.SecretArn }).(pulumi.StringPtrOutput) 348 } 349 350 // The SQL statement text to run. 351 // 352 // The following arguments are optional: 353 func (o StatementOutput) Sql() pulumi.StringOutput { 354 return o.ApplyT(func(v *Statement) pulumi.StringOutput { return v.Sql }).(pulumi.StringOutput) 355 } 356 357 // The name of the SQL statement. You can name the SQL statement when you create it to identify the query. 358 func (o StatementOutput) StatementName() pulumi.StringPtrOutput { 359 return o.ApplyT(func(v *Statement) pulumi.StringPtrOutput { return v.StatementName }).(pulumi.StringPtrOutput) 360 } 361 362 // A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs. 363 func (o StatementOutput) WithEvent() pulumi.BoolPtrOutput { 364 return o.ApplyT(func(v *Statement) pulumi.BoolPtrOutput { return v.WithEvent }).(pulumi.BoolPtrOutput) 365 } 366 367 // The serverless workgroup name. This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials. 368 func (o StatementOutput) WorkgroupName() pulumi.StringPtrOutput { 369 return o.ApplyT(func(v *Statement) pulumi.StringPtrOutput { return v.WorkgroupName }).(pulumi.StringPtrOutput) 370 } 371 372 type StatementArrayOutput struct{ *pulumi.OutputState } 373 374 func (StatementArrayOutput) ElementType() reflect.Type { 375 return reflect.TypeOf((*[]*Statement)(nil)).Elem() 376 } 377 378 func (o StatementArrayOutput) ToStatementArrayOutput() StatementArrayOutput { 379 return o 380 } 381 382 func (o StatementArrayOutput) ToStatementArrayOutputWithContext(ctx context.Context) StatementArrayOutput { 383 return o 384 } 385 386 func (o StatementArrayOutput) Index(i pulumi.IntInput) StatementOutput { 387 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Statement { 388 return vs[0].([]*Statement)[vs[1].(int)] 389 }).(StatementOutput) 390 } 391 392 type StatementMapOutput struct{ *pulumi.OutputState } 393 394 func (StatementMapOutput) ElementType() reflect.Type { 395 return reflect.TypeOf((*map[string]*Statement)(nil)).Elem() 396 } 397 398 func (o StatementMapOutput) ToStatementMapOutput() StatementMapOutput { 399 return o 400 } 401 402 func (o StatementMapOutput) ToStatementMapOutputWithContext(ctx context.Context) StatementMapOutput { 403 return o 404 } 405 406 func (o StatementMapOutput) MapIndex(k pulumi.StringInput) StatementOutput { 407 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Statement { 408 return vs[0].(map[string]*Statement)[vs[1].(string)] 409 }).(StatementOutput) 410 } 411 412 func init() { 413 pulumi.RegisterInputType(reflect.TypeOf((*StatementInput)(nil)).Elem(), &Statement{}) 414 pulumi.RegisterInputType(reflect.TypeOf((*StatementArrayInput)(nil)).Elem(), StatementArray{}) 415 pulumi.RegisterInputType(reflect.TypeOf((*StatementMapInput)(nil)).Elem(), StatementMap{}) 416 pulumi.RegisterOutputType(StatementOutput{}) 417 pulumi.RegisterOutputType(StatementArrayOutput{}) 418 pulumi.RegisterOutputType(StatementMapOutput{}) 419 }