NamedQuery
Provides an Athena Named Query resource.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var hogeBucket = new Aws.S3.Bucket("hogeBucket", new Aws.S3.BucketArgs
{
});
var testKey = new Aws.Kms.Key("testKey", new Aws.Kms.KeyArgs
{
DeletionWindowInDays = 7,
Description = "Athena KMS Key",
});
var testWorkgroup = new Aws.Athena.Workgroup("testWorkgroup", new Aws.Athena.WorkgroupArgs
{
Configuration = new Aws.Athena.Inputs.WorkgroupConfigurationArgs
{
ResultConfiguration = new Aws.Athena.Inputs.WorkgroupConfigurationResultConfigurationArgs
{
EncryptionConfiguration = new Aws.Athena.Inputs.WorkgroupConfigurationResultConfigurationEncryptionConfigurationArgs
{
EncryptionOption = "SSE_KMS",
KmsKeyArn = testKey.Arn,
},
},
},
});
var hogeDatabase = new Aws.Athena.Database("hogeDatabase", new Aws.Athena.DatabaseArgs
{
Bucket = hogeBucket.Id,
Name = "users",
});
var foo = new Aws.Athena.NamedQuery("foo", new Aws.Athena.NamedQueryArgs
{
Database = hogeDatabase.Name,
Query = hogeDatabase.Name.Apply(name => $"SELECT * FROM {name} limit 10;"),
Workgroup = testWorkgroup.Id,
});
}
}
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/athena"
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/kms"
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/s3"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
hogeBucket, err := s3.NewBucket(ctx, "hogeBucket", nil)
if err != nil {
return err
}
testKey, err := kms.NewKey(ctx, "testKey", &kms.KeyArgs{
DeletionWindowInDays: pulumi.Int(7),
Description: pulumi.String("Athena KMS Key"),
})
if err != nil {
return err
}
testWorkgroup, err := athena.NewWorkgroup(ctx, "testWorkgroup", &athena.WorkgroupArgs{
Configuration: &athena.WorkgroupConfigurationArgs{
ResultConfiguration: &athena.WorkgroupConfigurationResultConfigurationArgs{
EncryptionConfiguration: &athena.WorkgroupConfigurationResultConfigurationEncryptionConfigurationArgs{
EncryptionOption: pulumi.String("SSE_KMS"),
KmsKeyArn: testKey.Arn,
},
},
},
})
if err != nil {
return err
}
hogeDatabase, err := athena.NewDatabase(ctx, "hogeDatabase", &athena.DatabaseArgs{
Bucket: hogeBucket.ID(),
Name: pulumi.String("users"),
})
if err != nil {
return err
}
_, err = athena.NewNamedQuery(ctx, "foo", &athena.NamedQueryArgs{
Database: hogeDatabase.Name,
Query: hogeDatabase.Name.ApplyT(func(name string) (string, error) {
return fmt.Sprintf("%v%v%v", "SELECT * FROM ", name, " limit 10;"), nil
}).(pulumi.StringOutput),
Workgroup: testWorkgroup.ID(),
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
hoge_bucket = aws.s3.Bucket("hogeBucket")
test_key = aws.kms.Key("testKey",
deletion_window_in_days=7,
description="Athena KMS Key")
test_workgroup = aws.athena.Workgroup("testWorkgroup", configuration={
"resultConfiguration": {
"encryption_configuration": {
"encryptionOption": "SSE_KMS",
"kms_key_arn": test_key.arn,
},
},
})
hoge_database = aws.athena.Database("hogeDatabase",
bucket=hoge_bucket.id,
name="users")
foo = aws.athena.NamedQuery("foo",
database=hoge_database.name,
query=hoge_database.name.apply(lambda name: f"SELECT * FROM {name} limit 10;"),
workgroup=test_workgroup.id)import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const hogeBucket = new aws.s3.Bucket("hoge", {});
const testKey = new aws.kms.Key("test", {
deletionWindowInDays: 7,
description: "Athena KMS Key",
});
const testWorkgroup = new aws.athena.Workgroup("test", {
configuration: {
resultConfiguration: {
encryptionConfiguration: {
encryptionOption: "SSE_KMS",
kmsKeyArn: testKey.arn,
},
},
},
});
const hogeDatabase = new aws.athena.Database("hoge", {
bucket: hogeBucket.id,
name: "users",
});
const foo = new aws.athena.NamedQuery("foo", {
database: hogeDatabase.name,
query: pulumi.interpolate`SELECT * FROM ${hogeDatabase.name} limit 10;`,
workgroup: testWorkgroup.id,
});Create a NamedQuery Resource
new NamedQuery(name: string, args: NamedQueryArgs, opts?: CustomResourceOptions);def NamedQuery(resource_name, opts=None, database=None, description=None, name=None, query=None, workgroup=None, __props__=None);func NewNamedQuery(ctx *Context, name string, args NamedQueryArgs, opts ...ResourceOption) (*NamedQuery, error)public NamedQuery(string name, NamedQueryArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args NamedQueryArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args NamedQueryArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args NamedQueryArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
NamedQuery Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The NamedQuery resource accepts the following input properties:
- Database string
The database to which the query belongs.
- Query string
The text of the query itself. In other words, all query statements. Maximum length of 262144.
- Description string
A brief explanation of the query. Maximum length of 1024.
- Name string
The plain language name for the query. Maximum length of 128.
- Workgroup string
The workgroup to which the query belongs. Defaults to
primary
- Database string
The database to which the query belongs.
- Query string
The text of the query itself. In other words, all query statements. Maximum length of 262144.
- Description string
A brief explanation of the query. Maximum length of 1024.
- Name string
The plain language name for the query. Maximum length of 128.
- Workgroup string
The workgroup to which the query belongs. Defaults to
primary
- database string
The database to which the query belongs.
- query string
The text of the query itself. In other words, all query statements. Maximum length of 262144.
- description string
A brief explanation of the query. Maximum length of 1024.
- name string
The plain language name for the query. Maximum length of 128.
- workgroup string
The workgroup to which the query belongs. Defaults to
primary
- database str
The database to which the query belongs.
- query str
The text of the query itself. In other words, all query statements. Maximum length of 262144.
- description str
A brief explanation of the query. Maximum length of 1024.
- name str
The plain language name for the query. Maximum length of 128.
- workgroup str
The workgroup to which the query belongs. Defaults to
primary
Outputs
All input properties are implicitly available as output properties. Additionally, the NamedQuery resource produces the following output properties:
Look up an Existing NamedQuery Resource
Get an existing NamedQuery 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?: NamedQueryState, opts?: CustomResourceOptions): NamedQuerystatic get(resource_name, id, opts=None, database=None, description=None, name=None, query=None, workgroup=None, __props__=None);func GetNamedQuery(ctx *Context, name string, id IDInput, state *NamedQueryState, opts ...ResourceOption) (*NamedQuery, error)public static NamedQuery Get(string name, Input<string> id, NamedQueryState? state, CustomResourceOptions? opts = null)- 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.
The following state arguments are supported:
- Database string
The database to which the query belongs.
- Description string
A brief explanation of the query. Maximum length of 1024.
- Name string
The plain language name for the query. Maximum length of 128.
- Query string
The text of the query itself. In other words, all query statements. Maximum length of 262144.
- Workgroup string
The workgroup to which the query belongs. Defaults to
primary
- Database string
The database to which the query belongs.
- Description string
A brief explanation of the query. Maximum length of 1024.
- Name string
The plain language name for the query. Maximum length of 128.
- Query string
The text of the query itself. In other words, all query statements. Maximum length of 262144.
- Workgroup string
The workgroup to which the query belongs. Defaults to
primary
- database string
The database to which the query belongs.
- description string
A brief explanation of the query. Maximum length of 1024.
- name string
The plain language name for the query. Maximum length of 128.
- query string
The text of the query itself. In other words, all query statements. Maximum length of 262144.
- workgroup string
The workgroup to which the query belongs. Defaults to
primary
- database str
The database to which the query belongs.
- description str
A brief explanation of the query. Maximum length of 1024.
- name str
The plain language name for the query. Maximum length of 128.
- query str
The text of the query itself. In other words, all query statements. Maximum length of 262144.
- workgroup str
The workgroup to which the query belongs. Defaults to
primary
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.