CfnWorkGroup¶
-
class
aws_cdk.aws_athena.
CfnWorkGroup
(scope, id, *, name, description=None, recursive_delete_option=None, state=None, tags=None, work_group_configuration=None)¶ Bases:
aws_cdk.core.CfnResource
A CloudFormation
AWS::Athena::WorkGroup
.The AWS::Athena::WorkGroup resource specifies an Amazon Athena workgroup, which contains a name, description, creation time, state, and other configuration, listed under
WorkGroupConfiguration
. Each workgroup enables you to isolate queries for you or your group from other queries in the same account. For more information, see CreateWorkGroup in the Amazon Athena API Reference .- CloudformationResource
AWS::Athena::WorkGroup
- Link
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-athena-workgroup.html
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_athena as athena cfn_work_group = athena.CfnWorkGroup(self, "MyCfnWorkGroup", name="name", # the properties below are optional description="description", recursive_delete_option=False, state="state", tags=[CfnTag( key="key", value="value" )], work_group_configuration=athena.CfnWorkGroup.WorkGroupConfigurationProperty( bytes_scanned_cutoff_per_query=123, enforce_work_group_configuration=False, engine_version=athena.CfnWorkGroup.EngineVersionProperty( effective_engine_version="effectiveEngineVersion", selected_engine_version="selectedEngineVersion" ), publish_cloud_watch_metrics_enabled=False, requester_pays_enabled=False, result_configuration=athena.CfnWorkGroup.ResultConfigurationProperty( encryption_configuration=athena.CfnWorkGroup.EncryptionConfigurationProperty( encryption_option="encryptionOption", # the properties below are optional kms_key="kmsKey" ), output_location="outputLocation" ) ) )
Create a new
AWS::Athena::WorkGroup
.- Parameters
scope (
Construct
) –scope in which this resource is defined.
id (
str
) –scoped id of the resource.
name (
str
) – The workgroup name.description (
Optional
[str
]) – The workgroup description.recursive_delete_option (
Union
[bool
,IResolvable
,None
]) – The option to delete a workgroup and its contents even if the workgroup contains any named queries. The default is false.state (
Optional
[str
]) – The state of the workgroup: ENABLED or DISABLED.tags (
Optional
[Sequence
[Union
[CfnTag
,Dict
[str
,Any
]]]]) – The tags (key-value pairs) to associate with this resource.work_group_configuration (
Union
[IResolvable
,WorkGroupConfigurationProperty
,Dict
[str
,Any
],None
]) – The configuration of the workgroup, which includes the location in Amazon S3 where query results are stored, the encryption option, if any, used for query results, whether Amazon CloudWatch Metrics are enabled for the workgroup, and the limit for the amount of bytes scanned (cutoff) per query, if it is specified. TheEnforceWorkGroupConfiguration
option determines whether workgroup settings override client-side query settings.
Methods
-
add_deletion_override
(path)¶ Syntactic sugar for
addOverride(path, undefined)
.- Parameters
path (
str
) – The path of the value to delete.- Return type
None
-
add_depends_on
(target)¶ Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
- Parameters
target (
CfnResource
) –- Return type
None
-
add_metadata
(key, value)¶ Add a value to the CloudFormation Resource Metadata.
- Parameters
key (
str
) –value (
Any
) –
- See
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- Return type
None
-
add_override
(path, value)¶ Adds an override to the synthesized CloudFormation resource.
To add a property override, either use
addPropertyOverride
or prefixpath
with “Properties.” (i.e.Properties.TopicName
).If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal
.
in the property name, prefix with a\
. In most programming languages you will need to write this as"\\."
because the\
itself will need to be escaped.For example:
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"]) cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")
would add the overrides Example:
"Properties": { "GlobalSecondaryIndexes": [ { "Projection": { "NonKeyAttributes": [ "myattribute" ] ... } ... }, { "ProjectionType": "INCLUDE" ... }, ] ... }
The
value
argument toaddOverride
will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.- Parameters
path (
str
) –The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
value (
Any
) –The value. Could be primitive or complex.
- Return type
None
-
add_property_deletion_override
(property_path)¶ Adds an override that deletes the value of a property from the resource definition.
- Parameters
property_path (
str
) – The path to the property.- Return type
None
-
add_property_override
(property_path, value)¶ Adds an override to a resource property.
Syntactic sugar for
addOverride("Properties.<...>", value)
.- Parameters
property_path (
str
) – The path of the property.value (
Any
) – The value.
- Return type
None
-
apply_removal_policy
(policy=None, *, apply_to_update_replace_policy=None, default=None)¶ Sets the deletion policy of the resource based on the removal policy specified.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
).- Parameters
policy (
Optional
[RemovalPolicy
]) –apply_to_update_replace_policy (
Optional
[bool
]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: truedefault (
Optional
[RemovalPolicy
]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resoure, please consult that specific resource’s documentation.
- Return type
None
-
get_att
(attribute_name)¶ Returns a token for an runtime attribute of this resource.
Ideally, use generated attribute accessors (e.g.
resource.arn
), but this can be used for future compatibility in case there is no generated attribute.- Parameters
attribute_name (
str
) – The name of the attribute.- Return type
-
get_metadata
(key)¶ Retrieve a value value from the CloudFormation Resource Metadata.
- Parameters
key (
str
) –- See
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- Return type
Any
-
inspect
(inspector)¶ Examines the CloudFormation resource and discloses attributes.
- Parameters
inspector (
TreeInspector
) –tree inspector to collect and process attributes.
- Return type
None
-
override_logical_id
(new_logical_id)¶ Overrides the auto-generated logical ID with a specific ID.
- Parameters
new_logical_id (
str
) – The new logical ID to use for this stack element.- Return type
None
-
to_string
()¶ Returns a string representation of this construct.
- Return type
str
- Returns
a string representation of this resource
Attributes
-
CFN_RESOURCE_TYPE_NAME
= 'AWS::Athena::WorkGroup'¶
-
attr_creation_time
¶ The date and time the workgroup was created, as a UNIX timestamp in seconds.
For example:
1582761016
.- CloudformationAttribute
CreationTime
- Return type
str
-
attr_work_group_configuration_engine_version_effective_engine_version
¶ WorkGroupConfiguration.EngineVersion.EffectiveEngineVersion
- Type
cloudformationAttribute
- Return type
str
-
cfn_options
¶ Options for this resource, such as condition, update policy etc.
- Return type
-
cfn_resource_type
¶ AWS resource type.
- Return type
str
-
creation_stack
¶ return:
the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.
- Return type
List
[str
]
-
description
¶ The workgroup description.
-
logical_id
¶ The logical ID for this CloudFormation stack element.
The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use
overrideLogicalId(newLogicalId)
.- Return type
str
- Returns
the logical ID as a stringified token. This value will only get resolved during synthesis.
-
name
¶ The workgroup name.
-
node
¶ The construct tree node associated with this construct.
- Return type
-
recursive_delete_option
¶ The option to delete a workgroup and its contents even if the workgroup contains any named queries.
The default is false.
-
ref
¶ Return a string that will be resolved to a CloudFormation
{ Ref }
for this element.If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through
Lazy.any({ produce: resource.ref })
.- Return type
str
-
stack
¶ The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
- Return type
-
state
¶ ENABLED or DISABLED.
- Link
- Type
The state of the workgroup
- Return type
Optional
[str
]
The tags (key-value pairs) to associate with this resource.
-
work_group_configuration
¶ The configuration of the workgroup, which includes the location in Amazon S3 where query results are stored, the encryption option, if any, used for query results, whether Amazon CloudWatch Metrics are enabled for the workgroup, and the limit for the amount of bytes scanned (cutoff) per query, if it is specified.
The
EnforceWorkGroupConfiguration
option determines whether workgroup settings override client-side query settings.
Static Methods
-
classmethod
is_cfn_element
(x)¶ Returns
true
if a construct is a stack element (i.e. part of the synthesized cloudformation template).Uses duck-typing instead of
instanceof
to allow stack elements from different versions of this library to be included in the same stack.- Parameters
x (
Any
) –- Return type
bool
- Returns
The construct as a stack element or undefined if it is not a stack element.
-
classmethod
is_cfn_resource
(construct)¶ Check whether the given construct is a CfnResource.
- Parameters
construct (
IConstruct
) –- Return type
bool
-
classmethod
is_construct
(x)¶ Return whether the given object is a Construct.
- Parameters
x (
Any
) –- Return type
bool
EncryptionConfigurationProperty¶
-
class
CfnWorkGroup.
EncryptionConfigurationProperty
(*, encryption_option, kms_key=None)¶ Bases:
object
If query results are encrypted in Amazon S3, indicates the encryption option used (for example,
SSE_KMS
orCSE_KMS
) and key information.- Parameters
encryption_option (
str
) – Indicates whether Amazon S3 server-side encryption with Amazon S3-managed keys (SSE_S3
), server-side encryption with KMS-managed keys (SSE_KMS
), or client-side encryption with KMS-managed keys (CSE_KMS
) is used. If a query runs in a workgroup and the workgroup overrides client-side settings, then the workgroup’s setting for encryption is used. It specifies whether query results must be encrypted, for all queries that run in this workgroup.kms_key (
Optional
[str
]) – ForSSE_KMS
andCSE_KMS
, this is the KMS key ARN or ID.
- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_athena as athena encryption_configuration_property = athena.CfnWorkGroup.EncryptionConfigurationProperty( encryption_option="encryptionOption", # the properties below are optional kms_key="kmsKey" )
Attributes
-
encryption_option
¶ Indicates whether Amazon S3 server-side encryption with Amazon S3-managed keys (
SSE_S3
), server-side encryption with KMS-managed keys (SSE_KMS
), or client-side encryption with KMS-managed keys (CSE_KMS
) is used.If a query runs in a workgroup and the workgroup overrides client-side settings, then the workgroup’s setting for encryption is used. It specifies whether query results must be encrypted, for all queries that run in this workgroup.
-
kms_key
¶ For
SSE_KMS
andCSE_KMS
, this is the KMS key ARN or ID.
EngineVersionProperty¶
-
class
CfnWorkGroup.
EngineVersionProperty
(*, effective_engine_version=None, selected_engine_version=None)¶ Bases:
object
The Athena engine version for running queries.
- Parameters
effective_engine_version (
Optional
[str
]) – Read only. The engine version on which the query runs. If the user requests a valid engine version other than Auto, the effective engine version is the same as the engine version that the user requested. If the user requests Auto, the effective engine version is chosen by Athena. When a request to update the engine version is made by aCreateWorkGroup
orUpdateWorkGroup
operation, theEffectiveEngineVersion
field is ignored.selected_engine_version (
Optional
[str
]) – The engine version requested by the user. Possible values are determined by the output ofListEngineVersions
, including Auto. The default is Auto.
- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_athena as athena engine_version_property = athena.CfnWorkGroup.EngineVersionProperty( effective_engine_version="effectiveEngineVersion", selected_engine_version="selectedEngineVersion" )
Attributes
-
effective_engine_version
¶ Read only.
The engine version on which the query runs. If the user requests a valid engine version other than Auto, the effective engine version is the same as the engine version that the user requested. If the user requests Auto, the effective engine version is chosen by Athena. When a request to update the engine version is made by a
CreateWorkGroup
orUpdateWorkGroup
operation, theEffectiveEngineVersion
field is ignored.
-
selected_engine_version
¶ The engine version requested by the user.
Possible values are determined by the output of
ListEngineVersions
, including Auto. The default is Auto.
ResultConfigurationProperty¶
-
class
CfnWorkGroup.
ResultConfigurationProperty
(*, encryption_configuration=None, output_location=None)¶ Bases:
object
The location in Amazon S3 where query results are stored and the encryption option, if any, used for query results.
These are known as “client-side settings”. If workgroup settings override client-side settings, then the query uses the workgroup settings.
- Parameters
encryption_configuration (
Union
[IResolvable
,EncryptionConfigurationProperty
,Dict
[str
,Any
],None
]) – If query results are encrypted in Amazon S3, indicates the encryption option used (for example,SSE_KMS
orCSE_KMS
) and key information. This is a client-side setting. If workgroup settings override client-side settings, then the query uses the encryption configuration that is specified for the workgroup, and also uses the location for storing query results specified in the workgroup. SeeEnforceWorkGroupConfiguration
and Workgroup Settings Override Client-Side Settings .output_location (
Optional
[str
]) – The location in Amazon S3 where your query results are stored, such ass3://path/to/query/bucket/
. To run a query, you must specify the query results location using either a client-side setting for individual queries or a location specified by the workgroup. If workgroup settings override client-side settings, then the query uses the location specified for the workgroup. If no query location is set, Athena issues an error. For more information, see Working with Query Results, Output Files, and Query History andEnforceWorkGroupConfiguration
.
- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_athena as athena result_configuration_property = athena.CfnWorkGroup.ResultConfigurationProperty( encryption_configuration=athena.CfnWorkGroup.EncryptionConfigurationProperty( encryption_option="encryptionOption", # the properties below are optional kms_key="kmsKey" ), output_location="outputLocation" )
Attributes
-
encryption_configuration
¶ If query results are encrypted in Amazon S3, indicates the encryption option used (for example,
SSE_KMS
orCSE_KMS
) and key information.This is a client-side setting. If workgroup settings override client-side settings, then the query uses the encryption configuration that is specified for the workgroup, and also uses the location for storing query results specified in the workgroup. See
EnforceWorkGroupConfiguration
and Workgroup Settings Override Client-Side Settings .
-
output_location
¶ The location in Amazon S3 where your query results are stored, such as
s3://path/to/query/bucket/
.To run a query, you must specify the query results location using either a client-side setting for individual queries or a location specified by the workgroup. If workgroup settings override client-side settings, then the query uses the location specified for the workgroup. If no query location is set, Athena issues an error. For more information, see Working with Query Results, Output Files, and Query History and
EnforceWorkGroupConfiguration
.
WorkGroupConfigurationProperty¶
-
class
CfnWorkGroup.
WorkGroupConfigurationProperty
(*, bytes_scanned_cutoff_per_query=None, enforce_work_group_configuration=None, engine_version=None, publish_cloud_watch_metrics_enabled=None, requester_pays_enabled=None, result_configuration=None)¶ Bases:
object
The configuration of the workgroup, which includes the location in Amazon S3 where query results are stored, the encryption option, if any, used for query results, whether Amazon CloudWatch Metrics are enabled for the workgroup, and the limit for the amount of bytes scanned (cutoff) per query, if it is specified.
The
EnforceWorkGroupConfiguration
option determines whether workgroup settings override client-side query settings.- Parameters
bytes_scanned_cutoff_per_query (
Union
[int
,float
,None
]) – The upper limit (cutoff) for the amount of bytes a single query in a workgroup is allowed to scan. No default is defined. .. epigraph:: This property currently supports integer types. Support for long values is planned.enforce_work_group_configuration (
Union
[bool
,IResolvable
,None
]) –If set to “true”, the settings for the workgroup override client-side settings. If set to “false”, client-side settings are used. For more information, see Workgroup Settings Override Client-Side Settings .
engine_version (
Union
[IResolvable
,EngineVersionProperty
,Dict
[str
,Any
],None
]) – The engine version that all queries running on the workgroup use. Queries on theAmazonAthenaPreviewFunctionality
workgroup run on the preview engine regardless of this setting.publish_cloud_watch_metrics_enabled (
Union
[bool
,IResolvable
,None
]) – Indicates that the Amazon CloudWatch metrics are enabled for the workgroup.requester_pays_enabled (
Union
[bool
,IResolvable
,None
]) – If set totrue
, allows members assigned to a workgroup to reference Amazon S3 Requester Pays buckets in queries. If set tofalse
, workgroup members cannot query data from Requester Pays buckets, and queries that retrieve data from Requester Pays buckets cause an error. The default isfalse
. For more information about Requester Pays buckets, see Requester Pays Buckets in the Amazon Simple Storage Service Developer Guide .result_configuration (
Union
[IResolvable
,ResultConfigurationProperty
,Dict
[str
,Any
],None
]) –Specifies the location in Amazon S3 where query results are stored and the encryption option, if any, used for query results. For more information, see Working with Query Results, Output Files, and Query History .
- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_athena as athena work_group_configuration_property = athena.CfnWorkGroup.WorkGroupConfigurationProperty( bytes_scanned_cutoff_per_query=123, enforce_work_group_configuration=False, engine_version=athena.CfnWorkGroup.EngineVersionProperty( effective_engine_version="effectiveEngineVersion", selected_engine_version="selectedEngineVersion" ), publish_cloud_watch_metrics_enabled=False, requester_pays_enabled=False, result_configuration=athena.CfnWorkGroup.ResultConfigurationProperty( encryption_configuration=athena.CfnWorkGroup.EncryptionConfigurationProperty( encryption_option="encryptionOption", # the properties below are optional kms_key="kmsKey" ), output_location="outputLocation" ) )
Attributes
-
bytes_scanned_cutoff_per_query
¶ The upper limit (cutoff) for the amount of bytes a single query in a workgroup is allowed to scan.
No default is defined. .. epigraph:
This property currently supports integer types. Support for long values is planned.
-
enforce_work_group_configuration
¶ If set to “true”, the settings for the workgroup override client-side settings.
If set to “false”, client-side settings are used. For more information, see Workgroup Settings Override Client-Side Settings .
-
engine_version
¶ The engine version that all queries running on the workgroup use.
Queries on the
AmazonAthenaPreviewFunctionality
workgroup run on the preview engine regardless of this setting.
-
publish_cloud_watch_metrics_enabled
¶ Indicates that the Amazon CloudWatch metrics are enabled for the workgroup.
-
requester_pays_enabled
¶ If set to
true
, allows members assigned to a workgroup to reference Amazon S3 Requester Pays buckets in queries.If set to
false
, workgroup members cannot query data from Requester Pays buckets, and queries that retrieve data from Requester Pays buckets cause an error. The default isfalse
. For more information about Requester Pays buckets, see Requester Pays Buckets in the Amazon Simple Storage Service Developer Guide .
-
result_configuration
¶ Specifies the location in Amazon S3 where query results are stored and the encryption option, if any, used for query results.
For more information, see Working with Query Results, Output Files, and Query History .