github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/athena/database.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 athena 5 6 import ( 7 "context" 8 "reflect" 9 10 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 11 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 12 ) 13 14 // Provides an Athena database. 15 // 16 // ## Example Usage 17 // 18 // <!--Start PulumiCodeChooser --> 19 // ```go 20 // package main 21 // 22 // import ( 23 // 24 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/athena" 25 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3" 26 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 27 // 28 // ) 29 // 30 // func main() { 31 // pulumi.Run(func(ctx *pulumi.Context) error { 32 // example, err := s3.NewBucketV2(ctx, "example", &s3.BucketV2Args{ 33 // Bucket: pulumi.String("example"), 34 // }) 35 // if err != nil { 36 // return err 37 // } 38 // _, err = athena.NewDatabase(ctx, "example", &athena.DatabaseArgs{ 39 // Name: pulumi.String("database_name"), 40 // Bucket: example.ID(), 41 // }) 42 // if err != nil { 43 // return err 44 // } 45 // return nil 46 // }) 47 // } 48 // 49 // ``` 50 // <!--End PulumiCodeChooser --> 51 // 52 // ## Import 53 // 54 // Using `pulumi import`, import Athena Databases using their name. For example: 55 // 56 // ```sh 57 // $ pulumi import aws:athena/database:Database example example 58 // ``` 59 // Certain resource arguments, like `encryption_configuration` and `bucket`, do not have an API method for reading the information after creation. If the argument is set in the Pulumi program on an imported resource, Pulumi will always show a difference. To workaround this behavior, either omit the argument from the Pulumi program or use `ignore_changes` to hide the difference. For example: 60 type Database struct { 61 pulumi.CustomResourceState 62 63 // That an Amazon S3 canned ACL should be set to control ownership of stored query results. See ACL Configuration below. 64 AclConfiguration DatabaseAclConfigurationPtrOutput `pulumi:"aclConfiguration"` 65 // Name of S3 bucket to save the results of the query execution. 66 Bucket pulumi.StringPtrOutput `pulumi:"bucket"` 67 // Description of the database. 68 Comment pulumi.StringPtrOutput `pulumi:"comment"` 69 // Encryption key block AWS Athena uses to decrypt the data in S3, such as an AWS Key Management Service (AWS KMS) key. See Encryption Configuration below. 70 EncryptionConfiguration DatabaseEncryptionConfigurationPtrOutput `pulumi:"encryptionConfiguration"` 71 // AWS account ID that you expect to be the owner of the Amazon S3 bucket. 72 ExpectedBucketOwner pulumi.StringPtrOutput `pulumi:"expectedBucketOwner"` 73 // Boolean that indicates all tables should be deleted from the database so that the database can be destroyed without error. The tables are *not* recoverable. 74 ForceDestroy pulumi.BoolPtrOutput `pulumi:"forceDestroy"` 75 // Name of the database to create. 76 Name pulumi.StringOutput `pulumi:"name"` 77 // Key-value map of custom metadata properties for the database definition. 78 Properties pulumi.StringMapOutput `pulumi:"properties"` 79 } 80 81 // NewDatabase registers a new resource with the given unique name, arguments, and options. 82 func NewDatabase(ctx *pulumi.Context, 83 name string, args *DatabaseArgs, opts ...pulumi.ResourceOption) (*Database, error) { 84 if args == nil { 85 args = &DatabaseArgs{} 86 } 87 88 opts = internal.PkgResourceDefaultOpts(opts) 89 var resource Database 90 err := ctx.RegisterResource("aws:athena/database:Database", name, args, &resource, opts...) 91 if err != nil { 92 return nil, err 93 } 94 return &resource, nil 95 } 96 97 // GetDatabase gets an existing Database resource's state with the given name, ID, and optional 98 // state properties that are used to uniquely qualify the lookup (nil if not required). 99 func GetDatabase(ctx *pulumi.Context, 100 name string, id pulumi.IDInput, state *DatabaseState, opts ...pulumi.ResourceOption) (*Database, error) { 101 var resource Database 102 err := ctx.ReadResource("aws:athena/database:Database", name, id, state, &resource, opts...) 103 if err != nil { 104 return nil, err 105 } 106 return &resource, nil 107 } 108 109 // Input properties used for looking up and filtering Database resources. 110 type databaseState struct { 111 // That an Amazon S3 canned ACL should be set to control ownership of stored query results. See ACL Configuration below. 112 AclConfiguration *DatabaseAclConfiguration `pulumi:"aclConfiguration"` 113 // Name of S3 bucket to save the results of the query execution. 114 Bucket *string `pulumi:"bucket"` 115 // Description of the database. 116 Comment *string `pulumi:"comment"` 117 // Encryption key block AWS Athena uses to decrypt the data in S3, such as an AWS Key Management Service (AWS KMS) key. See Encryption Configuration below. 118 EncryptionConfiguration *DatabaseEncryptionConfiguration `pulumi:"encryptionConfiguration"` 119 // AWS account ID that you expect to be the owner of the Amazon S3 bucket. 120 ExpectedBucketOwner *string `pulumi:"expectedBucketOwner"` 121 // Boolean that indicates all tables should be deleted from the database so that the database can be destroyed without error. The tables are *not* recoverable. 122 ForceDestroy *bool `pulumi:"forceDestroy"` 123 // Name of the database to create. 124 Name *string `pulumi:"name"` 125 // Key-value map of custom metadata properties for the database definition. 126 Properties map[string]string `pulumi:"properties"` 127 } 128 129 type DatabaseState struct { 130 // That an Amazon S3 canned ACL should be set to control ownership of stored query results. See ACL Configuration below. 131 AclConfiguration DatabaseAclConfigurationPtrInput 132 // Name of S3 bucket to save the results of the query execution. 133 Bucket pulumi.StringPtrInput 134 // Description of the database. 135 Comment pulumi.StringPtrInput 136 // Encryption key block AWS Athena uses to decrypt the data in S3, such as an AWS Key Management Service (AWS KMS) key. See Encryption Configuration below. 137 EncryptionConfiguration DatabaseEncryptionConfigurationPtrInput 138 // AWS account ID that you expect to be the owner of the Amazon S3 bucket. 139 ExpectedBucketOwner pulumi.StringPtrInput 140 // Boolean that indicates all tables should be deleted from the database so that the database can be destroyed without error. The tables are *not* recoverable. 141 ForceDestroy pulumi.BoolPtrInput 142 // Name of the database to create. 143 Name pulumi.StringPtrInput 144 // Key-value map of custom metadata properties for the database definition. 145 Properties pulumi.StringMapInput 146 } 147 148 func (DatabaseState) ElementType() reflect.Type { 149 return reflect.TypeOf((*databaseState)(nil)).Elem() 150 } 151 152 type databaseArgs struct { 153 // That an Amazon S3 canned ACL should be set to control ownership of stored query results. See ACL Configuration below. 154 AclConfiguration *DatabaseAclConfiguration `pulumi:"aclConfiguration"` 155 // Name of S3 bucket to save the results of the query execution. 156 Bucket *string `pulumi:"bucket"` 157 // Description of the database. 158 Comment *string `pulumi:"comment"` 159 // Encryption key block AWS Athena uses to decrypt the data in S3, such as an AWS Key Management Service (AWS KMS) key. See Encryption Configuration below. 160 EncryptionConfiguration *DatabaseEncryptionConfiguration `pulumi:"encryptionConfiguration"` 161 // AWS account ID that you expect to be the owner of the Amazon S3 bucket. 162 ExpectedBucketOwner *string `pulumi:"expectedBucketOwner"` 163 // Boolean that indicates all tables should be deleted from the database so that the database can be destroyed without error. The tables are *not* recoverable. 164 ForceDestroy *bool `pulumi:"forceDestroy"` 165 // Name of the database to create. 166 Name *string `pulumi:"name"` 167 // Key-value map of custom metadata properties for the database definition. 168 Properties map[string]string `pulumi:"properties"` 169 } 170 171 // The set of arguments for constructing a Database resource. 172 type DatabaseArgs struct { 173 // That an Amazon S3 canned ACL should be set to control ownership of stored query results. See ACL Configuration below. 174 AclConfiguration DatabaseAclConfigurationPtrInput 175 // Name of S3 bucket to save the results of the query execution. 176 Bucket pulumi.StringPtrInput 177 // Description of the database. 178 Comment pulumi.StringPtrInput 179 // Encryption key block AWS Athena uses to decrypt the data in S3, such as an AWS Key Management Service (AWS KMS) key. See Encryption Configuration below. 180 EncryptionConfiguration DatabaseEncryptionConfigurationPtrInput 181 // AWS account ID that you expect to be the owner of the Amazon S3 bucket. 182 ExpectedBucketOwner pulumi.StringPtrInput 183 // Boolean that indicates all tables should be deleted from the database so that the database can be destroyed without error. The tables are *not* recoverable. 184 ForceDestroy pulumi.BoolPtrInput 185 // Name of the database to create. 186 Name pulumi.StringPtrInput 187 // Key-value map of custom metadata properties for the database definition. 188 Properties pulumi.StringMapInput 189 } 190 191 func (DatabaseArgs) ElementType() reflect.Type { 192 return reflect.TypeOf((*databaseArgs)(nil)).Elem() 193 } 194 195 type DatabaseInput interface { 196 pulumi.Input 197 198 ToDatabaseOutput() DatabaseOutput 199 ToDatabaseOutputWithContext(ctx context.Context) DatabaseOutput 200 } 201 202 func (*Database) ElementType() reflect.Type { 203 return reflect.TypeOf((**Database)(nil)).Elem() 204 } 205 206 func (i *Database) ToDatabaseOutput() DatabaseOutput { 207 return i.ToDatabaseOutputWithContext(context.Background()) 208 } 209 210 func (i *Database) ToDatabaseOutputWithContext(ctx context.Context) DatabaseOutput { 211 return pulumi.ToOutputWithContext(ctx, i).(DatabaseOutput) 212 } 213 214 // DatabaseArrayInput is an input type that accepts DatabaseArray and DatabaseArrayOutput values. 215 // You can construct a concrete instance of `DatabaseArrayInput` via: 216 // 217 // DatabaseArray{ DatabaseArgs{...} } 218 type DatabaseArrayInput interface { 219 pulumi.Input 220 221 ToDatabaseArrayOutput() DatabaseArrayOutput 222 ToDatabaseArrayOutputWithContext(context.Context) DatabaseArrayOutput 223 } 224 225 type DatabaseArray []DatabaseInput 226 227 func (DatabaseArray) ElementType() reflect.Type { 228 return reflect.TypeOf((*[]*Database)(nil)).Elem() 229 } 230 231 func (i DatabaseArray) ToDatabaseArrayOutput() DatabaseArrayOutput { 232 return i.ToDatabaseArrayOutputWithContext(context.Background()) 233 } 234 235 func (i DatabaseArray) ToDatabaseArrayOutputWithContext(ctx context.Context) DatabaseArrayOutput { 236 return pulumi.ToOutputWithContext(ctx, i).(DatabaseArrayOutput) 237 } 238 239 // DatabaseMapInput is an input type that accepts DatabaseMap and DatabaseMapOutput values. 240 // You can construct a concrete instance of `DatabaseMapInput` via: 241 // 242 // DatabaseMap{ "key": DatabaseArgs{...} } 243 type DatabaseMapInput interface { 244 pulumi.Input 245 246 ToDatabaseMapOutput() DatabaseMapOutput 247 ToDatabaseMapOutputWithContext(context.Context) DatabaseMapOutput 248 } 249 250 type DatabaseMap map[string]DatabaseInput 251 252 func (DatabaseMap) ElementType() reflect.Type { 253 return reflect.TypeOf((*map[string]*Database)(nil)).Elem() 254 } 255 256 func (i DatabaseMap) ToDatabaseMapOutput() DatabaseMapOutput { 257 return i.ToDatabaseMapOutputWithContext(context.Background()) 258 } 259 260 func (i DatabaseMap) ToDatabaseMapOutputWithContext(ctx context.Context) DatabaseMapOutput { 261 return pulumi.ToOutputWithContext(ctx, i).(DatabaseMapOutput) 262 } 263 264 type DatabaseOutput struct{ *pulumi.OutputState } 265 266 func (DatabaseOutput) ElementType() reflect.Type { 267 return reflect.TypeOf((**Database)(nil)).Elem() 268 } 269 270 func (o DatabaseOutput) ToDatabaseOutput() DatabaseOutput { 271 return o 272 } 273 274 func (o DatabaseOutput) ToDatabaseOutputWithContext(ctx context.Context) DatabaseOutput { 275 return o 276 } 277 278 // That an Amazon S3 canned ACL should be set to control ownership of stored query results. See ACL Configuration below. 279 func (o DatabaseOutput) AclConfiguration() DatabaseAclConfigurationPtrOutput { 280 return o.ApplyT(func(v *Database) DatabaseAclConfigurationPtrOutput { return v.AclConfiguration }).(DatabaseAclConfigurationPtrOutput) 281 } 282 283 // Name of S3 bucket to save the results of the query execution. 284 func (o DatabaseOutput) Bucket() pulumi.StringPtrOutput { 285 return o.ApplyT(func(v *Database) pulumi.StringPtrOutput { return v.Bucket }).(pulumi.StringPtrOutput) 286 } 287 288 // Description of the database. 289 func (o DatabaseOutput) Comment() pulumi.StringPtrOutput { 290 return o.ApplyT(func(v *Database) pulumi.StringPtrOutput { return v.Comment }).(pulumi.StringPtrOutput) 291 } 292 293 // Encryption key block AWS Athena uses to decrypt the data in S3, such as an AWS Key Management Service (AWS KMS) key. See Encryption Configuration below. 294 func (o DatabaseOutput) EncryptionConfiguration() DatabaseEncryptionConfigurationPtrOutput { 295 return o.ApplyT(func(v *Database) DatabaseEncryptionConfigurationPtrOutput { return v.EncryptionConfiguration }).(DatabaseEncryptionConfigurationPtrOutput) 296 } 297 298 // AWS account ID that you expect to be the owner of the Amazon S3 bucket. 299 func (o DatabaseOutput) ExpectedBucketOwner() pulumi.StringPtrOutput { 300 return o.ApplyT(func(v *Database) pulumi.StringPtrOutput { return v.ExpectedBucketOwner }).(pulumi.StringPtrOutput) 301 } 302 303 // Boolean that indicates all tables should be deleted from the database so that the database can be destroyed without error. The tables are *not* recoverable. 304 func (o DatabaseOutput) ForceDestroy() pulumi.BoolPtrOutput { 305 return o.ApplyT(func(v *Database) pulumi.BoolPtrOutput { return v.ForceDestroy }).(pulumi.BoolPtrOutput) 306 } 307 308 // Name of the database to create. 309 func (o DatabaseOutput) Name() pulumi.StringOutput { 310 return o.ApplyT(func(v *Database) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 311 } 312 313 // Key-value map of custom metadata properties for the database definition. 314 func (o DatabaseOutput) Properties() pulumi.StringMapOutput { 315 return o.ApplyT(func(v *Database) pulumi.StringMapOutput { return v.Properties }).(pulumi.StringMapOutput) 316 } 317 318 type DatabaseArrayOutput struct{ *pulumi.OutputState } 319 320 func (DatabaseArrayOutput) ElementType() reflect.Type { 321 return reflect.TypeOf((*[]*Database)(nil)).Elem() 322 } 323 324 func (o DatabaseArrayOutput) ToDatabaseArrayOutput() DatabaseArrayOutput { 325 return o 326 } 327 328 func (o DatabaseArrayOutput) ToDatabaseArrayOutputWithContext(ctx context.Context) DatabaseArrayOutput { 329 return o 330 } 331 332 func (o DatabaseArrayOutput) Index(i pulumi.IntInput) DatabaseOutput { 333 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Database { 334 return vs[0].([]*Database)[vs[1].(int)] 335 }).(DatabaseOutput) 336 } 337 338 type DatabaseMapOutput struct{ *pulumi.OutputState } 339 340 func (DatabaseMapOutput) ElementType() reflect.Type { 341 return reflect.TypeOf((*map[string]*Database)(nil)).Elem() 342 } 343 344 func (o DatabaseMapOutput) ToDatabaseMapOutput() DatabaseMapOutput { 345 return o 346 } 347 348 func (o DatabaseMapOutput) ToDatabaseMapOutputWithContext(ctx context.Context) DatabaseMapOutput { 349 return o 350 } 351 352 func (o DatabaseMapOutput) MapIndex(k pulumi.StringInput) DatabaseOutput { 353 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Database { 354 return vs[0].(map[string]*Database)[vs[1].(string)] 355 }).(DatabaseOutput) 356 } 357 358 func init() { 359 pulumi.RegisterInputType(reflect.TypeOf((*DatabaseInput)(nil)).Elem(), &Database{}) 360 pulumi.RegisterInputType(reflect.TypeOf((*DatabaseArrayInput)(nil)).Elem(), DatabaseArray{}) 361 pulumi.RegisterInputType(reflect.TypeOf((*DatabaseMapInput)(nil)).Elem(), DatabaseMap{}) 362 pulumi.RegisterOutputType(DatabaseOutput{}) 363 pulumi.RegisterOutputType(DatabaseArrayOutput{}) 364 pulumi.RegisterOutputType(DatabaseMapOutput{}) 365 }